publish egg interfaces

This commit is contained in:
David Rose 2003-10-07 13:37:59 +00:00
parent 10131ba504
commit a7562e48d0
54 changed files with 283 additions and 170 deletions

View File

@ -0,0 +1,11 @@
# For iterating over children
def getChildren(self):
"""Returns a Python list of the egg node's children."""
result = []
child = self.getFirstChild()
while (child != None):
result.append(child)
child = self.getNextChild()
return result

View File

@ -0,0 +1,8 @@
# For iterating over vertices
def getVertices(self):
"""Returns a Python list of the egg primitive's vertices."""
result = []
for i in range(self.getNumVertices()):
result.append(self.getVertex(i))
return result

View File

@ -87,6 +87,7 @@
pt_EggTexture.h vector_PT_EggTexture.h \
pt_EggVertex.h vector_PT_EggVertex.h
#define IGATESCAN all
#end lib_target

View File

@ -19,12 +19,12 @@
#ifndef EGGANIMDATA_H
#define EGGANIMDATA_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include <pointerToArray.h>
#include <pta_double.h>
#include "pointerToArray.h"
#include "pta_double.h"
////////////////////////////////////////////////////////////////////
// Class : EggAnimData
@ -32,7 +32,7 @@
// which contain rows and columns of numbers.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggAnimData : public EggNode {
public:
PUBLISHED:
INLINE EggAnimData(const string &name = "");
INLINE EggAnimData(const EggAnimData &copy);

View File

@ -19,12 +19,12 @@
#ifndef EGGATTRIBUTES_H
#define EGGATTRIBUTES_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggMorphList.h"
#include <typedObject.h>
#include <luse.h>
#include "typedObject.h"
#include "luse.h"
////////////////////////////////////////////////////////////////////
// Class : EggAttributes
@ -38,7 +38,7 @@
// EggObject a virtual base class is just no fun.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggAttributes {
public:
PUBLISHED:
EggAttributes();
EggAttributes(const EggAttributes &copy);
EggAttributes &operator = (const EggAttributes &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGBIN_H
#define EGGBIN_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggGroup.h"
@ -32,7 +32,7 @@
// EggBinMaker.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggBin : public EggGroup {
public:
PUBLISHED:
EggBin(const string &name = "");
EggBin(const EggGroup &copy);
EggBin(const EggBin &copy);

View File

@ -204,12 +204,12 @@
///////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include "pandabase.h"
#include "eggObject.h"
#include <pointerTo.h>
#include <notify.h>
#include "pointerTo.h"
#include "notify.h"
#include "pset.h"
#include "pmap.h"
@ -248,7 +248,7 @@ public:
// comment above.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggBinMaker : public EggObject {
public:
PUBLISHED:
EggBinMaker();
~EggBinMaker();

View File

@ -19,19 +19,17 @@
#ifndef EGGCOMMENT_H
#define EGGCOMMENT_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include <string>
///////////////////////////////////////////////////////////////////
// Class : EggComment
// Description : A comment that appears in an egg file within a
// <Comment> entry.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggComment : public EggNode {
public:
PUBLISHED:
INLINE EggComment(const string &node_name, const string &comment);
INLINE EggComment(const EggComment &copy);

View File

@ -19,11 +19,11 @@
#ifndef EGGCOORDINATESYSTEM_H
#define EGGCOORDINATESYSTEM_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include "eggData.h"
#include <coordinateSystem.h>
#include "coordinateSystem.h"
///////////////////////////////////////////////////////////////////

View File

@ -19,7 +19,7 @@
#ifndef EGGCURVE_H
#define EGGCURVE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggPrimitive.h"
@ -29,7 +29,7 @@
// EggNurbsCurve.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggCurve : public EggPrimitive {
public:
PUBLISHED:
INLINE EggCurve(const string &name = "");
INLINE EggCurve(const EggCurve &copy);
INLINE EggCurve &operator = (const EggCurve &copy);

View File

@ -19,16 +19,13 @@
#ifndef EGGDATA_H
#define EGGDATA_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggGroupNode.h"
#include <filename.h>
#include <coordinateSystem.h>
#include <notify.h>
#include <dSearchPath.h>
#include <string>
#include "filename.h"
#include "coordinateSystem.h"
#include "notify.h"
#include "dSearchPath.h"
///////////////////////////////////////////////////////////////////
// Class : EggData
@ -44,7 +41,7 @@
// are the toplevel nodes in the egg file.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggData : public EggGroupNode {
public:
PUBLISHED:
INLINE EggData();
INLINE EggData(const EggData &copy);
INLINE EggData &operator = (const EggData &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGEXTERNALREFERENCE_H
#define EGGEXTERNALREFERENCE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggFilenameNode.h"
@ -29,7 +29,7 @@
// be inserted at this point.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggExternalReference : public EggFilenameNode {
public:
PUBLISHED:
EggExternalReference(const string &node_name, const string &filename);
EggExternalReference(const EggExternalReference &copy);
EggExternalReference &operator = (const EggExternalReference &copy);

View File

@ -19,10 +19,10 @@
#ifndef EGGFILENAMENODE_H
#define EGGFILENAMENODE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include <filename.h>
#include "filename.h"
////////////////////////////////////////////////////////////////////
// Class : EggFilenameNode
@ -32,7 +32,7 @@
// EggTexture and EggExternalReference.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggFilenameNode : public EggNode {
public:
PUBLISHED:
INLINE EggFilenameNode();
INLINE EggFilenameNode(const string &node_name, const Filename &filename);
INLINE EggFilenameNode(const EggFilenameNode &copy);

View File

@ -38,7 +38,7 @@
// to the <Group>, <Instance>, and <Joint> type nodes.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggGroup : public EggGroupNode, public EggRenderMode, public EggTransform3d {
public:
PUBLISHED:
typedef pmap<PT_EggVertex, double> VertexRef;
typedef pmap<string, string> TagData;
@ -199,10 +199,12 @@ public:
INLINE bool has_tag(const string &key) const;
INLINE void clear_tag(const string &key);
public:
INLINE TagData::const_iterator tag_begin() const;
INLINE TagData::const_iterator tag_end() const;
INLINE TagData::size_type tag_size() const;
PUBLISHED:
void ref_vertex(EggVertex *vert, double membership = 1.0);
void unref_vertex(EggVertex *vert);
void unref_all_vertices();
@ -210,10 +212,12 @@ public:
void set_vertex_membership(EggVertex *vert, double membership);
void steal_vrefs(EggGroup *other);
public:
INLINE VertexRef::const_iterator vref_begin() const;
INLINE VertexRef::const_iterator vref_end() const;
INLINE VertexRef::size_type vref_size() const;
PUBLISHED:
#ifndef NDEBUG
void test_vref_integrity() const;
#else

View File

@ -148,26 +148,6 @@ rend() const {
return _children.rend();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::empty
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
bool EggGroupNode::
empty() const {
return _children.empty();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::size
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
EggGroupNode::size_type EggGroupNode::
size() const {
return _children.size();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::insert
// Access: Public
@ -221,6 +201,26 @@ replace(iterator position, PT(EggNode) x) {
*(Children::iterator &)position = x;
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::empty
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
bool EggGroupNode::
empty() const {
return _children.empty();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::size
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
EggGroupNode::size_type EggGroupNode::
size() const {
return _children.size();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::clear
// Access: Public
@ -231,6 +231,45 @@ clear() {
erase(begin(), end());
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::get_first_child
// Access: Public
// Description: Returns the first child in the group's list of
// children, or NULL if the list of children is empty.
// Can be used with get_next_child() to return the
// complete list of children without using the iterator
// class; however, this is non-thread-safe, and so is
// not recommended except for languages other than C++
// which cannot use the iterators.
////////////////////////////////////////////////////////////////////
EggNode *EggGroupNode::
get_first_child() {
_gnc_iterator = begin();
return get_next_child();
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::get_next_child
// Access: Public
// Description: Returns the next child in the group's list of
// children since the last call to get_first_child() or
// get_next_child(), or NULL if the last child has been
// returned. Can be used with get_first_child() to
// return the complete list of children without using
// the iterator class; however, this is non-thread-safe,
// and so is not recommended except for languages other
// than C++ which cannot use the iterators.
//
// It is an error to call this without previously
// calling get_first_child().
////////////////////////////////////////////////////////////////////
EggNode *EggGroupNode::
get_next_child() {
if (_gnc_iterator != end()) {
return *_gnc_iterator++;
}
return NULL;
}
////////////////////////////////////////////////////////////////////
// Function: EggGroupNode::add_child
@ -239,8 +278,9 @@ clear() {
// If the child node is already a child of some other
// node, removes it first.
////////////////////////////////////////////////////////////////////
PT(EggNode) EggGroupNode::
add_child(PT(EggNode) node) {
EggNode *EggGroupNode::
add_child(EggNode *node) {
PT(EggNode) ptnode = node;
if (node->_parent != NULL) {
node->_parent->remove_child(node);
}
@ -257,14 +297,15 @@ add_child(PT(EggNode) node) {
// group, does nothing and returns NULL.
////////////////////////////////////////////////////////////////////
PT(EggNode) EggGroupNode::
remove_child(PT(EggNode) node) {
iterator i = find(begin(), end(), node);
remove_child(EggNode *node) {
PT(EggNode) ptnode = node;
iterator i = find(begin(), end(), ptnode);
if (i == end()) {
return PT(EggNode)();
} else {
// erase() calls prepare_remove_child().
erase(i);
return node;
return ptnode;
}
}

View File

@ -63,7 +63,7 @@ private:
// Here begins the actual public interface to EggGroupNode.
public:
PUBLISHED:
EggGroupNode(const string &name = "") : EggNode(name) { }
EggGroupNode(const EggGroupNode &copy);
EggGroupNode &operator = (const EggGroupNode &copy);
@ -75,7 +75,7 @@ public:
// pointers to EggNodes. The set of children is read-only, however,
// except through the limited add_child/remove_child or insert/erase
// interface. The following implements this.
public:
#ifdef WIN32_VC
typedef const PT(EggNode) *pointer;
typedef const PT(EggNode) *const_pointer;
@ -96,17 +96,26 @@ public:
iterator end() const;
reverse_iterator rbegin() const;
reverse_iterator rend() const;
bool empty() const;
size_type size() const;
iterator insert(iterator position, PT(EggNode) x);
iterator erase(iterator position);
iterator erase(iterator first, iterator last);
void replace(iterator position, PT(EggNode) x);
PUBLISHED:
bool empty() const;
size_type size() const;
void clear();
PT(EggNode) add_child(PT(EggNode) node);
PT(EggNode) remove_child(PT(EggNode) node);
// This is an alternate way to traverse the list of children. It is
// mainly provided for scripting code, which can't use the iterators
// defined above (they don't export through interrogate very well).
// These are, of course, non-thread-safe.
EggNode *get_first_child();
EggNode *get_next_child();
EggNode *add_child(EggNode *node);
PT(EggNode) remove_child(EggNode *node);
void steal_children(EggGroupNode &other);
EggNode *find_child(const string &name) const;
@ -143,6 +152,7 @@ protected:
private:
Children _children;
const_iterator _gnc_iterator;
// Don't try to use these private functions. User code should add
// and remove children via add_child()/remove_child(), or via the

View File

@ -19,7 +19,7 @@
#ifndef EGGGROUPUNIQUIFIER_H
#define EGGGROUPUNIQUIFIER_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNameUniquifier.h"
@ -31,7 +31,7 @@
// you want it.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggGroupUniquifier : public EggNameUniquifier {
public:
PUBLISHED:
EggGroupUniquifier();
virtual string get_category(EggNode *node);

View File

@ -19,18 +19,18 @@
#ifndef EGGMATERIAL_H
#define EGGMATERIAL_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include <luse.h>
#include "luse.h"
///////////////////////////////////////////////////////////////////
// Class : EggMaterial
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggMaterial : public EggNode {
public:
PUBLISHED:
EggMaterial(const string &mref_name);
EggMaterial(const EggMaterial &copy);

View File

@ -19,13 +19,12 @@
#ifndef EGGMATERIALCOLLECTION_H
#define EGGMATERIALCOLLECTION_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggMaterial.h"
#include "eggGroupNode.h"
#include "vector_PT_EggMaterial.h"
#include <string>
#include "pmap.h"
////////////////////////////////////////////////////////////////////
@ -55,7 +54,7 @@ public:
// Here begins the actual public interface to EggMaterialCollection.
public:
PUBLISHED:
EggMaterialCollection();
EggMaterialCollection(const EggMaterialCollection &copy);
EggMaterialCollection &operator = (const EggMaterialCollection &copy);
@ -64,9 +63,12 @@ public:
void clear();
int extract_materials(EggGroupNode *node);
public:
EggGroupNode::iterator insert_materials(EggGroupNode *node);
EggGroupNode::iterator insert_materials(EggGroupNode *node, EggGroupNode::iterator position);
PUBLISHED:
int find_used_materials(EggNode *node);
void remove_unused_materials(EggNode *node);
@ -80,11 +82,13 @@ public:
// Can be used to traverse all the materials in the collection, in
// order as last sorted.
public:
INLINE iterator begin() const;
INLINE iterator end() const;
INLINE bool empty() const;
INLINE size_type size() const;
PUBLISHED:
bool add_material(EggMaterial *material);
bool remove_material(EggMaterial *material);

View File

@ -19,10 +19,10 @@
#ifndef EGGMORPH_H
#define EGGMORPH_H
#include <pandabase.h>
#include "pandabase.h"
#include <namable.h>
#include <luse.h>
#include "namable.h"
#include "luse.h"
#include "pset.h"
////////////////////////////////////////////////////////////////////

View File

@ -23,7 +23,7 @@
#include "eggMorph.h"
#include <indent.h>
#include "indent.h"
#include "pvector.h"

View File

@ -74,7 +74,7 @@
//
///////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include "pandabase.h"
#include "eggObject.h"
@ -90,7 +90,7 @@ class EggNode;
// comment above.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggNameUniquifier : public EggObject {
public:
PUBLISHED:
EggNameUniquifier();
~EggNameUniquifier();

View File

@ -48,3 +48,8 @@ operator = (const EggNamedObject &copy) {
Namable::operator = (copy);
return *this;
}
INLINE ostream &operator << (ostream &out, const EggNamedObject &n) {
n.output(out);
return out;
}

View File

@ -19,10 +19,23 @@
#include "eggNamedObject.h"
#include "eggMiscFuncs.h"
#include <indent.h>
#include "indent.h"
TypeHandle EggNamedObject::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: EggNamedObject::output
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void EggNamedObject::
output(ostream &out) const {
out << get_type();
if (has_name()) {
out << " " << get_name();
}
}
////////////////////////////////////////////////////////////////////
// Function: EggNamedObject::write_header
// Access: Public

View File

@ -27,15 +27,18 @@
////////////////////////////////////////////////////////////////////
// Class : EggNamedObject
// Description : This is a fairly high-level base class--any egg
// Description : This is a fairly low-level base class--any egg
// object that has a name.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggNamedObject : public EggObject, public Namable {
public:
PUBLISHED:
INLINE EggNamedObject(const string &name = "");
INLINE EggNamedObject(const EggNamedObject &copy);
INLINE EggNamedObject &operator = (const EggNamedObject &copy);
void output(ostream &out) const;
public:
void write_header(ostream &out, int indent_level,
const char *egg_keyword) const;
@ -59,6 +62,8 @@ private:
static TypeHandle _type_handle;
};
INLINE ostream &operator << (ostream &out, const EggNamedObject &n);
#include "eggNamedObject.I"
#endif

View File

@ -19,14 +19,14 @@
#ifndef EGGNODE_H
#define EGGNODE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNamedObject.h"
#include <typedObject.h>
#include <lmatrix.h>
#include <pointerTo.h>
#include <referenceCount.h>
#include "typedObject.h"
#include "lmatrix.h"
#include "pointerTo.h"
#include "referenceCount.h"
class EggGroupNode;
class EggRenderMode;
@ -40,7 +40,7 @@ class EggTextureCollection;
// include things like vertices.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggNode : public EggNamedObject {
public:
PUBLISHED:
INLINE EggNode(const string &name = "");
INLINE EggNode(const EggNode &copy);
INLINE EggNode &operator = (const EggNode &copy);

View File

@ -19,18 +19,18 @@
#ifndef EGGNURBSCURVE_H
#define EGGNURBSCURVE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggCurve.h"
#include <vector_double.h>
#include "vector_double.h"
////////////////////////////////////////////////////////////////////
// Class : EggNurbsCurve
// Description : A parametric NURBS curve.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggNurbsCurve : public EggCurve {
public:
PUBLISHED:
INLINE EggNurbsCurve(const string &name = "");
INLINE EggNurbsCurve(const EggNurbsCurve &copy);
INLINE EggNurbsCurve &operator = (const EggNurbsCurve &copy);

View File

@ -30,7 +30,7 @@
// (Almost) all things egg inherit from this.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggObject : public TypedReferenceCount {
public:
PUBLISHED:
INLINE EggObject();
INLINE EggObject(const EggObject &copy);
INLINE EggObject &operator = (const EggObject &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGPARAMETERS_H
#define EGGPARAMETERS_H
#include <pandabase.h>
#include "pandabase.h"
///////////////////////////////////////////////////////////////////
// Class : EggParameters

View File

@ -19,7 +19,7 @@
#ifndef EGGPOINT_H
#define EGGPOINT_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggPrimitive.h"
@ -29,7 +29,7 @@
// by a single <PointLight> entry.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggPoint : public EggPrimitive {
public:
PUBLISHED:
INLINE EggPoint(const string &name = "");
INLINE EggPoint(const EggPoint &copy);
INLINE EggPoint &operator = (const EggPoint &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGPOLYGON_H
#define EGGPOLYGON_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggPrimitive.h"
@ -28,7 +28,7 @@
// Description : A single polygon.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggPolygon : public EggPrimitive {
public:
PUBLISHED:
INLINE EggPolygon(const string &name = "");
INLINE EggPolygon(const EggPolygon &copy);
INLINE EggPolygon &operator = (const EggPolygon &copy);

View File

@ -38,7 +38,7 @@
// of this class.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggPolysetMaker : public EggBinMaker {
public:
PUBLISHED:
// The BinNumber serves to identify why a particular EggBin was
// created.
enum BinNumber {

View File

@ -19,7 +19,7 @@
#ifndef EGGPOOLUNIQUIFIER_H
#define EGGPOOLUNIQUIFIER_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNameUniquifier.h"
@ -32,7 +32,7 @@
// an egg file.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggPoolUniquifier : public EggNameUniquifier {
public:
PUBLISHED:
EggPoolUniquifier();
virtual string get_category(EggNode *node);

View File

@ -313,6 +313,16 @@ clear() {
erase(begin(), end());
}
////////////////////////////////////////////////////////////////////
// Function: EggPrimitive::get_num_vertices
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE int EggPrimitive::
get_num_vertices() const {
return size();
}
////////////////////////////////////////////////////////////////////
// Function: EggPrimitive::set_vertex
// Access: Public

View File

@ -22,8 +22,8 @@
#include "eggTextureCollection.h"
#include "lexerDefs.h"
#include <indent.h>
#include <vector_int.h>
#include "indent.h"
#include "vector_int.h"
TypeHandle EggPrimitive::_type_handle;
@ -334,7 +334,7 @@ add_vertex(EggVertex *vertex) {
////////////////////////////////////////////////////////////////////
// Function: EggPrimitive::remove_vertex
// Access: Public
// Description: Removes the indicated vertex vertex from the
// Description: Removes the indicated vertex from the
// primitive and returns it. If the vertex was not
// already in the primitive, does nothing and returns
// NULL.

View File

@ -19,7 +19,7 @@
#ifndef EGGPRIMITIVE_H
#define EGGPRIMITIVE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggNode.h"
#include "eggAttributes.h"
@ -31,7 +31,7 @@
#include "pt_EggMaterial.h"
#include "vector_PT_EggVertex.h"
#include <pointerTo.h>
#include "pointerTo.h"
#include "pvector.h"
class EggVertexPool;
@ -62,7 +62,7 @@ private:
// Here begins the actual public interface to EggPrimitive.
public:
PUBLISHED:
INLINE EggPrimitive(const string &name = "");
INLINE EggPrimitive(const EggPrimitive &copy);
INLINE EggPrimitive &operator = (const EggPrimitive &copy);
@ -101,7 +101,7 @@ public:
// pointers to EggVertex objects. The set of vertices is read-only,
// however, except through the limited add_vertex/remove_vertex or
// insert/erase interface. The following implements this.
public:
#ifdef WIN32_VC
typedef PT_EggVertex *pointer;
typedef PT_EggVertex *const_pointer;
@ -131,6 +131,8 @@ public:
INLINE iterator erase(iterator position);
iterator erase(iterator first, iterator last);
INLINE void replace(iterator position, EggVertex *vertex);
PUBLISHED:
INLINE void clear();
EggVertex *add_vertex(EggVertex *vertex);
@ -138,6 +140,7 @@ public:
void copy_vertices(const EggPrimitive &other);
// These are shorthands if you don't want to use the iterators.
INLINE int get_num_vertices() const;
INLINE void set_vertex(int index, EggVertex *vertex);
INLINE EggVertex *get_vertex(int index) const;

View File

@ -38,7 +38,7 @@
// EggObject a virtual base class is just no fun.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggRenderMode {
public:
PUBLISHED:
INLINE EggRenderMode();
INLINE EggRenderMode(const EggRenderMode &copy);
INLINE EggRenderMode &operator = (const EggRenderMode &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGSANIMDATA_H
#define EGGSANIMDATA_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggAnimData.h"
@ -30,7 +30,7 @@
// target, or as one column in an EggXfmSAnim.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggSAnimData : public EggAnimData {
public:
PUBLISHED:
INLINE EggSAnimData(const string &name = "");
INLINE EggSAnimData(const EggSAnimData &copy);
INLINE EggSAnimData &operator = (const EggSAnimData &copy);

View File

@ -19,7 +19,7 @@
#ifndef EGGSURFACE_H
#define EGGSURFACE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggPrimitive.h"
@ -29,7 +29,7 @@
// EggNurbsSurface.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggSurface : public EggPrimitive {
public:
PUBLISHED:
INLINE EggSurface(const string &name = "");
INLINE EggSurface(const EggSurface &copy);
INLINE EggSurface &operator = (const EggSurface &copy);

View File

@ -19,10 +19,10 @@
#ifndef EGGSWITCHCONDITION
#define EGGSWITCHCONDITION
#include <pandabase.h>
#include "pandabase.h"
#include "eggObject.h"
#include <luse.h>
#include "luse.h"
////////////////////////////////////////////////////////////////////
// Class : EggSwitchCondition
@ -35,7 +35,7 @@
// actually supported.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggSwitchCondition : public EggObject {
public:
PUBLISHED:
virtual EggSwitchCondition *make_copy() const=0;
virtual void write(ostream &out, int indent_level) const=0;

View File

@ -19,7 +19,7 @@
#ifndef EGGTABLE_H
#define EGGTABLE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggGroupNode.h"
@ -33,7 +33,7 @@
// hierarchy of tables.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggTable : public EggGroupNode {
public:
PUBLISHED:
enum TableType {
TT_invalid,
TT_table,

View File

@ -19,21 +19,21 @@
#ifndef EGGTEXTURE_H
#define EGGTEXTURE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggRenderMode.h"
#include "eggFilenameNode.h"
#include <luse.h>
#include "luse.h"
////////////////////////////////////////////////////////////////////
// Class : EggTexture
// Class : EggTexture
// Description : Defines a texture map that may be applied to
// geometry.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggTexture : public EggFilenameNode, public EggRenderMode {
public:
PUBLISHED:
EggTexture(const string &tref_name, const string &filename);
EggTexture(const EggTexture &copy);
EggTexture &operator = (const EggTexture &copy);

View File

@ -19,13 +19,12 @@
#ifndef EGGTEXTURECOLLECTION_H
#define EGGTEXTURECOLLECTION_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggTexture.h"
#include "eggGroupNode.h"
#include "vector_PT_EggTexture.h"
#include <string>
#include "pmap.h"
////////////////////////////////////////////////////////////////////
@ -55,7 +54,7 @@ public:
// Here begins the actual public interface to EggTextureCollection.
public:
PUBLISHED:
EggTextureCollection();
EggTextureCollection(const EggTextureCollection &copy);
EggTextureCollection &operator = (const EggTextureCollection &copy);
@ -64,9 +63,12 @@ public:
void clear();
int extract_textures(EggGroupNode *node);
public:
EggGroupNode::iterator insert_textures(EggGroupNode *node);
EggGroupNode::iterator insert_textures(EggGroupNode *node, EggGroupNode::iterator position);
PUBLISHED:
int find_used_textures(EggNode *node);
void remove_unused_textures(EggNode *node);
@ -80,11 +82,13 @@ public:
// Can be used to traverse all the textures in the collection, in
// order as last sorted.
public:
INLINE iterator begin() const;
INLINE iterator end() const;
INLINE bool empty() const;
INLINE size_type size() const;
PUBLISHED:
bool add_texture(EggTexture *texture);
bool remove_texture(EggTexture *texture);

View File

@ -31,7 +31,7 @@
// computes a 4x4 matrix.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggTransform3d {
public:
PUBLISHED:
EggTransform3d();
EggTransform3d(const EggTransform3d &copy);
EggTransform3d &operator = (const EggTransform3d &copy);

View File

@ -36,7 +36,7 @@
// object only.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggUserData : public TypedReferenceCount {
public:
PUBLISHED:
INLINE EggUserData();
INLINE EggUserData(const EggUserData &copy);
INLINE EggUserData &operator = (const EggUserData &copy);

View File

@ -28,13 +28,13 @@
//
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include "pandabase.h"
#include "eggTexture.h"
#include "pt_EggTexture.h"
#include <filename.h>
#include <pointerTo.h>
#include "filename.h"
#include "pointerTo.h"
#include "pset.h"
#include "pmap.h"

View File

@ -19,14 +19,14 @@
#ifndef EGGVERTEX_H
#define EGGVERTEX_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggObject.h"
#include "eggAttributes.h"
#include "eggMorphList.h"
#include <referenceCount.h>
#include <luse.h>
#include "referenceCount.h"
#include "luse.h"
#include "pset.h"
class EggVertexPool;
@ -44,6 +44,7 @@ public:
typedef pset<EggGroup *> GroupRef;
typedef pmultiset<EggPrimitive *> PrimitiveRef;
PUBLISHED:
EggVertex();
EggVertex(const EggVertex &copy);
EggVertex &operator = (const EggVertex &copy);
@ -84,17 +85,21 @@ public:
void transform(const LMatrix4d &mat);
public:
GroupRef::const_iterator gref_begin() const;
GroupRef::const_iterator gref_end() const;
GroupRef::size_type gref_size() const;
PUBLISHED:
bool has_gref(const EggGroup *group) const;
void copy_grefs_from(const EggVertex &other);
void clear_grefs();
public:
PrimitiveRef::const_iterator pref_begin() const;
PrimitiveRef::const_iterator pref_end() const;
PrimitiveRef::size_type pref_size() const;
PUBLISHED:
int has_pref(const EggPrimitive *prim) const;
#ifndef NDEBUG

View File

@ -19,17 +19,17 @@
#ifndef EGGVERTEXPOOL_H
#define EGGVERTEXPOOL_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggVertex.h"
#include "eggNode.h"
#include "pt_EggVertex.h"
#include <pointerTo.h>
#include "pointerTo.h"
#include "pset.h"
#include "pmap.h"
#include <lmatrix.h>
#include <iterator_types.h>
#include "lmatrix.h"
#include "iterator_types.h"
////////////////////////////////////////////////////////////////////
// Class : EggVertexPool
@ -72,7 +72,7 @@ public:
// Here begins the actual public interface to EggVertexPool.
public:
PUBLISHED:
EggVertexPool(const string &name);
EggVertexPool(const EggVertexPool &copy);
~EggVertexPool();
@ -84,12 +84,14 @@ public:
// Returns 0 if the pool is empty.
int get_highest_index() const;
public:
// Can be used to traverse all the vertices in index number order.
iterator begin() const;
iterator end() const;
bool empty() const;
size_type size() const;
PUBLISHED:
// add_vertex() adds a freshly-allocated vertex. It is up to the
// user to allocate the vertex.
void add_vertex(EggVertex *vertex, int index = -1);

View File

@ -34,7 +34,7 @@
// currently--it's replaced by EggXfmSAnim.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggXfmAnimData : public EggAnimData {
public:
PUBLISHED:
INLINE EggXfmAnimData(const string &name = "",
CoordinateSystem cs = CS_default);
EggXfmAnimData(const EggXfmSAnim &convert_from);

View File

@ -35,7 +35,7 @@ class EggXfmAnimData;
// any number of EggSAnimData children.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggXfmSAnim : public EggGroupNode {
public:
PUBLISHED:
INLINE EggXfmSAnim(const string &name = "",
CoordinateSystem cs = CS_default);
EggXfmSAnim(const EggXfmAnimData &convert_from);

View File

@ -42,4 +42,6 @@
#define INSTALL_HEADERS \
load_egg_file.h config_egg2pg.h
#define IGATESCAN load_egg_file.h
#end lib_target

View File

@ -36,8 +36,8 @@ class CharacterJointBundle;
class Character;
class CharacterSlider;
class MovingPartBase;
class NamedNode;
class EggLoader;
class PandaNode;
///////////////////////////////////////////////////////////////////
// Class : CharacterMaker

View File

@ -22,7 +22,6 @@
#include "sceneGraphReducer.h"
#include "virtualFileSystem.h"
#include "config_util.h"
#include "config_express.h"
static PT(PandaNode)
load_from_loader(EggLoader &loader) {
@ -80,32 +79,18 @@ load_egg_file(const string &filename, CoordinateSystem cs) {
EggLoader loader;
loader._data.set_egg_filename(egg_filename);
loader._data.set_auto_resolve_externals(true);
if (cs != CS_default) {
loader._data.set_coordinate_system(cs);
}
loader._data.set_coordinate_system(cs);
bool okflag;
if (use_vfs) {
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
istream *istr = vfs->open_read_file(egg_filename);
if (istr == (istream *)NULL) {
egg2pg_cat.error()
<< "Could not open " << egg_filename << " for reading.\n";
return NULL;
}
okflag = loader._data.read(*istr);
delete istr;
} else {
ifstream file;
if (!egg_filename.open_read(file)) {
egg2pg_cat.error()
<< "Could not open " << egg_filename << " for reading.\n";
return NULL;
}
okflag = loader._data.read(file);
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
istream *istr = vfs->open_read_file(egg_filename);
if (istr == (istream *)NULL) {
egg2pg_cat.error()
<< "Could not open " << egg_filename << " for reading.\n";
return NULL;
}
okflag = loader._data.read(*istr);
delete istr;
if (!okflag) {
egg2pg_cat.error()
@ -124,7 +109,7 @@ load_egg_file(const string &filename, CoordinateSystem cs) {
// loading.
////////////////////////////////////////////////////////////////////
PT(PandaNode)
load_egg_data(EggData &data) {
load_egg_data(EggData &data, CoordinateSystem cs) {
// We temporarily shuttle the children to a holding node so we can
// copy them into the EggLoader's structure without it complaining.
EggGroupNode children_holder;
@ -133,5 +118,8 @@ load_egg_data(EggData &data) {
EggLoader loader(data);
loader._data.steal_children(children_holder);
loader._data.set_auto_resolve_externals(true);
loader._data.set_coordinate_system(cs);
return load_from_loader(loader);
}

View File

@ -26,6 +26,7 @@
class EggData;
BEGIN_PUBLISH
////////////////////////////////////////////////////////////////////
// Function: load_egg_file
// Description: A convenience function; the primary interface to this
@ -47,6 +48,7 @@ load_egg_file(const string &filename, CoordinateSystem cs = CS_default);
// loading.
////////////////////////////////////////////////////////////////////
EXPCL_PANDAEGG PT(PandaNode)
load_egg_data(EggData &data);
load_egg_data(EggData &data, CoordinateSystem cs = CS_default);
END_PUBLISH
#endif