H3D API  2.4.1
Public Member Functions | List of all members
H3D::IndexedFaceSet::AutoNormal Class Reference

Specialized field for automatically generating normals from coordinates. More...

#include <H3D/IndexedFaceSet.h>

Inheritance diagram for H3D::IndexedFaceSet::AutoNormal:
Inheritance graph

Public Member Functions

virtual X3DNormalNodegenerateNormalsPerVertex (X3DCoordinateNode *_coord, const vector< int > &coord_index, bool _ccw, H3DFloat crease_angle)
 Create a new X3DNormalNode from the arguments given with one normal for each vertex specified by coord_index, i.e. More...
 
virtual X3DNormalNodegenerateNormalsPerVertex (X3DCoordinateNode *_coord, const vector< int > &coord_index, bool _ccw)
 Create a new X3DNormalNode from the arguments given with one normal for each vertex in coord. More...
 
virtual X3DNormalNodegenerateNormalsPerFace (X3DCoordinateNode *_coord, const vector< int > &coord_index, bool _ccw)
 Create a new X3DNormalNode from the arguments given with one normal for each face specified. More...
 

Additional Inherited Members

- Protected Member Functions inherited from H3D::TypedField< SFNormalNode, Types< SFBool, SFCoordinateNode, MFInt32, SFBool, SFFloat > >
void checkFieldType (Field *f, int index)
 Function for checking that a field is of a correct type given type specification according to the TypedField template arguments. More...
 
void checkTemplateArguments ()
 Function for checking that a field given TypedField type specification is valid. More...
 

Detailed Description

Specialized field for automatically generating normals from coordinates.

The resulting Normal node will contain normals per face if normalPerVertex is false or creaseAngle <=0. if normalPerVertex is true, then the normals returned will be a normal per vertex in coord if creaseAngle >= pi and a normal per vertex specified with coordIndex if 0 < creaseAngle < pi

routes_in[0] is the normalPerVertex field. routes_in[1] is the coord field. routes_in[2] is the coordIndex field. routes_in[3] is the ccw field. routes_in[4] is the creaseAngle field.

Member Function Documentation

◆ generateNormalsPerFace()

X3DNormalNode * IndexedFaceSet::AutoNormal::generateNormalsPerFace ( X3DCoordinateNode _coord,
const vector< int > &  coord_index,
bool  _ccw 
)
virtual

Create a new X3DNormalNode from the arguments given with one normal for each face specified.

Parameters
_coordNode with the coordinates.
coord_indexThe indices in coord for the vertices.
_ccwDefines the ordering of the vertex coordinates of the geometry with respect to generated normal vectors used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the local coordinate system of the Shape) from the opposite direction as the normal.
Returns
A new Normal node with a normal for each vertex.

References H3D::Normal::vector.

◆ generateNormalsPerVertex() [1/2]

X3DNormalNode * IndexedFaceSet::AutoNormal::generateNormalsPerVertex ( X3DCoordinateNode _coord,
const vector< int > &  coord_index,
bool  _ccw 
)
virtual

Create a new X3DNormalNode from the arguments given with one normal for each vertex in coord.

The normal for each vertex will be the average of the normal of all faces using that vertex.

Parameters
_coordNode with the coordinates.
coord_indexThe indices in coord for the vertices.
_ccwDefines the ordering of the vertex coordinates of the geometry with respect to generated normal vectors used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the local coordinate system of the Shape) from the opposite direction as the normal.

References H3D::X3DCoordinateNode::nrAvailableCoords(), H3DUtil::AutoRef< class >::reset(), and H3D::Normal::vector.

◆ generateNormalsPerVertex() [2/2]

X3DNormalNode * IndexedFaceSet::AutoNormal::generateNormalsPerVertex ( X3DCoordinateNode _coord,
const vector< int > &  coord_index,
bool  _ccw,
H3DFloat  crease_angle 
)
virtual

Create a new X3DNormalNode from the arguments given with one normal for each vertex specified by coord_index, i.e.

the number of normals will be the number of non-(-1) values in coord_index.

Parameters
_coordNode with the coordinates.
coord_indexThe indices in coord for the vertices.
_ccwDefines the ordering of the vertex coordinates of the geometry with respect to generated normal vectors used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the local coordinate system of the Shape) from the opposite direction as the normal.
crease_angleIf the angle between the geometric normals of two adjacent faces is less than the crease angle, normals are calculated so that the faces are shaded smoothly across the edge; otherwise, normals are calculated so that a lighting discontinuity across the edge is produced.
Returns
A new Normal node with a normal for each vertex.

References H3DCos(), H3D::X3DCoordinateNode::nrAvailableCoords(), H3DUtil::AutoRef< class >::reset(), and H3D::Normal::vector.


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