1 #ifndef COIN_SOSHAPE_BIGTEXTURE_H
2 #define COIN_SOSHAPE_BIGTEXTURE_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #ifndef COIN_INTERNAL
37 #error this is a private header file
38 #endif /* !COIN_INTERNAL */
39 
40 #include <Inventor/lists/SbList.h>
41 #include <Inventor/elements/SoMultiTextureImageElement.h>
42 #include <Inventor/SbVec2f.h>
43 #include <Inventor/SbPlane.h>
44 
45 class SoGLBigImage;
46 class SoState;
47 class SoPrimitiveVertex;
48 class SoMaterialBundle;
49 class SoShape;
50 class SbClip;
51 class SbVec3f;
52 
53 // FIXME: this class will also be part of the global namespace of
54 // the compiled Coin library (at least when compiled to a UNIX-style
55 // library). That should be avoided. 20020220 mortene.
56 
57 class soshape_bigtexture {
58 public:
59   soshape_bigtexture(void);
60   ~soshape_bigtexture();
61 
62   void beginShape(SoGLBigImage * image,
63                   const float quality);
64   void triangle(SoState * state,
65                 const SoPrimitiveVertex * v1,
66                 const SoPrimitiveVertex * v2,
67                 const SoPrimitiveVertex * v3);
68   SbBool endShape(SoState * state, SoShape * shape,
69                   SoMaterialBundle & mb);
70 
71 
72 private:
73   void clip_triangles(SoState * state);
74   void handle_triangle(SoState * state,
75                        SoPrimitiveVertex * v1,
76                        SoPrimitiveVertex * v2,
77                        SoPrimitiveVertex * v3,
78                        const SoMultiTextureImageElement::Wrap wrap[2],
79                        const int transs,
80                        const int transt);
81 
82   SbList <SoPrimitiveVertex*> vertexlist;
83 
84   class bt_region {
85   public:
86     SbVec2f start, end, tcmul;
87     SbPlane planes[4];
88     SbList <SoPrimitiveVertex*> pvlist;
89     SbList <int> facelist;
90   };
91 
92   SbList <SoPrimitiveVertex*> * pvlist;
93   int pvlistcnt;
94   SbClip * clipper;
95   SoGLBigImage * image;
96   float quality;
97   bt_region * regions;
98   int numallocregions;
99   int numregions;
100 
101   SoPrimitiveVertex * get_new_pv(void);
102 
103   static void * clipcb(const SbVec3f & v0, void * vdata0,
104                        const SbVec3f & v1, void * vdata1,
105                        const SbVec3f & newvertex,
106                        void * userdata);
107 };
108 
109 #endif // !COIN_SOSHAPE_BIGTEXTURE_H
110