00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_TEXTURE_COORDINATE3_ELEMENT
00025 #define _SO_TEXTURE_COORDINATE3_ELEMENT
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <Inventor/elements/SoReplacedTextureElement.h>
00029 #include <Inventor/STL/vector>
00030
00037 typedef const SbVec4f &
00038 SoTextureCoordinate3FunctionCB(void *userdata, const SbVec3f &point,
00039 const SbVec3f &normal);
00040
00041 class SoTextureCoordinateElement;
00042
00055 SoEXTENDER_Documented class SoTextureCoordinate3Element : public SoReplacedTextureElement {
00056
00057 SO_ELEMENT_HEADER(SoTextureCoordinate3Element);
00058
00059 public:
00064 enum CoordType {
00065 EXPLICIT = 1,
00066 FUNCTION = 2
00067 };
00068
00073 static void setDefault(SoState *state, SoNode *node);
00074
00075
00076 static void setFunction(SoState *state, SoNode *node,
00077 SoTextureCoordinate3FunctionCB *func,
00078 void *userData,
00079 SbBool frcSend = FALSE);
00080
00081
00085 static void set3(SoState *state, SoNode *node,
00086 int32_t numCoords, const SbVec3f *coords,
00087 SbBool frcSend = FALSE);
00088
00092 static void set4(SoState *state, SoNode *node,
00093 int32_t numCoords, const SbVec4f *coords,
00094 SbBool frcSend = FALSE);
00095
00100 static CoordType getType(SoState *state, int unit=0);
00101
00102 virtual CoordType getType(int unit=0) const;
00103
00110 static const SoTextureCoordinate3Element * getInstance(SoState *state);
00111
00112
00113
00119 const SbVec4f & get(const SbVec3f &point, const SbVec3f &normal,
00120 int unit=0) const;
00121
00122
00123
00127 int32_t getNum(int unit=0) const ;
00128
00129 SbBool is3D(int unit=0) const ;
00130
00131 SbBool isForceSending(int unit=0) const ;
00132
00137 const SbVec3f & get3(int index, int unit=0) const;
00138 const SbVec4f & get4(int index, int unit=0) const;
00139
00143 virtual void print(FILE *fp) const;
00144
00148 virtual void push(SoState *) ;
00149
00150 private:
00151
00153 virtual void commonInit();
00154
00156 virtual void init(SoState *state);
00157
00158 private:
00159
00160 static void initClass();
00161 static void exitClass();
00162
00163 struct SoTexCoord3Data {
00164 SoTexCoord3Data()
00165 :whatKind(EXPLICIT),
00166 numCoords(0),coords3(NULL),coords4(NULL),coordsAre3D(FALSE),forceSend(FALSE)
00167 {}
00168
00169
00170 SoTexCoord3Data& operator=(const SoTexCoord3Data& data)
00171 {
00172 whatKind = data.whatKind ;
00173 numCoords = data.numCoords ;
00174 coords3 = data.coords3 ;
00175 coords4 = data.coords4 ;
00176 coordsAre3D = data.coordsAre3D ;
00177 forceSend = data.forceSend;
00178 return *this ;
00179 }
00180
00181
00182
00183 CoordType whatKind;
00184
00185
00186 int32_t numCoords;
00187 const SbVec3f *coords3;
00188 const SbVec4f *coords4;
00189 SbBool coordsAre3D;
00190 SbBool forceSend;
00191 } ;
00192 SoTexCoord3Data& getData(const size_t unit) const;
00193
00194 private:
00195
00196 virtual ~SoTextureCoordinate3Element();
00197
00198 private:
00199 void checkSize(const size_t size) const;
00200
00201 SoState* m_state;
00202 mutable std::vector<SoTexCoord3Data> m_texCoord3Data ;
00203
00204
00205 SbVec3f convert3;
00206 SbVec4f convert4;
00207 };
00208
00209 #endif
00210
00211
00212