add has_normals

This commit is contained in:
David Rose 2004-05-04 23:34:11 +00:00
parent fedbdb47cb
commit fb79ed6314
6 changed files with 59 additions and 0 deletions

View File

@ -803,6 +803,27 @@ joint_has_primitives() const {
return false; return false;
} }
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::has_normals
// Access: Published, Virtual
// Description: 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.
////////////////////////////////////////////////////////////////////
bool EggGroupNode::
has_normals() const {
Children::const_iterator ci;
for (ci = _children.begin();
ci != _children.end();
++ci) {
if ((*ci)->has_normals()) {
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::update_under // Function: EggGroupNode::update_under
// Access: Protected, Virtual // Access: Protected, Virtual

View File

@ -134,6 +134,7 @@ PUBLISHED:
int remove_invalid_primitives(); int remove_invalid_primitives();
virtual bool has_primitives() const; virtual bool has_primitives() const;
virtual bool joint_has_primitives() const; virtual bool joint_has_primitives() const;
virtual bool has_normals() const;
protected: protected:
virtual void update_under(int depth_offset); virtual void update_under(int depth_offset);

View File

@ -346,6 +346,18 @@ joint_has_primitives() const {
return false; return false;
} }
////////////////////////////////////////////////////////////////////
// Function: EggNode::has_normals
// Access: Published, Virtual
// Description: 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.
////////////////////////////////////////////////////////////////////
bool EggNode::
has_normals() const {
return false;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: EggNode::r_transform // Function: EggNode::r_transform

View File

@ -103,6 +103,7 @@ protected:
virtual void adjust_under(); virtual void adjust_under();
virtual bool has_primitives() const; virtual bool has_primitives() const;
virtual bool joint_has_primitives() const; virtual bool joint_has_primitives() const;
virtual bool has_normals() const;
virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv,
CoordinateSystem to_cs); CoordinateSystem to_cs);

View File

@ -356,6 +356,29 @@ joint_has_primitives() const {
return true; return true;
} }
////////////////////////////////////////////////////////////////////
// Function: EggPrimitive::has_normals
// Access: Published, Virtual
// Description: 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.
////////////////////////////////////////////////////////////////////
bool EggPrimitive::
has_normals() const {
if (has_normal()) {
return true;
}
const_iterator vi;
for (vi = begin(); vi != end(); ++vi) {
if ((*vi)->has_normal()) {
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: EggPrimitive::erase // Function: EggPrimitive::erase

View File

@ -102,6 +102,7 @@ PUBLISHED:
void remove_nonunique_verts(); void remove_nonunique_verts();
virtual bool has_primitives() const; virtual bool has_primitives() const;
virtual bool joint_has_primitives() const; virtual bool joint_has_primitives() const;
virtual bool has_normals() const;
// The EggPrimitive itself appears to be an STL container of // The EggPrimitive itself appears to be an STL container of