Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

polygon Class Reference

Inheritance diagram for polygon:

BuilderPrimI BuilderPrimI BuilderPrimTempl< BuilderVertexI > BuilderPrimTempl< BuilderVertexI > BuilderAttribI BuilderAttribI BuilderAttribTempl< ushort, ushort, ushort, ushort > BuilderAttribTempl< ushort, ushort, ushort, ushort > List of all members.

Public Types

typedef BuilderVertexI Vertex
typedef TYPENAME BuilderVertexI::VType VType
typedef TYPENAME BuilderVertexI::NType NType
typedef TYPENAME BuilderVertexI::TType TType
typedef TYPENAME BuilderVertexI::CType CType
typedef TYPENAME BuilderVertexI::Attrib DAttrib

Public Member Functions

 polygon (int i, int j, int k)
 polygon (int i, int j, int k, int l)
 polygon (int i, int j, int k, int l, int m)
 polygon (int i, int j, int k, int l, int m, int n)
 polygon (int i, int j, int k, int l, int m, int n, int o)
void flatten_vertex_properties ()
 If all the vertices of the primitive have the same normal, color, etc., removes those properties from the vertices and assigns them to the primitive instead.

void remove_doubled_verts (int closed)
bool is_valid () const
bool has_normal () const
bool has_color () const
bool has_pixel_size () const
bool has_overall_normal () const
bool has_overall_color () const
bool has_overall_pixel_size () const
bool has_vertex_normal () const
bool has_vertex_color () const
bool has_vertex_texcoord () const
bool has_vertex_pixel_size () const
bool has_component_normal () const
bool has_component_color () const
bool has_component_pixel_size () const
bool has_any_normal () const
bool has_any_color () const
bool has_any_texcoord () const
bool has_any_pixel_size () const
BuilderPrimTemplclear ()
BuilderPrimTemplclear_vertices ()
BuilderPrimTemplset_attrib (const DAttrib &attrib)
BuilderPrimType get_type () const
BuilderPrimTemplset_type (BuilderPrimType t)
NType get_normal () const
BuilderPrimTemplset_normal (const NType &n)
CType get_color () const
BuilderPrimTemplset_color (const CType &c)
float get_pixel_size () const
BuilderPrimTemplset_pixel_size (float s)
BuilderPrimTempladd_vertex (const Vertex &v)
int get_num_verts () const
Vertexget_vertex (int n)
const Vertexget_vertex (int n) const
BuilderPrimTempladd_component (const DAttrib &attrib)
int get_num_components () const
DAttribget_component (int n)
const DAttribget_component (int n) const
bool operator< (const BuilderPrimTempl &other) const
bool operator< (const BuilderAttribTempl &other) const
ostream & output (ostream &out) const
void set_normal_value (const BuilderN *array, ushort index)
 Reassigns the normal, without knowing whether the attribute is indexed or nonindexed.

void set_color_value (const BuilderC *array, ushort index)
 Reassigns the color, without knowing whether the attribute is indexed or nonindexed.

BuilderAttribTemplclear_normal ()
BuilderAttribTemplclear_color ()
BuilderAttribTemplclear_pixel_size ()
bool operator== (const BuilderAttribTempl &other) const
bool operator!= (const BuilderAttribTempl &other) const
int compare_to (const BuilderAttribTempl &other) const

Static Public Member Functions

void fill_geom (Geom *geom, const PTA_ushort &v_array, GeomBindType n_attr, PTA_ushort n_array, GeomBindType t_attr, PTA_ushort t_array, GeomBindType c_attr, PTA_ushort c_array, const BuilderBucket &bucket, int num_prims, int num_components, int num_verts)
 Fills up the attribute values of a Geom with the indicated arrays.


Protected Types

typedef pvector< VertexVerts
typedef pvector< DAttribComponents

Protected Member Functions

int sort_value () const
void update_overall_attrib ()

Protected Attributes

Verts _verts
Components _components
BuilderPrimType _type
int _overall
NType _normal
CType _color
float _pixel_size
int _flags

Member Typedef Documentation

typedef pvector<DAttrib> BuilderPrimTempl< BuilderVertexI >::Components [protected, inherited]
 

Definition at line 149 of file builderPrimTempl.h.

typedef TYPENAME BuilderVertexI::CType BuilderPrimTempl< BuilderVertexI >::CType [inherited]
 

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

Definition at line 56 of file builderPrimTempl.h.

typedef TYPENAME BuilderVertexI::Attrib BuilderPrimTempl< BuilderVertexI >::DAttrib [inherited]
 

Definition at line 57 of file builderPrimTempl.h.

typedef TYPENAME BuilderVertexI::NType BuilderPrimTempl< BuilderVertexI >::NType [inherited]
 

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

Definition at line 54 of file builderPrimTempl.h.

typedef TYPENAME BuilderVertexI::TType BuilderPrimTempl< BuilderVertexI >::TType [inherited]
 

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

Definition at line 55 of file builderPrimTempl.h.

typedef BuilderVertexI BuilderPrimTempl< BuilderVertexI >::Vertex [inherited]
 

Definition at line 52 of file builderPrimTempl.h.

typedef pvector<Vertex> BuilderPrimTempl< BuilderVertexI >::Verts [protected, inherited]
 

Definition at line 148 of file builderPrimTempl.h.

typedef TYPENAME BuilderVertexI::VType BuilderPrimTempl< BuilderVertexI >::VType [inherited]
 

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

Definition at line 53 of file builderPrimTempl.h.


Constructor & Destructor Documentation

polygon::polygon int  i,
int  j,
int  k
[inline]
 

Definition at line 370 of file test_builder_data.cxx.

polygon::polygon int  i,
int  j,
int  k,
int  l
[inline]
 

Definition at line 375 of file test_builder_data.cxx.

polygon::polygon int  i,
int  j,
int  k,
int  l,
int  m
[inline]
 

Definition at line 381 of file test_builder_data.cxx.

polygon::polygon int  i,
int  j,
int  k,
int  l,
int  m,
int  n
[inline]
 

Definition at line 388 of file test_builder_data.cxx.

polygon::polygon int  i,
int  j,
int  k,
int  l,
int  m,
int  n,
int  o
[inline]
 

Definition at line 396 of file test_builder_data.cxx.


Member Function Documentation

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::add_component const DAttrib attrib  )  [inline, inherited]
 

Normally, this function is only used by the mesher code; user code generally should not need to call it.

In addition to storing a simple polygon, a BuilderPrim can store a composite primitive, like a triangle strip. In this case, it is useful to store the attributes (like color and normal) associated with each component.

When get_type() is one of the composite types, it is the responsibility of the caller to call add_component() once for each component, where the number of components is defined by the type and the number of vertices (e.g. for a triangle strip, the number of components is the number of vertices - 2).

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::add_vertex const Vertex v  )  [inline, inherited]
 

Adds a new vertex to the BuilderPrim.

The vertex data is copied into the prim's internal structure. Vertices should be added in counterclockwise order, when viewed from the front.

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::clear void   )  [inline, inherited]
 

Resets the BuilderPrim to its initial, default state.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

BuilderAttribTempl& BuilderAttribTempl< ushort, ushort, ushort, ushort >::clear_color  )  [inline, inherited]
 

Removes the attribute's color.

Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >.

BuilderAttribTempl& BuilderAttribTempl< ushort, ushort, ushort, ushort >::clear_normal  )  [inline, inherited]
 

Removes the attribute's normal.

Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >.

BuilderAttribTempl& BuilderAttribTempl< ushort, ushort, ushort, ushort >::clear_pixel_size  )  [inline, inherited]
 

Removes the attribute's pixel_size.

Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >.

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::clear_vertices  )  [inline, inherited]
 

Removes all the vertices that have been added to the BuilderPrim, without otherwise affecting its properties.

int BuilderAttribTempl< ushort, ushort, ushort, ushort >::compare_to const BuilderAttribTempl< ushort, ushort, ushort, ushort > &  other  )  const [inherited]
 

Returns a number less than zero if this object sorts before the indicated object, greater than zero if it sorts after, and zero if the objects are equivalent.

void BuilderPrimI::fill_geom Geom geom,
const PTA_ushort v_array,
GeomBindType  n_attr,
PTA_ushort  n_array,
GeomBindType  t_attr,
PTA_ushort  t_array,
GeomBindType  c_attr,
PTA_ushort  c_array,
const BuilderBucket bucket,
int  num_prims,
int  num_components,
int  num_verts
[static, inherited]
 

Fills up the attribute values of a Geom with the indicated arrays.

This creates an indexed Geom.

Definition at line 215 of file builderPrim.cxx.

References G_OFF, G_OVERALL, G_PER_COMPONENT, G_PER_PRIM, and G_PER_VERTEX.

void BuilderPrimI::flatten_vertex_properties  )  [inherited]
 

If all the vertices of the primitive have the same normal, color, etc., removes those properties from the vertices and assigns them to the primitive instead.

This can do nothing in the case of an indexed primitive, because we can't monkey with the vertex properties in this case.

Definition at line 201 of file builderPrim.cxx.

References NULL.

CType BuilderPrimTempl< BuilderVertexI >::get_color void   )  const [inline, inherited]
 

Returns the value previously set by set_color(), or the overall color value common to all vertices.

It is an error to call this without first testing that one of has_color() or has_overall_color() is true.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

const DAttrib& BuilderPrimTempl< BuilderVertexI >::get_component int  n  )  const [inline, inherited]
 

Returns the attributes associated with the nth component, where 0 <= n < get_num_components().

See add_component() and get_num_components().

DAttrib& BuilderPrimTempl< BuilderVertexI >::get_component int  n  )  [inline, inherited]
 

Returns a refernece to the attribute structure associated with the nth component, where 0 <= n < get_num_components().

This reference may be modified directly, e.g. to change the color of a polygon after it has been added to the tristrip. See add_component() and get_num_components().

NType BuilderPrimTempl< BuilderVertexI >::get_normal  )  const [inline, inherited]
 

Returns the value previously set by set_normal(), or the overall normal value common to all vertices.

It is an error to call this without first testing that one of has_normal() or has_overall_normal() is true.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

int BuilderPrimTempl< BuilderVertexI >::get_num_components  )  const [inline, inherited]
 

Returns the number of times add_component() has been called.

This should be, but is not necessarily, the same as the number of components in the composite primitive (e.g. a triangle strip). See add_component().

int BuilderPrimTempl< BuilderVertexI >::get_num_verts  )  const [inline, inherited]
 

Returns the number of vertices in the primitive.

float BuilderPrimTempl< BuilderVertexI >::get_pixel_size  )  const [inline, inherited]
 

Returns the value previously set by set_pixel_size(), or the overall pixel_size value common to all vertices.

It is an error to call this without first testing that one of has_pixel_size() or has_overall_pixel_size() is true.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

BuilderPrimType BuilderPrimTempl< BuilderVertexI >::get_type void   )  const [inline, inherited]
 

Indicates the type of primitive represented by the BuilderPrim.

See set_type().

const Vertex& BuilderPrimTempl< BuilderVertexI >::get_vertex int  n  )  const [inline, inherited]
 

Returns the nth vertex of the primitive, where 0 <= n < get_num_verts().

Vertex& BuilderPrimTempl< BuilderVertexI >::get_vertex int  n  )  [inline, inherited]
 

Returns a reference to the nth vertex of the primitive, where 0 <= n < get_num_verts().

This reference may be modified directly, e.g. to set a vertex normal on a vertex after it has been added to the primitive.

bool BuilderPrimTempl< BuilderVertexI >::has_any_color  )  const [inline, inherited]
 

Returns true if the prim has a color value set at any level.

That is, it returns true if any of has_overall_color(), has_vertex_color(), or has_component_color() is true.

bool BuilderPrimTempl< BuilderVertexI >::has_any_normal  )  const [inline, inherited]
 

Returns true if the prim has a normal value set at any level.

That is, it returns true if any of has_overall_normal(), has_vertex_normal(), or has_component_normal() is true.

bool BuilderPrimTempl< BuilderVertexI >::has_any_pixel_size  )  const [inline, inherited]
 

Returns true if the prim has a pixel_size value set at any level.

That is, it returns true if any of has_overall_pixel_size(), has_vertex_pixel_size(), or has_component_pixel_size() is true.

bool BuilderPrimTempl< BuilderVertexI >::has_any_texcoord  )  const [inline, inherited]
 

Returns true if the prim has a texcoord value set at any level.

Since texture coordinates can only be set on vertices, this is the same thing as has_vertex_texcoord().

bool BuilderPrimTempl< BuilderVertexI >::has_color  )  const [inline, inherited]
 

Returns true if set_color() has been called on the primitive.

This is unrelated to the color values that may or may not override from the vertices. Also see has_overall_color().

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

bool BuilderPrimTempl< BuilderVertexI >::has_component_color  )  const [inline, inherited]
 

Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different color value set.

bool BuilderPrimTempl< BuilderVertexI >::has_component_normal  )  const [inline, inherited]
 

Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different normal value set.

bool BuilderPrimTempl< BuilderVertexI >::has_component_pixel_size  )  const [inline, inherited]
 

Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different pixel_size value set.

bool BuilderPrimTempl< BuilderVertexI >::has_normal  )  const [inline, inherited]
 

Returns true if set_normal() has been called on the primitive.

This is unrelated to the normal values that may or may not override from the vertices. Also see has_overall_normal().

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

bool BuilderPrimTempl< BuilderVertexI >::has_overall_color  )  const [inline, inherited]
 

Returns true if the primitive has a single, overall color value.

This can happen because of one of: (a) the primitive had a color value assigned to it directly, and its individual vertices and components did not; (b) each vertex was assigned the same color value; (c) each component was assigned the same color value.

If has_overall_color() returns true, then get_color() will return the overall color value.

bool BuilderPrimTempl< BuilderVertexI >::has_overall_normal  )  const [inline, inherited]
 

Returns true if the primitive has a single, overall normal value.

This can happen because of one of: (a) the primitive had a normal value assigned to it directly, and its individual vertices and components did not; (b) each vertex was assigned the same normal value; (c) each component was assigned the same normal value.

If has_overall_normal() returns true, then get_normal() will return the overall normal value.

bool BuilderPrimTempl< BuilderVertexI >::has_overall_pixel_size  )  const [inline, inherited]
 

Returns true if the primitive has a single, overall pixel_size value.

This can happen because of one of: (a) the primitive had a pixel_size value assigned to it directly, and its individual vertices and components did not; (b) each vertex was assigned the same pixel_size value; (c) each component was assigned the same pixel_size value.

If has_overall_pixel_size() returns true, then get_pixel_size() will return the overall pixel_size value.

bool BuilderPrimTempl< BuilderVertexI >::has_pixel_size  )  const [inline, inherited]
 

Returns true if set_pixel_size() has been called on the primitive.

This is unrelated to the pixel_size values that may or may not override from the vertices. Also see has_overall_pixel_size().

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

bool BuilderPrimTempl< BuilderVertexI >::has_vertex_color  )  const [inline, inherited]
 

Returns true if each of the primitive's vertices has a different color value set.

bool BuilderPrimTempl< BuilderVertexI >::has_vertex_normal  )  const [inline, inherited]
 

Returns true if each of the primitive's vertices has a different normal value set.

bool BuilderPrimTempl< BuilderVertexI >::has_vertex_pixel_size  )  const [inline, inherited]
 

Returns true if each of the primitive's vertices has a different pixel_size value set.

bool BuilderPrimTempl< BuilderVertexI >::has_vertex_texcoord  )  const [inline, inherited]
 

Returns true if each of the primitive's vertices has a texcoord value set.

bool BuilderPrimTempl< BuilderVertexI >::is_valid  )  const [inherited]
 

Returns true if the primitive is well-defined and has the right number of vertices for its primitive type, and all of its vertices are valid.

bool BuilderAttribTempl< ushort, ushort, ushort, ushort >::operator!= const BuilderAttribTempl< ushort, ushort, ushort, ushort > &  other  )  const [inline, inherited]
 

Assigns an ordering to the vertices.

This is used by the Mesher to group identical vertices. This assumes that all vertices in the locus of consideration will share the same state: with or without normals, texcoords, etc.

bool BuilderAttribTempl< ushort, ushort, ushort, ushort >::operator< const BuilderAttribTempl< ushort, ushort, ushort, ushort > &  other  )  const [inline, inherited]
 

Assigns an ordering to the vertices.

This is used by the Mesher to group identical vertices. This assumes that all vertices in the locus of consideration will share the same state: with or without normals, texcoords, etc.

bool BuilderPrimTempl< BuilderVertexI >::operator< const BuilderPrimTempl< BuilderVertexI > &  other  )  const [inline, inherited]
 

Returns true if this primitive should come before the other one, in the bin ordering.

This is used to sort polygons into groups which can be tristripped together, similar to the same operation on the BuilderBucket, except that this works at a finer level of detail (i.e. on prims within the same bucket).

bool BuilderAttribTempl< ushort, ushort, ushort, ushort >::operator== const BuilderAttribTempl< ushort, ushort, ushort, ushort > &  other  )  const [inline, inherited]
 

Assigns an ordering to the vertices.

This is used by the Mesher to group identical vertices. This assumes that all vertices in the locus of consideration will share the same state: with or without normals, texcoords, etc.

ostream& BuilderPrimTempl< BuilderVertexI >::output ostream &  out  )  const [inherited]
 

Formats the prim for output in some sensible way.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

void BuilderPrimTempl< BuilderVertexI >::remove_doubled_verts int  closed  )  [inherited]
 

Removes consecutive identical vertices from the prim definition.

These are meaningless and only confuse polygon subdividing and meshing.

If closed is true, this also removes vertices doubled at the beginning and end (as if the list of vertices were implicitly closed, as it is for a polygon).

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::set_attrib const DAttrib attrib  )  [inline, inherited]
 

Copies the polygon attributes, color and normal, from the indicated attribute structure (which might be another BuilderPrim).

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::set_color const CType c  )  [inline, inherited]
 

Sets the flat color associated with the primitive.

If each of the primitive's vertices also has a color set, the vertex colors will override.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

void BuilderAttribI::set_color_value const BuilderC array,
ushort  index
[inline, inherited]
 

Reassigns the color, without knowing whether the attribute is indexed or nonindexed.

A nonindexed attribute will look up the index in the array and store the resulting value, while an indexed attribute will just store the index number (which assumes the array is the same one it's indexing on).

Definition at line 115 of file builderAttrib.I.

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::set_normal const NType n  )  [inline, inherited]
 

Sets the flat normal associated with the primitive.

If each of the primitive's vertices also has a normal set, the vertex normals will override.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

void BuilderAttribI::set_normal_value const BuilderN array,
ushort  index
[inline, inherited]
 

Reassigns the normal, without knowing whether the attribute is indexed or nonindexed.

A nonindexed attribute will look up the index in the array and store the resulting value, while an indexed attribute will just store the index number (which assumes the array is the same one it's indexing on).

Definition at line 91 of file builderAttrib.I.

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::set_pixel_size float  s  )  [inline, inherited]
 

Sets the line thickness (for a polygon or line) or size (for a point) in pixels.

Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >.

BuilderPrimTempl& BuilderPrimTempl< BuilderVertexI >::set_type BuilderPrimType  t  )  [inline, inherited]
 

Indicates the type of primitive represented by the BuilderPrim.

Normally, the user should set this to one of BPT_poly, BPT_point, or BPT_line. However, other types are possible, and are created by the mesher, including triangle strips, quad strips, and triangle fans.

Setting this value changes the interpretation of the vertices, for instance, a triangle strip is defined by vertices that zigzag back and forth between the triangles. Note that when defining a composite primitive such as a triangle strip, it is also necessary to call add_component() the correct number of times to match the calls to add_vertex(), according to the primitive type. See add_component().

int BuilderPrimTempl< BuilderVertexI >::sort_value  )  const [inline, protected, inherited]
 

Returns a number for grouping primitives, such that only primitives that share the same number can be tristripped together.

void BuilderPrimTempl< BuilderVertexI >::update_overall_attrib  )  [protected, inherited]
 

Examines the primitive and all of its vertices and components to determine the amount of commonality of each attribute, and updates the bits in _overall to indicate this.

If an overall attribute is found, the primitive attribute value is set to that common value.


Member Data Documentation

CType BuilderAttribTempl< ushort, ushort, ushort, ushort >::_color [protected, inherited]
 

Definition at line 84 of file builderAttribTempl.h.

Components BuilderPrimTempl< BuilderVertexI >::_components [protected, inherited]
 

Definition at line 152 of file builderPrimTempl.h.

int BuilderAttribTempl< ushort, ushort, ushort, ushort >::_flags [protected, inherited]
 

Definition at line 86 of file builderAttribTempl.h.

NType BuilderAttribTempl< ushort, ushort, ushort, ushort >::_normal [protected, inherited]
 

Definition at line 83 of file builderAttribTempl.h.

int BuilderPrimTempl< BuilderVertexI >::_overall [protected, inherited]
 

Definition at line 154 of file builderPrimTempl.h.

float BuilderAttribTempl< ushort, ushort, ushort, ushort >::_pixel_size [protected, inherited]
 

Definition at line 85 of file builderAttribTempl.h.

BuilderPrimType BuilderPrimTempl< BuilderVertexI >::_type [protected, inherited]
 

Definition at line 153 of file builderPrimTempl.h.

Verts BuilderPrimTempl< BuilderVertexI >::_verts [protected, inherited]
 

Definition at line 151 of file builderPrimTempl.h.


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:54:21 2003 for Panda by doxygen1.3