OpendTect  6.6
visshape.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Kristofer Tingdahl
8  Date: 4-11-2002
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "visbasemod.h"
15 #include "visobject.h"
16 #include "indexedshape.h"
17 #include "draw.h"
18 
19 namespace osg
20 {
21  class Geode;
22  class Geometry;
23  class PrimitiveSet;
24  class StateAttribute;
25  class Switch;
26 }
27 
28 namespace visBase
29 {
30 
31 class NodeState;
32 class ForegroundLifter;
33 class VisColorTab;
34 class Material;
35 class Coordinates;
36 class Normals;
37 class TextureChannels;
38 class TextureCoords;
39 
40 
41 #undef mDeclSetGetItem
42 #define mDeclSetGetItem( ownclass, clssname, variable ) \
43 protected: \
44  clssname* gt##clssname() const; \
45 public: \
46  inline clssname* get##clssname() { return gt##clssname(); } \
47  inline const clssname* get##clssname() const { return gt##clssname(); } \
48  void set##clssname(clssname*)
49 
50 
52 {
53 public:
54 
55  mDeclSetGetItem( Shape, Material, material_ );
56 
57  void setMaterialBinding( int );
58  static int cOverallMaterialBinding() { return 0; }
59  static int cPerVertexMaterialBinding() { return 2; }
60 
61  int getMaterialBinding() const;
62 
66 
67  int usePar(const IOPar&);
68  void fillPar(IOPar&) const;
69 
70 protected:
71  Shape();
72  virtual ~Shape();
73 
75 
76  static const char* sKeyOnOff();
77  static const char* sKeyTexture();
78  static const char* sKeyMaterial();
79 };
80 
81 
83 {
84  class TextureCallbackHandler;
85  class NodeCallbackHandler;
86 
87 public:
88 
89  static VertexShape* create()
91 
92  void setPrimitiveType(Geometry::PrimitiveSet::PrimitiveType);
94 
97 
98  virtual void setCoordinates(Coordinates* coords);
99  virtual Coordinates* getCoordinates() { return coords_; }
100  virtual const Coordinates* getCoordinates() const { return coords_; }
101  virtual void setLineStyle(const OD::LineStyle&){};
102 
103  void removeSwitch();
109  virtual void setDisplayTransformation( const mVisTrans* );
117 
121  int nrPrimitiveSets() const;
122  virtual void touchPrimitiveSet(int) {}
124  void setMaterial( Material* mt );
128  { usecoordinateschangedcb_ = yn; }
131  { return useosgsmoothnormal_; }
132  Coord3 getOsgNormal(int) const;
133 
134  enum BindType{ BIND_OFF = 0,BIND_OVERALL,
136  BIND_PER_PRIMITIVE, BIND_PER_VERTEX};
146  const unsigned char* getTextureData(int&,int&,int&) const;
147  void forceRedraw(bool=true);
148  void setAttribAndMode(osg::StateAttribute*);
149 
150 protected:
152  bool creategeode );
154 
155  void setupOsgNode();
156 
157  virtual void addPrimitiveSetToScene(osg::PrimitiveSet*);
158  virtual void removePrimitiveSetFromScene(const osg::PrimitiveSet*);
159 
160  void setUpdateVar(bool& var,bool yn);
162 
163  bool needstextureupdate_; // Only set via setUpdateVar(.)
164 
168 
169  osg::Node* node_;
170 
171  osg::Geode* geode_;
173 
176 
179 
181  NodeCallbackHandler* nodecallbackhandler_;
182  TextureCallbackHandler* texturecallbackhandler_;
185 
187 
192 
193 };
194 
195 #undef mDeclSetGetItem
196 
197 
198 
200 {
202 };
203 
204 
205 
206 }
207 
visBase::VertexShape::texturecallbackhandler_
TextureCallbackHandler * texturecallbackhandler_
Definition: visshape.h:182
Coord3
A cartesian coordinate in 3D space.
Definition: coord.h:72
OD::LineStyle
Definition: draw.h:118
visBase::Shape
Definition: visshape.h:52
visBase::VertexShape::removeAllPrimitiveSets
void removeAllPrimitiveSets()
visBase::VertexShape::useVertexBufferRender
void useVertexBufferRender(bool)
visBase::VertexShape::useosgsmoothnormal_
bool useosgsmoothnormal_
Definition: visshape.h:174
visBase::VertexShape::enableCoordinatesChangedCB
void enableCoordinatesChangedCB(bool yn)
Definition: visshape.h:127
visBase::VertexShape::setNormalBindType
void setNormalBindType(BindType)
visBase::VertexShape::primitivesets_
ObjectSet< Geometry::PrimitiveSet > primitivesets_
Definition: visshape.h:191
visBase::PrimitiveSetCreator::doCreate
Geometry::PrimitiveSet * doCreate(bool, bool)
visBase::VertexShape::getNormalBindType
int getNormalBindType()
ObjectSet< Geometry::PrimitiveSet >
Geometry
Definition: arraytesselator.h:21
visBase
Definition: visannot.h:43
visBase::VertexShape::nodecallbackhandler_
NodeCallbackHandler * nodecallbackhandler_
Definition: visshape.h:181
visBase::VertexShape::setLineStyle
virtual void setLineStyle(const OD::LineStyle &)
Definition: visshape.h:101
visBase::VertexShape::channels_
RefMan< TextureChannels > channels_
Definition: visshape.h:180
visBase::VertexShape::dirtyCoordinates
void dirtyCoordinates()
visBase::VertexShape::getOsgNormal
Coord3 getOsgNormal(int) const
visBase::VertexShape::normalbindtype_
BindType normalbindtype_
Definition: visshape.h:178
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
sKey::Geometry
FixedString Geometry()
Definition: keystrs.h:72
visBase::VertexShape::needstextureupdate_
bool needstextureupdate_
Will trigger redraw request if necessary.
Definition: visshape.h:163
visBase::VertexShape::normals_
Normals * normals_
Definition: visshape.h:165
osg
Open Scene Graph.
Definition: visannot.h:29
visBase::VertexShape::redrawlock_
Threads::Lock redrawlock_
Definition: visshape.h:183
visBase::Shape::cPerVertexMaterialBinding
static int cPerVertexMaterialBinding()
Definition: visshape.h:59
visBase::VisualObject
Definition: visobject.h:37
visBase::VertexShape::texturecoords_
TextureCoords * texturecoords_
Definition: visshape.h:167
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
visBase::VertexShape::removeSwitch
void removeSwitch()
visBase::Shape::~Shape
virtual ~Shape()
visobject.h
Geometry::PrimitiveSet
Definition: indexedshape.h:29
visBase::VertexShape::coordinatesChangedCB
void coordinatesChangedCB(CallBacker *)
visBase::PrimitiveSetCreator
Definition: visshape.h:200
visBase::VertexShape::coords_
Coordinates * coords_
Definition: visshape.h:166
visBase::VertexShape::colorbindtype_
BindType colorbindtype_
Definition: visshape.h:177
visBase::VertexShape::useOsgAutoNormalComputation
void useOsgAutoNormalComputation(bool)
Geometry::PrimitiveSetCreator
Definition: indexedshape.h:99
visBase::VertexShape::useOsgAutoNormalComputation
bool useOsgAutoNormalComputation() const
Definition: visshape.h:130
visBase::VertexShape::BindType
BindType
Definition: visshape.h:134
visBase::VertexShape::touchPrimitiveSet
virtual void touchPrimitiveSet(int)
Definition: visshape.h:122
visBase::TextureChannels
Definition: vistexturechannels.h:50
visBase::Shape::Shape
Shape()
visBase::VertexShape::geode_
osg::Geode * geode_
Definition: visshape.h:171
ODGMT::Shape
Shape
Definition: gmtdef.h:20
visBase::VertexShape::isredrawing_
bool isredrawing_
Definition: visshape.h:184
visBase::VertexShape
Definition: visshape.h:83
visBase::Shape::sKeyTexture
static const char * sKeyTexture()
visBase::VertexShape::setTextureChannels
void setTextureChannels(TextureChannels *)
indexedshape.h
visBase::VertexShape::setUpdateVar
void setUpdateVar(bool &var, bool yn)
visBase::Shape::setRenderMode
void setRenderMode(RenderMode)
visBase::Shape::cOverallMaterialBinding
static int cOverallMaterialBinding()
Definition: visshape.h:58
visBase::VertexShape::node_
osg::Node * node_
Definition: visshape.h:169
visBase::VertexShape::removePrimitiveSetFromScene
virtual void removePrimitiveSetFromScene(const osg::PrimitiveSet *)
visBase::Shape::sKeyMaterial
static const char * sKeyMaterial()
mDeclSetGetItem
#define mDeclSetGetItem(ownclass, clssname, variable)
Definition: visshape.h:42
visBase::VertexShape::addPrimitiveSet
void addPrimitiveSet(Geometry::PrimitiveSet *)
visBase::VertexShape::setDisplayTransformation
virtual void setDisplayTransformation(const visBase::Transformation *)
visBase::VertexShape::usecoordinateschangedcb_
bool usecoordinateschangedcb_
Definition: visshape.h:175
visBase::Shape::material_
Material * material_
Definition: visshape.h:74
visBase::Material
Definition: vismaterial.h:37
visBase::VertexShape::create
static VertexShape * create()
Definition: visshape.h:89
visBase::Shape::getMaterialBinding
int getMaterialBinding() const
draw.h
visBase::VertexShape::updatePartialGeometry
void updatePartialGeometry(Interval< int >)
mVisTrans
#define mVisTrans
Definition: visdata.h:28
visBase::VertexShape::~VertexShape
~VertexShape()
visBase::Shape::fillPar
void fillPar(IOPar &) const
visBase::VertexShape::VertexShape
VertexShape(Geometry::PrimitiveSet::PrimitiveType, bool creategeode)
visBase::Shape::sKeyOnOff
static const char * sKeyOnOff()
visBase::VertexShape::setMaterial
void setMaterial(Material *mt)
visBase::Shape::usePar
int usePar(const IOPar &)
osg default render lighting is on
visBase::VertexShape::setColorBindType
void setColorBindType(BindType)
Geometry::PrimitiveSet::PrimitiveType
PrimitiveType
Definition: indexedshape.h:32
visBase::VertexShape::materialChangeCB
void materialChangeCB(CallBacker *)
mCreateDataObj
#define mCreateDataObj(clss)
Definition: visdata.h:214
visBase::VertexShape::primitivetype_
Geometry::PrimitiveSet::PrimitiveType primitivetype_
Definition: visshape.h:186
visBase::VertexShape::forceRedraw
void forceRedraw(bool=true)
visBase::VertexShape::BIND_PER_PRIMITIVE_SET
@ BIND_PER_PRIMITIVE_SET
Definition: visshape.h:135
visBase::Coordinates
A set of coordinates. The coordinates will be transformed by the transformation before given to Coin,...
Definition: viscoord.h:45
visBase::VertexShape::getCoordinates
virtual const Coordinates * getCoordinates() const
Definition: visshape.h:100
Interval< int >
visBase::Shape::setMaterialBinding
void setMaterialBinding(int)
visBase::VertexShape::lock_
Threads::Lock lock_
Definition: visshape.h:188
visBase::RenderMode
RenderMode
Base class for all objects that are visual on the scene.
Definition: visobject.h:33
visBase::VertexShape::setupOsgNode
void setupOsgNode()
visBase::TextureCoords
Definition: vistexturecoords.h:28
Threads::Lock
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class.
Definition: threadlock.h:53
visBase::VertexShape::addPrimitiveSetToScene
virtual void addPrimitiveSetToScene(osg::PrimitiveSet *)
visBase::VertexShape::removePrimitiveSet
void removePrimitiveSet(const Geometry::PrimitiveSet *)
visBase::VertexShape::setAttribAndMode
void setAttribAndMode(osg::StateAttribute *)
visBase::Normals
Definition: visnormals.h:32
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
visBase::VertexShape::nrPrimitiveSets
int nrPrimitiveSets() const
visBase::Shape::enableRenderLighting
void enableRenderLighting(bool)
visBase::VertexShape::getTextureData
const unsigned char * getTextureData(int &, int &, int &) const
visBase::VertexShape::osggeom_
osg::Geometry * osggeom_
Definition: visshape.h:172
RefMan
Definition: ptrman.h:206
visBase::VertexShape::getPrimitiveSet
Geometry::PrimitiveSet * getPrimitiveSet(int)
visBase::VertexShape::getDisplayTransformation
const visBase::Transformation * getDisplayTransformation() const

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021