diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index 31c4fa0514..4941acdd2f 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -37,6 +37,7 @@ using namespace std; #define NOEXCEPT noexcept #define FINAL #define OVERRIDE +#define MOVE(x) x #define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname) @@ -137,8 +138,11 @@ typedef ios::seekdir ios_seekdir; # endif # if __has_extension(cxx_rvalue_references) && (__cplusplus >= 201103L) # define USE_MOVE_SEMANTICS +# define MOVE(x) move(x) +# else +# define MOVE(x) x # endif -# if __has_extension(cxx_override_control) +# if __has_extension(cxx_override_control) && (__cplusplus >= 201103L) # define FINAL final # define OVERRIDE override # endif @@ -150,6 +154,7 @@ typedef ios::seekdir ios_seekdir; # define USE_MOVE_SEMANTICS # define FINAL final # define OVERRIDE override +# define MOVE(x) move(x) #elif defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC 2010 has move semantics. Not much else. # define CONSTEXPR INLINE @@ -157,11 +162,13 @@ typedef ios::seekdir ios_seekdir; # define USE_MOVE_SEMANTICS # define FINAL # define OVERRIDE +# define MOVE(x) move(x) #else # define CONSTEXPR INLINE # define NOEXCEPT # define FINAL # define OVERRIDE +# define MOVE(x) x #endif #if defined(WIN32_VC) && !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES) diff --git a/dtool/src/pystub/pystub.cxx b/dtool/src/pystub/pystub.cxx index 116da89ee7..305eabd596 100644 --- a/dtool/src/pystub/pystub.cxx +++ b/dtool/src/pystub/pystub.cxx @@ -192,6 +192,7 @@ extern "C" { EXPCL_PYSTUB extern void *PyExc_SystemExit; EXPCL_PYSTUB extern void *PyExc_TypeError; EXPCL_PYSTUB extern void *PyExc_ValueError; + EXPCL_PYSTUB extern void *_Py_FalseStruct; EXPCL_PYSTUB extern void *_Py_NoneStruct; EXPCL_PYSTUB extern void *_Py_NotImplementedStruct; EXPCL_PYSTUB extern void *_Py_TrueStruct; @@ -381,6 +382,7 @@ void *PyExc_StopIteration = (void *)NULL; void *PyExc_SystemExit = (void *)NULL; void *PyExc_TypeError = (void *)NULL; void *PyExc_ValueError = (void *)NULL; +void *_Py_FalseStruct = (void *)NULL; void *_Py_NoneStruct = (void *)NULL; void *_Py_NotImplementedStruct = (void *)NULL; void *_Py_TrueStruct = (void *)NULL; diff --git a/panda/src/gobj/geomVertexArrayFormat.cxx b/panda/src/gobj/geomVertexArrayFormat.cxx index 4d53cc3ea0..7f1deaff61 100644 --- a/panda/src/gobj/geomVertexArrayFormat.cxx +++ b/panda/src/gobj/geomVertexArrayFormat.cxx @@ -47,7 +47,7 @@ GeomVertexArrayFormat() : // Description: //////////////////////////////////////////////////////////////////// GeomVertexArrayFormat:: -GeomVertexArrayFormat(InternalName *name0, int num_components0, +GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, GeomVertexArrayFormat::NumericType numeric_type0, GeomVertexArrayFormat::Contents contents0) : _is_registered(false), @@ -57,7 +57,7 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, _divisor(0), _columns_unsorted(false) { - add_column(name0, num_components0, numeric_type0, contents0); + add_column(MOVE(name0), num_components0, numeric_type0, contents0); } //////////////////////////////////////////////////////////////////// @@ -66,10 +66,10 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, // Description: //////////////////////////////////////////////////////////////////// GeomVertexArrayFormat:: -GeomVertexArrayFormat(InternalName *name0, int num_components0, +GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, GeomVertexArrayFormat::NumericType numeric_type0, GeomVertexArrayFormat::Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, GeomVertexArrayFormat::NumericType numeric_type1, GeomVertexArrayFormat::Contents contents1) : _is_registered(false), @@ -79,8 +79,8 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, _divisor(0), _columns_unsorted(false) { - add_column(name0, num_components0, numeric_type0, contents0); - add_column(name1, num_components1, numeric_type1, contents1); + add_column(MOVE(name0), num_components0, numeric_type0, contents0); + add_column(MOVE(name1), num_components1, numeric_type1, contents1); } //////////////////////////////////////////////////////////////////// @@ -89,13 +89,13 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, // Description: //////////////////////////////////////////////////////////////////// GeomVertexArrayFormat:: -GeomVertexArrayFormat(InternalName *name0, int num_components0, +GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, GeomVertexArrayFormat::NumericType numeric_type0, GeomVertexArrayFormat::Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, GeomVertexArrayFormat::NumericType numeric_type1, GeomVertexArrayFormat::Contents contents1, - InternalName *name2, int num_components2, + CPT_InternalName name2, int num_components2, GeomVertexArrayFormat::NumericType numeric_type2, GeomVertexArrayFormat::Contents contents2) : _is_registered(false), @@ -105,9 +105,9 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, _divisor(0), _columns_unsorted(false) { - add_column(name0, num_components0, numeric_type0, contents0); - add_column(name1, num_components1, numeric_type1, contents1); - add_column(name2, num_components2, numeric_type2, contents2); + add_column(MOVE(name0), num_components0, numeric_type0, contents0); + add_column(MOVE(name1), num_components1, numeric_type1, contents1); + add_column(MOVE(name2), num_components2, numeric_type2, contents2); } //////////////////////////////////////////////////////////////////// @@ -116,16 +116,16 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, // Description: //////////////////////////////////////////////////////////////////// GeomVertexArrayFormat:: -GeomVertexArrayFormat(InternalName *name0, int num_components0, +GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, GeomVertexArrayFormat::NumericType numeric_type0, GeomVertexArrayFormat::Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, GeomVertexArrayFormat::NumericType numeric_type1, GeomVertexArrayFormat::Contents contents1, - InternalName *name2, int num_components2, + CPT_InternalName name2, int num_components2, GeomVertexArrayFormat::NumericType numeric_type2, GeomVertexArrayFormat::Contents contents2, - InternalName *name3, int num_components3, + CPT_InternalName name3, int num_components3, GeomVertexArrayFormat::NumericType numeric_type3, GeomVertexArrayFormat::Contents contents3) : _is_registered(false), @@ -135,10 +135,10 @@ GeomVertexArrayFormat(InternalName *name0, int num_components0, _divisor(0), _columns_unsorted(false) { - add_column(name0, num_components0, numeric_type0, contents0); - add_column(name1, num_components1, numeric_type1, contents1); - add_column(name2, num_components2, numeric_type2, contents2); - add_column(name3, num_components3, numeric_type3, contents3); + add_column(MOVE(name0), num_components0, numeric_type0, contents0); + add_column(MOVE(name1), num_components1, numeric_type1, contents1); + add_column(MOVE(name2), num_components2, numeric_type2, contents2); + add_column(MOVE(name3), num_components3, numeric_type3, contents3); } //////////////////////////////////////////////////////////////////// @@ -235,7 +235,7 @@ unref() const { // type. //////////////////////////////////////////////////////////////////// int GeomVertexArrayFormat:: -add_column(InternalName *name, int num_components, +add_column(CPT_InternalName name, int num_components, GeomVertexArrayFormat::NumericType numeric_type, GeomVertexArrayFormat::Contents contents, int start, int column_alignment) { @@ -243,7 +243,7 @@ add_column(InternalName *name, int num_components, start = _total_bytes; } - return add_column(GeomVertexColumn(name, num_components, numeric_type, contents, + return add_column(GeomVertexColumn(MOVE(name), num_components, numeric_type, contents, start, column_alignment)); } diff --git a/panda/src/gobj/geomVertexArrayFormat.h b/panda/src/gobj/geomVertexArrayFormat.h index 3bdb3e1596..9e150d596b 100644 --- a/panda/src/gobj/geomVertexArrayFormat.h +++ b/panda/src/gobj/geomVertexArrayFormat.h @@ -50,29 +50,29 @@ class BamReader; // data may be piggybacked into the data record simply // by choosing a unique name. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_GOBJ GeomVertexArrayFormat : public TypedWritableReferenceCount, public GeomEnums { +class EXPCL_PANDA_GOBJ GeomVertexArrayFormat FINAL : public TypedWritableReferenceCount, public GeomEnums { PUBLISHED: GeomVertexArrayFormat(); GeomVertexArrayFormat(const GeomVertexArrayFormat ©); - GeomVertexArrayFormat(InternalName *name0, int num_components0, + GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0); - GeomVertexArrayFormat(InternalName *name0, int num_components0, + GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1); - GeomVertexArrayFormat(InternalName *name0, int num_components0, + GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1, - InternalName *name2, int num_components2, + CPT_InternalName name2, int num_components2, NumericType numeric_type2, Contents contents2); - GeomVertexArrayFormat(InternalName *name0, int num_components0, + GeomVertexArrayFormat(CPT_InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, - InternalName *name1, int num_components1, + CPT_InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1, - InternalName *name2, int num_components2, + CPT_InternalName name2, int num_components2, NumericType numeric_type2, Contents contents2, - InternalName *name3, int num_components3, + CPT_InternalName name3, int num_components3, NumericType numeric_type3, Contents contents3); void operator = (const GeomVertexArrayFormat ©); ~GeomVertexArrayFormat(); @@ -93,7 +93,7 @@ PUBLISHED: INLINE int get_total_bytes() const; - int add_column(InternalName *name, int num_components, + int add_column(CPT_InternalName name, int num_components, NumericType numeric_type, Contents contents, int start = -1, int column_alignment = 0); int add_column(const GeomVertexColumn &column); @@ -115,7 +115,7 @@ PUBLISHED: void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; - void write_with_data(ostream &out, int indent_level, + void write_with_data(ostream &out, int indent_level, const GeomVertexArrayData *array_data) const; string get_format_string(bool pad = true) const; diff --git a/panda/src/gobj/geomVertexColumn.I b/panda/src/gobj/geomVertexColumn.I index a92e066c04..f2646a0fb0 100644 --- a/panda/src/gobj/geomVertexColumn.I +++ b/panda/src/gobj/geomVertexColumn.I @@ -28,13 +28,13 @@ GeomVertexColumn() : //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexColumn:: -GeomVertexColumn(InternalName *name, int num_components, +GeomVertexColumn(CPT_InternalName name, int num_components, NumericType numeric_type, Contents contents, int start, int column_alignment) : - _name(name), + _name(MOVE(name)), _num_components(num_components), _numeric_type(numeric_type), _contents(contents), @@ -48,7 +48,7 @@ GeomVertexColumn(InternalName *name, int num_components, //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Copy Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexColumn:: GeomVertexColumn(const GeomVertexColumn ©) : @@ -66,7 +66,7 @@ GeomVertexColumn(const GeomVertexColumn ©) : //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexColumn:: ~GeomVertexColumn() { @@ -82,7 +82,7 @@ INLINE GeomVertexColumn:: // system-defined field types. Only the system-defined // field types are used for the actual rendering. //////////////////////////////////////////////////////////////////// -INLINE InternalName *GeomVertexColumn:: +INLINE const InternalName *GeomVertexColumn:: get_name() const { return _name; } @@ -334,7 +334,7 @@ operator == (const GeomVertexColumn &other) const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::operator != // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool GeomVertexColumn:: operator != (const GeomVertexColumn &other) const { @@ -351,7 +351,7 @@ operator != (const GeomVertexColumn &other) const { //////////////////////////////////////////////////////////////////// INLINE bool GeomVertexColumn:: operator < (const GeomVertexColumn &other) const { - if (_start != other._start) { + if (_start != other._start) { return _start < other._start; } if (_total_bytes < other._total_bytes) { @@ -382,7 +382,7 @@ maybe_scale_color_f(unsigned int value) { return (float)value; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_f // Access: Public @@ -394,11 +394,11 @@ maybe_scale_color_f(unsigned int a, unsigned int b) { if (_column->get_contents() == C_color) { _v2.set((float)a / 255.0f, (float)b / 255.0f); - } else { + } else { _v2.set((float)a, (float)b); } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_f // Access: Public @@ -411,11 +411,11 @@ maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c) { _v3.set((float)a / 255.0f, (float)b / 255.0f, (float)c / 255.0f); - } else { + } else { _v3.set((float)a, (float)b, (float)c); } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_f // Access: Public @@ -434,7 +434,6 @@ maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c, _v4.set((float)a, (float)b, (float)c, (float)d); } } - //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_f @@ -452,7 +451,7 @@ maybe_unscale_color_f(float data) { return (unsigned int)data; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_f // Access: Public @@ -470,7 +469,7 @@ maybe_unscale_color_f(const LVecBase2f &data) { _b = (unsigned int)data[1]; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_f // Access: Public @@ -490,7 +489,7 @@ maybe_unscale_color_f(const LVecBase3f &data) { _c = (unsigned int)data[2]; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_f // Access: Public @@ -529,7 +528,7 @@ maybe_scale_color_d(unsigned int value) { return (double)value; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_d // Access: Public @@ -541,11 +540,11 @@ maybe_scale_color_d(unsigned int a, unsigned int b) { if (_column->get_contents() == C_color) { _v2d.set((double)a / 255.0, (double)b / 255.0); - } else { + } else { _v2d.set((double)a, (double)b); } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_d // Access: Public @@ -558,11 +557,11 @@ maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c) { _v3d.set((double)a / 255.0, (double)b / 255.0, (double)c / 255.0); - } else { + } else { _v3d.set((double)a, (double)b, (double)c); } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_scale_color_d // Access: Public @@ -581,7 +580,6 @@ maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c, _v4d.set((double)a, (double)b, (double)c, (double)d); } } - //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_d @@ -599,7 +597,7 @@ maybe_unscale_color_d(double data) { return (unsigned int)data; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_d // Access: Public @@ -617,7 +615,7 @@ maybe_unscale_color_d(const LVecBase2d &data) { _b = (unsigned int)data[1]; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_d // Access: Public @@ -637,7 +635,7 @@ maybe_unscale_color_d(const LVecBase3d &data) { _c = (unsigned int)data[2]; } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::maybe_unscale_color_d // Access: Public diff --git a/panda/src/gobj/geomVertexColumn.h b/panda/src/gobj/geomVertexColumn.h index fc8bfff031..ab3ddf9f4f 100644 --- a/panda/src/gobj/geomVertexColumn.h +++ b/panda/src/gobj/geomVertexColumn.h @@ -38,18 +38,17 @@ class GeomVertexWriter; // to completely define a particular array structure. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_GOBJ GeomVertexColumn : public GeomEnums { -PUBLISHED: private: INLINE GeomVertexColumn(); PUBLISHED: - INLINE GeomVertexColumn(InternalName *name, int num_components, + INLINE GeomVertexColumn(CPT_InternalName name, int num_components, NumericType numeric_type, Contents contents, int start, int column_alignment = 0); INLINE GeomVertexColumn(const GeomVertexColumn ©); void operator = (const GeomVertexColumn ©); INLINE ~GeomVertexColumn(); - INLINE InternalName *get_name() const; + INLINE const InternalName *get_name() const; INLINE int get_num_components() const; INLINE int get_num_values() const; INLINE int get_num_elements() const; @@ -95,7 +94,7 @@ public: void fillin(DatagramIterator &scan, BamReader *manager); private: - PT(InternalName) _name; + CPT_InternalName _name; int _num_components; int _num_values; int _num_elements; @@ -141,7 +140,7 @@ private: virtual void set_data2d(unsigned char *pointer, const LVecBase2d &data); virtual void set_data3d(unsigned char *pointer, const LVecBase3d &data); virtual void set_data4d(unsigned char *pointer, const LVecBase4d &data); - + virtual void set_data1i(unsigned char *pointer, int data); virtual void set_data2i(unsigned char *pointer, const LVecBase2i &data); virtual void set_data3i(unsigned char *pointer, const LVecBase3i &data); diff --git a/panda/src/gobj/geomVertexFormat.I b/panda/src/gobj/geomVertexFormat.I index 1c6012fb2b..0026fae224 100644 --- a/panda/src/gobj/geomVertexFormat.I +++ b/panda/src/gobj/geomVertexFormat.I @@ -236,7 +236,7 @@ get_texcoord(int n) const { INLINE int GeomVertexFormat:: get_num_morphs() const { nassertr(_is_registered, 0); - + return _morphs.size(); } diff --git a/panda/src/gobj/geomVertexFormat.cxx b/panda/src/gobj/geomVertexFormat.cxx index 610f06c70d..b0fd53515c 100644 --- a/panda/src/gobj/geomVertexFormat.cxx +++ b/panda/src/gobj/geomVertexFormat.cxx @@ -26,7 +26,7 @@ TypeHandle GeomVertexFormat::_type_handle; //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexFormat:: GeomVertexFormat() : @@ -38,7 +38,7 @@ GeomVertexFormat() : //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexFormat:: GeomVertexFormat(const GeomVertexArrayFormat *array_format) : @@ -51,7 +51,7 @@ GeomVertexFormat(const GeomVertexArrayFormat *array_format) : //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Copy Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexFormat:: GeomVertexFormat(const GeomVertexFormat ©) : @@ -65,7 +65,7 @@ GeomVertexFormat(const GeomVertexFormat ©) : //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Copy Assignment Operator // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexFormat:: operator = (const GeomVertexFormat ©) { @@ -78,7 +78,7 @@ operator = (const GeomVertexFormat ©) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Destructor // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexFormat:: ~GeomVertexFormat() { @@ -109,7 +109,6 @@ unref() const { return false; } - //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::get_post_animated_format // Access: Published @@ -129,7 +128,7 @@ get_post_animated_format() const { if (_post_animated_format == (GeomVertexFormat *)NULL) { PT(GeomVertexFormat) new_format = new GeomVertexFormat(*this); new_format->remove_column(InternalName::get_transform_blend()); - + int num_morphs = get_num_morphs(); for (int mi = 0; mi < num_morphs; mi++) { CPT(InternalName) delta_name = get_morph_delta(mi); @@ -138,7 +137,7 @@ get_post_animated_format() const { new_format->_animation.set_none(); - CPT(GeomVertexFormat) registered = + CPT(GeomVertexFormat) registered = GeomVertexFormat::register_format(new_format); ((GeomVertexFormat *)this)->_post_animated_format = registered; if (_post_animated_format != this) { @@ -215,13 +214,13 @@ get_union_format(const GeomVertexFormat *other) const { if (column_b != (GeomVertexColumn *)NULL && column_b->get_total_bytes() > column_a->get_total_bytes()) { // Column b is larger. Keep it. - new_array->add_column(column_b->get_name(), + new_array->add_column(column_b->get_name(), column_b->get_num_components(), column_b->get_numeric_type(), column_b->get_contents()); } else { // Column a is larger. Keep it. - new_array->add_column(column_a->get_name(), + new_array->add_column(column_a->get_name(), column_a->get_num_components(), column_a->get_numeric_type(), column_a->get_contents()); @@ -242,13 +241,13 @@ get_union_format(const GeomVertexFormat *other) const { if (column_b != (GeomVertexColumn *)NULL && column_b->get_total_bytes() > column_a->get_total_bytes()) { // Column b is larger. Keep it. - new_array->add_column(column_b->get_name(), + new_array->add_column(column_b->get_name(), column_b->get_num_components(), column_b->get_numeric_type(), column_b->get_contents()); } else { // Column a is larger. Keep it. - new_array->add_column(column_a->get_name(), + new_array->add_column(column_a->get_name(), column_a->get_num_components(), column_a->get_numeric_type(), column_a->get_contents()); @@ -517,7 +516,7 @@ get_column(const InternalName *name) const { if (ai != _columns_by_name.end()) { int array_index = (*ai).second._array_index; int column_index = (*ai).second._column_index; - + nassertr(array_index >= 0 && array_index < (int)_arrays.size(), NULL); return _arrays[array_index]->get_column(column_index); } @@ -628,7 +627,7 @@ maybe_align_columns_for_animation() { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::output // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexFormat:: output(ostream &out) const { @@ -654,7 +653,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::write // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexFormat:: write(ostream &out, int indent_level) const { @@ -673,10 +672,10 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::write_with_data // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexFormat:: -write_with_data(ostream &out, int indent_level, +write_with_data(ostream &out, int indent_level, const GeomVertexData *data) const { indent(out, indent_level) << data->get_num_rows() << " rows.\n"; @@ -725,7 +724,7 @@ get_array_info(const InternalName *name, int &array_index, //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::compare_to // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// int GeomVertexFormat:: compare_to(const GeomVertexFormat &other) const { @@ -760,7 +759,7 @@ make_registry() { _registry->make_standard_formats(); } } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::do_register // Access: Private @@ -813,7 +812,7 @@ do_register() { // Go back through the index now and identify the points, vectors, // and morph descriptions, so we can quickly look these up later. DataTypesByName::iterator ni; - for (ni = _columns_by_name.begin(); + for (ni = _columns_by_name.begin(); ni != _columns_by_name.end(); ++ni) { const DataTypeRecord &record = (*ni).second; @@ -840,8 +839,8 @@ do_register() { // It's a morph description. MorphRecord morph; morph._delta = column->get_name(); - - // The delta name must be of the form "basename.morph.slidername". + + // The delta name must be of the form "basename.morph.slidername". int n = morph._delta->find_ancestor("morph"); if (n < 0) { gobj_cat.warning() @@ -850,10 +849,10 @@ do_register() { } else { morph._slider = InternalName::make(morph._delta->get_net_basename(n - 1)); morph._base = morph._delta->get_ancestor(n + 1); - + if (_columns_by_name.find(morph._base) == _columns_by_name.end()) { gobj_cat.warning() - << "vertex format defines " + << "vertex format defines " << *column->get_name() << " but does not define " << *morph._base << "\n"; } else { @@ -879,7 +878,7 @@ do_register() { get_array_info(InternalName::get_color(), _color_array_index, _color_column); } - + //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::do_unregister // Access: Private @@ -896,7 +895,7 @@ do_unregister() { _texcoords.clear(); _morphs.clear(); - if (_post_animated_format != (GeomVertexFormat *)NULL && + if (_post_animated_format != (GeomVertexFormat *)NULL && _post_animated_format != this) { unref_delete(_post_animated_format); } @@ -997,7 +996,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Registry::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexFormat::Registry:: Registry() { @@ -1006,32 +1005,32 @@ Registry() { //////////////////////////////////////////////////////////////////// // Function: GeomVertexFormat::Registry::make_standard_formats // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexFormat::Registry:: make_standard_formats() { _v3 = register_format(new GeomVertexArrayFormat - (InternalName::get_vertex(), 3, + (InternalName::get_vertex(), 3, NT_stdfloat, C_point)); _v3n3 = register_format(new GeomVertexArrayFormat - (InternalName::get_vertex(), 3, + (InternalName::get_vertex(), 3, NT_stdfloat, C_point, - InternalName::get_normal(), 3, + InternalName::get_normal(), 3, NT_stdfloat, C_vector)); _v3t2 = register_format(new GeomVertexArrayFormat - (InternalName::get_vertex(), 3, + (InternalName::get_vertex(), 3, NT_stdfloat, C_point, - InternalName::get_texcoord(), 2, + InternalName::get_texcoord(), 2, NT_stdfloat, C_texcoord)); _v3n3t2 = register_format(new GeomVertexArrayFormat - (InternalName::get_vertex(), 3, + (InternalName::get_vertex(), 3, NT_stdfloat, C_point, InternalName::get_normal(), 3, NT_stdfloat, C_vector, - InternalName::get_texcoord(), 2, + InternalName::get_texcoord(), 2, NT_stdfloat, C_texcoord)); // Define the DirectX-style packed color formats diff --git a/panda/src/gobj/geomVertexFormat.h b/panda/src/gobj/geomVertexFormat.h index 8efbfdc708..ba2faf2c36 100644 --- a/panda/src/gobj/geomVertexFormat.h +++ b/panda/src/gobj/geomVertexFormat.h @@ -58,7 +58,7 @@ class GeomMunger; // standard and/or user-defined columns in your custom // GeomVertexFormat constructions. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_GOBJ GeomVertexFormat : public TypedWritableReferenceCount, public GeomEnums { +class EXPCL_PANDA_GOBJ GeomVertexFormat FINAL : public TypedWritableReferenceCount, public GeomEnums { PUBLISHED: GeomVertexFormat(); GeomVertexFormat(const GeomVertexArrayFormat *array_format); @@ -96,7 +96,7 @@ PUBLISHED: int get_array_with(const InternalName *name) const; const GeomVertexColumn *get_column(const InternalName *name) const; INLINE bool has_column(const InternalName *name) const; - + MAKE_SEQ(get_columns, get_num_columns, get_column); void remove_column(const InternalName *name, bool keep_empty_array = false); @@ -126,7 +126,7 @@ PUBLISHED: void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; - void write_with_data(ostream &out, int indent_level, + void write_with_data(ostream &out, int indent_level, const GeomVertexData *data) const; // Some standard vertex formats. No particular requirement to use @@ -203,16 +203,16 @@ private: int _color_array_index; const GeomVertexColumn *_color_column; - typedef pvector< CPT(InternalName) > Columns; + typedef pvector Columns; Columns _points; Columns _vectors; Columns _texcoords; class MorphRecord { public: - CPT(InternalName) _slider; - CPT(InternalName) _base; - CPT(InternalName) _delta; + CPT_InternalName _slider; + CPT_InternalName _base; + CPT_InternalName _delta; }; typedef pvector Morphs; Morphs _morphs; @@ -237,12 +237,12 @@ private: CPT(GeomVertexFormat) _v3n3; CPT(GeomVertexFormat) _v3t2; CPT(GeomVertexFormat) _v3n3t2; - + CPT(GeomVertexFormat) _v3cp; CPT(GeomVertexFormat) _v3n3cp; CPT(GeomVertexFormat) _v3cpt2; CPT(GeomVertexFormat) _v3n3cpt2; - + CPT(GeomVertexFormat) _v3c4; CPT(GeomVertexFormat) _v3n3c4; CPT(GeomVertexFormat) _v3c4t2; diff --git a/panda/src/gobj/geomVertexReader.I b/panda/src/gobj/geomVertexReader.I index 0dba5f8108..cd64794139 100644 --- a/panda/src/gobj/geomVertexReader.I +++ b/panda/src/gobj/geomVertexReader.I @@ -52,31 +52,14 @@ GeomVertexReader(const GeomVertexData *vertex_data, // reader specifically to process the named data type. //////////////////////////////////////////////////////////////////// INLINE GeomVertexReader:: -GeomVertexReader(const GeomVertexData *vertex_data, const string &name, +GeomVertexReader(const GeomVertexData *vertex_data, + CPT_InternalName name, Thread *current_thread) : _vertex_data(vertex_data), _current_thread(current_thread) { initialize(); - set_column(name); -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexReader::Constructor -// Access: Published -// Description: Constructs a new reader to process the vertices of -// the indicated data object. This flavor creates the -// reader specifically to process the named data type. -//////////////////////////////////////////////////////////////////// -INLINE GeomVertexReader:: -GeomVertexReader(const GeomVertexData *vertex_data, - const InternalName *name, - Thread *current_thread) : - _vertex_data(vertex_data), - _current_thread(current_thread) -{ - initialize(); - set_column(name); + set_column(MOVE(name)); } //////////////////////////////////////////////////////////////////// @@ -317,25 +300,7 @@ set_column(int column) { // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool GeomVertexReader:: -set_column(const string &name) { - return set_column(InternalName::make(name)); -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexReader::set_column -// Access: Published -// Description: Sets up the reader to use the data type with the -// indicated name. -// -// This also resets the read row number to the start row -// (the same value passed to a previous call to -// set_row(), or 0 if set_row() was never called.) -// -// The return value is true if the data type is valid, -// false otherwise. -//////////////////////////////////////////////////////////////////// -INLINE bool GeomVertexReader:: -set_column(const InternalName *name) { +set_column(CPT_InternalName name) { if (_vertex_data != (const GeomVertexData *)NULL) { GeomVertexDataPipelineReader reader(_vertex_data, _current_thread); reader.check_array_readers(); diff --git a/panda/src/gobj/geomVertexReader.h b/panda/src/gobj/geomVertexReader.h index 814b2af020..04f7a9a823 100644 --- a/panda/src/gobj/geomVertexReader.h +++ b/panda/src/gobj/geomVertexReader.h @@ -59,14 +59,11 @@ PUBLISHED: INLINE GeomVertexReader(const GeomVertexData *vertex_data, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexReader(const GeomVertexData *vertex_data, - const string &name, - Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexReader(const GeomVertexData *vertex_data, - const InternalName *name, + CPT_InternalName name, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexReader(const GeomVertexArrayData *array_data, Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexReader(const GeomVertexArrayData *array_data, + INLINE GeomVertexReader(const GeomVertexArrayData *array_data, int column, Thread *current_thread = Thread::get_current_thread()); @@ -90,8 +87,7 @@ PUBLISHED: INLINE bool get_force() const; INLINE bool set_column(int column); - INLINE bool set_column(const string &name); - INLINE bool set_column(const InternalName *name); + INLINE bool set_column(CPT_InternalName name); bool set_column(int array, const GeomVertexColumn *column); INLINE void clear(); diff --git a/panda/src/gobj/geomVertexRewriter.I b/panda/src/gobj/geomVertexRewriter.I index ca9408f2da..89f6a55743 100644 --- a/panda/src/gobj/geomVertexRewriter.I +++ b/panda/src/gobj/geomVertexRewriter.I @@ -49,28 +49,12 @@ GeomVertexRewriter(GeomVertexData *vertex_data, Thread *current_thread) : // rewriter specifically to process the named data type. //////////////////////////////////////////////////////////////////// INLINE GeomVertexRewriter:: -GeomVertexRewriter(GeomVertexData *vertex_data, const string &name, +GeomVertexRewriter(GeomVertexData *vertex_data, CPT_InternalName name, Thread *current_thread) : GeomVertexWriter(vertex_data, current_thread), GeomVertexReader(vertex_data, current_thread) { - set_column(name); -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexRewriter::Constructor -// Access: Published -// Description: Constructs a new rewriter to process the vertices of -// the indicated data object. This flavor creates the -// rewriter specifically to process the named data type. -//////////////////////////////////////////////////////////////////// -INLINE GeomVertexRewriter:: -GeomVertexRewriter(GeomVertexData *vertex_data, const InternalName *name, - Thread *current_thread) : - GeomVertexWriter(vertex_data, current_thread), - GeomVertexReader(vertex_data, current_thread) -{ - set_column(name); + set_column(MOVE(name)); } //////////////////////////////////////////////////////////////////// @@ -237,30 +221,11 @@ set_column(int column) { // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool GeomVertexRewriter:: -set_column(const string &name) { - return set_column(InternalName::make(name)); -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexRewriter::set_column -// Access: Published -// Description: Sets up the rewriter to use the data type with the -// indicated name. -// -// This also resets both the read and write row -// numbers to the start row (the same value passed to -// a previous call to set_row(), or 0 if set_row() -// was never called.) -// -// The return value is true if the data type is valid, -// false otherwise. -//////////////////////////////////////////////////////////////////// -INLINE bool GeomVertexRewriter:: -set_column(const InternalName *name) { +set_column(CPT_InternalName name) { // It's important to invoke the writer first, then the reader. See // set_row(). GeomVertexWriter::set_column(name); - return GeomVertexReader::set_column(name); + return GeomVertexReader::set_column(MOVE(name)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/geomVertexRewriter.h b/panda/src/gobj/geomVertexRewriter.h index efd6e11b56..5e180b357e 100644 --- a/panda/src/gobj/geomVertexRewriter.h +++ b/panda/src/gobj/geomVertexRewriter.h @@ -41,11 +41,10 @@ PUBLISHED: INLINE GeomVertexRewriter(Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexRewriter(GeomVertexData *vertex_data, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexRewriter(GeomVertexData *vertex_data, - const string &name, Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexRewriter(GeomVertexData *vertex_data, - const InternalName *name, Thread *current_thread = Thread::get_current_thread()); + CPT_InternalName name, + Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexRewriter(GeomVertexArrayData *array_data, Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexRewriter(GeomVertexArrayData *array_data, + INLINE GeomVertexRewriter(GeomVertexArrayData *array_data, int column, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexRewriter(const GeomVertexRewriter ©); INLINE void operator = (const GeomVertexRewriter ©); @@ -58,8 +57,7 @@ PUBLISHED: INLINE Thread *get_current_thread() const; INLINE bool set_column(int column); - INLINE bool set_column(const string &name); - INLINE bool set_column(const InternalName *name); + INLINE bool set_column(CPT_InternalName name); INLINE bool set_column(int array, const GeomVertexColumn *column); INLINE void clear(); diff --git a/panda/src/gobj/geomVertexWriter.I b/panda/src/gobj/geomVertexWriter.I index 9c33d9c27d..66a9f4ee6d 100644 --- a/panda/src/gobj/geomVertexWriter.I +++ b/panda/src/gobj/geomVertexWriter.I @@ -51,30 +51,13 @@ GeomVertexWriter(GeomVertexData *vertex_data, Thread *current_thread) : // writer specifically to process the named data type. //////////////////////////////////////////////////////////////////// INLINE GeomVertexWriter:: -GeomVertexWriter(GeomVertexData *vertex_data, const string &name, +GeomVertexWriter(GeomVertexData *vertex_data, CPT_InternalName name, Thread *current_thread) : _vertex_data(vertex_data), _current_thread(current_thread) { initialize(); - set_column(name); -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::Constructor -// Access: Published -// Description: Constructs a new writer to process the vertices of -// the indicated data object. This flavor creates the -// writer specifically to process the named data type. -//////////////////////////////////////////////////////////////////// -INLINE GeomVertexWriter:: -GeomVertexWriter(GeomVertexData *vertex_data, const InternalName *name, - Thread *current_thread) : - _vertex_data(vertex_data), - _current_thread(current_thread) -{ - initialize(); - set_column(name); + set_column(MOVE(name)); } //////////////////////////////////////////////////////////////////// @@ -131,7 +114,7 @@ GeomVertexWriter(GeomVertexDataPipelineWriter *data_writer, //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::Copy Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexWriter:: GeomVertexWriter(const GeomVertexWriter ©) : @@ -152,7 +135,7 @@ GeomVertexWriter(const GeomVertexWriter ©) : //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::Copy Assignment Operator // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void GeomVertexWriter:: operator = (const GeomVertexWriter ©) { @@ -172,7 +155,7 @@ operator = (const GeomVertexWriter ©) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexWriter:: ~GeomVertexWriter() { @@ -268,24 +251,6 @@ set_column(int column) { return false; } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::set_column -// Access: Published -// Description: Sets up the writer to use the data type with the -// indicated name. -// -// This also resets the write row number to the start -// row (the same value passed to a previous call to -// set_row(), or 0 if set_row() was never called.) -// -// The return value is true if the data type is valid, -// false otherwise. -//////////////////////////////////////////////////////////////////// -INLINE bool GeomVertexWriter:: -set_column(const string &name) { - return set_column(InternalName::make(name)); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::set_column // Access: Published @@ -300,7 +265,7 @@ set_column(const string &name) { // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool GeomVertexWriter:: -set_column(const InternalName *name) { +set_column(CPT_InternalName name) { if (_vertex_data != (GeomVertexData *)NULL) { GeomVertexDataPipelineWriter writer(_vertex_data, true, _current_thread); writer.check_array_writers(); diff --git a/panda/src/gobj/geomVertexWriter.h b/panda/src/gobj/geomVertexWriter.h index e29cfb149c..2a22f78f1f 100644 --- a/panda/src/gobj/geomVertexWriter.h +++ b/panda/src/gobj/geomVertexWriter.h @@ -26,7 +26,7 @@ // Class : GeomVertexWriter // Description : This object provides a high-level interface for // quickly writing a sequence of numeric values from a -// vertex table. +// vertex table. // // This object can be used both to replace existing // vertices in the table, or to extend the table with @@ -72,14 +72,11 @@ PUBLISHED: INLINE GeomVertexWriter(GeomVertexData *vertex_data, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexWriter(GeomVertexData *vertex_data, - const string &name, - Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexWriter(GeomVertexData *vertex_data, - const InternalName *name, + CPT_InternalName name, Thread *current_thread = Thread::get_current_thread()); INLINE GeomVertexWriter(GeomVertexArrayData *array_data, Thread *current_thread = Thread::get_current_thread()); - INLINE GeomVertexWriter(GeomVertexArrayData *array_data, + INLINE GeomVertexWriter(GeomVertexArrayData *array_data, int column, Thread *current_thread = Thread::get_current_thread()); @@ -99,8 +96,7 @@ PUBLISHED: INLINE Thread *get_current_thread() const; INLINE bool set_column(int column); - INLINE bool set_column(const string &name); - INLINE bool set_column(const InternalName *name); + INLINE bool set_column(CPT_InternalName name); bool set_column(int array, const GeomVertexColumn *column); INLINE void clear(); bool reserve_num_rows(int num_rows); @@ -225,7 +221,7 @@ private: PT(GeomVertexData) _vertex_data; int _array; PT(GeomVertexArrayData) _array_data; - + Thread *_current_thread; GeomVertexColumn::Packer *_packer; int _stride; diff --git a/panda/src/gobj/internalName.I b/panda/src/gobj/internalName.I index 0c2dacccd3..2b8669ff5a 100644 --- a/panda/src/gobj/internalName.I +++ b/panda/src/gobj/internalName.I @@ -12,9 +12,10 @@ // //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// // Function: InternalName::make -// Access: Published, Static +// Access: Public, Static // Description: The public interface for constructing an InternalName // pointer. This will return a new InternalName // representing the indicated name, if this is the first @@ -32,6 +33,34 @@ make(const string &name) { return get_root()->append(name); } +//////////////////////////////////////////////////////////////////// +// Function: InternalName::make +// Access: Public, Static +// Description: This version of make() is defined such as to accept +// mostly string literals, which may be string pooled +// by the compiler. This allows us to make an +// additional optimization. +// +// This constructor is also used for fixed-size arrays, +// since there is no neat way to catch string literals +// only. Presumably people aren't using InternalName +// in that way. +//////////////////////////////////////////////////////////////////// +template +INLINE PT(InternalName) InternalName:: +make(const char (&literal)[N]) { + LightMutexHolder holder(_literal_table_lock); + LiteralTable::const_iterator it = _literal_table.find(literal); + + if (it == _literal_table.end()) { + PT(InternalName) name = get_root()->append(literal); + _literal_table.insert(LiteralTable::value_type(literal, name)); + return name; + } else { + return it->second; + } +} + //////////////////////////////////////////////////////////////////// // Function: InternalName::get_parent // Access: Published @@ -430,10 +459,147 @@ get_view() { //////////////////////////////////////////////////////////////////// // Function: InternalName::output operator // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE ostream & operator << (ostream &out, const InternalName &tcn) { tcn.output(out); return out; } + +#ifndef CPPPARSER +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(const InternalName *ptr) : + ConstPointerTo(ptr) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(const PointerTo ©) : + ConstPointerTo(copy) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(const ConstPointerTo ©) : + ConstPointerTo(copy) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Conversion Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(const string &name) : + ConstPointerTo(InternalName::make(name)) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Conversion Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +template +INLINE CPT_InternalName:: +CPT_InternalName(const char (&literal)[N]) : + ConstPointerTo(InternalName::make(literal)) +{ +} + +#ifdef USE_MOVE_SEMANTICS +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Move Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(PointerTo &&from) NOEXCEPT : + ConstPointerTo(move(from)) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Move Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName:: +CPT_InternalName(ConstPointerTo &&from) NOEXCEPT : + ConstPointerTo(move(from)) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Move Assignment Operator +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName &CPT_InternalName:: +operator = (PointerTo &&from) NOEXCEPT { + this->reassign(move(from)); + return *this; +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Move Assignment Operator +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName &CPT_InternalName:: +operator = (ConstPointerTo &&from) NOEXCEPT { + this->reassign(move(from)); + return *this; +} +#endif // USE_MOVE_SEMANTICS + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Assignment operator +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName &CPT_InternalName:: +operator = (const To *ptr) { + this->reassign((To *)ptr); + return *this; +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Assignment operator +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName &CPT_InternalName:: +operator = (const PointerTo ©) { + this->reassign((const ConstPointerTo &)copy); + return *this; +} + +//////////////////////////////////////////////////////////////////// +// Function: CPT_InternalName::Assignment operator +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE CPT_InternalName &CPT_InternalName:: +operator = (const ConstPointerTo ©) { + this->reassign((const ConstPointerTo &)copy); + return *this; +} +#endif // CPPPARSER diff --git a/panda/src/gobj/internalName.cxx b/panda/src/gobj/internalName.cxx index 856fdcd403..c6f57af3ac 100644 --- a/panda/src/gobj/internalName.cxx +++ b/panda/src/gobj/internalName.cxx @@ -47,6 +47,9 @@ TypeHandle InternalName::_texcoord_type_handle; InternalName::PyInternTable InternalName::_py_intern_table; #endif +InternalName::LiteralTable InternalName::_literal_table; +LightMutex InternalName::_literal_table_lock; + //////////////////////////////////////////////////////////////////// // Function: InternalName::Constructor // Access: Private @@ -225,7 +228,7 @@ get_ancestor(int n) const { } else { return get_root(); - } + } } //////////////////////////////////////////////////////////////////// @@ -267,13 +270,13 @@ get_net_basename(int n) const { } else { return _basename; - } + } } //////////////////////////////////////////////////////////////////// // Function: InternalName::output // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void InternalName:: output(ostream &out) const { @@ -366,7 +369,7 @@ make_from_bam(const FactoryParams ¶ms) { // it later. me->ref(); manager->register_finalize(me); - + return me.p(); } @@ -393,7 +396,7 @@ make_texcoord_from_bam(const FactoryParams ¶ms) { me->ref(); manager->register_finalize(me); - + return me.p(); } diff --git a/panda/src/gobj/internalName.h b/panda/src/gobj/internalName.h index 82c570dcbb..079f7a29da 100644 --- a/panda/src/gobj/internalName.h +++ b/panda/src/gobj/internalName.h @@ -21,6 +21,7 @@ #include "pointerTo.h" #include "pmap.h" #include "lightMutex.h" +#include "lightMutexHolder.h" class FactoryParams; @@ -39,13 +40,16 @@ class FactoryParams; // one or more other names, or by giving it a source // string directly. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_GOBJ InternalName : public TypedWritableReferenceCount { +class EXPCL_PANDA_GOBJ InternalName FINAL : public TypedWritableReferenceCount { private: InternalName(InternalName *parent, const string &basename); public: INLINE static PT(InternalName) make(const string &name); + template + INLINE static PT(InternalName) make(const char (&literal)[N]); + PUBLISHED: virtual ~InternalName(); virtual bool unref() const; @@ -91,6 +95,8 @@ PUBLISHED: INLINE static PT(InternalName) get_view(); #ifdef HAVE_PYTHON + // These versions are exposed to Python, which have additional logic + // to map from Python interned strings. #if PY_MAJOR_VERSION >= 3 EXTENSION(static PT(InternalName) make(PyUnicodeObject *str)); #else @@ -114,6 +120,10 @@ private: NameTable _name_table; LightMutex _name_table_lock; + typedef phash_map LiteralTable; + static LiteralTable _literal_table; + static LightMutex _literal_table_lock; + static PT(InternalName) _root; static PT(InternalName) _error; static PT(InternalName) _default; @@ -171,7 +181,46 @@ private: INLINE ostream &operator << (ostream &out, const InternalName &tcn); +//////////////////////////////////////////////////////////////////// +// Class : CPT_InternalName +// Description : This is a const pointer to an InternalName, and +// should be used in lieu of a CPT(InternalName) in +// function arguments. The extra feature that it +// offers is that it has a constructor to automatically +// convert from a string, so that strings are coerced +// by the compiler when passed to such a function. +//////////////////////////////////////////////////////////////////// +#ifdef CPPPARSER +// This construct confuses interrogate, so we give it a typedef. +typedef const InternalName *CPT_InternalName; +#else +class CPT_InternalName : public ConstPointerTo { +public: + INLINE CPT_InternalName(const To *ptr = (const To *)NULL); + INLINE CPT_InternalName(const PointerTo ©); + INLINE CPT_InternalName(const ConstPointerTo ©); + INLINE CPT_InternalName(const string &name); + + template + INLINE CPT_InternalName(const char (&literal)[N]); + +#ifdef USE_MOVE_SEMANTICS + INLINE CPT_InternalName(PointerTo &&from) NOEXCEPT; + INLINE CPT_InternalName(ConstPointerTo &&from) NOEXCEPT; + INLINE CPT_InternalName &operator = (PointerTo &&from) NOEXCEPT; + INLINE CPT_InternalName &operator = (ConstPointerTo &&from) NOEXCEPT; +#endif // USE_MOVE_SEMANTICS + + INLINE CPT_InternalName &operator = (const To *ptr); + INLINE CPT_InternalName &operator = (const PointerTo ©); + INLINE CPT_InternalName &operator = (const ConstPointerTo ©); +}; + +INLINE void swap(CPT_InternalName &one, CPT_InternalName &two) NOEXCEPT { + one.swap(two); +} +#endif // CPPPARSER + #include "internalName.I" #endif - diff --git a/panda/src/pgraph/internalNameCollection.cxx b/panda/src/pgraph/internalNameCollection.cxx index fd4bd74395..f5242e7b21 100644 --- a/panda/src/pgraph/internalNameCollection.cxx +++ b/panda/src/pgraph/internalNameCollection.cxx @@ -52,7 +52,7 @@ operator = (const InternalNameCollection ©) { // Description: Adds a new InternalName to the collection. //////////////////////////////////////////////////////////////////// void InternalNameCollection:: -add_name(InternalName *name) { +add_name(const InternalName *name) { // If the pointer to our internal array is shared by any other // InternalNameCollections, we have to copy the array now so we won't // inadvertently modify any of our brethren InternalNameCollection @@ -75,7 +75,7 @@ add_name(InternalName *name) { // not a member of the collection. //////////////////////////////////////////////////////////////////// bool InternalNameCollection:: -remove_name(InternalName *name) { +remove_name(const InternalName *name) { int name_index = -1; for (int i = 0; name_index == -1 && i < (int)_names.size(); i++) { if (_names[i] == name) { @@ -131,7 +131,7 @@ remove_names_from(const InternalNameCollection &other) { InternalNames new_names; int num_names = get_num_names(); for (int i = 0; i < num_names; i++) { - PT(InternalName) name = get_name(i); + const InternalName *name = get_name(i); if (!other.has_name(name)) { new_names.push_back(name); } @@ -153,7 +153,7 @@ remove_duplicate_names() { int num_names = get_num_names(); for (int i = 0; i < num_names; i++) { - PT(InternalName) name = get_name(i); + const InternalName *name = get_name(i); bool duplicated = false; for (int j = 0; j < i && !duplicated; j++) { @@ -175,7 +175,7 @@ remove_duplicate_names() { // this collection, false otherwise. //////////////////////////////////////////////////////////////////// bool InternalNameCollection:: -has_name(InternalName *name) const { +has_name(const InternalName *name) const { for (int i = 0; i < get_num_names(); i++) { if (name == get_name(i)) { return true; @@ -209,7 +209,7 @@ get_num_names() const { // Access: Published // Description: Returns the nth InternalName in the collection. //////////////////////////////////////////////////////////////////// -InternalName *InternalNameCollection:: +const InternalName *InternalNameCollection:: get_name(int index) const { nassertr(index >= 0 && index < (int)_names.size(), NULL); @@ -223,7 +223,7 @@ get_name(int index) const { // the same as get_name(), but it may be a more // convenient way to access it. //////////////////////////////////////////////////////////////////// -InternalName *InternalNameCollection:: +const InternalName *InternalNameCollection:: operator [] (int index) const { nassertr(index >= 0 && index < (int)_names.size(), NULL); diff --git a/panda/src/pgraph/internalNameCollection.h b/panda/src/pgraph/internalNameCollection.h index 48e0cf443f..fbf59b5bbe 100644 --- a/panda/src/pgraph/internalNameCollection.h +++ b/panda/src/pgraph/internalNameCollection.h @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////// // Class : InternalNameCollection -// Description : +// Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH InternalNameCollection { PUBLISHED: @@ -30,18 +30,18 @@ PUBLISHED: void operator = (const InternalNameCollection ©); INLINE ~InternalNameCollection(); - void add_name(InternalName *name); - bool remove_name(InternalName *name); + void add_name(const InternalName *name); + bool remove_name(const InternalName *name); void add_names_from(const InternalNameCollection &other); void remove_names_from(const InternalNameCollection &other); void remove_duplicate_names(); - bool has_name(InternalName *name) const; + bool has_name(const InternalName *name) const; void clear(); int get_num_names() const; - InternalName *get_name(int index) const; + const InternalName *get_name(int index) const; MAKE_SEQ(get_names, get_num_names, get_name); - InternalName *operator [] (int index) const; + const InternalName *operator [] (int index) const; int size() const; INLINE void operator += (const InternalNameCollection &other); INLINE InternalNameCollection operator + (const InternalNameCollection &other) const; @@ -50,7 +50,7 @@ PUBLISHED: void write(ostream &out, int indent_level = 0) const; private: - typedef PTA(PT(InternalName)) InternalNames; + typedef PTA(CPT(InternalName)) InternalNames; InternalNames _names; }; diff --git a/panda/src/pgraph/nodePath.I b/panda/src/pgraph/nodePath.I index 69186c89e9..ea347495cf 100644 --- a/panda/src/pgraph/nodePath.I +++ b/panda/src/pgraph/nodePath.I @@ -279,7 +279,7 @@ node() const { // Description: Returns an integer that is guaranteed to be the same // for all NodePaths that represent the same node // instance, and different for all NodePaths that -// represent a different node instance. +// represent a different node instance. // // The same key will be returned for a particular // instance as long as at least one NodePath exists that @@ -1313,6 +1313,258 @@ get_sa() const { return get_color_scale()[3]; } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_float &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_double &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_int &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase4 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase3 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase2 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase4 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase3 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase2 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase4i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase3i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LVecBase2i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase4i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase3i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LVecBase2i &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LMatrix4 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const PTA_LMatrix3 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LMatrix4 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const LMatrix3 &v, int priority) { + set_shader_input(new ShaderInput(id, v, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, Texture *tex, int priority) { + set_shader_input(new ShaderInput(id, tex, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority) { + set_shader_input(new ShaderInput(id, tex, sampler, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z, int n, int priority) { + set_shader_input(new ShaderInput(id, tex, read, write, z, n, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, const NodePath &np, int priority) { + set_shader_input(new ShaderInput(id, np, priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, int n1, int n2, int n3, int n4, int priority) { + set_shader_input(new ShaderInput(id, LVecBase4i(n1, n2, n3, n4), priority)); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::set_shader_input +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, PN_stdfloat n1, PN_stdfloat n2, PN_stdfloat n3, PN_stdfloat n4, int priority) { + set_shader_input(new ShaderInput(id, LVecBase4(n1, n2, n3, n4), priority)); +} + //////////////////////////////////////////////////////////////////// // Function: NodePath::set_tex_offset // Access: Published @@ -1339,7 +1591,7 @@ set_tex_offset(TextureStage *stage, PN_stdfloat u, PN_stdfloat v) { INLINE void NodePath:: set_tex_offset(TextureStage *stage, const LVecBase2 &uv) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_pos2d(uv)); } @@ -1356,7 +1608,7 @@ set_tex_offset(TextureStage *stage, const LVecBase2 &uv) { INLINE void NodePath:: set_tex_rotate(TextureStage *stage, PN_stdfloat r) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_rotate2d(r)); } @@ -1372,7 +1624,7 @@ set_tex_rotate(TextureStage *stage, PN_stdfloat r) { INLINE void NodePath:: set_tex_scale(TextureStage *stage, PN_stdfloat scale) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_scale(scale)); } @@ -1402,7 +1654,7 @@ set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv) { INLINE void NodePath:: set_tex_scale(TextureStage *stage, const LVecBase2 &scale) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_scale2d(scale)); } @@ -1475,7 +1727,7 @@ set_tex_pos(TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) { INLINE void NodePath:: set_tex_pos(TextureStage *stage, const LVecBase3 &uvw) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_pos(uvw)); } @@ -1505,7 +1757,7 @@ set_tex_hpr(TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) { INLINE void NodePath:: set_tex_hpr(TextureStage *stage, const LVecBase3 &hpr) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_hpr(hpr)); } @@ -1533,7 +1785,7 @@ set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat s INLINE void NodePath:: set_tex_scale(TextureStage *stage, const LVecBase3 &scale) { nassertv_always(!is_empty()); - set_tex_transform(stage, + set_tex_transform(stage, get_tex_transform(stage)->set_scale(scale)); } @@ -1605,7 +1857,7 @@ set_tex_offset(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_std INLINE void NodePath:: set_tex_offset(const NodePath &other, TextureStage *stage, const LVecBase2 &uv) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(other, stage)->set_pos2d(uv)); } @@ -1622,7 +1874,7 @@ set_tex_offset(const NodePath &other, TextureStage *stage, const LVecBase2 &uv) INLINE void NodePath:: set_tex_rotate(const NodePath &other, TextureStage *stage, PN_stdfloat r) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(other, stage)->set_rotate2d(r)); } @@ -1638,7 +1890,7 @@ set_tex_rotate(const NodePath &other, TextureStage *stage, PN_stdfloat r) { INLINE void NodePath:: set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat scale) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(stage)->set_scale(scale)); } @@ -1668,7 +1920,7 @@ set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_std INLINE void NodePath:: set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase2 &scale) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(stage)->set_scale2d(scale)); } @@ -1741,7 +1993,7 @@ set_tex_pos(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdflo INLINE void NodePath:: set_tex_pos(const NodePath &other, TextureStage *stage, const LVecBase3 &uvw) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(stage)->set_pos(uvw)); } @@ -1771,7 +2023,7 @@ set_tex_hpr(const NodePath &other, TextureStage *stage, PN_stdfloat h, PN_stdflo INLINE void NodePath:: set_tex_hpr(const NodePath &other, TextureStage *stage, const LVecBase3 &hpr) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(stage)->set_hpr(hpr)); } @@ -1799,7 +2051,7 @@ set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_std INLINE void NodePath:: set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase3 &scale) { nassertv_always(!is_empty()); - set_tex_transform(other, stage, + set_tex_transform(other, stage, get_tex_transform(stage)->set_scale(scale)); } diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index fdbfd02945..828179f603 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -3842,7 +3842,7 @@ set_shader_input(const ShaderInput *inp) { // Description: //////////////////////////////////////////////////////////////////// const ShaderInput *NodePath:: -get_shader_input(const InternalName *id) const { +get_shader_input(CPT_InternalName id) const { nassertr_always(!is_empty(), NULL); const RenderAttrib *attrib = @@ -3881,7 +3881,7 @@ get_instance_count() const { // Description: //////////////////////////////////////////////////////////////////// void NodePath:: -clear_shader_input(const InternalName *id) { +clear_shader_input(CPT_InternalName id) { nassertv_always(!is_empty()); const RenderAttrib *attrib = @@ -3892,259 +3892,6 @@ clear_shader_input(const InternalName *id) { } } - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_float &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_double &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_int &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase4 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase3 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase2 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase4 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase3 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase2 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase4i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase3i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LVecBase2i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase4i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase3i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LVecBase2i &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LMatrix4 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const PTA_LMatrix3 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LMatrix4 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const LMatrix3 &v, int priority) { - set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, Texture *tex, int priority) { - set_shader_input(new ShaderInput(id,tex,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, Texture *tex, const SamplerState &sampler, int priority) { - set_shader_input(new ShaderInput(id,tex,sampler,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, Texture *tex, bool read, bool write, int z, int n, int priority) { - set_shader_input(new ShaderInput(id,tex,read,write,z,n,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, const NodePath &np, int priority) { - set_shader_input(new ShaderInput(id,np,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, int n1, int n2, int n3, int n4, int priority) { - set_shader_input(new ShaderInput(id, LVecBase4i(n1, n2, n3, n4), priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -void NodePath:: -set_shader_input(const InternalName *id, PN_stdfloat n1, PN_stdfloat n2, PN_stdfloat n3, PN_stdfloat n4, int priority) { - set_shader_input(new ShaderInput(id, LVecBase4(n1, n2, n3, n4), priority)); -} - //////////////////////////////////////////////////////////////////// // Function: NodePath::set_instance_count // Access: Published @@ -4678,7 +4425,7 @@ find_all_vertex_columns(const string &name) const { InternalNameCollection tc; InternalNames::iterator ti; for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) { - InternalName *name = (*ti); + const InternalName *name = (*ti); if (glob.matches(name->get_name())) { tc.add_name(name); } @@ -4725,12 +4472,12 @@ find_all_texcoords(const string &name) const { r_find_all_vertex_columns(node(), vertex_columns); GlobPattern glob(name); - CPT(InternalName) texcoord_name = InternalName::get_texcoord(); + CPT_InternalName texcoord_name = InternalName::get_texcoord(); InternalNameCollection tc; InternalNames::iterator ti; for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) { - InternalName *name = (*ti); + const InternalName *name = (*ti); if (name->get_top() == texcoord_name) { // This is a texture coordinate name. Figure out the basename // of the texture coordinates. diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 2cade4e55c..f03580f255 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -624,39 +624,39 @@ PUBLISHED: void clear_shader(); void set_shader_input(const ShaderInput *inp); - void set_shader_input(const InternalName *id, Texture *tex, int priority=0); - void set_shader_input(const InternalName *id, Texture *tex, const SamplerState &sampler, int priority=0); - void set_shader_input(const InternalName *id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0); - void set_shader_input(const InternalName *id, const NodePath &np, int priority=0); - void set_shader_input(const InternalName *id, const PTA_float &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_double &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_int &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase4 &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase3 &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase2 &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LMatrix4 &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LMatrix3 &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase4 &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase3 &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase2 &v, int priority=0); - void set_shader_input(const InternalName *id, const LMatrix4 &v, int priority=0); - void set_shader_input(const InternalName *id, const LMatrix3 &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase4i &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase3i &v, int priority=0); - void set_shader_input(const InternalName *id, const PTA_LVecBase2i &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase4i &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase3i &v, int priority=0); - void set_shader_input(const InternalName *id, const LVecBase2i &v, int priority=0); - void set_shader_input(const InternalName *id, int n1, int n2=0, int n3=0, - int n4=0, int priority=0); - void set_shader_input(const InternalName *id, PN_stdfloat n1, PN_stdfloat n2=0, - PN_stdfloat n3=0, PN_stdfloat n4=0, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, Texture *tex, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const NodePath &np, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_float &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_double &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_int &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase4 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase3 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase2 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LMatrix4 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LMatrix3 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase4 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase3 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase2 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LMatrix4 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LMatrix3 &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase4i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase3i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase2i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase4i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase3i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, const LVecBase2i &v, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, int n1, int n2=0, int n3=0, + int n4=0, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, PN_stdfloat n1, PN_stdfloat n2=0, + PN_stdfloat n3=0, PN_stdfloat n4=0, int priority=0); - void clear_shader_input(const InternalName *id); + void clear_shader_input(CPT_InternalName id); void set_instance_count(int instance_count); const Shader *get_shader() const; - const ShaderInput *get_shader_input(const InternalName *id) const; + const ShaderInput *get_shader_input(CPT_InternalName id) const; int get_instance_count() const; void set_tex_transform(TextureStage *stage, const TransformState *transform); @@ -954,7 +954,7 @@ private: CollideMask and_mask, CollideMask or_mask, TypeHandle node_type); - typedef phash_set InternalNames; + typedef phash_set InternalNames; bool r_has_vertex_column(PandaNode *node, const InternalName *name) const; void r_find_all_vertex_columns(PandaNode *node, InternalNames &vertex_columns) const; @@ -1008,6 +1008,9 @@ private: INLINE ostream &operator << (ostream &out, const NodePath &node_path); +// We have to put this down here, to work around a circular include. +#include "shaderInput.h" + #include "nodePath.I" #endif diff --git a/panda/src/pgraph/renderAttrib.cxx b/panda/src/pgraph/renderAttrib.cxx index 255405402c..419a9094c9 100644 --- a/panda/src/pgraph/renderAttrib.cxx +++ b/panda/src/pgraph/renderAttrib.cxx @@ -152,7 +152,7 @@ get_auto_shader_attrib_impl(const RenderState *state) const { //////////////////////////////////////////////////////////////////// // Function: RenderAttrib::unref -// Access: Published, Virtual +// Access: Published, Virtual, Final // Description: This method overrides ReferenceCount::unref() to // clear the pointer from the global object pool when // its reference count goes to zero. diff --git a/panda/src/pgraph/renderAttrib.h b/panda/src/pgraph/renderAttrib.h index 979c669598..d3d9c67c40 100644 --- a/panda/src/pgraph/renderAttrib.h +++ b/panda/src/pgraph/renderAttrib.h @@ -84,7 +84,7 @@ PUBLISHED: INLINE CPT(RenderAttrib) get_unique() const; INLINE CPT(RenderAttrib) get_auto_shader_attrib(const RenderState *state) const; - virtual bool unref() const; + virtual bool unref() const FINAL; virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level) const; diff --git a/panda/src/pgraph/shaderAttrib.I b/panda/src/pgraph/shaderAttrib.I index 53a5afb68f..3331fa0a5f 100755 --- a/panda/src/pgraph/shaderAttrib.I +++ b/panda/src/pgraph/shaderAttrib.I @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////// // Function: ShaderAttrib::Constructor // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE ShaderAttrib:: ShaderAttrib() : @@ -32,14 +32,14 @@ ShaderAttrib() : _auto_glow_on(false), _auto_gloss_on(false), _auto_ramp_on(false), - _auto_shadow_on(false) + _auto_shadow_on(false) { } //////////////////////////////////////////////////////////////////// // Function: ShaderAttrib::Copy Constructor // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE ShaderAttrib:: ShaderAttrib(const ShaderAttrib ©) : @@ -85,7 +85,7 @@ auto_shader() const { //////////////////////////////////////////////////////////////////// // Function: ShaderAttrib::get_shader_priority // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int ShaderAttrib:: get_shader_priority() const { @@ -106,18 +106,169 @@ get_instance_count() const { //////////////////////////////////////////////////////////////////// // Function: ShaderAttrib::get_flag // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool ShaderAttrib:: get_flag(int index) const { return (_flags & (1<_inputs.find(input->get_name()); if (i == result->_inputs.end()) { - result->_inputs.insert(Inputs::value_type(input->get_name(),input)); + result->_inputs.insert(Inputs::value_type(input->get_name(), input)); } else { i->second = input; } return return_new(result); } -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_float &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_double &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_LVecBase4 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_LVecBase3 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_LVecBase2 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const LVecBase4 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const LVecBase3 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const LVecBase2 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_LMatrix4 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const PTA_LMatrix3 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const LMatrix4 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const LMatrix3 &v, int priority) const { - return set_shader_input(new ShaderInput(id,v,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, Texture *tex, int priority) const { - return set_shader_input(new ShaderInput(id,tex,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, const NodePath &np, int priority) const { - return set_shader_input(new ShaderInput(id,np,priority)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderAttrib::set_shader_input -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -CPT(RenderAttrib) ShaderAttrib:: -set_shader_input(const InternalName *id, double n1, double n2, double n3, double n4, int priority) const { - return set_shader_input(new ShaderInput(id, LVecBase4(n1,n2,n3,n4), priority)); -} - //////////////////////////////////////////////////////////////////// // Function: ShaderAttrib::set_instance_count // Access: Published diff --git a/panda/src/pgraph/shaderAttrib.h b/panda/src/pgraph/shaderAttrib.h index 6795adf9dc..1b3fe6c42a 100755 --- a/panda/src/pgraph/shaderAttrib.h +++ b/panda/src/pgraph/shaderAttrib.h @@ -70,23 +70,22 @@ PUBLISHED: // Shader Inputs CPT(RenderAttrib) set_shader_input(const ShaderInput *inp) const; - // InternalName* id - CPT(RenderAttrib) set_shader_input(const InternalName *id, Texture *tex, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const NodePath &np, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_float &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_double &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_LMatrix4 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_LMatrix3 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_LVecBase4 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_LVecBase3 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const PTA_LVecBase2 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const LVecBase4 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const LVecBase3 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const LVecBase2 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const LMatrix4 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, const LMatrix3 &v, int priority=0) const; - CPT(RenderAttrib) set_shader_input(const InternalName *id, double n1=0, double n2=0, double n3=0, double n4=1, - int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, Texture *tex, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const NodePath &np, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_float &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_double &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_LMatrix4 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_LMatrix3 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_LVecBase4 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_LVecBase3 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const PTA_LVecBase2 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const LVecBase4 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const LVecBase3 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const LVecBase2 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const LMatrix4 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, const LMatrix3 &v, int priority=0) const; + INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, double n1=0, double n2=0, double n3=0, double n4=1, + int priority=0) const; CPT(RenderAttrib) set_instance_count(int instance_count) const; @@ -137,7 +136,7 @@ private: bool _auto_ramp_on; bool _auto_shadow_on; - typedef pmap < CPT(InternalName), CPT(ShaderInput) > Inputs; + typedef pmap Inputs; Inputs _inputs; PUBLISHED: diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index 483febbb9d..da50cc9c82 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -28,8 +28,8 @@ INLINE ShaderInput:: // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, int priority) : + _name(MOVE(name)), _type(M_invalid), _priority(priority), _bind_layer(0), @@ -44,8 +44,8 @@ ShaderInput(const InternalName *name, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, Texture *tex, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, Texture *tex, int priority) : + _name(MOVE(name)), _type(M_texture), _priority(priority), _value(tex), @@ -61,8 +61,8 @@ ShaderInput(const InternalName *name, Texture *tex, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, Texture *tex, const SamplerState &sampler, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, Texture *tex, const SamplerState &sampler, int priority) : + _name(MOVE(name)), _type(M_texture_sampler), _priority(priority), _value(tex), @@ -79,8 +79,8 @@ ShaderInput(const InternalName *name, Texture *tex, const SamplerState &sampler, // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, Texture *tex, bool read, bool write, int z, int n, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, Texture *tex, bool read, bool write, int z, int n, int priority) : + _name(MOVE(name)), _type(M_texture), _priority(priority), _value(tex), @@ -108,8 +108,8 @@ ShaderInput(const InternalName *name, Texture *tex, bool read, bool write, int z // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, ParamValueBase *param, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, ParamValueBase *param, int priority) : + _name(MOVE(name)), _type(M_param), _priority(priority), _value(param), @@ -125,8 +125,8 @@ ShaderInput(const InternalName *name, ParamValueBase *param, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const NodePath &np, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const NodePath &np, int priority) : + _name(MOVE(name)), _type(M_nodepath), _priority(priority), _stored_nodepath(np), @@ -142,8 +142,8 @@ ShaderInput(const InternalName *name, const NodePath &np, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_float &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_float &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -159,8 +159,8 @@ ShaderInput(const InternalName *name, const PTA_float &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase4f &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase4f &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -176,8 +176,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase4f &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase3f &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase3f &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -193,8 +193,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase3f &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase2f &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase2f &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -210,8 +210,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase2f &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase4f &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase4f &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -228,8 +228,8 @@ ShaderInput(const InternalName *name, const LVecBase4f &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase3f &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase3f &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -246,8 +246,8 @@ ShaderInput(const InternalName *name, const LVecBase3f &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase2f &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase2f &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -264,8 +264,8 @@ ShaderInput(const InternalName *name, const LVecBase2f &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LMatrix4f &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LMatrix4f &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -281,8 +281,8 @@ ShaderInput(const InternalName *name, const PTA_LMatrix4f &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LMatrix3f &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LMatrix3f &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -298,8 +298,8 @@ ShaderInput(const InternalName *name, const PTA_LMatrix3f &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LMatrix4f &mat, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LMatrix4f &mat, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(mat), @@ -315,8 +315,8 @@ ShaderInput(const InternalName *name, const LMatrix4f &mat, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LMatrix3f &mat, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LMatrix3f &mat, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(mat), @@ -332,8 +332,8 @@ ShaderInput(const InternalName *name, const LMatrix3f &mat, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_double &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_double &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -349,8 +349,8 @@ ShaderInput(const InternalName *name, const PTA_double &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase4d &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase4d &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -366,8 +366,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase4d &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase3d &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase3d &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -383,8 +383,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase3d &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase2d &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase2d &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -400,8 +400,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase2d &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase4d &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase4d &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -418,8 +418,8 @@ ShaderInput(const InternalName *name, const LVecBase4d &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase3d &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase3d &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -436,8 +436,8 @@ ShaderInput(const InternalName *name, const LVecBase3d &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase2d &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase2d &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -454,8 +454,8 @@ ShaderInput(const InternalName *name, const LVecBase2d &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LMatrix4d &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LMatrix4d &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -471,8 +471,8 @@ ShaderInput(const InternalName *name, const PTA_LMatrix4d &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LMatrix3d &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LMatrix3d &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -488,8 +488,8 @@ ShaderInput(const InternalName *name, const PTA_LMatrix3d &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LMatrix4d &mat, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LMatrix4d &mat, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(mat), @@ -505,8 +505,8 @@ ShaderInput(const InternalName *name, const LMatrix4d &mat, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LMatrix3d &mat, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LMatrix3d &mat, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(mat), @@ -522,8 +522,8 @@ ShaderInput(const InternalName *name, const LMatrix3d &mat, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_int &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_int &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -539,8 +539,8 @@ ShaderInput(const InternalName *name, const PTA_int &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase4i &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase4i &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -556,8 +556,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase4i &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase3i &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase3i &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -573,8 +573,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase3i &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const PTA_LVecBase2i &ptr, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const PTA_LVecBase2i &ptr, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(ptr), @@ -590,8 +590,8 @@ ShaderInput(const InternalName *name, const PTA_LVecBase2i &ptr, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase4i &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase4i &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -608,8 +608,8 @@ ShaderInput(const InternalName *name, const LVecBase4i &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase3i &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase3i &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), @@ -626,8 +626,8 @@ ShaderInput(const InternalName *name, const LVecBase3i &vec, int priority) : // Description: //////////////////////////////////////////////////////////////////// INLINE ShaderInput:: -ShaderInput(const InternalName *name, const LVecBase2i &vec, int priority) : - _name(name), +ShaderInput(CPT_InternalName name, const LVecBase2i &vec, int priority) : + _name(MOVE(name)), _type(M_numeric), _priority(priority), _stored_ptr(vec), diff --git a/panda/src/pgraph/shaderInput.h b/panda/src/pgraph/shaderInput.h index 4d289d09ec..7a6f4aa27a 100644 --- a/panda/src/pgraph/shaderInput.h +++ b/panda/src/pgraph/shaderInput.h @@ -52,43 +52,43 @@ PUBLISHED: }; static const ShaderInput *get_blank(); - INLINE ShaderInput(const InternalName *id, int priority=0); - INLINE ShaderInput(const InternalName *id, const NodePath &np, int priority=0); - INLINE ShaderInput(const InternalName *id, Texture *tex, int priority=0); - INLINE ShaderInput(const InternalName *id, Texture *tex, const SamplerState &sampler, int priority=0); - INLINE ShaderInput(const InternalName *id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0); - INLINE ShaderInput(const InternalName *id, ParamValueBase *param, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_float &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4f &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3f &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2f &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4f &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3f &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase4f &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase3f &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase2f &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LMatrix4f &mat, int priority=0); - INLINE ShaderInput(const InternalName *id, const LMatrix3f &mat, int priority=0); + INLINE ShaderInput(CPT_InternalName name, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const NodePath &np, int priority=0); + INLINE ShaderInput(CPT_InternalName name, Texture *tex, int priority=0); + INLINE ShaderInput(CPT_InternalName name, Texture *tex, const SamplerState &sampler, int priority=0); + INLINE ShaderInput(CPT_InternalName name, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0); + INLINE ShaderInput(CPT_InternalName name, ParamValueBase *param, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_float &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase4f &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase3f &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase2f &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LMatrix4f &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LMatrix3f &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase4f &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase3f &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase2f &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LMatrix4f &mat, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LMatrix3f &mat, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_double &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4d &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3d &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2d &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4d &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3d &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase4d &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase3d &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase2d &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LMatrix4d &mat, int priority=0); - INLINE ShaderInput(const InternalName *id, const LMatrix3d &mat, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_double &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase4d &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase3d &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase2d &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LMatrix4d &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LMatrix3d &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase4d &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase3d &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase2d &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LMatrix4d &mat, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LMatrix3d &mat, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_int &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4i &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3i &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2i &ptr, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase4i &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase3i &vec, int priority=0); - INLINE ShaderInput(const InternalName *id, const LVecBase2i &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_int &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase4i &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase3i &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase2i &ptr, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase4i &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase3i &vec, int priority=0); + INLINE ShaderInput(CPT_InternalName name, const LVecBase2i &vec, int priority=0); enum ShaderInputType { M_invalid = 0, @@ -119,7 +119,7 @@ private: LVecBase4 _stored_vector; NodePath _stored_nodepath; Shader::ShaderPtrData _stored_ptr; - CPT(InternalName) _name; + CPT_InternalName _name; PT(TypedWritableReferenceCount) _value; int _priority; diff --git a/panda/src/pgraph/transformState.h b/panda/src/pgraph/transformState.h index 69b1a9f326..dac1f87da0 100644 --- a/panda/src/pgraph/transformState.h +++ b/panda/src/pgraph/transformState.h @@ -59,7 +59,7 @@ class FactoryParams; // instead of modifying a TransformState object, create a // new one. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH TransformState : public NodeCachedReferenceCount { +class EXPCL_PANDA_PGRAPH TransformState FINAL : public NodeCachedReferenceCount { protected: TransformState();