#include <builderPrim.h>
Inheritance diagram for BuilderPrim:
Public Types | |
typedef BuilderVertex | Vertex |
typedef TYPENAME BuilderVertex::VType | VType |
typedef TYPENAME BuilderVertex::NType | NType |
typedef TYPENAME BuilderVertex::TType | TType |
typedef TYPENAME BuilderVertex::CType | CType |
typedef TYPENAME BuilderVertex::Attrib | DAttrib |
Public Member Functions | |
BuilderPrim () | |
BuilderPrim (const BuilderPrim ©) | |
BuilderPrim & | operator= (const BuilderPrim ©) |
BuilderPrim & | nonindexed_copy (const BuilderPrimTempl< BuilderVertexI > ©, const BuilderBucket &bucket) |
Makes a nonindexed copy of the given indexed prim, by looking up the current values of the indexed coordinates in the given bucket. | |
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 |
BuilderPrimTempl & | clear () |
BuilderPrimTempl & | clear_vertices () |
BuilderPrimTempl & | set_attrib (const DAttrib &attrib) |
BuilderPrimType | get_type () const |
BuilderPrimTempl & | set_type (BuilderPrimType t) |
NType | get_normal () const |
BuilderPrimTempl & | set_normal (const NType &n) |
CType | get_color () const |
BuilderPrimTempl & | set_color (const CType &c) |
float | get_pixel_size () const |
BuilderPrimTempl & | set_pixel_size (float s) |
BuilderPrimTempl & | add_vertex (const Vertex &v) |
int | get_num_verts () const |
Vertex & | get_vertex (int n) |
const Vertex & | get_vertex (int n) const |
BuilderPrimTempl & | add_component (const DAttrib &attrib) |
int | get_num_components () const |
DAttrib & | get_component (int n) |
const DAttrib & | get_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. | |
BuilderAttribTempl & | clear_normal () |
BuilderAttribTempl & | clear_color () |
BuilderAttribTempl & | clear_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_BuilderV &v_array, GeomBindType n_attr, const PTA_BuilderN &n_array, GeomBindType t_attr, const PTA_BuilderTC &t_array, GeomBindType c_attr, const PTA_BuilderC &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< Vertex > | Verts |
typedef pvector< DAttrib > | Components |
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 |
See the comments at the the head of this file, and in builder.h.
Look in builderPrimTempl.h and builderAttribTempl.h for most of the interface to BuilderPrim.
Definition at line 100 of file builderPrim.h.
|
Definition at line 149 of file builderPrimTempl.h. |
|
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. Definition at line 56 of file builderPrimTempl.h. |
|
Definition at line 57 of file builderPrimTempl.h. |
|
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. Definition at line 54 of file builderPrimTempl.h. |
|
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. Definition at line 55 of file builderPrimTempl.h. |
|
Definition at line 52 of file builderPrimTempl.h. |
|
Definition at line 148 of file builderPrimTempl.h. |
|
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. Definition at line 53 of file builderPrimTempl.h. |
|
Definition at line 31 of file builderPrim.I. References INLINE. |
|
Definition at line 42 of file builderPrim.I. References INLINE, and BuilderPrimTempl< VTX >::operator=(). |
|
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). |
|
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. |
|
Resets the BuilderPrim to its initial, default state.
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. |
|
Removes the attribute's color.
Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >. |
|
Removes the attribute's normal.
Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >. |
|
Removes the attribute's pixel_size.
Reimplemented in BuilderVertexTempl< ushort, ushort, ushort, ushort >. |
|
Removes all the vertices that have been added to the BuilderPrim, without otherwise affecting its properties.
|
|
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.
|
|
Fills up the attribute values of a Geom with the indicated arrays. This creates a nonindexed Geom. Definition at line 152 of file builderPrim.cxx. References G_OFF, and Geom::set_colors(). |
|
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 provide better meshing by removing properties from otherwise shared vertices. Definition at line 112 of file builderPrim.cxx. |
|
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 >. |
|
Returns the attributes associated with the nth component, where 0 <= n < get_num_components(). See add_component() and get_num_components(). |
|
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(). |
|
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 >. |
|
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(). |
|
Returns the number of vertices in the primitive.
|
|
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 >. |
|
Indicates the type of primitive represented by the BuilderPrim. See set_type(). |
|
Returns the nth vertex of the primitive, where 0 <= n < get_num_verts().
|
|
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. |
|
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. |
|
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. |
|
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. |
|
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(). |
|
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 >. |
|
Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different color value set.
|
|
Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different normal value set.
|
|
Returns true if the prim is a composite primitive like a tristrip, and its individual components each have a different pixel_size value set.
|
|
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 >. |
|
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. |
|
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. |
|
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. |
|
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 >. |
|
Returns true if each of the primitive's vertices has a different color value set.
|
|
Returns true if each of the primitive's vertices has a different normal value set.
|
|
Returns true if each of the primitive's vertices has a different pixel_size value set.
|
|
Returns true if each of the primitive's vertices has a texcoord value set.
|
|
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.
|
|
Makes a nonindexed copy of the given indexed prim, by looking up the current values of the indexed coordinates in the given bucket.
Definition at line 42 of file builderPrim.cxx. Referenced by BuilderBucketNode::operator=(). |
|
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. |
|
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. |
|
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). |
|
Definition at line 54 of file builderPrim.I. References INLINE. |
|
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. |
|
Formats the prim for output in some sensible way.
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. |
|
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). |
|
Copies the polygon attributes, color and normal, from the indicated attribute structure (which might be another BuilderPrim).
|
|
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 >. |
|
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. |
|
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 >. |
|
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. |
|
Sets the line thickness (for a polygon or line) or size (for a point) in pixels.
Reimplemented from BuilderAttribTempl< ushort, ushort, ushort, ushort >. |
|
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(). |
|
Returns a number for grouping primitives, such that only primitives that share the same number can be tristripped together.
|
|
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. |
|
Definition at line 84 of file builderAttribTempl.h. |
|
Definition at line 152 of file builderPrimTempl.h. |
|
Definition at line 86 of file builderAttribTempl.h. |
|
Definition at line 83 of file builderAttribTempl.h. |
|
Definition at line 154 of file builderPrimTempl.h. |
|
Definition at line 85 of file builderAttribTempl.h. |
|
Definition at line 153 of file builderPrimTempl.h. |
|
Definition at line 151 of file builderPrimTempl.h. |