H3D API  2.4.1
TexGenGeometry.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __TEXGENGEOMETRY_H__
30 #define __TEXGENGEOMETRY_H__
31 
32 #include <H3D/X3DGeometryNode.h>
35 
36 namespace H3D {
37 
51  class H3DAPI_API TexGenGeometry :
52  public X3DGeometryNode {
53  public:
54 
57  typedef DependentSFNode<
60  Field,
63 
68  public DependentSFNode< X3DGeometryNode,
69  FieldRef< H3DDisplayListObject,
70  H3DDisplayListObject::DisplayList,
71  &H3DDisplayListObject::displayList >,
72  true > {
73  public:
74  ~SFGeometryNode() { value = NULL; }
75  protected:
76  virtual void onAdd( Node *n ) {
81  true >::onAdd( n );
82  X3DGeometryNode *g = dynamic_cast< X3DGeometryNode * >( n );
83  X3DGeometryNode *own =
84  dynamic_cast< X3DGeometryNode * >( getOwner() );
85  if( g && own ) g->bound->route( own->bound );
86  }
87 
88  virtual void onRemove( Node *n ) {
93  true >::onRemove( n );
94  X3DGeometryNode *g = dynamic_cast< X3DGeometryNode * >( n );
95  X3DGeometryNode *own =
96  dynamic_cast< X3DGeometryNode * >( getOwner() );
97  if( g && own ) g->bound->unroute( own->bound );
98  }
99  };
100 
102  TexGenGeometry( Inst< SFNode > _metadata = 0,
103  Inst< SFBound > _bound = 0,
104  Inst< DisplayList > _displayList = 0,
105  Inst< MFBool > _isTouched = 0,
106  Inst< MFVec3f > _force = 0,
107  Inst< MFVec3f > _contactPoint = 0,
108  Inst< MFVec3f > _contactNormal = 0,
109  Inst< SFGeometryNode > _geometry = 0,
110  Inst< SFTexCoordGenNode > _texCoord = 0 );
111 
113  virtual void render();
114 
116  virtual void traverseSG( TraverseInfo &ti );
117 
119  virtual int nrTriangles() {
120  X3DGeometryNode *g = geometry->getValue();
121  if( g ) return g->nrTriangles();
122  else return 0;
123  }
124 
131  H3DUniquePtr< SFGeometryNode > geometry;
132 
139  H3DUniquePtr< SFTexCoordGenNode > texCoord;
140 
143  };
144 }
145 
146 #endif
Contains the DependentSFNode and DependentMFNode template classes.
Header file for TextureCoordinateGenerator, X3D scene-graph node.
Header file for X3DGeometryNode, X3D scene-graph node.
DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:294
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
The Field class.
Definition: Field.h:46
H3DUniquePtr< SFBound > bound
The field containing the bound object.
Definition: H3DBoundedObject.h:59
We use the Field's lazy evaluation mechanisms to manage the GL display lists for rendering,...
Definition: H3DDisplayListObject.h:60
This abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
H3DUniquePtr< DisplayList > displayList
The DisplayList instance handling the OpenGL caching of this object.
Definition: H3DDisplayListObject.h:256
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
The SFGeometryNode keeps a route between the contained X3DGeometryNode's bound field and the bound fi...
Definition: TexGenGeometry.h:72
The TexGenGeometry node is a wrapper node that lets you specify a TextureCoordinateGenerator node to ...
Definition: TexGenGeometry.h:52
DependentSFNode< TextureCoordinateGenerator, FieldRef< X3DGeometricPropertyNode, Field, &X3DGeometricPropertyNode::propertyChanged > > SFTexCoordGenNode
The SFTextureCoordinteNode is dependent on the propertyChanged field of the contained TextureCoordina...
Definition: TexGenGeometry.h:62
virtual int nrTriangles()
The number of triangles renderered in this geometry.
Definition: TexGenGeometry.h:119
H3DUniquePtr< SFGeometryNode > geometry
The geometry field contains the X3DGeometryNode that we want to generate texture coordinates for.
Definition: TexGenGeometry.h:131
H3DUniquePtr< SFTexCoordGenNode > texCoord
The texCoord field contains the TextureCoordinateGenerator node to use to generate texture coordinate...
Definition: TexGenGeometry.h:139
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TexGenGeometry.h:142
TextureCoordinateGenerator supports the automatic generation of texture coodinates for geometric shap...
Definition: TextureCoordinateGenerator.h:92
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
This is the base node type for all geometric property node types defined in X3D.
Definition: X3DGeometricPropertyNode.h:43
H3DUniquePtr< Field > propertyChanged
Field that indicated whether the properties have changed.
Definition: X3DGeometricPropertyNode.h:53
This is the base node type for all geometry in X3D.
Definition: X3DGeometryNode.h:61
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194