| http://www.sim.no/ http://www.coin3d.org/

SoTextureCoordinateElement.h
1 #ifndef COIN_SOTEXTURECOORDINATEELEMENT_H
2 #define COIN_SOTEXTURECOORDINATEELEMENT_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/elements/SoReplacedElement.h>
28 #include <Inventor/SbVec2f.h>
29 #include <Inventor/SbVec3f.h>
30 #include <Inventor/SbVec4f.h>
31
32 /*
33 * TODO
34 * - conversion between 2D and 4D (like Open Inventor)
35 */
36
37 typedef const SbVec4f & SoTextureCoordinateFunctionCB(void * userdata,
38 const SbVec3f & point,
39 const SbVec3f & normal);
40
41 class COIN_DLL_API SoTextureCoordinateElement : public SoReplacedElement {
42 typedef SoReplacedElement inherited;
43
44 SO_ELEMENT_HEADER(SoTextureCoordinateElement);
45 public:
46 static void initClass(void);
47 protected:
48 virtual ~SoTextureCoordinateElement();
49
50 public:
51
52 enum CoordType {
53 NONE = 0,
54 TEXGEN = 0,
55 EXPLICIT = 1,
56 FUNCTION = 2,
57 DEFAULT = 3
58 };
59
60 virtual void init(SoState * state);
61
62 static void setDefault(SoState * const state, SoNode * const node);
63 static void setFunction(SoState * const state, SoNode * const node,
64 SoTextureCoordinateFunctionCB * const func,
65 void * const userdata);
66
67 static void set2(SoState * const state, SoNode * const node,
68 const int32_t numCoords, const SbVec2f * const coords);
69 static void set3(SoState * const state, SoNode * const node,
70 const int32_t numCoords, const SbVec3f * const coords);
71 static void set4(SoState * const state, SoNode * const node,
72 const int32_t numCoords, const SbVec4f * const coords);
73
74 static CoordType getType(SoState * const state);
75 virtual CoordType getType(void) const;
76
77 static const SoTextureCoordinateElement *getInstance(SoState * const state);
78
79 const SbVec4f &get(const SbVec3f & point,
80 const SbVec3f & normal) const;
81 int32_t getNum(void) const;
82 SbBool is2D(void) const;
83 int32_t getDimension(void) const;
84
85 const SbVec2f &get2(const int index) const;
86 const SbVec3f &get3(const int index) const;
87 const SbVec4f &get4(const int index) const;
88
89 const SbVec2f *getArrayPtr2(void) const;
90 const SbVec3f *getArrayPtr3(void) const;
91 const SbVec4f *getArrayPtr4(void) const;
92
93 protected:
94 CoordType whatKind;
95 SoTextureCoordinateFunctionCB *funcCB;
96 void *funcCBData;
97 int32_t numCoords;
98 const SbVec2f *coords2;
99 const SbVec3f *coords3;
100 const SbVec4f *coords4;
101 SbBool coordsDimension;
102 SbVec2f convert2;
103 SbVec3f convert3;
104 SbVec4f convert4;
105 };
106
107 #endif // !COIN_SOTEXTURECOORDINATEELEMENT_H
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:39
SbVec4f
The SbVec4f class is a 4 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec4f.h:40
SoTextureCoordinateElement::coords4
const SbVec4f * coords4
Definition: SoTextureCoordinateElement.h:100
SoTextureCoordinateElement::funcCBData
void * funcCBData
Definition: SoTextureCoordinateElement.h:96
SoTextureCoordinateElement::coords2
const SbVec2f * coords2
Definition: SoTextureCoordinateElement.h:98
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoElement
SoElement is the abstract base class for all elements.
Definition: SoElement.h:34
SoTextureCoordinateElement::whatKind
CoordType whatKind
Definition: SoTextureCoordinateElement.h:94
SoState
The SoState class manages the Coin scenegraph traversal state data.The SoState class is used by actio...
Definition: SoState.h:35
SoTextureCoordinateElement::funcCB
SoTextureCoordinateFunctionCB * funcCB
Definition: SoTextureCoordinateElement.h:95
SoReplacedElement::init
virtual void init(SoState *state)
Definition: SoReplacedElement.cpp:79
SoTextureCoordinateElement::numCoords
int32_t numCoords
Definition: SoTextureCoordinateElement.h:97
SoTextureCoordinateElement::convert3
SbVec3f convert3
Definition: SoTextureCoordinateElement.h:103
SoReplacedElement
The SoReplacedElement class is an abstract element superclass.This is the superclass of all elements ...
Definition: SoReplacedElement.h:30
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SoTextureCoordinateElement::coordsDimension
SbBool coordsDimension
Definition: SoTextureCoordinateElement.h:101
SoTextureCoordinateElement::coords3
const SbVec3f * coords3
Definition: SoTextureCoordinateElement.h:99
SoTextureCoordinateElement
The SoTextureCoordinateElement class is yet to be documented.FIXME: write doc.
Definition: SoTextureCoordinateElement.h:41
SoTextureCoordinateElement::CoordType
CoordType
Definition: SoTextureCoordinateElement.h:52
SoTextureCoordinateElement::convert4
SbVec4f convert4
Definition: SoTextureCoordinateElement.h:104
SoTextureCoordinateElement::convert2
SbVec2f convert2
Definition: SoTextureCoordinateElement.h:102

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.