From 1faecc8269e3b8920da54f9fbb5ee3aaadf55a58 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 2 Mar 2001 00:14:22 +0000 Subject: [PATCH] *** empty log message *** --- dtool/pptempl/Template.models.pp | 48 ++++++ panda/src/cull/cullTraverser.cxx | 4 + panda/src/egg/eggNode.I | 2 +- panda/src/egg2sg/characterMaker.cxx | 41 +++-- panda/src/egg2sg/computedVerticesMaker.cxx | 49 ++++++ panda/src/egg2sg/computedVerticesMaker.h | 19 ++- panda/src/egg2sg/eggLoader.cxx | 38 ++--- panda/src/gobj/geom.I | 169 ++++++++++++++++++++- panda/src/gobj/geom.cxx | 47 ++---- panda/src/gobj/geom.h | 29 ++-- panda/src/gobj/geomLine.h | 3 +- panda/src/gobj/geomLinestrip.h | 3 +- panda/src/gobj/geomPoint.h | 3 +- panda/src/gobj/geomPolygon.h | 3 +- panda/src/gobj/geomQuad.h | 3 +- panda/src/gobj/geomSphere.h | 3 +- panda/src/gobj/geomSprite.h | 3 +- panda/src/gobj/geomTri.h | 3 +- panda/src/gobj/geomTrifan.h | 3 +- panda/src/gobj/geomTristrip.h | 3 +- panda/src/linmath/luse.N | 10 ++ panda/src/putil/pointerToArray.I | 125 ++++++++------- panda/src/putil/pointerToArray.h | 20 ++- 23 files changed, 474 insertions(+), 157 deletions(-) diff --git a/dtool/pptempl/Template.models.pp b/dtool/pptempl/Template.models.pp index d181e151df..f212fa4f22 100644 --- a/dtool/pptempl/Template.models.pp +++ b/dtool/pptempl/Template.models.pp @@ -98,6 +98,7 @@ install-bam : $[install_bam_targets] install-other : $[install_other_targets] install : install-other install-bam +uninstall : uninstall-other uninstall-bam uninstall-egg clean-bam : #if $[bam_targets] @@ -284,6 +285,15 @@ $[dest]/$[local] : $[source_prefix]$[local] #end egg #end install_egg +// Egg file uninstallation. +uninstall-egg : +#forscopes install_egg + #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES] $[UNPAL_SOURCES]] + #if $[files] + rm -f $[files] + #endif +#end install_egg + // Bam file installation. #forscopes install_egg @@ -299,6 +309,16 @@ $[dest]/$[local] : $[sourcedir]/$[local] #end egg #end install_egg +// Bam file uninstallation. +uninstall-bam : +#forscopes install_egg + #define files $[patsubst %.egg,$[install_model_dir]/%.bam,$[SOURCES] $[UNPAL_SOURCES]] + #if $[files] + rm -f $[files] + #endif +#end install_egg + + // Miscellaneous file installation. #forscopes install_audio install_dna install_icons install_misc @@ -313,6 +333,16 @@ $[dest]/$[local] : $[local] #end file #end install_audio install_dna install_icons install_misc +// Miscellaneous file uninstallation. +uninstall-other: +#forscopes install_audio install_dna install_icons install_misc + #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES]] + #if $[files] + rm -f $[files] + #endif +#end install_audio install_dna install_icons install_misc + + #end Makefile @@ -363,6 +393,9 @@ install-egg : egg pal repal $[subdirs:%=install-egg-%] install-bam : egg pal repal $[subdirs:%=install-bam-%] install-other : $[subdirs:%=install-other-%] install : egg pal repal $[subdirs:%=install-%] +uninstall-egg : $[subdirs:%=uninstall-egg-%] +uninstall-bam : $[subdirs:%=uninstall-bam-%] +uninstall-other : $[subdirs:%=uninstall-other-%] uninstall : $[subdirs:%=uninstall-%] # @@ -472,6 +505,21 @@ install-$[dirname] : cd ./$[PATH] && $(MAKE) install #end dirname +#formap dirname subdirs +uninstall-egg-$[dirname] : + cd ./$[PATH] && $(MAKE) uninstall-egg +#end dirname + +#formap dirname subdirs +uninstall-bam-$[dirname] : + cd ./$[PATH] && $(MAKE) uninstall-bam +#end dirname + +#formap dirname subdirs +uninstall-other-$[dirname] : + cd ./$[PATH] && $(MAKE) uninstall-other +#end dirname + #formap dirname subdirs uninstall-$[dirname] : cd ./$[PATH] && $(MAKE) uninstall diff --git a/panda/src/cull/cullTraverser.cxx b/panda/src/cull/cullTraverser.cxx index c6e831ac25..5036118d9c 100644 --- a/panda/src/cull/cullTraverser.cxx +++ b/panda/src/cull/cullTraverser.cxx @@ -510,6 +510,10 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, } node->draw_traverse(); + // We have to get a new _now timestamp, just in case either of the + // above traversals changed it. + _now = last_graph_update(_graph_type); + AllTransitionsWrapper trans; UpdateSeq last_update = arc->get_last_update(); diff --git a/panda/src/egg/eggNode.I b/panda/src/egg/eggNode.I index 7bcee61158..9ca6c32ab4 100644 --- a/panda/src/egg/eggNode.I +++ b/panda/src/egg/eggNode.I @@ -168,7 +168,7 @@ get_vertex_frame_inv() const { // Function: EggNode::get_node_frame_inv // Access: Public // Description: Returns the inverse of the matrix returned by -// get_vertex_frame(). See get_vertex_frame(). +// get_node_frame(). See get_node_frame(). //////////////////////////////////////////////////////////////////// INLINE const LMatrix4d &EggNode:: get_node_frame_inv() const { diff --git a/panda/src/egg2sg/characterMaker.cxx b/panda/src/egg2sg/characterMaker.cxx index 01d1cadea2..ef109b1f13 100644 --- a/panda/src/egg2sg/characterMaker.cxx +++ b/panda/src/egg2sg/characterMaker.cxx @@ -264,7 +264,7 @@ make_static_primitive(EggPrimitive *egg_primitive, EggGroupNode *prim_home) { LMatrix4d transform = egg_primitive->get_vertex_frame() * prim_home->get_node_frame_inv(); - + _loader.make_nonindexed_primitive(egg_primitive, node, &transform); } @@ -280,7 +280,7 @@ make_dynamic_primitive(EggPrimitive *egg_primitive, EggGroupNode *prim_home) { LMatrix4d transform = egg_primitive->get_vertex_frame() * prim_home->get_node_frame_inv(); - + _loader.make_indexed_primitive(egg_primitive, node, &transform, _comp_verts_maker); } @@ -342,18 +342,37 @@ determine_primitive_home(EggPrimitive *egg_primitive) { nassertr(home != NULL, NULL); // So, all the vertices are assigned to the same group. This means - // the polygon belongs entirely to one joint. If that joint happens - // to have a flag, and will therefore be an explicit animated - // node, we might as well put the polygon under that joint. - // Otherwise, we'll leave the polygon under the character node and - // animate it there explicitly. + // the polygon belongs entirely to one joint. + // If the group is not, in fact, a joint then we return the first + // joint above the group. + EggGroup *egg_group = (EggGroup *)NULL; if (home->is_of_type(EggGroup::get_class_type())) { - EggGroup *egg_group = DCAST(EggGroup, home); - if (egg_group->get_dcs_flag()) { - return home; + egg_group = DCAST(EggGroup, home); + } + while (egg_group != (EggGroup *)NULL && + egg_group->get_group_type() != EggGroup::GT_joint && + egg_group->get_dart_type() == EggGroup::DT_none) { + nassertr(egg_group->get_parent() != (EggGroupNode *)NULL, NULL); + home = egg_group->get_parent(); + egg_group = (EggGroup *)NULL; + if (home->is_of_type(EggGroup::get_class_type())) { + egg_group = DCAST(EggGroup, home); } } - return NULL; + if (egg_group != (EggGroup *)NULL && + egg_group->get_group_type() == EggGroup::GT_joint && + !egg_group->get_dcs_flag()) { + // If the home is a joint without a flag--this is the normal + // case--we'll move the polygon under the character node and + // animate it from there explicitly. + return NULL; + } + + // Otherwise, if the joint *does* have a flag, we'll create + // static geometry that we parent directly to the joint node. + // We'll also create static geometry for polygons that have no + // explicit joint assignment. + return home; } diff --git a/panda/src/egg2sg/computedVerticesMaker.cxx b/panda/src/egg2sg/computedVerticesMaker.cxx index ae2589be74..e7e3924c64 100644 --- a/panda/src/egg2sg/computedVerticesMaker.cxx +++ b/panda/src/egg2sg/computedVerticesMaker.cxx @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include @@ -67,6 +69,53 @@ add_joint(EggNode *joint, double membership) { } } +//////////////////////////////////////////////////////////////////// +// Function: ComputedVerticesMaker::add_vertex_joints +// Access: Public +// Description: Adds the joints the vertex belongs to, along with +// their respective memberships, to the current +// transform space definition. +//////////////////////////////////////////////////////////////////// +void ComputedVerticesMaker:: +add_vertex_joints(EggVertex *vertex, EggNode *object) { + if (vertex->gref_size() == 0) { + // This vertex belongs in the same group as the primitive that + // contains it. + EggGroupNode *egg_joint = object->get_parent(); + + // We actually walk up to find the first group above that that's a + // joint, or the character root itself, so we won't (a) be fooled + // by meaningless transforms on non-joints within a character + // hierarchy, or (b) consider meaninglessly different groups to be + // significant. + EggGroup *egg_group = (EggGroup *)NULL; + if (egg_joint->is_of_type(EggGroup::get_class_type())) { + egg_group = DCAST(EggGroup, egg_joint); + } + while (egg_group != (EggGroup *)NULL && + egg_group->get_group_type() != EggGroup::GT_joint && + egg_group->get_dart_type() == EggGroup::DT_none) { + nassertv(egg_group->get_parent() != (EggGroupNode *)NULL); + egg_joint = egg_group->get_parent(); + egg_group = (EggGroup *)NULL; + if (egg_joint->is_of_type(EggGroup::get_class_type())) { + egg_group = DCAST(EggGroup, egg_joint); + } + } + + add_joint(egg_joint, 1.0); + + } else { + // This vertex belongs in the joint or joints that reference it. + EggVertex::GroupRef::const_iterator gri; + for (gri = vertex->gref_begin(); gri != vertex->gref_end(); ++gri) { + EggGroup *egg_joint = (*gri); + double membership = egg_joint->get_vertex_membership(vertex); + add_joint(egg_joint, membership); + } + } +} + //////////////////////////////////////////////////////////////////// // Function: ComputedVerticesMaker::mark_space diff --git a/panda/src/egg2sg/computedVerticesMaker.h b/panda/src/egg2sg/computedVerticesMaker.h index 12e2dd2e71..f0f7f7c846 100644 --- a/panda/src/egg2sg/computedVerticesMaker.h +++ b/panda/src/egg2sg/computedVerticesMaker.h @@ -26,10 +26,26 @@ class ComputedVertices; class CharacterMaker; class EggNode; +class EggVertex; /////////////////////////////////////////////////////////////////// // Class : ComputedVerticesMaker -// Description : +// Description : An object to collect together all the vertices of a +// character, indicate what the transform space of each +// vertex is (which may be a soft-skinned combination of +// one or more joints), and identify which vertices may +// be shared together. +// +// Generally, you use a ComputedVerticesMaker by first +// defining a transform space via begin_new_space(), +// repeated calls to add_joint() (or +// add_vertex_joints()), and then mark_space(). Having +// done that, you can then add any number of vertices to +// the space via add_vertex(), add_normal(), etc., and +// it will return an index number for each vertex, +// collapsing duplicate vertices together properly. +// When you are ready to define a new space, simply +// repeat the process from begin_new_space(). //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG ComputedVerticesMaker { public: @@ -37,6 +53,7 @@ public: void begin_new_space(); void add_joint(EggNode *joint, double membership); + void add_vertex_joints(EggVertex *vertex, EggNode *object); void mark_space(); int add_vertex(const Vertexd &vertex, const EggMorphVertexList &morphs, diff --git a/panda/src/egg2sg/eggLoader.cxx b/panda/src/egg2sg/eggLoader.cxx index 17f6eafb6e..7c435f27bc 100644 --- a/panda/src/egg2sg/eggLoader.cxx +++ b/panda/src/egg2sg/eggLoader.cxx @@ -266,11 +266,13 @@ make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, BuilderBucket bucket; setup_bucket(bucket, parent, egg_prim); - LMatrix4d mat = egg_prim->get_vertex_to_node(); + LMatrix4d mat; if (transform != NULL) { - mat = (*transform) * mat; - } + mat = (*transform); + } else { + mat = egg_prim->get_vertex_to_node(); + } BuilderPrim bprim; bprim.set_type(BPT_poly); @@ -340,11 +342,13 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, bucket.set_texcoords(_comp_verts_maker._texcoords); bucket.set_colors(_comp_verts_maker._colors); - LMatrix4d mat = egg_prim->get_vertex_to_node(); + LMatrix4d mat; if (transform != NULL) { - mat = (*transform) * mat; - } + mat = (*transform); + } else { + mat = egg_prim->get_vertex_to_node(); + } BuilderPrimI bprim; bprim.set_type(BPT_poly); @@ -359,12 +363,7 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, EggPrimitive::const_iterator vi; for (vi = egg_prim->begin(); vi != egg_prim->end(); ++vi) { EggVertex *egg_vert = *vi; - EggVertex::GroupRef::const_iterator gri; - for (gri = egg_vert->gref_begin(); gri != egg_vert->gref_end(); ++gri) { - EggGroup *egg_joint = (*gri); - double membership = egg_joint->get_vertex_membership(egg_vert); - _comp_verts_maker.add_joint(egg_joint, membership); - } + _comp_verts_maker.add_vertex_joints(egg_vert, egg_prim); } _comp_verts_maker.mark_space(); @@ -390,20 +389,7 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, // Set up the ComputedVerticesMaker for the coordinate space of // the vertex. _comp_verts_maker.begin_new_space(); - if (egg_vert->gref_size() == 0) { - // This vertex belongs where the primitive is. - EggGroupNode *egg_joint = egg_prim->get_parent(); - _comp_verts_maker.add_joint(egg_joint, 1.0); - - } else { - // This vertex belongs in the joint or joints that reference it. - EggVertex::GroupRef::const_iterator gri; - for (gri = egg_vert->gref_begin(); gri != egg_vert->gref_end(); ++gri) { - EggGroup *egg_joint = (*gri); - double membership = egg_joint->get_vertex_membership(egg_vert); - _comp_verts_maker.add_joint(egg_joint, membership); - } - } + _comp_verts_maker.add_vertex_joints(egg_vert, egg_prim); _comp_verts_maker.mark_space(); int vindex = diff --git a/panda/src/gobj/geom.I b/panda/src/gobj/geom.I index 97f9abe1a3..0db5f41297 100644 --- a/panda/src/gobj/geom.I +++ b/panda/src/gobj/geom.I @@ -3,6 +3,172 @@ // //////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_binding +// Access: Published +// Description: Returns the GeomBindType which indicates the +// assignment of colors (or normals, etc.) to the +// primitives. +//////////////////////////////////////////////////////////////////// +INLINE GeomBindType Geom:: +get_binding(int attr) const { + return _bind[attr]; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_coords_array +// Access: Published +// Description: Returns the array of vertex coordinates associated +// with the Geom. This must have binding type +// G_PER_VERTEX. It may either be indexed or +// nonindexed, depending on whether get_coords_index() +// returns a NULL array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_Vertexf &Geom:: +get_coords_array() const { + return _coords; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_normals_array +// Access: Published +// Description: Returns the array of normals associated with the +// Geom. This may have any binding type. It may either +// be indexed or nonindexed, depending on whether +// get_normals_index() returns a NULL array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_Normalf &Geom:: +get_normals_array() const { + return _norms; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_colors_array +// Access: Published +// Description: Returns the array of colors associated with the +// Geom. This may have any binding type. It may either +// be indexed or nonindexed, depending on whether +// get_colors_index() returns a NULL array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_Colorf &Geom:: +get_colors_array() const { + return _colors; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_texcoords_array +// Access: Published +// Description: Returns the array of texcoords associated with the +// Geom. This may have a binding type of G_PER_VERTEX +// or G_OFF. It may either be indexed or nonindexed, +// depending on whether get_texcoords_index() returns a +// NULL array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_TexCoordf &Geom:: +get_texcoords_array() const { + return _texcoords; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_coords_index +// Access: Published +// Description: Returns the array of indices that, if nonempty, will +// be used to traverse the vertices in coords_array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_ushort &Geom:: +get_coords_index() const { + return _vindex; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_normals_index +// Access: Published +// Description: Returns the array of indices that, if nonempty, will +// be used to traverse the vertices in normals_array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_ushort &Geom:: +get_normals_index() const { + return _nindex; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_colors_index +// Access: Published +// Description: Returns the array of indices that, if nonempty, will +// be used to traverse the vertices in colors_array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_ushort &Geom:: +get_colors_index() const { + return _cindex; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_texcoords_index +// Access: Published +// Description: Returns the array of indices that, if nonempty, will +// be used to traverse the vertices in texcoords_array. +//////////////////////////////////////////////////////////////////// +INLINE const PTA_ushort &Geom:: +get_texcoords_index() const { + return _tindex; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::set_num_prims +// Access: Public +// Description: Sets the number of primitives in the Geom. The +// meaning of this depends on the precise type of Geom; +// generally, each prim is one triangle in a GeomTri, or +// one tristrip in a GeomTristrip. +//////////////////////////////////////////////////////////////////// +INLINE void Geom:: +set_num_prims(int num) { + _numprims = num; + make_dirty(); +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_num_prims +// Access: Public +// Description: Returns the number of primitives in the Geom. +//////////////////////////////////////////////////////////////////// +INLINE int Geom:: +get_num_prims(void) const { + return _numprims; +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::set_lengths +// Access: Public +// Description: Sets the array that indicates the length (number of +// vertices) of each primitive. This array should have +// get_num_prims() entries. This only has meaning for +// composite type Geoms, like a GeomTristrip; it is +// ignored for simple Geoms, like a GeomTri. +//////////////////////////////////////////////////////////////////// +INLINE void Geom:: +set_lengths(const PTA_int &lengths) { + _primlengths = lengths; + make_dirty(); +} + +//////////////////////////////////////////////////////////////////// +// Function: Geom::get_lengths +// Access: Public +// Description: Returns the array the indicates the length (number of +// vertices) of each primitive. This array will +// generally only be defined for composite type Geoms, +// like a GeomTristrip; it is meaningless for simple +// Geoms. +//////////////////////////////////////////////////////////////////// +INLINE PTA_int Geom:: +get_lengths() const { + return _primlengths; +} + + + //////////////////////////////////////////////////////////////////// // // make_vertex_iterator(), get_next_vertex() @@ -33,8 +199,7 @@ // Access: Public // Description: //////////////////////////////////////////////////////////////////// -INLINE Geom:: -VertexIterator Geom:: +INLINE Geom::VertexIterator Geom:: make_vertex_iterator() const { check_config(); VertexIterator i; diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 7bdbc3a429..5a65753f1f 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -306,27 +306,6 @@ get_texcoords(PTA_TexCoordf &texcoords, GeomBindType &bind, tindex = _tindex; } -//////////////////////////////////////////////////////////////////// -// Function: Geom::set_lengths -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Geom:: -set_lengths(const PTA_int &lengths) { - _primlengths = lengths; - make_dirty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Geom::get_lengths -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PTA_int Geom:: -get_lengths() const { - return _primlengths; -} - //////////////////////////////////////////////////////////////////// // Function: Geom::explode // Access: Public, Virtual @@ -424,23 +403,15 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void Geom:: output(ostream &out) const { - out << get_type() << " (" << _numprims << ") "; - out << "v:"; - if ( _coords != (Vertexf*)0L ) out << "1 "; else out << "0 "; - out << "n:"; - if ( _norms != (Normalf*)0L ) out << "1 "; else out << "0 "; - out << "c:"; - if ( _colors != (Colorf*)0L ) out << "1 "; else out << "0 "; - out << "t:"; - if ( _texcoords != (TexCoordf*)0L ) out << "1 "; else out << "0 "; - out << "vi:"; - if ( _vindex != (ushort*)0L ) out << "1 "; else out << "0 "; - out << "ni:"; - if ( _nindex != (ushort*)0L ) out << "1 "; else out << "0 "; - out << "ci:"; - if ( _cindex != (ushort*)0L ) out << "1 "; else out << "0 "; - out << "ti:"; - if ( _tindex != (ushort*)0L ) out << "1 "; else out << "0 "; + out << get_type() << " (" << _numprims << ")" + << " v:" << _coords.size() + << " n:" << _norms.size() + << " c:" << _colors.size() + << " t:" << _texcoords.size() + << " vi:" << _vindex.size() + << " ni:" << _nindex.size() + << " ci:" << _cindex.size() + << " ti:" << _tindex.size(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/geom.h b/panda/src/gobj/geom.h index 71161053cf..d55ae3fb55 100644 --- a/panda/src/gobj/geom.h +++ b/panda/src/gobj/geom.h @@ -33,6 +33,7 @@ class BamWriter; //////////////////////////////////////////////////////////////////// // Defines //////////////////////////////////////////////////////////////////// +BEGIN_PUBLISH enum GeomBindType { G_OFF, @@ -41,6 +42,7 @@ enum GeomBindType G_PER_COMPONENT, G_PER_VERTEX }; +END_PUBLISH static const int num_GeomBindTypes = 5; enum GeomAttrType @@ -126,10 +128,7 @@ public: public: void get_min_max( Vertexf& min, Vertexf& max ) const; - - GeomBindType get_binding( int attr ) const { - return _bind[attr]; - } + void set_coords( const PTA_Vertexf &coords, GeomBindType bind, @@ -160,12 +159,24 @@ public: void get_texcoords( PTA_TexCoordf &texcoords, GeomBindType &bind, PTA_ushort &tindex) const; + +PUBLISHED: + INLINE GeomBindType get_binding(int attr) const; + INLINE const PTA_Vertexf &get_coords_array() const; + INLINE const PTA_Normalf &get_normals_array() const; + INLINE const PTA_Colorf &get_colors_array() const; + INLINE const PTA_TexCoordf &get_texcoords_array() const; + INLINE const PTA_ushort &get_coords_index() const; + INLINE const PTA_ushort &get_normals_index() const; + INLINE const PTA_ushort &get_colors_index() const; + INLINE const PTA_ushort &get_texcoords_index() const; + +public: + INLINE void set_num_prims(int num); + INLINE int get_num_prims(void) const; - INLINE void set_num_prims(int num) { _numprims = num; make_dirty(); } - INLINE int get_num_prims(void) const { return _numprims; } - - void set_lengths( const PTA_int &lengths ); - PTA_int get_lengths() const; + INLINE void set_lengths(const PTA_int &lengths); + INLINE PTA_int get_lengths() const; virtual int get_num_vertices_per_prim() const=0; virtual int get_num_more_vertices_than_components() const=0; diff --git a/panda/src/gobj/geomLine.h b/panda/src/gobj/geomLine.h index dfc23ac283..4692d760cd 100644 --- a/panda/src/gobj/geomLine.h +++ b/panda/src/gobj/geomLine.h @@ -53,10 +53,11 @@ public: protected: void fillin(DatagramIterator& scan, BamReader* manager); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomLine", diff --git a/panda/src/gobj/geomLinestrip.h b/panda/src/gobj/geomLinestrip.h index 843be4b2d0..91618f5213 100644 --- a/panda/src/gobj/geomLinestrip.h +++ b/panda/src/gobj/geomLinestrip.h @@ -52,10 +52,11 @@ public: protected: void fillin(DatagramIterator& scan, BamReader* manager); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomLinestrip", diff --git a/panda/src/gobj/geomPoint.h b/panda/src/gobj/geomPoint.h index 7698873764..facdf44709 100644 --- a/panda/src/gobj/geomPoint.h +++ b/panda/src/gobj/geomPoint.h @@ -53,10 +53,11 @@ public: protected: void fillin(DatagramIterator& scan, BamReader* manager); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomPoint", diff --git a/panda/src/gobj/geomPolygon.h b/panda/src/gobj/geomPolygon.h index 76f3b894bb..cbf82e5f5f 100644 --- a/panda/src/gobj/geomPolygon.h +++ b/panda/src/gobj/geomPolygon.h @@ -41,10 +41,11 @@ public: static void register_with_read_factory(void); static TypedWriteable *make_GeomPolygon(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomPolygon", diff --git a/panda/src/gobj/geomQuad.h b/panda/src/gobj/geomQuad.h index 188dbc520b..d64b8886f2 100644 --- a/panda/src/gobj/geomQuad.h +++ b/panda/src/gobj/geomQuad.h @@ -39,10 +39,11 @@ public: static void register_with_read_factory(void); static TypedWriteable *make_GeomQuad(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomQuad", diff --git a/panda/src/gobj/geomSphere.h b/panda/src/gobj/geomSphere.h index 1622b89530..9b05861010 100644 --- a/panda/src/gobj/geomSphere.h +++ b/panda/src/gobj/geomSphere.h @@ -54,10 +54,11 @@ public: static TypedWriteable *make_GeomSphere(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomSphere", diff --git a/panda/src/gobj/geomSprite.h b/panda/src/gobj/geomSprite.h index 265ee98fa0..e31ab7058b 100644 --- a/panda/src/gobj/geomSprite.h +++ b/panda/src/gobj/geomSprite.h @@ -73,10 +73,11 @@ public: protected: void fillin(DatagramIterator &scan, BamReader *manager); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomSprite", diff --git a/panda/src/gobj/geomTri.h b/panda/src/gobj/geomTri.h index fcc93e591e..02cdb80d9d 100644 --- a/panda/src/gobj/geomTri.h +++ b/panda/src/gobj/geomTri.h @@ -39,10 +39,11 @@ public: static void register_with_read_factory(void); static TypedWriteable *make_GeomTri(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTri", diff --git a/panda/src/gobj/geomTrifan.h b/panda/src/gobj/geomTrifan.h index 2183826fba..c8ae4ea672 100644 --- a/panda/src/gobj/geomTrifan.h +++ b/panda/src/gobj/geomTrifan.h @@ -42,10 +42,11 @@ public: static void register_with_read_factory(void); static TypedWriteable *make_GeomTrifan(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTrifan", diff --git a/panda/src/gobj/geomTristrip.h b/panda/src/gobj/geomTristrip.h index e1067d775d..dd109b9f6c 100644 --- a/panda/src/gobj/geomTristrip.h +++ b/panda/src/gobj/geomTristrip.h @@ -41,10 +41,11 @@ public: static void register_with_read_factory(void); static TypedWriteable *make_GeomTristrip(const FactoryParams ¶ms); -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } +public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTristrip", diff --git a/panda/src/linmath/luse.N b/panda/src/linmath/luse.N index 5d55dd814e..182014e3f1 100644 --- a/panda/src/linmath/luse.N +++ b/panda/src/linmath/luse.N @@ -73,3 +73,13 @@ forcetype LOrientationf forcetype LQuaterniond forcetype LRotationd forcetype LOrientationd + +forcetype PTA_Vertexf +forcetype PTA_Normalf +forcetype PTA_TexCoordf +forcetype PTA_Colorf + +renametype PTA_Vertexf PTA_Vertexf +renametype PTA_Normalf PTA_Normalf +renametype PTA_TexCoordf PTA_TexCoordf +renametype PTA_Colorf PTA_Colorf diff --git a/panda/src/putil/pointerToArray.I b/panda/src/putil/pointerToArray.I index 93a69a6770..8968b50fad 100644 --- a/panda/src/putil/pointerToArray.I +++ b/panda/src/putil/pointerToArray.I @@ -11,7 +11,7 @@ vector ConstPointerToArray::_empty_array; //////////////////////////////////////////////////////////////////// // Function: PointerToArray::Constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// template @@ -23,7 +23,7 @@ PointerToArray() : //////////////////////////////////////////////////////////////////// // Function: PointerToArray::Constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// template @@ -36,7 +36,7 @@ PointerToArray(size_type n) : //////////////////////////////////////////////////////////////////// // Function: PointerToArray::Constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// template @@ -49,7 +49,7 @@ PointerToArray(size_type n, const Element &value) : //////////////////////////////////////////////////////////////////// // Function: PointerToArray::Copy Constructor -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// template @@ -117,7 +117,7 @@ rend() const { //////////////////////////////////////////////////////////////////// // Function: PointerToArray::size -// Access: Public +// Access: Published // Description: //////////////////////////////////////////////////////////////////// template @@ -177,26 +177,6 @@ capacity() const { return _ptr->capacity(); } -#ifndef WIN32_VC -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::Indexing operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerToArray::reference PointerToArray:: -operator[](size_type n) const { - nassertd(_ptr != NULL) { - ((PointerToArray *)this)->reassign(new RefCountObj >); - } - nassertd(!_ptr->empty()) { - _ptr->push_back(Element()); - } - nassertr(n < _ptr->size(), _ptr->operator[](0)); - return _ptr->operator[](n); -} -#endif - //////////////////////////////////////////////////////////////////// // Function: PointerToArray::front // Access: Public @@ -231,20 +211,6 @@ back() const { return _ptr->back(); } -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::push_back -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerToArray:: -push_back(const Element &x) { - if (_ptr == NULL) { - reassign(new RefCountObj >); - } - _ptr->push_back(x); -} - //////////////////////////////////////////////////////////////////// // Function: PointerToArray::insert // Access: Public @@ -318,21 +284,6 @@ insert(iterator position, const Element *first, const Element *last) const { } #endif -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::pop_back -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerToArray:: -pop_back() const { - nassertd(_ptr != NULL) { - ((PointerToArray *)this)->reassign(new RefCountObj >); - } - nassertv(!_ptr->empty()); - _ptr->pop_back(); -} - //////////////////////////////////////////////////////////////////// // Function: PointerToArray::erase // Access: Public @@ -365,6 +316,72 @@ erase(iterator first, iterator last) const { _ptr->erase(first, last); } +#if !defined(WIN32_VC) || defined(CPPPARSER) +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::Indexing operator +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +template +INLINE PointerToArray::reference PointerToArray:: +operator [](size_type n) const { + nassertd(_ptr != NULL) { + ((PointerToArray *)this)->reassign(new RefCountObj >); + } + nassertd(!_ptr->empty()) { + _ptr->push_back(Element()); + } + nassertr(n < _ptr->size(), _ptr->operator[](0)); + return _ptr->operator[](n); +} +#endif + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::push_back +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +template +INLINE void PointerToArray:: +push_back(const Element &x) { + if (_ptr == NULL) { + reassign(new RefCountObj >); + } + _ptr->push_back(x); +} + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::pop_back +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +template +INLINE void PointerToArray:: +pop_back() { + nassertd(_ptr != NULL) { + ((PointerToArray *)this)->reassign(new RefCountObj >); + } + nassertv(!_ptr->empty()); + _ptr->pop_back(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::make_empty +// Access: Published +// Description: Empties the array pointed to. This is different from +// clear(), which reassigns the pointer to a NULL +// pointer. +//////////////////////////////////////////////////////////////////// +template +INLINE void PointerToArray:: +make_empty() { + nassertd(_ptr != NULL) { + ((PointerToArray *)this)->reassign(new RefCountObj >); + } + nassertv(!_ptr->empty()); + _ptr->clear(); +} + //////////////////////////////////////////////////////////////////// // Function: PointerToArray::Typecast operator // Access: Public diff --git a/panda/src/putil/pointerToArray.h b/panda/src/putil/pointerToArray.h index 6eaf1abac9..21ade71a21 100644 --- a/panda/src/putil/pointerToArray.h +++ b/panda/src/putil/pointerToArray.h @@ -83,11 +83,13 @@ public: typedef vector::difference_type difference_type; typedef vector::size_type size_type; +PUBLISHED: INLINE PointerToArray(); INLINE PointerToArray(size_type n); INLINE PointerToArray(size_type n, const Element &value); INLINE PointerToArray(const PointerToArray ©); +public: // Duplicating the interface of vector. The following member // functions are all const, because they do not reassign the // pointer--they operate only within the vector itself, which is @@ -101,19 +103,18 @@ public: // Equality and comparison operators are pointerwise for // PointerToArrays, not elementwise as in vector. +PUBLISHED: INLINE size_type size() const; + +public: INLINE size_type max_size() const; INLINE bool empty() const; // Functions specific to vectors. INLINE void reserve(size_type n); INLINE size_type capacity() const; -#ifndef WIN32_VC - INLINE reference operator[](size_type n) const; -#endif INLINE reference front() const; INLINE reference back() const; - INLINE void push_back(const Element &x); INLINE iterator insert(iterator position) const; INLINE iterator insert(iterator position, const Element &x) const; INLINE void insert(iterator position, size_type n, const Element &x) const; @@ -125,10 +126,19 @@ public: INLINE void insert(iterator position, const Element *first, const Element *last) const; #endif - INLINE void pop_back() const; INLINE void erase(iterator position) const; INLINE void erase(iterator first, iterator last) const; +PUBLISHED: +#if !defined(WIN32_VC) || defined(CPPPARSER) + INLINE reference operator [](size_type n) const; +#endif + INLINE void push_back(const Element &x); + INLINE void pop_back(); + INLINE void make_empty(); + +public: + INLINE operator Element *() const; INLINE Element *p() const; INLINE vector &v() const;