#include <sglGeoSet.hpp>
Inheritance diagram for sglGeoSet::
Public Types | |
enum | BindEnum { eOFF, eOVERALL, ePER_PRIM, ePER_VERTEX } |
Public Methods | |
sglGeoSet () | |
virtual | ~sglGeoSet () |
virtual sglStats::PrimEnum | getPrimType () const=0 |
virtual GLenum | getGLPrimType () const=0 |
virtual unsigned int | getPrimSize () const=0 |
unsigned int | getNumPrims () const |
void | setNumPrims (unsigned int num) |
void | setCoordList (sglVec3f *alist) |
void | setCoordList (sglDataPtr *data, sglDataPtr::DataTypeEnum type=sglDataPtr::eFLOAT, int size=3, int offset=0, int stride=0) |
void | setNormalList (BindEnum bind, sglVec3f *alist) |
void | setNormalList (BindEnum bind, sglDataPtr *data, sglDataPtr::DataTypeEnum type=sglDataPtr::eFLOAT, int offset=0, int stride=0) |
void | setColorList (BindEnum bind, sglVec4f *alist) |
void | setColorList (BindEnum bind, sglDataPtr *data, sglDataPtr::DataTypeEnum type=sglDataPtr::eFLOAT, int size=4, int offset=0, int stride=0) |
BindEnum | getNormalBind () const |
BindEnum | getColorBind () const |
sglDataPtr* | getCoordList () const |
sglDataPtr* | getNormalList () const |
sglDataPtr* | getColorList () const |
sglDataPtr::DataTypeEnum | getCoordType () const |
sglDataPtr::DataTypeEnum | getNormalType () const |
sglDataPtr::DataTypeEnum | getColorType () const |
int | getCoordSize () const |
int | getColorSize () const |
int | getCoordOffset () const |
int | getNormalOffset () const |
int | getColorOffset () const |
int | getCoordStride () const |
int | getNormalStride () const |
int | getColorStride () const |
virtual bool | isValid () const |
virtual void | addStats (sglStats &stats) const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Protected Types | |
enum | NormalEnum { eNORMALS_NONE = 0x00000, eNORMALS_OVERALL = 0x00001, eNORMALS_PER_PRIM = 0x00002, eNORMALS_PER_VERTEX = 0x00003 } |
enum | ColorEnum { eCOLORS_NONE = 0x00000, eCOLORS_OVERALL = 0x00004, eCOLORS_PER_PRIM = 0x00008, eCOLORS_PER_VERTEX = 0x0000c } |
enum | ModeEnum { eNORMALS = 0x00003, eCOLORS = 0x0000c, eMULTI_TEXTURE = 0x00010, ePREFETCH = 0x00020 } |
enum | TexCoordsEnum { eTEXCOORDS_OVERALL = 0x01000, eTEXCOORDS_PER_PRIM = 0x02000, eTEXCOORDS_PER_VERTEX = 0x04000, eTEXCOORDS = 0x07000 } |
enum | BoundsEnum { eNUMPRIMS = 0x01, eLENGTHS = 0x02, eVERTICES = 0x04, eVINDICES = 0x08 } |
Protected Methods | |
virtual bool | computeBounds () |
virtual void | updateDrawFunc () |
Protected Attributes | |
unsigned int | m_mode |
unsigned int | m_num_prims |
sglVertexPtr | m_vertices |
sglNormalPtr | m_normals |
sglColorPtr | m_colors |
unsigned int | m_compute_bounds |
Friends | |
class | Initializer |
\begin{enumerate} \item sglGeoSet::ePER_VERTEX - like the coordinate vertex array, this array must have the same number of entries and each element is applied with a corresponding vertex.
\item sglGeoSet::ePER_PRIM - the array contains as many entries as the number of primitives, one for each.
\item sglGeoSet::eOVERALL - the array contains one element and applies to for all vertices in the coordinate list. \end{enumerate}
Passing in a NULL pointer for the attribute list has the effect of disabling that attribute. The getColorBind() and getNormalBind() functions return what mode the particular attribute is currently set to. If the attribute is unused (disabled) then the SGL_OFF token is returned.
{\bf Concrete subclasses: sglPointSet, sglLineSet, sglTriangleSet, sglQuadSet}
sglPointSet, sglLineSet, sglTriangleSet, and sglQuadSet are the only immediate concrete subclasses of sglGeoSet and allow the rendering of individual points, line segments, triangles, and quads. They imply that the primitive sizes are 1, 2, 3, and 4 respectively. The number of primitives, which is set by calling the sglGeoSet::setNumPrims() function, along with the classes' implied primitive size determine the required sizes of the geometry attributes. For example, an sglLineSet with the number of primitives set to 9, means that the vertex array must be at least 18 elements long. Note, no error checking is done by SGL so if the user makes a mistake, access out of array bounds can result in undefined behaviour.
{\bf Example:} \begin{verbatim} sglVec3f *vertex = new sglVec4f[6]; // vertices for two triangles vertex[0].set( 0.0f, 0.0f, 0.0f); vertex[1].set( 5.0f, 0.0f, 0.0f); vertex[2].set( 0.0f, 5.0f, 0.0f); vertex[3].set( 0.0f, 0.0f, 0.0f); vertex[4].set( 0.0f,-5.0f, 0.0f); vertex[5].set(-5.0f, 0.0f, 0.0f);
sglVec4f *color = new sglVec4f[2]; color[0].set(1.0f, 0.0f, 0.0f, 1.0f); // first triangle is red color[1].set(0.0f, 1.0f, 0.0f, 1.0f); // second triangle is green
sglVec3f *normal = new sglVec3f[1]; // one normal for all vertices normal[0].set(0.0f,0.0f,1.0f);
sglTriangleSet *tri_geom = new sglTriangleSet; tri_geom->setNumPrims(2); tri_geom->setCoorList(vertex); // sglGeoSet::ePER_VERTEX is implied tri_geom->setColorList(sglGeoSet::ePER_PRIM, color); tri_geom->setNormalList(sglGeoSet::eOVERALL, normal); \end{verbatim}
Definition at line 104 of file sglGeoSet.hpp.
|
default constructor.
|
|
virtual destructor.
|
|
|
get/set the number of primitives in this geoset.
Definition at line 127 of file sglGeoSet.hpp. |
|
Set the array of vertices. Deprecated.
Definition at line 132 of file sglGeoSet.hpp. |
|
Set the array of vertices. This will increment the reference count on the given data pointer, and decrement the reference count of the previous data pointer. If the previous data pointer's refernce count goes to zero, it will be deleted.
|
|
Set the array of normals. Deprecated.
Definition at line 155 of file sglGeoSet.hpp. |
|
Set the array of normals. This will increment the reference count on the given data pointer, and decrement the reference count of the previous data pointer. If the previous data pointer's refernce count goes to zero, it will be deleted. Normals must have three values per normal.
|
|
Set the array of colors. Deprecated.
Definition at line 179 of file sglGeoSet.hpp. |
|
Set the array of colors. This will increment the reference count on the given data pointer, and decrement the reference count of the previous data pointer. If the previous data pointer's refernce count goes to zero, it will be deleted.
|
|
get the current normal and color binding state.
|
|
get the current vertex, normal, color attribute lists.
Definition at line 209 of file sglGeoSet.hpp. |
|
get the current vertex, normal, color data types.
Definition at line 216 of file sglGeoSet.hpp. |
|
get the number of values per vertex coordinate and color.
Definition at line 226 of file sglGeoSet.hpp. |
|
get the number of bytes in the array before the first coordinate value.
Definition at line 231 of file sglGeoSet.hpp. |
|
get the number of bytes from the start of one vertex to the next.
Definition at line 238 of file sglGeoSet.hpp. |
|
Add this drawable's stats to the given debug_stats.
Reimplemented from sglDrawable. Reimplemented in sglBezierSurfaceSet, sglGeoStripSet, sglIndexedGeoStripSet, and sglMonoIndexedGeoStripSet. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglDrawable. Reimplemented in sglCylinder. |
|
Compute the bounding box for this geometry and fill in the member variable, m_bbox, in this class.
Reimplemented from sglDrawable. Reimplemented in sglBezierCurveSet, sglBezierSurfaceSet, sglGeoStripSet, sglIndexedGeoSet, sglIndexedGeoStripSet, sglMonoIndexedGeoSet, and sglMonoIndexedGeoStripSet. |