H3D API  2.4.1
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
H3D::SuperShape Class Reference

The SuperShape node implements a SuperShape! More...

#include <H3D/SuperShape.h>

Inheritance diagram for H3D::SuperShape:
Inheritance graph

Classes

class  SFCoordinateNode
 The SFCoordinateNode is a class that contain a X3DCoordinateNode. More...
 

Public Types

typedef DependentSFNode< X3DNormalNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DNormalNode::propertyChanged > > SFNormalNode
 The SFNormalNode is dependent on the propertyChanged field of the contained X3DNormalNode.
 
typedef CoordBoundField SFBound
 The bound field for SuperShape 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.
 

Public Member Functions

virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual int nrTriangles ()
 The number of triangles renderered in this geometry.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. More...
 
- 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.
 

Public Attributes

H3DUniquePtr< SFFloatss1_m
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss1_a
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss1_b
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss1_n1
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss1_n2
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss1_n3
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_m
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_a
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_b
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_n1
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_n2
 Parameter to define supershape. More...
 
H3DUniquePtr< SFFloatss2_n3
 Parameter to define supershape. More...
 
H3DUniquePtr< SFInt32resolution
 Parameter to define the resolution of the supershape. 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

void startTexGen ()
 Start texture coordinate generation. More...
 
void stopTexGen ()
 Stop texture coordinate generation.
 
- 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...
 

Protected Attributes

H3DUniquePtr< SFCoordinateNodecoord
 Field that contains a Coordinate node with the coordinates generated by SuperShape. More...
 
H3DUniquePtr< SFNormalNodenormal
 Field that contains a Normal node with the normals generated by SuperShape. 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.
 

Additional Inherited Members

- 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.
 
- 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.
 
- 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...
 

Detailed Description

The SuperShape node implements a SuperShape!

A SuperShape is an implementation of the SuperFormula. The SuperFormula is a formula that can be used to describe geometric shapes found in nature. For information about the parameters defining the SuperShape see 2d-equation on http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/supershape3d/ This geometryNode implements a 3D-version of the SuperFormula by using two functions. The parameter names for one function is ss1_x and for the other it is ss2. Experiment with values to see what they do.

Examples:

Internal routes:

Member Function Documentation

◆ render()

void SuperShape::render ( )
virtual

◆ startTexGen()

void SuperShape::startTexGen ( )
protected

Start texture coordinate generation.

Texture coordinates will be generated for all texture units used by the currently active texture. Texture coordinates will be generated from the bounding box of the geometry

References H3D::H3DBoundedObject::bound, H3D::BoxBound::center, H3D::X3DTextureNode::getActiveTexture(), H3D_FULL_LOCATION, H3DAbs(), H3D::BoxBound::size, and H3D::MultiTexture::texture.

◆ traverseSG()

void SuperShape::traverseSG ( TraverseInfo ti)
virtual

Traverse the scenegraph.

A HAPIHapticShape is added for haptic rendering if haptics is enabled.

Parameters
tiThe TraverseInfo object containing information about the traversal.

Reimplemented from H3D::X3DGeometryNode.

References H3D::X3DGeometryNode::traverseSG(), and H3D::X3DGeometryNode::useBackFaceCulling().

Member Data Documentation

◆ coord

H3DUniquePtr< SFCoordinateNode > H3D::SuperShape::coord
protected

Field that contains a Coordinate node with the coordinates generated by SuperShape.

C++ only field.

Referenced by render().

◆ normal

H3DUniquePtr< SFNormalNode > H3D::SuperShape::normal
protected

Field that contains a Normal node with the normals generated by SuperShape.

C++ only field.

Referenced by render().

◆ resolution

H3DUniquePtr< SFInt32 > H3D::SuperShape::resolution

Parameter to define the resolution of the supershape.

A higher value generally give a shape that more closely follows the values generate by the implicit SuperFormula than a lower value.

Access type: inputOutput
Default value: 128

Referenced by render().

◆ ss1_a

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_a

Parameter to define supershape.

Access type: inputOutput
Default value: 1

◆ ss1_b

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_b

Parameter to define supershape.

Access type: inputOutput
Default value: 1

◆ ss1_m

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_m

Parameter to define supershape.

Access type: inputOutput
Default value: 4

◆ ss1_n1

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_n1

Parameter to define supershape.

Access type: inputOutput
Default value: 100

◆ ss1_n2

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_n2

Parameter to define supershape.

Access type: inputOutput
Default value: 100

◆ ss1_n3

H3DUniquePtr< SFFloat > H3D::SuperShape::ss1_n3

Parameter to define supershape.

Access type: inputOutput
Default value: 100

◆ ss2_a

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_a

Parameter to define supershape.

Access type: inputOutput
Default value: 1

◆ ss2_b

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_b

Parameter to define supershape.

Access type: inputOutput
Default value: 1

◆ ss2_m

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_m

Parameter to define supershape.

Access type: inputOutput
Default value: 4

◆ ss2_n1

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_n1

Parameter to define supershape.

Access type: inputOutput
Default value: 100

◆ ss2_n2

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_n2

Parameter to define supershape.

Access type: inputOutput
Default value: 100

◆ ss2_n3

H3DUniquePtr< SFFloat > H3D::SuperShape::ss2_n3

Parameter to define supershape.

Access type: inputOutput
Default value: 100


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