diff --git a/panda/src/express/Sources.pp b/panda/src/express/Sources.pp index f7366cb9d7..cdbb549c67 100644 --- a/panda/src/express/Sources.pp +++ b/panda/src/express/Sources.pp @@ -48,6 +48,7 @@ profileTimer.I profileTimer.h \ pStatCollectorForwardBase.h \ pta_uchar.h pta_float.h \ + pta_int.h \ ramfile.I ramfile.h \ referenceCount.I referenceCount.h \ stringDecoder.h stringDecoder.I \ @@ -101,6 +102,7 @@ profileTimer.cxx \ pStatCollectorForwardBase.cxx \ pta_uchar.cxx pta_float.cxx \ + pta_int.cxx \ ramfile.cxx \ referenceCount.cxx \ stringDecoder.cxx \ @@ -163,6 +165,7 @@ profileTimer.I profileTimer.h \ pStatCollectorForwardBase.h \ pta_uchar.h pta_float.h \ + pta_int.h \ ramfile.I ramfile.h \ referenceCount.I referenceCount.h \ stringDecoder.h stringDecoder.I \ diff --git a/panda/src/express/config_express.N b/panda/src/express/config_express.N index 39ddcd425c..243134f184 100644 --- a/panda/src/express/config_express.N +++ b/panda/src/express/config_express.N @@ -62,3 +62,8 @@ forcetype PointerToArray forcetype ConstPointerToArray renametype PointerToArray PTAFloat renametype ConstPointerToArray CPTAFloat + +forcetype PointerToArray +forcetype ConstPointerToArray +renametype PointerToArray PTAInt +renametype ConstPointerToArray CPTAInt diff --git a/panda/src/putil/pta_int.cxx b/panda/src/express/pta_int.cxx similarity index 100% rename from panda/src/putil/pta_int.cxx rename to panda/src/express/pta_int.cxx diff --git a/panda/src/putil/pta_int.h b/panda/src/express/pta_int.h similarity index 77% rename from panda/src/putil/pta_int.h rename to panda/src/express/pta_int.h index aab5f8a61d..7fbd99e770 100644 --- a/panda/src/putil/pta_int.h +++ b/panda/src/express/pta_int.h @@ -29,15 +29,13 @@ // rather than defining the pta again. //////////////////////////////////////////////////////////////////// -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, RefCountObj); -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, PointerToBase >); -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, RefCountObj); +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, PointerToBase >); +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArray) -BEGIN_PUBLISH typedef PointerToArray PTA_int; typedef ConstPointerToArray CPTA_int; -END_PUBLISH // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ diff --git a/panda/src/gobj/geomPrimitive.I b/panda/src/gobj/geomPrimitive.I index 550cf19a91..2dfcefb141 100644 --- a/panda/src/gobj/geomPrimitive.I +++ b/panda/src/gobj/geomPrimitive.I @@ -273,12 +273,17 @@ check_valid(const GeomVertexData *vertex_data) const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_vertices -// Access: Public +// Access: Published // Description: Returns a const pointer to the vertex index array so // application code can read it directly. This might // return NULL if the primitive is nonindexed. Do not // attempt to modify the returned array; use // modify_vertices() or set_vertices() for this. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// INLINE CPT(GeomVertexArrayData) GeomPrimitive:: get_vertices() const { @@ -288,10 +293,15 @@ get_vertices() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_index_stride -// Access: Public +// Access: Published // Description: A convenience function to return the gap between // successive index numbers, in bytes, of the index // data. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// INLINE int GeomPrimitive:: get_index_stride() const { @@ -301,7 +311,7 @@ get_index_stride() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_ends -// Access: Public +// Access: Published // Description: Returns a const pointer to the primitive ends // array so application code can read it directly. Do // not attempt to modify the returned array; use @@ -310,6 +320,11 @@ get_index_stride() const { // Note that simple primitive types, like triangles, do // not have a ends array: since all the primitives // have the same number of vertices, it is not needed. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// INLINE CPTA_int GeomPrimitive:: get_ends() const { @@ -319,7 +334,7 @@ get_ends() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_mins -// Access: Public +// Access: Published // Description: Returns a const pointer to the primitive mins // array so application code can read it directly. Do // not attempt to modify the returned array; use @@ -327,6 +342,11 @@ get_ends() const { // // Note that simple primitive types, like triangles, do // not have a mins array. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// INLINE CPT(GeomVertexArrayData) GeomPrimitive:: get_mins() const { @@ -337,7 +357,7 @@ get_mins() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_maxs -// Access: Public +// Access: Published // Description: Returns a const pointer to the primitive maxs // array so application code can read it directly. Do // not attempt to modify the returned array; use @@ -345,6 +365,11 @@ get_mins() const { // // Note that simple primitive types, like triangles, do // not have a maxs array. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// INLINE CPT(GeomVertexArrayData) GeomPrimitive:: get_maxs() const { diff --git a/panda/src/gobj/geomPrimitive.cxx b/panda/src/gobj/geomPrimitive.cxx index 748c187ec6..ecde0dc2b8 100644 --- a/panda/src/gobj/geomPrimitive.cxx +++ b/panda/src/gobj/geomPrimitive.cxx @@ -988,7 +988,7 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::modify_vertices -// Access: Public +// Access: Published // Description: Returns a modifiable pointer to the vertex index // list, so application code can directly fiddle with // this data. Use with caution, since there are no @@ -1005,6 +1005,11 @@ write(ostream &out, int indent_level) const { // Don't call this in a downstream thread unless you // don't mind it blowing away other changes you might // have recently made in an upstream thread. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// PT(GeomVertexArrayData) GeomPrimitive:: modify_vertices(int num_vertices) { @@ -1016,7 +1021,7 @@ modify_vertices(int num_vertices) { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::set_vertices -// Access: Public +// Access: Published // Description: Completely replaces the vertex index list with a new // table. Chances are good that you should also replace // the ends list with set_ends() at the same time. @@ -1029,6 +1034,11 @@ modify_vertices(int num_vertices) { // Don't call this in a downstream thread unless you // don't mind it blowing away other changes you might // have recently made in an upstream thread. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// void GeomPrimitive:: set_vertices(const GeomVertexArrayData *vertices, int num_vertices) { @@ -1042,13 +1052,18 @@ set_vertices(const GeomVertexArrayData *vertices, int num_vertices) { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::set_nonindexed_vertices -// Access: Public +// Access: Published // Description: Sets the primitive up as a nonindexed primitive, // using the indicated vertex range. // // Don't call this in a downstream thread unless you // don't mind it blowing away other changes you might // have recently made in an upstream thread. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// void GeomPrimitive:: set_nonindexed_vertices(int first_vertex, int num_vertices) { @@ -1067,7 +1082,7 @@ set_nonindexed_vertices(int first_vertex, int num_vertices) { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::modify_ends -// Access: Public +// Access: Published // Description: Returns a modifiable pointer to the primitive ends // array, so application code can directly fiddle with // this data. Use with caution, since there are no @@ -1080,6 +1095,11 @@ set_nonindexed_vertices(int first_vertex, int num_vertices) { // Don't call this in a downstream thread unless you // don't mind it blowing away other changes you might // have recently made in an upstream thread. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// PTA_int GeomPrimitive:: modify_ends() { @@ -1098,7 +1118,7 @@ modify_ends() { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::set_ends -// Access: Public +// Access: Published // Description: Completely replaces the primitive ends array with // a new table. Chances are good that you should also // replace the vertices list with set_vertices() at the @@ -1111,6 +1131,11 @@ modify_ends() { // Don't call this in a downstream thread unless you // don't mind it blowing away other changes you might // have recently made in an upstream thread. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// void GeomPrimitive:: set_ends(CPTA_int ends) { @@ -1123,7 +1148,7 @@ set_ends(CPTA_int ends) { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::set_minmax -// Access: Public +// Access: Published // Description: Explicitly specifies the minimum and maximum // vertices, as well as the lists of per-component min // and max. @@ -1136,6 +1161,11 @@ set_ends(CPTA_int ends) { // Note that any modification to the vertex array will // normally cause this to be recomputed, unless you set // it immediately again. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// void GeomPrimitive:: set_minmax(int min_vertex, int max_vertex, @@ -1152,10 +1182,15 @@ set_minmax(int min_vertex, int max_vertex, //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::clear_minmax -// Access: Public +// Access: Published // Description: Undoes a previous call to set_minmax(), and allows // the minimum and maximum values to be recomputed // normally. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// void GeomPrimitive:: clear_minmax() { @@ -1165,7 +1200,7 @@ clear_minmax() { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_num_vertices_per_primitive -// Access: Public, Virtual +// Access: Published, Virtual // Description: If the primitive type is a simple type in which all // primitives have the same number of vertices, like // triangles, returns the number of vertices per @@ -1173,6 +1208,11 @@ clear_minmax() { // type in which different primitives might have // different numbers of vertices, for instance a // triangle strip, returns 0. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// int GeomPrimitive:: get_num_vertices_per_primitive() const { @@ -1181,9 +1221,14 @@ get_num_vertices_per_primitive() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_min_num_vertices_per_primitive -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns the minimum number of vertices that must be // added before close_primitive() may legally be called. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// int GeomPrimitive:: get_min_num_vertices_per_primitive() const { @@ -1192,12 +1237,17 @@ get_min_num_vertices_per_primitive() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::get_num_unused_vertices_per_primitive -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns the number of vertices that are added between // primitives that aren't, strictly speaking, part of // the primitives themselves. This is used, for // instance, to define degenerate triangles to connect // otherwise disconnected triangle strips. +// +// This method is intended for low-level usage only. +// There are higher-level methods for more common usage. +// We recommend you do not use this method directly. If +// you do, be sure you know what you are doing! //////////////////////////////////////////////////////////////////// int GeomPrimitive:: get_num_unused_vertices_per_primitive() const { diff --git a/panda/src/gobj/geomPrimitive.h b/panda/src/gobj/geomPrimitive.h index a115837e04..c218cf98e7 100644 --- a/panda/src/gobj/geomPrimitive.h +++ b/panda/src/gobj/geomPrimitive.h @@ -143,16 +143,16 @@ PUBLISHED: virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level) const; -public: +PUBLISHED: // These public methods are not intended for high-level usage. They - // are public so that C++ code that absolutely needs fast access to - // the primitive data can get to it, but using them requires - // knowledge about how the component primitives are encoded within - // the GeomPrimitive class, and it's easy to screw something up. - // Also, if too many code samples depend on this internal knowledge, - // it may make it difficult to extend this class later. It is - // recommended that application-level code use the above interfaces - // instead. + // are public so that low-level code that absolutely needs fast + // access to the primitive data can get to it, but using them + // requires knowledge about how the component primitives are encoded + // within the GeomPrimitive class, and it's easy to screw something + // up. Also, if too many code samples depend on this internal + // knowledge, it may make it difficult to extend this class later. + // It is recommended that application-level code use the above + // interfaces instead. INLINE CPT(GeomVertexArrayData) get_vertices() const; PT(GeomVertexArrayData) modify_vertices(int num_vertices = -1); @@ -176,6 +176,7 @@ public: virtual int get_min_num_vertices_per_primitive() const; virtual int get_num_unused_vertices_per_primitive() const; +public: void prepare(PreparedGraphicsObjects *prepared_objects); bool is_prepared(PreparedGraphicsObjects *prepared_objects) const; diff --git a/panda/src/putil/Sources.pp b/panda/src/putil/Sources.pp index 34a6b3d537..fefb375f2b 100644 --- a/panda/src/putil/Sources.pp +++ b/panda/src/putil/Sources.pp @@ -58,7 +58,7 @@ pbitops.I pbitops.h \ portalMask.h \ pta_double.h \ - pta_int.h pta_ushort.h \ + pta_ushort.h \ pythonCallbackObject.h pythonCallbackObject.I \ simpleHashMap.I simpleHashMap.h \ sparseArray.I sparseArray.h \ @@ -107,7 +107,7 @@ nodeCachedReferenceCount.cxx \ pbitops.cxx \ pta_double.cxx \ - pta_int.cxx pta_ushort.cxx \ + pta_ushort.cxx \ pythonCallbackObject.cxx \ simpleHashMap.cxx \ sparseArray.cxx \ @@ -169,7 +169,7 @@ portalMask.h \ pbitops.I pbitops.h \ pta_double.h \ - pta_int.h pta_ushort.h \ + pta_ushort.h \ pythonCallbackObject.h pythonCallbackObject.I \ simpleHashMap.I simpleHashMap.h \ sparseArray.I sparseArray.h \