H3D API  2.4.1
X3DNurbsSurfaceGeometryNode.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 __X3DNURBSSURFACEGEOMETRYNODE_H__
30 #define __X3DNURBSSURFACEGEOMETRYNODE_H__
31 
34 #include <H3D/X3DCoordinateNode.h>
37 #include <H3D/CoordBoundField.h>
38 #include <H3D/SFInt32.h>
39 #include <H3D/MFDouble.h>
41 
42 namespace H3D {
43 
125  class H3DAPI_API X3DNurbsSurfaceGeometryNode :
127  public:
128 
133  Field,
136 
141  typedef DependentSFNode<
144  Field,
147 
150 
154  public:
155 
161  value = NULL;
162  }
163 
164  virtual void onAdd( Node *n ) {
165  SFNode::onAdd( n );
166  X3DTextureCoordinateNode *tex_coord_node =
167  dynamic_cast< X3DTextureCoordinateNode * >( n );
168 
169  NurbsTextureCoordinate *nurbs_tex_coord =
170  dynamic_cast< NurbsTextureCoordinate * >( n );
171 
172  if( !tex_coord_node && !nurbs_tex_coord ) {
173  stringstream s;
174  s << "Expecting X3DTextureCoordinateNode or NurbsTextureCoordinate";
175  throw InvalidNodeType( n->getTypeName(),
176  s.str(),
177  H3D_FULL_LOCATION );
178  }
179  }
180  };
181 #ifdef __BORLANDC__
182  friend class TexCoordOrNurbsTex;
183 #endif
184 
187  if( nurbs_object ) gluDeleteNurbsRenderer( nurbs_object );
188  }
189 
191  X3DNurbsSurfaceGeometryNode( Inst< SFNode > _metadata = 0,
192  Inst< SFBound > _bound = 0,
193  Inst< DisplayList > _displayList = 0,
194  Inst< MFBool > _isTouched = 0,
195  Inst< MFVec3f > _force = 0,
196  Inst< MFVec3f > _contactPoint = 0,
197  Inst< MFVec3f > _contactNormal = 0,
198  Inst< SFCoordinateNode > _controlPoint = 0,
199  Inst< TexCoordOrNurbsTex > _texCoord = 0,
200  Inst< SFInt32 > _uTessellation = 0,
201  Inst< SFInt32 > _vTessellation = 0,
202  Inst< MFDouble > _weight = 0,
203  Inst< SFBool > _solid = 0,
204  Inst< SFBool > _uClosed = 0,
205  Inst< SFBool > _vClosed = 0,
206  Inst< SFInt32 > _uDimension = 0,
207  Inst< SFInt32 > _vDimension = 0,
208  Inst< MFDouble > _uKnot = 0,
209  Inst< MFDouble > _vKnot = 0,
210  Inst< SFInt32 > _uOrder = 0,
211  Inst< SFInt32 > _vOrder = 0 );
212 
214  virtual void render();
215 
217  virtual void traverseSG( TraverseInfo &ti );
218 
221  virtual int nrTriangles() {
222  return -1;
223  }
224 
228  virtual void renderBetweenBeginEnd(
229  GLUnurbsObj * /*nurbs_object*/,
230  X3DTextureCoordinateNode * /*tex_coord_node*/,
231  TextureCoordinateGenerator * /*tex_coord_gen*/,
232  NurbsTextureCoordinate * /*nurbs_tex_coord*/,
233  GLfloat * /*texKnotU*/,
234  GLfloat * /*texKnotV*/,
235  GLfloat * /*texCoordinates*/,
236  GLfloat * /*u_knots*/,
237  GLfloat * /*v_knots*/,
238  H3DInt32 &/*sizeOfVertex*/,
239  GLfloat * /*withWeights*/,
240  H3DInt32 &/*uSizeToUse*/,
241  H3DInt32 &/*vSizeToUse*/,
242  H3DInt32 &/*map2Vertex3Or4*/ ) {};
243 
254  H3DUniquePtr< SFCoordinateNode > controlPoint;
255 
266  H3DUniquePtr< TexCoordOrNurbsTex > texCoord;
267 
275  H3DUniquePtr< SFInt32 > uTessellation;
276 
284  H3DUniquePtr< SFInt32 > vTessellation;
285 
298  H3DUniquePtr< MFDouble > weight;
299 
307  H3DUniquePtr< SFBool > solid;
308 
316  H3DUniquePtr< SFBool > uClosed;
317 
325  H3DUniquePtr< SFBool > vClosed;
326 
333  H3DUniquePtr< SFInt32 > uDimension;
334 
341  H3DUniquePtr< SFInt32 > vDimension;
342 
348  H3DUniquePtr< MFDouble > uKnot;
349 
355  H3DUniquePtr< MFDouble > vKnot;
356 
363  H3DUniquePtr< SFInt32 > uOrder;
364 
371  H3DUniquePtr< SFInt32 > vOrder;
372 
375 
376  protected:
377  GLUnurbsObj *nurbs_object;
380  H3DUniquePtr< Field > printWarning;
381  };
382 }
383 
384 #endif
Header file for CoordBoundField, specialiced field class.
Contains the DependentSFNode and DependentMFNode template classes.
Contains the MFDouble field class.
Header file for NurbsTextureCoordinate, X3D scene-graph node.
Contains the SFInt32 field class.
Header file for TextureCoordinateGenerator, X3D scene-graph node.
Header file for X3DCoordinateNode, X3D scene-graph node.
Header file for X3DParametricGeometryNode, X3D scene-graph node.
Header file for X3DTextureCoordinateNode, X3D scene-graph node.
std::string getTypeName() const
The CoordBoundField is specialized update itself from a X3DCoordinateNode.
Definition: CoordBoundField.h:43
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
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
The NurbsTextureCoordinate node is a NURBS surface existing in the parametric domain of its surface h...
Definition: NurbsTextureCoordinate.h:71
virtual void onAdd(Node *n)
This function will be called when the value of RefCountSField changes.
Definition: RefCountSField.h:164
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 coordinate node types in X3D.
Definition: X3DCoordinateNode.h:47
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 field class takes as input SFNode field and checks whether this is one of the allowed textureNod...
Definition: X3DNurbsSurfaceGeometryNode.h:153
~TexCoordOrNurbsTex()
Destructor.
Definition: X3DNurbsSurfaceGeometryNode.h:160
The X3DNurbsSurfaceGeometryNode represents the abstract geometry type for all types of NURBS surfaces...
Definition: X3DNurbsSurfaceGeometryNode.h:126
H3DUniquePtr< SFInt32 > uDimension
Defines the number of control points in the u dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:333
~X3DNurbsSurfaceGeometryNode()
Destructor.
Definition: X3DNurbsSurfaceGeometryNode.h:186
CoordBoundField SFBound
The bound field for X3DNurbsSurfaceGeometryNode is a CoordBoundField.
Definition: X3DNurbsSurfaceGeometryNode.h:149
H3DUniquePtr< SFInt32 > vOrder
Defines the order of the surface in the v dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:371
H3DUniquePtr< Field > printWarning
A field used to check if a warning should be printed.
Definition: X3DNurbsSurfaceGeometryNode.h:380
H3DUniquePtr< SFInt32 > vTessellation
vTesselation provides a hint to the tessellation system of the nurbs surface.
Definition: X3DNurbsSurfaceGeometryNode.h:284
DependentSFNode< X3DGeometricPropertyNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DGeometricPropertyNode::propertyChanged > > TexCoordOrNurbsTexDependent
The SFTextureCoordinteNode is dependent on the propertyChanged field of the contained X3DTextureCoord...
Definition: X3DNurbsSurfaceGeometryNode.h:146
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: X3DNurbsSurfaceGeometryNode.h:374
H3DUniquePtr< SFInt32 > uTessellation
uTesselation provides a hint to the tessellation system of the nurbs surface.
Definition: X3DNurbsSurfaceGeometryNode.h:275
virtual int nrTriangles()
The number of triangles renderered in this geometry, we don't know so return -1.
Definition: X3DNurbsSurfaceGeometryNode.h:221
H3DUniquePtr< SFInt32 > vDimension
Defines the number of control points in the v dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:341
H3DUniquePtr< SFBool > uClosed
The uClosed defines whether the curve should be rendered as a closed object in the u direction.
Definition: X3DNurbsSurfaceGeometryNode.h:316
H3DUniquePtr< SFBool > solid
Specifies if both sides of the Sphere should be rendered or only the outside.
Definition: X3DNurbsSurfaceGeometryNode.h:307
H3DUniquePtr< MFDouble > vKnot
Defines the knot values of the surface in the v dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:355
H3DUniquePtr< MFDouble > uKnot
Defines the knot values of the surface in the u dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:348
H3DUniquePtr< TexCoordOrNurbsTex > texCoord
texCoord provides additional information on how to generate texture coordinates.
Definition: X3DNurbsSurfaceGeometryNode.h:266
H3DUniquePtr< SFBool > vClosed
The vClosed defines whether the curve should be rendered as a closed object in the v direction.
Definition: X3DNurbsSurfaceGeometryNode.h:325
DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
The SFCoordinateNode is dependent on the propertyChanged field of the contained X3DCoordinateNode.
Definition: X3DNurbsSurfaceGeometryNode.h:135
H3DUniquePtr< MFDouble > weight
A weight value that shall be greater than zero is assigned to each controlPoint.
Definition: X3DNurbsSurfaceGeometryNode.h:298
virtual void renderBetweenBeginEnd(GLUnurbsObj *, X3DTextureCoordinateNode *, TextureCoordinateGenerator *, NurbsTextureCoordinate *, GLfloat *, GLfloat *, GLfloat *, GLfloat *, GLfloat *, H3DInt32 &, GLfloat *, H3DInt32 &, H3DInt32 &, H3DInt32 &)
Function called by render to render the small part that differs between NurbsPatchSurface and NurbsTr...
Definition: X3DNurbsSurfaceGeometryNode.h:228
H3DUniquePtr< SFInt32 > uOrder
Defines the order of the surface in the u dimension.
Definition: X3DNurbsSurfaceGeometryNode.h:363
H3DUniquePtr< SFCoordinateNode > controlPoint
controlPoint defines a set of control points of dimension uDimension × vDimension.
Definition: X3DNurbsSurfaceGeometryNode.h:242
This abstract node type is the base type for all geometry node types that are created parametrically ...
Definition: X3DParametricGeometryNode.h:44
This abstract node type is the base type for all node types which specify texture coordinates.
Definition: X3DTextureCoordinateNode.h:55
int H3DInt32
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