H3D API  2.4.1
Public Member Functions | Static Public Attributes | List of all members
H3D::NurbsPatchSurface Class Reference

The NurbsPatchSurface node is a contiguous NURBS surface patch. More...

#include <H3D/NurbsPatchSurface.h>

Inheritance diagram for H3D::NurbsPatchSurface:
Inheritance graph

Public Member Functions

 NurbsPatchSurface (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< MFBool > _isTouched=0, Inst< MFVec3f > _force=0, Inst< MFVec3f > _contactPoint=0, Inst< MFVec3f > _contactNormal=0, Inst< SFCoordinateNode > _controlPoint=0, Inst< TexCoordOrNurbsTex > _texCoord=0, Inst< SFInt32 > _uTessellation=0, Inst< SFInt32 > _vTessellation=0, Inst< MFDouble > _weight=0, Inst< SFBool > _solid=0, Inst< SFBool > _uClosed=0, Inst< SFBool > _vClosed=0, Inst< SFInt32 > _uDimension=0, Inst< SFInt32 > _vDimension=0, Inst< MFDouble > _uKnot=0, Inst< MFDouble > _vKnot=0, Inst< SFInt32 > _uOrder=0, Inst< SFInt32 > _vOrder=0)
 Constructor.
 
virtual void renderBetweenBeginEnd (GLUnurbsObj *_nurbs_object, X3DTextureCoordinateNode *tex_coord_node, TextureCoordinateGenerator *tex_coord_gen, NurbsTextureCoordinate *nurbs_tex_coord, GLfloat *texKnotU, GLfloat *texKnotV, GLfloat *texCoordinates, GLfloat *u_knots, GLfloat *v_knots, H3DInt32 &sizeOfVertex, GLfloat *withWeights, H3DInt32 &uSizeToUse, H3DInt32 &vSizeToUse, H3DInt32 &map2Vertex3Or4)
 Function called by render to render the small part that differs between NurbsPatchSurface and NurbsTrimmedSurface. More...
 
- Public Member Functions inherited from H3D::X3DNurbsSurfaceGeometryNode
 ~X3DNurbsSurfaceGeometryNode ()
 Destructor.
 
 X3DNurbsSurfaceGeometryNode (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< MFBool > _isTouched=0, Inst< MFVec3f > _force=0, Inst< MFVec3f > _contactPoint=0, Inst< MFVec3f > _contactNormal=0, Inst< SFCoordinateNode > _controlPoint=0, Inst< TexCoordOrNurbsTex > _texCoord=0, Inst< SFInt32 > _uTessellation=0, Inst< SFInt32 > _vTessellation=0, Inst< MFDouble > _weight=0, Inst< SFBool > _solid=0, Inst< SFBool > _uClosed=0, Inst< SFBool > _vClosed=0, Inst< SFInt32 > _uDimension=0, Inst< SFInt32 > _vDimension=0, Inst< MFDouble > _uKnot=0, Inst< MFDouble > _vKnot=0, Inst< SFInt32 > _uOrder=0, Inst< SFInt32 > _vOrder=0)
 Constructor.
 
virtual void render ()
 Render the X3DNurbsSurfaceGeometryNode with OpenGL.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph.
 
virtual int nrTriangles ()
 The number of triangles renderered in this geometry, we don't know so return -1.
 
- Public Member Functions inherited from H3D::X3DParametricGeometryNode
 X3DParametricGeometryNode (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< MFBool > _isTouched=0, Inst< MFVec3f > _force=0, Inst< MFVec3f > _contactPoint=0, Inst< MFVec3f > _contactNormal=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DGeometryNode
 X3DGeometryNode (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< MFBool > _isTouched=0, Inst< MFVec3f > _force=0, Inst< MFVec3f > _contactPoint=0, Inst< MFVec3f > _contactNormal=0, Inst< MFVec3f > _contactTexCoord=0, Inst< SFBoundTree > _boundTree=0, Inst< SFVec3f > _centerOfMass=0)
 Constructor.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and this geometry. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on this geometry to point p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the geometry. More...
 
virtual void glRender ()
 Function overridden from HAPIGLShape. More...
 
virtual H3DShadowObjectNodegetShadowObject ()
 Get the H3DShadowObjectNode used to create a shadow volume for this geometry. More...
 
void useCulling (bool enabled)
 This function should be used by the render() function to disable or enable face culling. More...
 
bool usingCulling ()
 Returns if face culling is in use or not.
 
void allowCulling (bool allow)
 Control if face culling is allowed or not. More...
 
void useBackFaceCulling (bool enabled)
 Enabling/disabling back face culling. More...
 
bool allowingCulling ()
 Returns true if back face culling is allowed, false otherwise.
 
void setCullFace (GLenum face)
 Set which side of a polygon to cull. More...
 
GLenum getCullFace ()
 Get which face will be culled if culling is enabled.
 
template<class OptionNodeType >
void getOptionNode (OptionNodeType *&option)
 Get the first option node of the type of the pointer given as argument from the renderOptions fieeld The option argument will contain the node afterwards, or NULL if no option of that type exists.
 
int getHapticShapeId (unsigned int index)
 Get a shape id to be used for rendering of this geometry with HLAPI for the given haptics device. More...
 
virtual ~X3DGeometryNode ()
 Destructor.
 
HAPI::HAPIHapticShape * getOpenGLHapticShape (unsigned int hd_index, H3DSurfaceNode *_surface, const Matrix4f &_transform, int _nr_vertices=-1)
 Returns a either a HLFeedbackShape or a HLDepthBufferShape with the X3DGeometryNode. More...
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual bool supportsTangentAttributes ()
 Returns true if this geometry supports the automatic generation of tangents and binormals as FloatVertexAttribues(needed by e.g. More...
 
virtual void getBound (HAPI::Vec3 &center, HAPI::Vec3 &size)
 Overriden from HAPIGLShape to use the bound field in he X3DGeometryNode. More...
 
virtual void initialize ()
 Changes behaviour of X3DGeometryNode to be a thread safe RefCountedClass.
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNurbsSurfaceGeometryNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DGeometryNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Public Types inherited from H3D::X3DNurbsSurfaceGeometryNode
typedef DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
 The SFCoordinateNode is dependent on the propertyChanged field of the contained X3DCoordinateNode.
 
typedef DependentSFNode< X3DGeometricPropertyNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DGeometricPropertyNode::propertyChanged > > TexCoordOrNurbsTexDependent
 The SFTextureCoordinteNode is dependent on the propertyChanged field of the contained X3DTextureCoordinateNode or NurbsTextureCoordinate which both inherits from X3DGeometricPropertyNode.
 
typedef CoordBoundField SFBound
 The bound field for X3DNurbsSurfaceGeometryNode is a CoordBoundField.
 
- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Public Attributes inherited from H3D::X3DNurbsSurfaceGeometryNode
H3DUniquePtr< SFCoordinateNodecontrolPoint
 controlPoint defines a set of control points of dimension uDimension × vDimension. More...
 
H3DUniquePtr< TexCoordOrNurbsTextexCoord
 texCoord provides additional information on how to generate texture coordinates. More...
 
H3DUniquePtr< SFInt32uTessellation
 uTesselation provides a hint to the tessellation system of the nurbs surface. More...
 
H3DUniquePtr< SFInt32vTessellation
 vTesselation provides a hint to the tessellation system of the nurbs surface. More...
 
H3DUniquePtr< MFDoubleweight
 A weight value that shall be greater than zero is assigned to each controlPoint. More...
 
H3DUniquePtr< SFBoolsolid
 Specifies if both sides of the Sphere should be rendered or only the outside. More...
 
H3DUniquePtr< SFBooluClosed
 The uClosed defines whether the curve should be rendered as a closed object in the u direction. More...
 
H3DUniquePtr< SFBoolvClosed
 The vClosed defines whether the curve should be rendered as a closed object in the v direction. More...
 
H3DUniquePtr< SFInt32uDimension
 Defines the number of control points in the u dimension. More...
 
H3DUniquePtr< SFInt32vDimension
 Defines the number of control points in the v dimension. More...
 
H3DUniquePtr< MFDoubleuKnot
 Defines the knot values of the surface in the u dimension. More...
 
H3DUniquePtr< MFDoublevKnot
 Defines the knot values of the surface in the v dimension. More...
 
H3DUniquePtr< SFInt32uOrder
 Defines the order of the surface in the u dimension. More...
 
H3DUniquePtr< SFInt32vOrder
 Defines the order of the surface in the v dimension. More...
 
- Public Attributes inherited from H3D::X3DGeometryNode
H3DUniquePtr< MFBoolisTouched
 Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop. More...
 
H3DUniquePtr< MFVec3fforce
 The last force delivered by this geometry to the haptics device. More...
 
H3DUniquePtr< MFVec3fcontactPoint
 The last contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< MFVec3fcontactTexCoord
 The texture coordinate of last the contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< MFVec3fcontactNormal
 The normal at the last contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< SFVec3fcenterOfMass
 The field contains center of mass for the object, based on its bounding box. More...
 
H3DUniquePtr< SFBoundTreeboundTree
 Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode. More...
 
H3DUniquePtr< MFOptionsNodeoptions
 Contains nodes with options for haptics and graphics rendering. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::X3DGeometryNode
static void cleanUpFunction (void *userdata)
 Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct time. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 
- Protected Attributes inherited from H3D::X3DNurbsSurfaceGeometryNode
H3DUniquePtr< FieldprintWarning
 A field used to check if a warning should be printed. More...
 
- Protected Attributes inherited from H3D::X3DGeometryNode
AutoRef< Nodeshadow_volume
 The shadow volume used for this geometry when shadows enabled. More...
 
vector< pair< int, pair< Matrix4f, H3DTime > > > haptic_shape_ids
 identifiers for the shapes geometry.
 

Detailed Description

The NurbsPatchSurface node is a contiguous NURBS surface patch.

uDimension and vDimension define the number of control points in the u and v dimensions.

uOrder and vOrder define the order of the surface in the u and v dimensions.

uKnot and vKnot define the knot values of the surface in the u and v dimensions.

uClosed and vClosed define whether or not the specific dimension is to be evaluated as a closed surface or not in the u and v dimensions.

controlPoint defines a set of control points of dimension uDimension × vDimension. This set of points defines a mesh where the points do not have a uniform spacing. uDimension points define a polyline in u-direction followed by further u-polylines with the v-parameter in ascending order. The number of control points shall be equal or greater than the order. A closed surface shall be specified by repeating the limiting control points and setting the closed field to TRUE. If the closed field is set to FALSE, the implementation shall not be required to smoothly blend the edges of the surface in that dimension into a continuous surface. If the last set of control points are not identical, the field is ignored.

The control vertex corresponding to the control point P[i,j] on the control grid is:

P[i,j].x = controlPoints[i + ( j × uDimension)].x P[i,j].y = controlPoints[i + ( j × uDimension)].y P[i,j].z = controlPoints[i + ( j × uDimension)].z P[i,j].w = weight[ i + (j × uDimension)]

where 0 = i < uDimension and 0 = j < vDimension.

For an implementation subdividing the surface in a equal number of subdivision steps, tessellation values could be interpreted in the following way:

if a tessellation value is greater than 0, the number of tessellation points is:

tessellation+1;

if a tessellation value is smaller than 0, the number of tessellation points is:

-tessellation × (u/v)dimension)+1;

if a tessellation value is 0, the number of tessellation points is:

(2 × (u/v)dimension)+1.

For implementations doing tessellations based on chord length, tessellation values less than zero are interpreted as the maximum chord length deviation in pixels. Implementations doing fully automatic tessellation may ignore the tessellation hint parameters.

texCoord provides additional information on how to generate texture coordinates. By default, texture coordinates in the unit square (or cube for 3D coordinates) are generated automatically from the parametric subdivision. A NurbsTextureCoordinate node or simply a TextureCoordinate node can then be used to compute a texture coordinate given a u/v parameter of the NurbsSurface. The NurbsTextureCoordinate also supports non-animated surfaces to specify a "chord length"-based texture coordinate parametrization.

The solid field determines whether the surface is visible when viewed from the inside

closed defines whether the curve should be rendered as a closed object in the given parametric direction allowing the object to be closed in one direction, but not the other (EXAMPLE cylinder).

Examples:

Internal routes:

Member Function Documentation

◆ renderBetweenBeginEnd()

void NurbsPatchSurface::renderBetweenBeginEnd ( GLUnurbsObj *  ,
X3DTextureCoordinateNode ,
TextureCoordinateGenerator ,
NurbsTextureCoordinate ,
GLfloat *  ,
GLfloat *  ,
GLfloat *  ,
GLfloat *  ,
GLfloat *  ,
H3DInt32 ,
GLfloat *  ,
H3DInt32 ,
H3DInt32 ,
H3DInt32  
)
virtual

Function called by render to render the small part that differs between NurbsPatchSurface and NurbsTrimmedSurface.

The arguments are things that are needed to render that difference.

Reimplemented from H3D::X3DNurbsSurfaceGeometryNode.

References H3D::NurbsTextureCoordinate::renderTexForNurbs(), H3D::TextureCoordinateGenerator::startTexGen(), H3D::X3DNurbsSurfaceGeometryNode::uDimension, H3D::X3DNurbsSurfaceGeometryNode::uOrder, and H3D::X3DNurbsSurfaceGeometryNode::vOrder.


The documentation for this class was generated from the following files: