Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

EggMaterial Class Reference

Inheritance diagram for EggMaterial:
EggNode EggNamedObject EggObject Namable TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Types

enum  Equivalence { E_attributes = 0x001, E_mref_name = 0x002 }

Public Member Functions

 EggMaterial (const string &mref_name)
 EggMaterial (const EggMaterial &copy)
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.
virtual EggTransformas_transform ()
 Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
void clear_amb ()
void clear_diff ()
void clear_emit ()
void clear_local ()
void clear_name ()
 Resets the Namable's name to empty.
void clear_shininess ()
void clear_spec ()
void clear_user_data (TypeHandle type)
 Removes the user data pointer of the indicated type.
void clear_user_data ()
 Removes *all* user data pointers from the node.
virtual EggRenderModedetermine_alpha_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 an alpha_mode other than AM_unspecified.
virtual EggRenderModedetermine_bin ()
 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 bin specified.
virtual bool determine_decal ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set.
virtual EggRenderModedetermine_depth_offset ()
 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_offset specified.
virtual EggRenderModedetermine_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.
virtual EggRenderModedetermine_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.
virtual EggRenderModedetermine_draw_order ()
 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 draw_order specified.
virtual bool determine_indexed ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set.
virtual EggRenderModedetermine_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.
void flatten_transforms ()
 Removes any transform and instance records from this node in the scene graph and below.
virtual TypeHandle force_init_type ()
Colorf get_amb () const
 It is legal to call this even if has_amb() returns false.
int get_best_parent_from_Set (const std::set< int > &) const
int get_depth () const
 Returns the number of nodes above this node in the egg hierarchy.
Colorf get_diff () const
 It is legal to call this even if has_diff() returns false.
Colorf get_emit () const
 It is legal to call this even if has_emit() returns false.
bool get_local () const
const string & get_name () const
const LMatrix4dget_node_frame () const
 Returns the coordinate frame of the node itself.
const LMatrix4dget_node_frame_inv () const
 Returns the inverse of the matrix returned by get_node_frame().
const LMatrix4dget_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.
const LMatrix4dget_node_frame_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix.
const LMatrix4dget_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.
const LMatrix4dget_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.
EggGroupNodeget_parent () const
int get_ref_count () const
 Returns the current reference count.
double get_shininess () const
Colorf get_spec () const
 It is legal to call this even if has_spec() returns false.
virtual TypeHandle get_type () const
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
EggUserDataget_user_data () const
 Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored.
EggUserDataget_user_data (TypeHandle type) const
 Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.
const LMatrix4dget_vertex_frame () const
 Returns the coordinate frame of the vertices referenced by primitives at or under this node.
const LMatrix4dget_vertex_frame_inv () const
 Returns the inverse of the matrix returned by get_vertex_frame().
const LMatrix4dget_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.
const LMatrix4dget_vertex_frame_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix.
const LMatrix4dget_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.
const LMatrix4dget_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.
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object.
bool has_amb () const
bool has_diff () const
bool has_emit () const
bool has_local () const
bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.
bool has_shininess () const
bool has_spec () const
bool has_user_data () const
 Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.
bool has_user_data (TypeHandle type) const
 Returns true if the user data pointer of the indicated type has been set, false otherwise.
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
virtual bool is_anim_matrix () const
 Returns true if this node represents a table of animation transformation data, false otherwise.
bool is_equivalent_to (const EggMaterial &other, int eq) const
 Returns true if the two materials are equivalent in all relevant properties (according to eq), false otherwise.
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
virtual bool is_joint () const
 Returns true if this particular node represents a <Joint> entry or not.
bool is_local_coord () const
 Returns true if this node's vertices are not in the global coordinate space.
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
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.
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.
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void operator delete (void *ptr)
void operator delete (void *ptr, void *)
void operator delete (void *ptr, void *)
void operator delete (void *ptr)
void operator delete[] (void *, void *)
void operator delete[] (void *ptr)
void operator delete[] (void *, void *)
void operator delete[] (void *ptr)
void * operator new (size_t size)
void * operator new (size_t size)
void * operator new (size_t size, void *ptr)
void * operator new (size_t size, void *ptr)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size)
void * operator new[] (size_t size)
void output (ostream &out) const
 Outputs the Namable.
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.
void ref () const
 Explicitly increments the reference count.
int rename_node (vector_string strip_prefix)
 Rename by stripping out the prefix.
void set_amb (const Colorf &amb)
void set_diff (const Colorf &diff)
void set_emit (const Colorf &emit)
void set_local (bool local)
void set_name (const string &name)
void set_shininess (double shininess)
void set_spec (const Colorf &spec)
void set_user_data (EggUserData *user_data)
 Sets the user data associated with this object.
bool sorts_less_than (const EggMaterial &other, int eq) const
 An ordering operator to compare two materials for sorting order.
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
void test_under_integrity () const
 Recursively checks the integrity of the _under_flags, _parent, and _depth members of this node and all of its ancestors.
void transform (const LMatrix4d &mat)
 Applies the indicated transformation to the node and all of its descendants.
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.
virtual bool unref () const
 Explicitly decrements the reference count.
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object.
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object.
virtual void write (ostream &out, int indent_level) const
 Writes the material definition to the indicated output stream in Egg format.
void write_header (ostream &out, int indent_level, const char *egg_keyword) const
 Writes the first line of the egg object, e.g.

Static Public Member Functions

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.

Protected Types

typedef RefCountObj< LMatrix4dMatrixFrame
enum  UnderFlags { UF_under_instance = 0x001, UF_under_transform = 0x002, UF_local_coord = 0x004 }

Protected Member Functions

virtual void adjust_under ()
 This is called within update_under() after all the various under settings have been inherited directly from the parent node.
bool do_test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool do_test_ref_count_nonzero () const
 Returns true if the reference count is nonzero, false otherwise.
virtual bool egg_start_parse_body ()
 This function is called within parse_egg().
virtual bool has_normals () const
 Returns true if any of the primitives (e.g.
virtual bool has_primitives () const
 Returns true if there are any primitives (e.g.
virtual bool joint_has_primitives () const
 Returns true if there are any primitives (e.g.
 PT (MatrixFrame) _node_to_vertex
 PT (MatrixFrame) _vertex_to_node
 PT (MatrixFrame) _node_frame_inv
 PT (MatrixFrame) _vertex_frame
 PT (MatrixFrame) _node_frame
 PT (MatrixFrame) _vertex_frame_inv
virtual void r_apply_texmats (EggTextureCollection &textures)
 The recursive implementation of apply_texmats().
virtual void r_flatten_transforms ()
 The recursive implementation of flatten_transforms().
virtual void r_mark_coordsys (CoordinateSystem cs)
 This is only called immediately after loading an egg file from disk, to propagate the value found in the CoordinateSystem entry (or the default Y-up coordinate system) to all nodes that care about what the coordinate system is.
virtual void r_transform (const LMatrix4d &mat, const LMatrix4d &inv, CoordinateSystem to_cs)
 This is called from within the egg code by transform().
virtual void r_transform_vertices (const LMatrix4d &mat)
 This is called from within the egg code by transform_vertices_only()().
virtual void update_under (int depth_offset)
 This function is called from within EggGroupNode whenever the parentage of the node has changed.

Protected Attributes

int _depth
EggGroupNode_parent
int _under_flags

Detailed Description

Definition at line 28 of file eggMaterial.h.


Member Function Documentation

void EggNode::adjust_under ( ) [protected, virtual, inherited]

This is called within update_under() after all the various under settings have been inherited directly from the parent node.

It is responsible for adjusting these settings to reflect states local to the current node; for instance, an <Instance> node will force the UF_under_instance bit on.

Reimplemented in EggGroup.

Definition at line 401 of file eggNode.cxx.

Referenced by EggNode::update_under().

void EggNode::apply_texmats ( ) [inherited]

Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves.

Definition at line 58 of file eggNode.cxx.

References EggTextureCollection::find_used_textures(), and EggNode::r_apply_texmats().

EggTransform * EggObject::as_transform ( ) [virtual, inherited]

Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.

Reimplemented in EggGroup, and EggTexture.

Definition at line 183 of file eggObject.cxx.

TypedObject * TypedObject::as_typed_object ( ) [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 99 of file typedObject.I.

const TypedObject * TypedObject::as_typed_object ( ) const [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 110 of file typedObject.I.

void Namable::clear_name ( ) [inline, inherited]

Resets the Namable's name to empty.

Reimplemented in AsyncTask.

Definition at line 64 of file namable.I.

void EggObject::clear_user_data ( ) [inherited]

Removes *all* user data pointers from the node.

Definition at line 153 of file eggObject.cxx.

void EggObject::clear_user_data ( TypeHandle  type) [inherited]

Removes the user data pointer of the indicated type.

Definition at line 164 of file eggObject.cxx.

EggRenderMode * EggNode::determine_alpha_mode ( ) [virtual, inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has an alpha_mode other than AM_unspecified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

Definition at line 99 of file eggNode.cxx.

References EggNode::determine_alpha_mode().

Referenced by EggNode::determine_alpha_mode().

EggRenderMode * EggNode::determine_bin ( ) [virtual, inherited]

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 bin specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

Definition at line 207 of file eggNode.cxx.

References EggNode::determine_bin().

Referenced by EggNode::determine_bin().

bool EggNode::determine_decal ( ) [virtual, inherited]

Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set.

Returns the value of the decal flag if it is found, or false if it is not.

In other words, returns true if the "decal" flag is in effect for the indicated node, false otherwise.

Reimplemented in EggGroup.

Definition at line 247 of file eggNode.cxx.

References EggNode::determine_decal().

Referenced by EggNode::determine_decal().

EggRenderMode * EggNode::determine_depth_offset ( ) [virtual, inherited]

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_offset specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

Definition at line 171 of file eggNode.cxx.

References EggNode::determine_depth_offset().

Referenced by EggNode::determine_depth_offset().

EggRenderMode * EggNode::determine_depth_test_mode ( ) [virtual, inherited]

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 in EggGroup, and EggPrimitive.

Definition at line 135 of file eggNode.cxx.

References EggNode::determine_depth_test_mode().

Referenced by EggNode::determine_depth_test_mode().

EggRenderMode * EggNode::determine_depth_write_mode ( ) [virtual, inherited]

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 in EggGroup, and EggPrimitive.

Definition at line 117 of file eggNode.cxx.

References EggNode::determine_depth_write_mode().

Referenced by EggNode::determine_depth_write_mode().

EggRenderMode * EggNode::determine_draw_order ( ) [virtual, inherited]

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 draw_order specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

Definition at line 189 of file eggNode.cxx.

References EggNode::determine_draw_order().

Referenced by EggNode::determine_draw_order().

bool EggNode::determine_indexed ( ) [virtual, inherited]

Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set.

Returns the value of the indexed scalar if it is found, or false if it is not.

In other words, returns true if the "indexed" flag is in effect for the indicated node, false otherwise.

Reimplemented in EggGroup.

Definition at line 227 of file eggNode.cxx.

References EggNode::determine_indexed().

Referenced by EggNode::determine_indexed().

EggRenderMode * EggNode::determine_visibility_mode ( ) [virtual, inherited]

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 in EggGroup, and EggPrimitive.

Definition at line 153 of file eggNode.cxx.

References EggNode::determine_visibility_mode().

Referenced by EggNode::determine_visibility_mode().

bool ReferenceCount::do_test_ref_count_integrity ( ) const [protected, inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

Definition at line 29 of file referenceCount.cxx.

Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().

bool ReferenceCount::do_test_ref_count_nonzero ( ) const [protected, inherited]

Returns true if the reference count is nonzero, false otherwise.

Definition at line 56 of file referenceCount.cxx.

References ReferenceCount::do_test_ref_count_integrity().

Referenced by ReferenceCount::test_ref_count_nonzero().

bool EggNode::egg_start_parse_body ( ) [protected, virtual, inherited]

This function is called within parse_egg().

It should call the appropriate function on the lexer to initialize the parser into the state associated with this object. If the object cannot be parsed into directly, it should return false.

Reimplemented in EggGroup, EggPrimitive, and EggTexture.

Definition at line 340 of file eggNode.cxx.

Referenced by EggNode::parse_egg().

void EggNode::flatten_transforms ( ) [inline, inherited]

Removes any transform and instance records from this node in the scene graph and below.

If an instance node is encountered, removes the instance and applies the transform to its vertices, duplicating vertices if necessary.

Since this function may result in duplicated vertices, it may be a good idea to call remove_unused_vertices() after calling this.

Definition at line 351 of file eggNode.I.

References EggNode::r_flatten_transforms(), and EggNode::update_under().

Colorf EggMaterial::get_amb ( ) const [inline]

It is legal to call this even if has_amb() returns false.

If so, it simply returns the default amb color.

Definition at line 102 of file eggMaterial.I.

Referenced by is_equivalent_to(), sorts_less_than(), and write().

int EggNode::get_depth ( ) const [inline, inherited]

Returns the number of nodes above this node in the egg hierarchy.

Definition at line 71 of file eggNode.I.

Colorf EggMaterial::get_diff ( ) const [inline]

It is legal to call this even if has_diff() returns false.

If so, it simply returns the default diff color.

Definition at line 55 of file eggMaterial.I.

Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().

Colorf EggMaterial::get_emit ( ) const [inline]

It is legal to call this even if has_emit() returns false.

If so, it simply returns the default emit color.

Definition at line 149 of file eggMaterial.I.

Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().

const LMatrix4d & EggNode::get_node_frame ( ) const [inline, inherited]

Returns the coordinate frame of the node itself.

This is simply the net product of all transformations up to the root.

Definition at line 152 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by EggGroup::adjust_under().

const LMatrix4d & EggNode::get_node_frame_inv ( ) const [inline, inherited]

Returns the inverse of the matrix returned by get_node_frame().

See get_node_frame().

Definition at line 183 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by EggGroup::adjust_under().

const LMatrix4d * EggNode::get_node_frame_inv_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix.

Definition at line 277 of file eggNode.I.

const LMatrix4d * EggNode::get_node_frame_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix.

Definition at line 252 of file eggNode.I.

const LMatrix4d & EggNode::get_node_to_vertex ( ) const [inline, inherited]

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.

This is the same thing as:

get_node_frame() * get_vertex_frame_inv()

Definition at line 223 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by XFileMesh::create_polygons().

const LMatrix4d * EggNode::get_node_to_vertex_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix.

Definition at line 301 of file eggNode.I.

int ReferenceCount::get_ref_count ( ) const [inline, inherited]
Colorf EggMaterial::get_spec ( ) const [inline]

It is legal to call this even if has_spec() returns false.

If so, it simply returns the default spec color.

Definition at line 196 of file eggMaterial.I.

Referenced by is_equivalent_to(), XFileMaterial::set_from_egg(), sorts_less_than(), and write().

int TypedObject::get_type_index ( ) const [inline, inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 52 of file typedObject.I.

References TypeHandle::get_index().

EggUserData * EggObject::get_user_data ( ) const [inherited]

Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored.

Definition at line 102 of file eggObject.cxx.

Referenced by MayaNodeTree::get_egg_group(), and EggBinner::sorts_less().

EggUserData * EggObject::get_user_data ( TypeHandle  type) const [inherited]

Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.

Definition at line 113 of file eggObject.cxx.

const LMatrix4d & EggNode::get_vertex_frame ( ) const [inline, inherited]

Returns the coordinate frame of the vertices referenced by primitives at or under this node.

This is not the same as get_node_frame().

Generally, vertices in an egg file are stored in the global coordinate space, regardless of the transforms defined at each node. Thus, get_vertex_frame() will usually return the identity transform (global coordinate space). However, primitives under an <Instance> entry reference their vertices in the coordinate system under effect at the time of the <Instance>. Thus, nodes under an <Instance> entry may return this non-identity matrix.

Specifically, this may return a non-identity matrix only if is_local_coord() is true.

Definition at line 135 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by EggGroup::adjust_under(), EggPrimitive::r_flatten_transforms(), EggGroup::r_flatten_transforms(), XFileVertex::set_from_egg(), XFileNormal::set_from_egg(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_polyline().

const LMatrix4d & EggNode::get_vertex_frame_inv ( ) const [inline, inherited]

Returns the inverse of the matrix returned by get_vertex_frame().

See get_vertex_frame().

Definition at line 167 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by EggGroup::adjust_under().

const LMatrix4d * EggNode::get_vertex_frame_inv_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix.

Definition at line 264 of file eggNode.I.

const LMatrix4d * EggNode::get_vertex_frame_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix.

Definition at line 239 of file eggNode.I.

const LMatrix4d & EggNode::get_vertex_to_node ( ) const [inline, inherited]

Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node.

This is the same thing as:

get_vertex_frame() * get_node_frame_inv()

Definition at line 203 of file eggNode.I.

References LMatrix4d::ident_mat().

Referenced by EggLoader::make_polyset(), XFileVertex::set_from_egg(), and XFileNormal::set_from_egg().

const LMatrix4d * EggNode::get_vertex_to_node_ptr ( ) const [inline, inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix.

Definition at line 289 of file eggNode.I.

WeakReferenceList * ReferenceCount::get_weak_list ( ) const [inline, inherited]

Returns the WeakReferenceList associated with this ReferenceCount object.

If there has never been a WeakReferenceList associated with this object, creates one now.

Definition at line 307 of file referenceCount.I.

Referenced by ReferenceCount::weak_ref().

bool Namable::has_name ( ) const [inline, inherited]
bool EggNode::has_normals ( ) const [protected, virtual, inherited]

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 in EggGroupNode, EggPrimitive, and EggVertexPool.

Definition at line 436 of file eggNode.cxx.

bool EggNode::has_primitives ( ) const [protected, virtual, inherited]

Returns true if there are any primitives (e.g.

polygons) defined within this group or below, false otherwise.

Reimplemented in EggGroupNode, and EggPrimitive.

Definition at line 412 of file eggNode.cxx.

bool EggObject::has_user_data ( TypeHandle  type) const [inherited]

Returns true if the user data pointer of the indicated type has been set, false otherwise.

Definition at line 141 of file eggObject.cxx.

bool EggObject::has_user_data ( ) const [inherited]

Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.

Definition at line 130 of file eggObject.cxx.

Referenced by MayaNodeTree::get_egg_group().

bool ReferenceCount::has_weak_list ( ) const [inline, inherited]

Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.

In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).

Definition at line 294 of file referenceCount.I.

Referenced by ReferenceCount::weak_unref().

static void EggMaterial::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from EggNode.

Definition at line 96 of file eggMaterial.h.

References EggNode::init_type().

bool EggNode::is_anim_matrix ( ) const [virtual, inherited]

Returns true if this node represents a table of animation transformation data, false otherwise.

Reimplemented in EggXfmAnimData, and EggXfmSAnim.

Definition at line 85 of file eggNode.cxx.

Referenced by EggTable::has_transform(), and EggTable::r_transform().

bool EggMaterial::is_equivalent_to ( const EggMaterial other,
int  eq 
) const

Returns true if the two materials are equivalent in all relevant properties (according to eq), false otherwise.

The Equivalence parameter, eq, should be set to the bitwise OR of the following properties, according to what you consider relevant:

EggMaterial::E_attributes: All material attributes (diff, spec, etc.) except MRef name.

EggMaterial::E_mref_name: The MRef name.

Definition at line 147 of file eggMaterial.cxx.

References get_amb(), get_diff(), get_emit(), and get_spec().

Referenced by EggMaterialCollection::create_unique_material().

bool TypedObject::is_exact_type ( TypeHandle  handle) const [inline, inherited]
bool EggNode::is_joint ( ) const [virtual, inherited]

Returns true if this particular node represents a <Joint> entry or not.

This is a handy thing to know since Joints are sorted to the end of their sibling list when writing an egg file. See EggGroupNode::write().

Reimplemented in EggGroup.

Definition at line 74 of file eggNode.cxx.

Referenced by EggGroupNode::joint_has_primitives().

bool EggNode::is_local_coord ( ) const [inline, inherited]

Returns true if this node's vertices are not in the global coordinate space.

This will be the case if there was an <Instance> node under a transform at or above this node.

Definition at line 109 of file eggNode.I.

Referenced by EggVertex::get_num_global_coord(), EggVertex::get_num_local_coord(), EggPrimitive::r_flatten_transforms(), and EggGroup::r_flatten_transforms().

bool TypedObject::is_of_type ( TypeHandle  handle) const [inline, inherited]

Returns true if the current object is or derives from the indicated type.

Definition at line 63 of file typedObject.I.

References TypeHandle::is_derived_from().

Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().

bool EggNode::is_under_instance ( ) const [inline, inherited]

Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise.

Definition at line 84 of file eggNode.I.

bool EggNode::is_under_transform ( ) const [inline, inherited]

Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise.

Definition at line 96 of file eggNode.I.

bool EggNode::joint_has_primitives ( ) const [protected, virtual, inherited]

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 in EggGroupNode, and EggPrimitive.

Definition at line 424 of file eggNode.cxx.

Referenced by EggGroupNode::joint_has_primitives().

void ReferenceCount::local_object ( ) [inline, inherited]

This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.

This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.

Definition at line 276 of file referenceCount.I.

Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().

void EggNamedObject::output ( ostream &  out) const [inherited]

Outputs the Namable.

This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

Reimplemented from Namable.

Definition at line 28 of file eggNamedObject.cxx.

References Namable::has_name().

bool EggNode::parse_egg ( const string &  egg_syntax) [inherited]

Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition.

Updates the object accordingly. Returns true if successful, false if there was some parse error or if the object does not support this functionality.

Definition at line 267 of file eggNode.cxx.

References EggNode::egg_start_parse_body(), and TypedObject::is_of_type().

void EggNode::r_apply_texmats ( EggTextureCollection textures) [protected, virtual, inherited]

The recursive implementation of apply_texmats().

Reimplemented in EggGroupNode, EggNurbsSurface, and EggPrimitive.

Definition at line 499 of file eggNode.cxx.

Referenced by EggNode::apply_texmats().

void EggNode::r_flatten_transforms ( ) [protected, virtual, inherited]

The recursive implementation of flatten_transforms().

Reimplemented in EggGroup, EggGroupNode, and EggPrimitive.

Definition at line 490 of file eggNode.cxx.

Referenced by EggNode::flatten_transforms().

void EggNode::r_mark_coordsys ( CoordinateSystem  cs) [protected, virtual, inherited]

This is only called immediately after loading an egg file from disk, to propagate the value found in the CoordinateSystem entry (or the default Y-up coordinate system) to all nodes that care about what the coordinate system is.

Reimplemented in EggGroupNode, EggXfmAnimData, and EggXfmSAnim.

Definition at line 481 of file eggNode.cxx.

void EggNode::r_transform ( const LMatrix4d mat,
const LMatrix4d inv,
CoordinateSystem  to_cs 
) [protected, virtual, inherited]

This is called from within the egg code by transform().

It applies a transformation matrix to the current node in some sensible way, then continues down the tree.

The first matrix is the transformation to apply; the second is its inverse. The third parameter is the coordinate system we are changing to, or CS_default if we are not changing coordinate systems.

Reimplemented in EggGroup, EggGroupNode, EggPrimitive, EggTable, EggVertexPool, EggXfmAnimData, and EggXfmSAnim.

Definition at line 455 of file eggNode.cxx.

Referenced by EggTable::r_transform(), and EggNode::transform().

void EggNode::r_transform_vertices ( const LMatrix4d mat) [protected, virtual, inherited]

This is called from within the egg code by transform_vertices_only()().

It applies a transformation matrix to the current node in some sensible way (if the current node is a vertex pool with vertices), then continues down the tree.

Reimplemented in EggGroupNode, and EggVertexPool.

Definition at line 468 of file eggNode.cxx.

Referenced by EggNode::transform(), and EggNode::transform_vertices_only().

void ReferenceCount::ref ( ) const [inline, inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

Definition at line 179 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().

int EggNode::rename_node ( vector_string  strip_prefix) [inherited]

Rename by stripping out the prefix.

Definition at line 36 of file eggNode.cxx.

Referenced by EggGroupNode::rename_nodes().

void EggObject::set_user_data ( EggUserData user_data) [inherited]

Sets the user data associated with this object.

This may be any EggUserData-derived object. The egg library will do nothing with this pointer, except to hold its reference count and return the pointer on request.

The EggObject maintains multiple different EggUserData pointers, one for each unique type (as reported by get_type()). If you know that only one type of EggUserData object will be added in your application, you may use the query functions that accept no parameters, but it is recommended that in general you pass in the type of your particular user data, to allow multiple applications to coexist in the same egg data.

This pointer is also copied by the copy assignment operator and copy constructor.

Definition at line 89 of file eggObject.cxx.

Referenced by MayaNodeTree::get_egg_group(), and EggBinner::prepare_node().

bool EggMaterial::sorts_less_than ( const EggMaterial other,
int  eq 
) const

An ordering operator to compare two materials for sorting order.

This imposes an arbitrary ordering useful to identify unique materials, according to the indicated Equivalence factor. See is_equivalent_to().

Definition at line 179 of file eggMaterial.cxx.

References LVecBase4f::compare_to(), get_amb(), get_diff(), get_emit(), and get_spec().

Referenced by EggPolysetMaker::sorts_less().

bool ReferenceCount::test_ref_count_integrity ( ) const [inline, inherited]
bool ReferenceCount::test_ref_count_nonzero ( ) const [inline, inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

Definition at line 252 of file referenceCount.I.

References ReferenceCount::do_test_ref_count_nonzero().

Referenced by CopyOnWritePointer::test_ref_count_nonzero().

void EggNode::test_under_integrity ( ) const [inherited]

Recursively checks the integrity of the _under_flags, _parent, and _depth members of this node and all of its ancestors.

Definition at line 300 of file eggNode.cxx.

References ReferenceCount::test_ref_count_integrity(), and EggNode::test_under_integrity().

Referenced by EggNode::test_under_integrity(), EggGroup::write(), EggAnimPreload::write(), EggTable::write(), and EggXfmSAnim::write().

void EggNode::transform ( const LMatrix4d mat) [inline, inherited]

Applies the indicated transformation to the node and all of its descendants.

Reimplemented in EggVertexPool.

Definition at line 313 of file eggNode.I.

References EggNode::r_transform(), EggNode::r_transform_vertices(), and EggNode::update_under().

Referenced by SomethingToEgg::apply_units_scale(), EggToSomething::apply_units_scale(), and EggGroup::set_default_pose().

void EggNode::transform_vertices_only ( const LMatrix4d mat) [inline, inherited]

Applies the indicated transformation only to vertices that appear in global space within vertex pools at this node and below.

Joints and other transforms are not affected, nor are local vertices.

Definition at line 333 of file eggNode.I.

References EggNode::r_transform_vertices().

Referenced by EggTopstrip::strip_anim_vertices().

bool ReferenceCount::unref ( ) const [inline, virtual, inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.

Definition at line 214 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().

void EggNode::update_under ( int  depth_offset) [protected, virtual, inherited]

This function is called from within EggGroupNode whenever the parentage of the node has changed.

It should update the depth and under_instance flags accordingly.

depth_offset is the difference between the old depth value and the new value. It should be consistent with the supplied depth value. If it is not, we have some error.

Reimplemented in EggGroupNode.

Definition at line 358 of file eggNode.cxx.

References EggNode::adjust_under(), and ReferenceCount::test_ref_count_integrity().

Referenced by EggNode::flatten_transforms(), and EggNode::transform().

void ReferenceCount::weak_ref ( WeakPointerToVoid ptv) [inline, inherited]

Adds the indicated PointerToVoid as a weak reference to this object.

Definition at line 321 of file referenceCount.I.

References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().

void ReferenceCount::weak_unref ( WeakPointerToVoid ptv) [inline, inherited]

Removes the indicated PointerToVoid as a weak reference to this object.

It must have previously been added via a call to weak_ref().

Definition at line 334 of file referenceCount.I.

References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().

void EggMaterial::write ( ostream &  out,
int  indent_level 
) const [virtual]

Writes the material definition to the indicated output stream in Egg format.

Implements EggNode.

Definition at line 60 of file eggMaterial.cxx.

References get_amb(), get_diff(), get_emit(), get_spec(), and EggNamedObject::write_header().

void EggNamedObject::write_header ( ostream &  out,
int  indent_level,
const char *  egg_keyword 
) const [inherited]

Writes the first line of the egg object, e.g.

"<Group> group_name {" or some such. It automatically enquotes the name if it contains any special characters. egg_keyword is the keyword that begins the line, e.g. "<Group>".

Definition at line 45 of file eggNamedObject.cxx.

References Namable::has_name().

Referenced by EggXfmSAnim::write(), EggXfmAnimData::write(), EggVertexPool::write(), EggTriangleStrip::write(), EggTriangleFan::write(), EggTexture::write(), EggTable::write(), EggSAnimData::write(), EggPoint::write(), EggNurbsSurface::write(), EggNurbsCurve::write(), write(), EggLine::write(), EggGroup::write(), EggExternalReference::write(), EggComment::write(), and EggAnimPreload::write().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations