mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
added a geom tag, setPreserved, which prevents flattening
This commit is contained in:
parent
7454d3e33e
commit
be02db659d
@ -28,6 +28,17 @@ get_num_geoms() const {
|
||||
return cdata->get_geoms()->size();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomNode::get_num_geoms
|
||||
// Access: Public
|
||||
// Description: Returns the number of geoms in the node.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomNode::
|
||||
set_preserved(bool value){
|
||||
_preserved = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomNode::get_geom
|
||||
// Access: Public
|
||||
|
@ -45,6 +45,7 @@ GeomNode(const string &name) :
|
||||
PandaNode(name)
|
||||
{
|
||||
// GeomNodes have a certain set of bits on by default.
|
||||
_preserved = false;
|
||||
set_into_collide_mask(get_default_collide_mask());
|
||||
}
|
||||
|
||||
@ -56,7 +57,8 @@ GeomNode(const string &name) :
|
||||
GeomNode::
|
||||
GeomNode(const GeomNode ©) :
|
||||
PandaNode(copy),
|
||||
_cycler(copy._cycler)
|
||||
_cycler(copy._cycler),
|
||||
_preserved(copy._preserved)
|
||||
{
|
||||
}
|
||||
|
||||
@ -222,6 +224,46 @@ xform(const LMatrix4f &mat) {
|
||||
transformer.transform_vertices(this, mat);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomNode::safe_to_flatten
|
||||
// Access: Public, Virtual
|
||||
// Description: Transforms the contents of this node by the indicated
|
||||
// matrix, if it means anything to do so. For most
|
||||
// kinds of nodes, this does nothing.
|
||||
//
|
||||
// For a GeomNode, this does the right thing, but it is
|
||||
// better to use a GeomTransformer instead, since it
|
||||
// will share the new arrays properly between different
|
||||
// GeomNodes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool GeomNode::
|
||||
safe_to_flatten() const {
|
||||
if(_preserved)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomNode::safe_to_combine
|
||||
// Access: Public, Virtual
|
||||
// Description: Transforms the contents of this node by the indicated
|
||||
// matrix, if it means anything to do so. For most
|
||||
// kinds of nodes, this does nothing.
|
||||
//
|
||||
// For a GeomNode, this does the right thing, but it is
|
||||
// better to use a GeomTransformer instead, since it
|
||||
// will share the new arrays properly between different
|
||||
// GeomNodes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool GeomNode::
|
||||
safe_to_combine() const {
|
||||
if(_preserved)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomNode::combine_with
|
||||
// Access: Public, Virtual
|
||||
|
@ -57,7 +57,12 @@ public:
|
||||
virtual bool is_renderable() const;
|
||||
virtual CollideMask get_legal_collide_mask() const;
|
||||
|
||||
virtual bool safe_to_flatten() const;
|
||||
virtual bool safe_to_combine() const;
|
||||
|
||||
PUBLISHED:
|
||||
|
||||
INLINE void set_preserved(bool value);
|
||||
INLINE int get_num_geoms() const;
|
||||
INLINE const Geom *get_geom(int n) const;
|
||||
INLINE Geom *get_unique_geom(int n);
|
||||
@ -98,6 +103,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
bool _preserved;
|
||||
typedef RefCountObj< pvector<GeomEntry> > GeomList;
|
||||
typedef pmap<const InternalName *, int> NameCount;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user