Panda3D
|
A base class for any of a number of kinds of geometry primitives: polygons, point lights, nurbs patches, parametrics curves, etc. More...
#include "eggPrimitive.h"
Public Types | |
typedef Vertices::const_iterator | const_iterator |
typedef Vertices::const_pointer | const_pointer |
typedef Vertices::const_reference | const_reference |
typedef Vertices::const_reverse_iterator | const_reverse_iterator |
typedef Vertices::difference_type | difference_type |
typedef Vertices::const_iterator | iterator |
typedef Vertices::const_pointer | pointer |
typedef Vertices::const_reference | reference |
typedef Vertices::const_reverse_iterator | reverse_iterator |
enum | Shading { S_unknown, S_overall, S_per_face, S_per_vertex } |
typedef Vertices::size_type | size_type |
![]() | |
enum | AlphaMode { AM_unspecified, AM_off, AM_on, AM_blend, AM_blend_no_occlude, AM_ms, AM_ms_mask, AM_binary, AM_dual } |
enum | DepthTestMode { DTM_unspecified, DTM_off, DTM_on } |
enum | DepthWriteMode { DWM_unspecified, DWM_off, DWM_on } |
enum | VisibilityMode { VM_unspecified, VM_hidden, VM_normal } |
Public Member Functions | |
EggPrimitive (const string &name="") | |
EggPrimitive (const EggPrimitive ©) | |
void | add_texture (EggTexture *texture) |
Applies the indicated texture to the primitive. More... | |
EggVertex * | add_vertex (EggVertex *vertex) |
Adds the indicated vertex to the end of the primitive's list of vertices, and returns it. More... | |
virtual void | apply_first_attribute () |
Sets the first vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded. More... | |
virtual void | apply_last_attribute () |
Sets the last vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded. More... | |
iterator | begin () const |
virtual bool | cleanup () |
Cleans up modeling errors in whatever context this makes sense. More... | |
void | clear () |
Removes all of the vertices from the primitive. More... | |
void | clear_connected_shading () |
Resets the connected_shading member in this primitive, so that get_connected_shading() will recompute a new value. More... | |
void | clear_material () |
Removes any material from the primitive. More... | |
void | clear_texture () |
Removes any texturing from the primitive. More... | |
void | copy_attributes (const EggAttributes &other) |
Copies the rendering attributes from the indicated primitive. More... | |
void | copy_attributes (const EggPrimitive &other) |
Copies the rendering attributes from the indicated primitive. More... | |
void | copy_vertices (const EggPrimitive &other) |
Replaces the current primitive's list of vertices with a copy of the list of vertices on the other primitive. More... | |
virtual EggRenderMode * | determine_alpha_mode () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has an alpha_mode other than AM_unspecified. More... | |
virtual EggRenderMode * | determine_bin () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a bin specified. More... | |
virtual EggRenderMode * | determine_depth_offset () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a depth_offset specified. More... | |
virtual EggRenderMode * | determine_depth_test_mode () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified. More... | |
virtual EggRenderMode * | determine_depth_write_mode () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified. More... | |
virtual EggRenderMode * | determine_draw_order () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a draw_order specified. More... | |
virtual EggRenderMode * | determine_visibility_mode () |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified. More... | |
bool | empty () const |
iterator | end () const |
iterator | erase (iterator position) |
iterator | erase (iterator first, iterator last) |
Part of the implementaion of the EggPrimitive as an STL container. More... | |
iterator | find (EggVertex *vertex) |
Returns the iterator pointing to the indicated vertex, or end() if the vertex is not part of the primitive. More... | |
virtual TypeHandle | force_init_type () |
bool | get_bface_flag () const |
Retrieves the backfacing flag of the polygon. More... | |
Shading | get_connected_shading () const |
Determines what sort of shading properties this primitive's connected neighbors have. More... | |
EggMaterial * | get_material () const |
Returns a pointer to the applied material, or NULL if there is no material applied. More... | |
int | get_num_textures () const |
Returns the number of textures applied to the primitive. More... | |
int | get_num_vertices () const |
EggVertexPool * | get_pool () const |
Returns the vertex pool associated with the vertices of the primitive, or NULL if the primitive has no vertices. More... | |
virtual Shading | get_shading () const |
Returns the shading properties apparent on this particular primitive. More... | |
string | get_sort_name () const |
Returns the name of the primitive for the purposes of sorting primitives into different groups, if there is one. More... | |
EggTexture * | get_texture () const |
Returns the first texture on the primitive, if any, or NULL if there are no textures on the primitive. More... | |
EggTexture * | get_texture (int n) const |
Returns the nth texture that has been applied to the primitive. More... | |
virtual TypeHandle | get_type () const |
EggVertex * | get_vertex (int index) const |
Returns a particular index based on its index number. More... | |
bool | has_material () const |
Returns true if the primitive is materiald (and get_material() will return a real pointer), false otherwise (and get_material() will return NULL). More... | |
virtual bool | has_normals () const |
Returns true if any of the primitives (e.g. More... | |
virtual bool | has_primitives () const |
Returns true if there are any primitives (e.g. More... | |
bool | has_texture () const |
Returns true if the primitive has any textures specified, false otherwise. More... | |
bool | has_texture (EggTexture *texture) const |
Returns true if the primitive has the particular indicated texture, false otherwise. More... | |
bool | has_vertex_color () const |
Returns true if any vertex on the primitive has a specific color set, false otherwise. More... | |
bool | has_vertex_normal () const |
Returns true if any vertex on the primitive has a specific normal set, false otherwise. More... | |
iterator | insert (iterator position, EggVertex *x) |
virtual bool | joint_has_primitives () const |
Returns true if there are any primitives (e.g. More... | |
MAKE_SEQ (get_textures, get_num_textures, get_texture) | |
MAKE_SEQ (get_vertices, get_num_vertices, get_vertex) | |
EggPrimitive & | operator= (const EggPrimitive ©) |
EggVertex * | operator[] (int index) const |
This is read-only: you can't assign directly to an indexed vertex. More... | |
virtual void | post_apply_flat_attribute () |
Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices of the primitive, if they don't already have an attribute set, just so they end up with *something*. More... | |
reverse_iterator | rbegin () const |
void | remove_doubled_verts (bool closed) |
Certain kinds of primitives, particularly polygons, don't like to have the same vertex repeated consecutively. More... | |
void | remove_nonunique_verts () |
Removes any multiple appearances of the same vertex from the primitive. More... | |
EggVertex * | remove_vertex (EggVertex *vertex) |
Removes the indicated vertex from the primitive and returns it. More... | |
reverse_iterator | rend () const |
void | replace (iterator position, EggVertex *vertex) |
Replaces the vertex at the indicated position with the indicated vertex. More... | |
virtual void | reverse_vertex_ordering () |
Reverses the ordering of the vertices in this primitive, if appropriate, in order to change the direction the polygon appears to be facing. More... | |
void | set_bface_flag (bool flag) |
Sets the backfacing flag of the polygon. More... | |
void | set_material (EggMaterial *material) |
Applies the indicated material to the primitive. More... | |
void | set_texture (EggTexture *texture) |
Replaces the current list of textures with the indicated texture. More... | |
void | set_vertex (int index, EggVertex *vertex) |
Replaces a particular vertex based on its index number in the list of vertices. More... | |
size_type | size () const |
void | test_vref_integrity () const |
virtual void | unify_attributes (Shading shading) |
If the shading property is S_per_vertex, ensures that all vertices have a normal and a color, and the overall primitive does not. More... | |
virtual void | write (ostream &out, int indent_level) const =0 |
![]() | |
EggNode (const string &name="") | |
EggNode (const EggNode ©) | |
void | apply_texmats () |
Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves. More... | |
virtual bool | determine_decal () |
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set. More... | |
virtual bool | determine_indexed () |
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set. More... | |
void | flatten_transforms () |
Removes any transform and instance records from this node in the scene graph and below. More... | |
int | get_depth () const |
Returns the number of nodes above this node in the egg hierarchy. More... | |
const LMatrix4d & | get_node_frame () const |
Returns the coordinate frame of the node itself. More... | |
const LMatrix4d & | get_node_frame_inv () const |
Returns the inverse of the matrix returned by get_node_frame(). More... | |
const LMatrix4d * | get_node_frame_inv_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix. More... | |
const LMatrix4d * | get_node_frame_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix. More... | |
const LMatrix4d & | get_node_to_vertex () const |
Returns the transformation matrix suitable for converting vertices in the coordinate space of the node to the appropriate coordinate space for storing in the egg file. More... | |
const LMatrix4d * | get_node_to_vertex_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix. More... | |
EggGroupNode * | get_parent () const |
const LMatrix4d & | get_vertex_frame () const |
Returns the coordinate frame of the vertices referenced by primitives at or under this node. More... | |
const LMatrix4d & | get_vertex_frame_inv () const |
Returns the inverse of the matrix returned by get_vertex_frame(). More... | |
const LMatrix4d * | get_vertex_frame_inv_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix. More... | |
const LMatrix4d * | get_vertex_frame_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix. More... | |
const LMatrix4d & | get_vertex_to_node () const |
Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node. More... | |
const LMatrix4d * | get_vertex_to_node_ptr () const |
Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix. More... | |
virtual bool | is_anim_matrix () const |
Returns true if this node represents a table of animation transformation data, false otherwise. More... | |
virtual bool | is_joint () const |
Returns true if this particular node represents a <Joint> entry or not. More... | |
bool | is_local_coord () const |
Returns true if this node's vertices are not in the global coordinate space. More... | |
bool | is_under_instance () const |
Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise. More... | |
bool | is_under_transform () const |
Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise. More... | |
EggNode & | operator= (const EggNode ©) |
bool | parse_egg (const string &egg_syntax) |
Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition. More... | |
int | rename_node (vector_string strip_prefix) |
Rename by stripping out the prefix. More... | |
void | test_under_integrity () const |
void | transform (const LMatrix4d &mat) |
Applies the indicated transformation to the node and all of its descendants. More... | |
void | transform_vertices_only (const LMatrix4d &mat) |
Applies the indicated transformation only to vertices that appear in global space within vertex pools at this node and below. More... | |
![]() | |
EggNamedObject (const string &name="") | |
EggNamedObject (const EggNamedObject ©) | |
EggNamedObject & | operator= (const EggNamedObject ©) |
void | output (ostream &out) const |
void | write_header (ostream &out, int indent_level, const char *egg_keyword) const |
Writes the first line of the egg object, e.g. More... | |
![]() | |
EggObject (const EggObject ©) | |
virtual EggTransform * | as_transform () |
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not. More... | |
void | clear_user_data () |
Removes *all* user data pointers from the node. More... | |
void | clear_user_data (TypeHandle type) |
Removes the user data pointer of the indicated type. More... | |
EggUserData * | get_user_data () const |
Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored. More... | |
EggUserData * | get_user_data (TypeHandle type) const |
Returns the user data pointer of the indicated type, if it exists, or NULL if it does not. More... | |
bool | has_user_data () const |
Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise. More... | |
bool | has_user_data (TypeHandle type) const |
Returns true if the user data pointer of the indicated type has been set, false otherwise. More... | |
EggObject & | operator= (const EggObject ©) |
void | set_user_data (EggUserData *user_data) |
Sets the user data associated with this object. More... | |
![]() | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
![]() | |
Namable (const string &initial_name="") | |
Namable (const Namable ©) | |
void | clear_name () |
Resets the Namable's name to empty. More... | |
const string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. More... | |
Namable & | operator= (const Namable &other) |
void | output (ostream &out) const |
Outputs the Namable. More... | |
void | set_name (const string &name) |
![]() | |
EggAttributes (const EggAttributes ©) | |
void | clear_color () |
void | clear_normal () |
int | compare_to (const EggAttributes &other) const |
An ordering operator to compare two vertices for sorting order. More... | |
void | copy_color (const EggAttributes &other) |
Sets this color to be the same as the other's, include morphs. More... | |
void | copy_normal (const EggAttributes &other) |
Sets this normal to be the same as the other's, include morphs. More... | |
LColor | get_color () const |
Returns the color set on this particular attribute. More... | |
const LNormald & | get_normal () const |
bool | has_color () const |
bool | has_normal () const |
bool | matches_color (const EggAttributes &other) const |
Returns true if this color matches that of the other EggAttributes object, include the morph list. More... | |
bool | matches_normal (const EggAttributes &other) const |
Returns true if this normal matches that of the other EggAttributes object, include the morph list. More... | |
EggAttributes & | operator= (const EggAttributes ©) |
void | set_color (const LColor &Color) |
void | set_normal (const LNormald &normal) |
bool | sorts_less_than (const EggAttributes &other) const |
An ordering operator to compare two vertices for sorting order. More... | |
void | transform (const LMatrix4d &mat) |
Applies the indicated transformation matrix to the attributes. More... | |
void | write (ostream &out, int indent_level) const |
Writes the attributes to the indicated output stream in Egg format. More... | |
![]() | |
EggRenderMode (const EggRenderMode ©) | |
void | clear_bin () |
Removes the bin name that was set for this particular object. More... | |
void | clear_depth_offset () |
Removes the depth-offset flag from this particular object. More... | |
void | clear_draw_order () |
Removes the draw-order flag from this particular object. More... | |
AlphaMode | get_alpha_mode () const |
Returns the alpha mode that was set, or AM_unspecified if nothing was set. More... | |
string | get_bin () const |
Returns the bin name that has been set for this particular object, if any. More... | |
int | get_depth_offset () const |
Returns the "depth-offset" flag as set for this particular object. More... | |
DepthTestMode | get_depth_test_mode () const |
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set. More... | |
DepthWriteMode | get_depth_write_mode () const |
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. More... | |
int | get_draw_order () const |
Returns the "draw-order" flag as set for this particular object. More... | |
VisibilityMode | get_visibility_mode () const |
Returns the visibility mode that was set, or VM_unspecified if nothing was set. More... | |
bool | has_bin () const |
Returns true if a bin name has been set for this particular object. More... | |
bool | has_depth_offset () const |
Returns true if the depth-offset flag has been set for this particular object. More... | |
bool | has_draw_order () const |
Returns true if the draw-order flag has been set for this particular object. More... | |
bool | operator!= (const EggRenderMode &other) const |
bool | operator< (const EggRenderMode &other) const |
EggRenderMode & | operator= (const EggRenderMode ©) |
bool | operator== (const EggRenderMode &other) const |
void | set_alpha_mode (AlphaMode mode) |
Specifies precisely how the transparency for this geometry should be achieved, or if it should be used. More... | |
void | set_bin (const string &bin) |
Sets the "bin" string for this particular object. More... | |
void | set_depth_offset (int bias) |
Sets the "depth-offset" flag associated with this object. More... | |
void | set_depth_test_mode (DepthTestMode mode) |
Specifies whether this geometry should be tested against the depth buffer when it is drawn (assuming the rendering backend provides a depth buffer). More... | |
void | set_depth_write_mode (DepthWriteMode mode) |
Specifies whether writes should be made to the depth buffer (assuming the rendering backend provides a depth buffer) when rendering this geometry. More... | |
void | set_draw_order (int order) |
Sets the "draw-order" flag associated with this object. More... | |
void | set_visibility_mode (VisibilityMode mode) |
Specifies whether this geometry is to be considered normally visible, or hidden. More... | |
void | write (ostream &out, int indent_level) const |
Writes the attributes to the indicated output stream in Egg format. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
static AlphaMode | string_alpha_mode (const string &string) |
Returns the AlphaMode value associated with the given string representation, or AM_unspecified if the string does not match any known AlphaMode value. More... | |
static DepthTestMode | string_depth_test_mode (const string &string) |
Returns the DepthTestMode value associated with the given string representation, or DTM_unspecified if the string does not match any known DepthTestMode value. More... | |
static DepthWriteMode | string_depth_write_mode (const string &string) |
Returns the DepthWriteMode value associated with the given string representation, or DWM_unspecified if the string does not match any known DepthWriteMode value. More... | |
static VisibilityMode | string_visibility_mode (const string &string) |
Returns the HiddenMode value associated with the given string representation, or VM_unspecified if the string does not match any known HiddenMode value. More... | |
Friends | |
class | EggTextureCollection |
Additional Inherited Members | |
![]() | |
EggMorphNormalList | _dnormals |
EggMorphColorList | _drgbas |
A base class for any of a number of kinds of geometry primitives: polygons, point lights, nurbs patches, parametrics curves, etc.
Things with a set of vertices and some rendering properties like color.
An EggPrimitive is an STL-style container of pointers to EggVertex's. In fact, it IS a vector, and can be manipulated in all the ways that vectors can. However, it is necessary that all vertices belong to the same vertex pool.
Definition at line 51 of file eggPrimitive.h.
|
inline |
Applies the indicated texture to the primitive.
Note that, in the case of multiple textures being applied to a single primitive, the order in which the textures are applied does not affect the rendering order; use EggTexture::set_sort() to specify that.
Definition at line 197 of file eggPrimitive.I.
References clear_texture().
Referenced by DaeMaterials::apply_to_primitive(), MayaToEggConverter::clear(), MaxToEggConverter::convert(), get_texture(), and set_texture().
Adds the indicated vertex to the end of the primitive's list of vertices, and returns it.
Definition at line 747 of file eggPrimitive.cxx.
References remove_vertex().
Referenced by DXFToEggLayer::add_line(), EggSaver::add_node(), DXFToEggLayer::add_polygon(), EggVertexPool::add_unused_vertices_to_prim(), MayaToEggConverter::clear(), MaxToEggConverter::convert(), FltToEggConverter::convert_flt(), copy_vertices(), XFileMesh::create_polygons(), find(), SoftToEggConverter::find_morph_table(), EggGroupNode::rebuild_vertex_pools(), and QtessSurface::tesselate_auto().
|
virtual |
Sets the first vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.
This reflects the DirectX convention of storing flat-shaded properties on the first vertex, although it is not usually a convention in Egg.
This may introduce redundant vertices to the vertex pool.
Reimplemented in EggCompositePrimitive, and EggTriangleFan.
Definition at line 506 of file eggPrimitive.cxx.
References post_apply_flat_attribute().
Referenced by EggGroupNode::apply_first_attribute(), and apply_last_attribute().
|
virtual |
Sets the last vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.
This reflects the OpenGL convention of storing flat-shaded properties on the last vertex, although it is not usually a convention in Egg.
This may introduce redundant vertices to the vertex pool.
Reimplemented in EggCompositePrimitive.
Definition at line 486 of file eggPrimitive.cxx.
References apply_first_attribute().
Referenced by EggGroupNode::apply_last_attribute(), and unify_attributes().
|
virtual |
Cleans up modeling errors in whatever context this makes sense.
For instance, for a polygon, this calls remove_doubled_verts(true). For a point, it calls remove_nonunique_verts(). Returns true if the primitive is valid, or false if it is degenerate.
Reimplemented in EggCompositePrimitive, EggPoint, and EggPolygon.
Definition at line 566 of file eggPrimitive.cxx.
References remove_doubled_verts().
Referenced by EggGroupNode::remove_invalid_primitives(), and reverse_vertex_ordering().
|
inline |
Removes all of the vertices from the primitive.
Definition at line 432 of file eggPrimitive.I.
References set_vertex(), and EggTextureCollection::size().
Referenced by copy_vertices(), EggGroupNode::rebuild_vertex_pools(), and replace().
|
inline |
Resets the connected_shading member in this primitive, so that get_connected_shading() will recompute a new value.
Definition at line 98 of file eggPrimitive.I.
References get_connected_shading().
Referenced by EggGroupNode::clear_connected_shading(), and get_sort_name().
|
inline |
Removes any material from the primitive.
Definition at line 251 of file eggPrimitive.I.
References get_material().
Referenced by set_material().
|
inline |
Removes any texturing from the primitive.
Definition at line 207 of file eggPrimitive.I.
References get_num_textures().
Referenced by add_texture(), and set_texture().
void EggPrimitive::copy_attributes | ( | const EggAttributes & | other | ) |
Copies the rendering attributes from the indicated primitive.
Definition at line 296 of file eggPrimitive.cxx.
Referenced by EggTriangleFan::apply_first_attribute(), get_shading(), EggMesherFanMaker::unroll(), and EggTriangleStrip::write().
void EggPrimitive::copy_attributes | ( | const EggPrimitive & | other | ) |
Copies the rendering attributes from the indicated primitive.
Definition at line 307 of file eggPrimitive.cxx.
References get_bface_flag(), get_material(), has_vertex_normal(), set_bface_flag(), and set_material().
void EggPrimitive::copy_vertices | ( | const EggPrimitive & | other | ) |
Replaces the current primitive's list of vertices with a copy of the list of vertices on the other primitive.
Definition at line 791 of file eggPrimitive.cxx.
References add_vertex(), clear(), EggTransform::clear_transform(), EggVertex::copy_grefs_from(), EggTextureCollection::create_unique_texture(), EggVertexPool::create_unique_vertex(), get_bface_flag(), EggAttributes::get_color(), EggVertex::get_index(), get_material(), get_num_textures(), EggVertex::get_pool(), get_pool(), get_shading(), get_texture(), EggTransform::get_transform3d(), EggTexture::get_uv_name(), EggVertex::get_uv_obj(), EggVertexUV::get_uvw(), get_vertex(), EggNode::get_vertex_frame(), has_material(), Namable::has_name(), EggVertex::has_pref(), EggTransform::has_transform(), EggTransform::has_transform3d(), EggVertexUV::has_w(), EggNode::is_local_coord(), EggAttributes::matches_color(), EggAttributes::matches_normal(), EggVertex::pref_begin(), EggVertex::pref_end(), EggVertex::set_uv_obj(), set_vertex(), ReferenceCount::test_ref_count_integrity(), EggAttributes::transform(), EggVertex::transform(), EggTransform::transform_is_identity(), EggRenderMode::write(), and EggAttributes::write().
Referenced by remove_vertex().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has an alpha_mode other than AM_unspecified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 38 of file eggPrimitive.cxx.
References EggTexture::affects_polygon_alpha(), EggNode::determine_alpha_mode(), determine_depth_write_mode(), EggRenderMode::get_alpha_mode(), get_num_textures(), and get_texture().
Referenced by EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a bin specified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 209 of file eggPrimitive.cxx.
References EggNode::determine_bin(), get_num_textures(), get_shading(), get_texture(), and EggRenderMode::has_bin().
Referenced by determine_draw_order(), and EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a depth_offset specified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 155 of file eggPrimitive.cxx.
References EggNode::determine_depth_offset(), determine_draw_order(), get_num_textures(), get_texture(), and EggRenderMode::has_depth_offset().
Referenced by determine_visibility_mode(), and EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 101 of file eggPrimitive.cxx.
References EggNode::determine_depth_test_mode(), determine_visibility_mode(), EggRenderMode::get_depth_test_mode(), get_num_textures(), and get_texture().
Referenced by determine_depth_write_mode(), and EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 74 of file eggPrimitive.cxx.
References determine_depth_test_mode(), EggNode::determine_depth_write_mode(), EggRenderMode::get_depth_write_mode(), get_num_textures(), and get_texture().
Referenced by determine_alpha_mode(), and EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this primitive that has a draw_order specified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 182 of file eggPrimitive.cxx.
References determine_bin(), EggNode::determine_draw_order(), get_num_textures(), get_texture(), and EggRenderMode::has_draw_order().
Referenced by determine_depth_offset(), and EggRenderState::fill_state().
|
virtual |
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified.
Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.
Reimplemented from EggNode.
Definition at line 128 of file eggPrimitive.cxx.
References determine_depth_offset(), EggNode::determine_visibility_mode(), get_num_textures(), get_texture(), and EggRenderMode::get_visibility_mode().
Referenced by determine_depth_test_mode(), and EggRenderState::fill_state().
EggPrimitive::iterator EggPrimitive::erase | ( | iterator | first, |
iterator | last | ||
) |
Part of the implementaion of the EggPrimitive as an STL container.
Most of the rest of these functions are inline and declared in EggPrimitive.I.
Definition at line 712 of file eggPrimitive.cxx.
References find().
EggPrimitive::iterator EggPrimitive::find | ( | EggVertex * | vertex | ) |
Returns the iterator pointing to the indicated vertex, or end() if the vertex is not part of the primitive.
Definition at line 734 of file eggPrimitive.cxx.
References add_vertex().
Referenced by erase(), has_texture(), EggVertexPool::remove_unused_vertices(), and remove_vertex().
|
inline |
Retrieves the backfacing flag of the polygon.
See set_bface_flag().
Definition at line 301 of file eggPrimitive.I.
References operator[]().
Referenced by copy_attributes(), copy_vertices(), EggRenderState::fill_state(), EggLoader::make_polyset(), set_bface_flag(), and EggPolysetMaker::sorts_less().
|
inline |
Determines what sort of shading properties this primitive's connected neighbors have.
To get the most accurate results, you should first call clear_connected_shading() on all connected primitives (or on all primitives in the egg file). It might also be a good idea to call remove_unused_vertices() to ensure proper connectivity.
You may find it easiest to call these other methods on the EggData root node (they are defined on EggGroupNode).
Definition at line 120 of file eggPrimitive.I.
References set_texture().
Referenced by clear_connected_shading(), EggRenderState::fill_state(), EggGroupNode::get_connected_shading(), and EggGroupNode::unify_attributes().
|
inline |
Returns a pointer to the applied material, or NULL if there is no material applied.
Definition at line 262 of file eggPrimitive.I.
References has_material().
Referenced by clear_material(), copy_attributes(), copy_vertices(), EggRenderState::fill_state(), EggMaterialCollection::find_used_materials(), EggMaterialCollection::replace_materials(), XFileMaterial::set_from_egg(), and EggPolysetMaker::sorts_less().
|
inline |
Returns the number of textures applied to the primitive.
Definition at line 218 of file eggPrimitive.I.
References get_texture().
Referenced by MayaToEggConverter::clear(), clear_texture(), copy_vertices(), determine_alpha_mode(), determine_bin(), determine_depth_offset(), determine_depth_test_mode(), determine_depth_write_mode(), determine_draw_order(), determine_visibility_mode(), EggRenderState::fill_state(), EggTextureCollection::find_used_textures(), has_texture(), and EggPolysetMaker::sorts_less().
|
inline |
Returns the vertex pool associated with the vertices of the primitive, or NULL if the primitive has no vertices.
Definition at line 480 of file eggPrimitive.I.
Referenced by copy_vertices(), get_vertex(), EggLoader::make_polyset(), and EggMesher::mesh().
|
virtual |
Returns the shading properties apparent on this particular primitive.
This returns S_per_vertex if the vertices have colors or normals (and they are not all the same values), or for a simple primitive, S_overall otherwise. A composite primitive may also return S_per_face if the individual component primitives have colors or normals that are not all the same values.
To get the most accurate results, you should call clear_shading() on all connected primitives (or on all primitives in the egg file), followed by get_shading() on each primitive. You may find it easiest to call these methods on the EggData root node (they are defined on EggGroupNode).
Reimplemented in EggCompositePrimitive.
Definition at line 247 of file eggPrimitive.cxx.
References copy_attributes(), get_vertex(), has_vertex_color(), has_vertex_normal(), EggAttributes::matches_color(), and EggAttributes::matches_normal().
Referenced by copy_vertices(), determine_bin(), EggCompositePrimitive::get_shading(), EggLoader::make_polyset(), unify_attributes(), and EggGroupNode::unify_attributes().
|
inline |
Returns the name of the primitive for the purposes of sorting primitives into different groups, if there is one.
Presently, this is defined as the primitive name itself, unless it begins with a digit.
Definition at line 82 of file eggPrimitive.I.
References clear_connected_shading().
Referenced by EggBinner::sorts_less().
|
inline |
Returns the first texture on the primitive, if any, or NULL if there are no textures on the primitive.
This method is deprecated and is used in support of single-texturing only. New code should be written to use the multitexture variants instead.
Definition at line 182 of file eggPrimitive.I.
References add_texture(), and has_texture().
Referenced by copy_vertices(), determine_alpha_mode(), determine_bin(), determine_depth_offset(), determine_depth_test_mode(), determine_depth_write_mode(), determine_draw_order(), determine_visibility_mode(), EggRenderState::fill_state(), EggTextureCollection::find_used_textures(), get_num_textures(), has_texture(), XFileVertex::set_from_egg(), XFileMaterial::set_from_egg(), and EggPolysetMaker::sorts_less().
|
inline |
Returns the nth texture that has been applied to the primitive.
Definition at line 229 of file eggPrimitive.I.
References set_material().
|
inline |
Returns a particular index based on its index number.
Definition at line 466 of file eggPrimitive.I.
References get_pool(), and EggTextureCollection::size().
Referenced by EggPolygon::calculate_normal(), MaxToEggConverter::convert(), copy_vertices(), EggNurbsSurface::get_cv(), get_shading(), EggLoader::make_polyset(), EggCompositePrimitive::post_apply_flat_attribute(), post_apply_flat_attribute(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), set_vertex(), EggGroupNode::strip_normals(), and EggPolygon::write().
|
inline |
Returns true if the primitive is materiald (and get_material() will return a real pointer), false otherwise (and get_material() will return NULL).
Definition at line 275 of file eggPrimitive.I.
References set_bface_flag().
Referenced by copy_vertices(), EggRenderState::fill_state(), EggMaterialCollection::find_used_materials(), get_material(), EggMaterialCollection::replace_materials(), XFileMaterial::set_from_egg(), and EggPolysetMaker::sorts_less().
|
virtual |
Returns true if any of the primitives (e.g.
polygons) defined within this group or below have either face or vertex normals defined, false otherwise.
Reimplemented from EggNode.
Definition at line 688 of file eggPrimitive.cxx.
Referenced by joint_has_primitives().
|
virtual |
Returns true if there are any primitives (e.g.
polygons) defined within this group or below, false otherwise.
Reimplemented from EggNode.
Definition at line 664 of file eggPrimitive.cxx.
References joint_has_primitives().
Referenced by remove_nonunique_verts().
|
inline |
Returns true if the primitive has any textures specified, false otherwise.
This method is deprecated and is used in support of single-texturing only. New code should be written to use the multitexture variants instead.
Definition at line 155 of file eggPrimitive.I.
References get_num_textures().
Referenced by TextureReference::apply_properties_to_source(), get_texture(), XFileVertex::set_from_egg(), XFileMaterial::set_from_egg(), and set_texture().
|
inline |
Returns true if the primitive has the particular indicated texture, false otherwise.
Definition at line 166 of file eggPrimitive.I.
References find(), and get_texture().
bool EggPrimitive::has_vertex_color | ( | ) | const |
Returns true if any vertex on the primitive has a specific color set, false otherwise.
If you call unify_attributes() first, this will also return false even if all the vertices were set to the same value (since unify_attributes() removes redundant vertex properties).
Definition at line 348 of file eggPrimitive.cxx.
References unify_attributes().
Referenced by get_shading(), has_vertex_normal(), EggLoader::make_polyset(), and EggPolysetMaker::sorts_less().
bool EggPrimitive::has_vertex_normal | ( | ) | const |
Returns true if any vertex on the primitive has a specific normal set, false otherwise.
If you call unify_attributes() first, this will also return false even if all the vertices were set to the same value (since unify_attributes() removes redundant vertex properties).
Definition at line 326 of file eggPrimitive.cxx.
References has_vertex_color().
Referenced by copy_attributes(), get_shading(), and EggPolysetMaker::sorts_less().
|
virtual |
Returns true if there are any primitives (e.g.
polygons) defined within this group or below, but the search does not include nested joints.
Reimplemented from EggNode.
Definition at line 676 of file eggPrimitive.cxx.
References has_normals().
Referenced by has_primitives().
|
inline |
This is read-only: you can't assign directly to an indexed vertex.
See set_vertex() instead.
Definition at line 373 of file eggPrimitive.I.
References replace(), and EggTextureCollection::size().
Referenced by get_bface_flag().
|
virtual |
Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices of the primitive, if they don't already have an attribute set, just so they end up with *something*.
Reimplemented in EggCompositePrimitive.
Definition at line 521 of file eggPrimitive.cxx.
References EggAttributes::get_color(), get_vertex(), and reverse_vertex_ordering().
Referenced by apply_first_attribute(), and EggGroupNode::post_apply_flat_attribute().
void EggPrimitive::remove_doubled_verts | ( | bool | closed | ) |
Certain kinds of primitives, particularly polygons, don't like to have the same vertex repeated consecutively.
Unfortunately, some modeling programs (like MultiGen) make this an easy mistake to make.
It's handy to have a function to remove these redundant vertices. If closed is true, it also checks that the first and last vertices are not the same.
This function identifies repeated vertices by position only; it does not consider any other properties, such as color or UV, significant in differentiating vertices.
Definition at line 589 of file eggPrimitive.cxx.
References remove_nonunique_verts().
Referenced by EggPolygon::cleanup(), and cleanup().
void EggPrimitive::remove_nonunique_verts | ( | ) |
Removes any multiple appearances of the same vertex from the primitive.
This primarily makes sense for a point primitive, which is really a collection of points and which doesn't make sense to include the same point twice, in any order.
Definition at line 636 of file eggPrimitive.cxx.
References has_primitives().
Referenced by EggPoint::cleanup(), and remove_doubled_verts().
Removes the indicated vertex from the primitive and returns it.
If the vertex was not already in the primitive, does nothing and returns NULL.
Definition at line 766 of file eggPrimitive.cxx.
References copy_vertices(), and find().
Referenced by add_vertex().
|
inline |
Replaces the vertex at the indicated position with the indicated vertex.
It is an error to call this with an invalid position iterator (e.g. end()).
Definition at line 413 of file eggPrimitive.I.
References clear().
Referenced by TextureReference::apply_properties_to_source(), operator[](), EggVertexPool::remove_unused_vertices(), set_vertex(), EggCompositePrimitive::unify_attributes(), and unify_attributes().
|
virtual |
Reverses the ordering of the vertices in this primitive, if appropriate, in order to change the direction the polygon appears to be facing.
Does not adjust the surface normal, if any.
Definition at line 549 of file eggPrimitive.cxx.
References cleanup().
Referenced by MayaToEggConverter::clear(), post_apply_flat_attribute(), and EggGroupNode::reverse_vertex_ordering().
|
inline |
Sets the backfacing flag of the polygon.
If this is true, the polygon will be rendered so that both faces are visible; if it is false, only the front face of the polygon will be visible.
Definition at line 289 of file eggPrimitive.I.
References get_bface_flag().
Referenced by CLwoSurface::apply_properties(), DaeMaterials::apply_to_primitive(), MayaToEggConverter::clear(), MaxToEggConverter::convert(), FltToEggConverter::convert_flt(), copy_attributes(), SoftToEggConverter::find_morph_table(), has_material(), and EggLoader::make_polyset().
|
inline |
Applies the indicated material to the primitive.
Definition at line 241 of file eggPrimitive.I.
References clear_material().
Referenced by CLwoSurface::apply_properties(), XFileMaterial::apply_to_egg(), DaeMaterials::apply_to_primitive(), copy_attributes(), get_texture(), and EggMaterialCollection::replace_materials().
|
inline |
Replaces the current list of textures with the indicated texture.
This method is deprecated and is used in support of single-texturing only. Please use the multitexture variant add_texture instead.
Definition at line 139 of file eggPrimitive.I.
References add_texture(), clear_texture(), and has_texture().
Referenced by CLwoSurface::apply_properties(), XFileMaterial::apply_to_egg(), FltToEggConverter::convert_flt(), SoftToEggConverter::FindClosestTriVert(), and get_connected_shading().
|
inline |
Replaces a particular vertex based on its index number in the list of vertices.
This is just a convenience function for people who don't want to mess with the iterators.
Definition at line 455 of file eggPrimitive.I.
References get_vertex(), replace(), and EggTextureCollection::size().
Referenced by clear(), MaxToEggConverter::convert(), copy_vertices(), EggGroupNode::recompute_polygon_normals(), EggNurbsSurface::set_cv(), and EggGroupNode::strip_normals().
|
virtual |
If the shading property is S_per_vertex, ensures that all vertices have a normal and a color, and the overall primitive does not.
If the shading property is S_per_face, and this is a composite primitive, ensures that all components have a normal and a color, and the vertices and overall primitive do not. (If this is a simple primitive, S_per_face works the same as S_overall, below).
If the shading property is S_overall, ensures that no vertices or components have a normal or a color, and the overall primitive does (if any exists at all).
After this call, either the primitive will have normals or its vertices will, but not both. Ditto for colors.
This may create redundant vertices in the vertex pool.
Reimplemented in EggCompositePrimitive.
Definition at line 383 of file eggPrimitive.cxx.
References apply_last_attribute(), EggAttributes::copy_color(), EggVertex::copy_grefs_from(), EggAttributes::copy_normal(), EggVertexPool::create_unique_vertex(), EggAttributes::get_color(), EggVertex::get_pool(), get_shading(), and replace().
Referenced by has_vertex_color(), and EggGroupNode::unify_attributes().