diff --git a/direct/src/directscripts/packpanda.nsi b/direct/src/directscripts/packpanda.nsi index a57514c799..73c9011d9a 100755 --- a/direct/src/directscripts/packpanda.nsi +++ b/direct/src/directscripts/packpanda.nsi @@ -97,20 +97,11 @@ Section "${SMDIRECTORY}" SecCore SetOutPath $INSTDIR\etc File /r "${PANDACONF}\*" SetOutPath $INSTDIR\direct\directscripts - !ifdef PPGAME - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\directscripts\*" + File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\directscripts\*" SetOutPath $INSTDIR\direct\filter - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\filter\*.sha" + File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\filter\*.sha" SetOutPath $INSTDIR\direct - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\*.py" - !else - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\src\directscripts\*" - SetOutPath $INSTDIR\direct\filter - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\src\filter\*.sha" - SetOutPath $INSTDIR\direct - File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\src\*.py" - File "${PANDA}\tmp\__init__.py" - !endif + File /r /x CVS /x Opt?-Win32 "${PANDA}\direct\*.py" Delete "$INSTDIR\panda3d.py" Delete "$INSTDIR\panda3d.pyc" Delete "$INSTDIR\panda3d.pyo" diff --git a/direct/src/filter/Sources.pp b/direct/src/filter/Sources.pp index 1c0f9da15f..0b4c7990cc 100644 --- a/direct/src/filter/Sources.pp +++ b/direct/src/filter/Sources.pp @@ -1,4 +1,4 @@ #defer install_data_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME] -#define INSTALL_DATA filter-bloomi.sha filter-bloomx.sha filter-bloomy.sha filter-blurx.sha filter-blury.sha filter-copy.sha filter-down4.sha filter-ssao.sha +#define INSTALL_DATA filter-bloomi.sha filter-bloomx.sha filter-bloomy.sha filter-blurx.sha filter-blury.sha filter-copy.sha filter-down4.sha diff --git a/dtool/src/dtoolbase/deletedChain.h b/dtool/src/dtoolbase/deletedChain.h index 21038c606b..4fb93609f2 100644 --- a/dtool/src/dtoolbase/deletedChain.h +++ b/dtool/src/dtoolbase/deletedChain.h @@ -96,6 +96,7 @@ public: return (void *)StaticDeletedChain< Type >::allocate(size, get_type_handle(Type)); \ } \ inline void *operator new(size_t size, void *ptr) { \ + (void) size; \ return ptr; \ } \ inline void operator delete(void *ptr) { \ @@ -115,6 +116,7 @@ public: return (void *)_deleted_chain.allocate(size, get_type_handle(Type)); \ } \ inline void *operator new(size_t size, void *ptr) { \ + (void) size; \ return ptr; \ } \ inline void operator delete(void *ptr) { \ diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 8dfb7e2127..81829bb3e0 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -184,6 +184,9 @@ #ifdef CPPPARSER #include + +// Also pick up the forward declaration of PyObject. +#include #endif #ifdef USE_TAU @@ -322,14 +325,17 @@ #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE -#elif defined(WIN32_VC) +#define ALIGN_64BYTE +#elif defined(_MSC_VER) #define ALIGN_4BYTE __declspec(align(4)) #define ALIGN_8BYTE __declspec(align(8)) #define ALIGN_16BYTE __declspec(align(16)) +#define ALIGN_64BYTE __declspec(align(64)) #elif defined(__GNUC__) #define ALIGN_4BYTE __attribute__ ((aligned (4))) #define ALIGN_8BYTE __attribute__ ((aligned (8))) #define ALIGN_16BYTE __attribute__ ((aligned (16))) +#define ALIGN_64BYTE __attribute__ ((aligned (64))) #else #define ALIGN_4BYTE #define ALIGN_8BYTE diff --git a/dtool/src/dtoolbase/memoryBase.h b/dtool/src/dtoolbase/memoryBase.h index e4452fb32e..1dc15366b1 100644 --- a/dtool/src/dtoolbase/memoryBase.h +++ b/dtool/src/dtoolbase/memoryBase.h @@ -28,24 +28,26 @@ #define ALLOC_MEMORY_BASE \ inline void *operator new(size_t size) { \ - return PANDA_MALLOC_SINGLE(size); \ + return PANDA_MALLOC_SINGLE(size); \ } \ inline void *operator new(size_t size, void *ptr) { \ + (void) size; \ return ptr; \ } \ inline void operator delete(void *ptr) { \ - PANDA_FREE_SINGLE(ptr); \ + PANDA_FREE_SINGLE(ptr); \ } \ - inline void operator delete(void *ptr, void *) { \ + inline void operator delete(void *, void *) { \ } \ inline void *operator new[](size_t size) { \ - return PANDA_MALLOC_ARRAY(size); \ + return PANDA_MALLOC_ARRAY(size); \ } \ inline void *operator new[](size_t size, void *ptr) { \ + (void) size; \ return ptr; \ } \ inline void operator delete[](void *ptr) { \ - PANDA_FREE_ARRAY(ptr); \ + PANDA_FREE_ARRAY(ptr); \ } \ inline void operator delete[](void *, void *) { \ } diff --git a/dtool/src/dtoolbase/memoryHook.cxx b/dtool/src/dtoolbase/memoryHook.cxx index e830b871b7..567097e213 100644 --- a/dtool/src/dtoolbase/memoryHook.cxx +++ b/dtool/src/dtoolbase/memoryHook.cxx @@ -52,6 +52,10 @@ #ifdef _DEBUG #define DEBUG 1 #endif +#ifdef assert + // dlmalloc defines its own assert, which clashes. + #undef assert +#endif #include "dlmalloc.h" #include "dlmalloc_src.cxx" diff --git a/dtool/src/dtoolbase/typeRegistry.cxx b/dtool/src/dtoolbase/typeRegistry.cxx index f98a7b7195..4b61ec56a2 100644 --- a/dtool/src/dtoolbase/typeRegistry.cxx +++ b/dtool/src/dtoolbase/typeRegistry.cxx @@ -204,11 +204,15 @@ record_alternate_name(TypeHandle type, const string &name) { if (rnode != (TypeRegistryNode *)NULL) { NameRegistry::iterator ri = _name_registry.insert(NameRegistry::value_type(name, rnode)).first; + if ((*ri).second != rnode) { + _lock->release(); cerr << "Name " << name << " already assigned to TypeHandle " << rnode->_name << "; cannot reassign to " << type << "\n"; + return; } + } _lock->release(); @@ -303,8 +307,10 @@ is_derived_from(TypeHandle child, TypeHandle base, const TypeRegistryNode *child_node = look_up(child, child_object); const TypeRegistryNode *base_node = look_up(base, (TypedObject *)NULL); - assert(child_node != (TypeRegistryNode *)NULL && - base_node != (TypeRegistryNode *)NULL); + + assert(child_node != (TypeRegistryNode *)NULL); + assert(base_node != (TypeRegistryNode *)NULL); + freshen_derivations(); bool result = TypeRegistryNode::is_derived_from(child_node, base_node); @@ -622,7 +628,7 @@ rebuild_derivations() { node->clear_subtree(); } } - + // Start by getting the list of root classes: those classes which do // not derive from anything. for (hi = _handle_registry.begin(); @@ -709,24 +715,41 @@ look_up(TypeHandle handle, TypedObject *object) const { _lock->release(); handle = object->force_init_type(); _lock->acquire(); + if (handle._index == 0) { // Strange. cerr << "Unable to force_init_type() on unregistered TypeHandle.\n"; return NULL; } + + // Now get the name for printing. We can't use TypeHandle:: + // get_name() since that recursively calls look_up(). + ostringstream name; + if (handle._index > 0 && handle._index < (int)_handle_registry.size()) { + TypeRegistryNode *rnode = _handle_registry[handle._index]; + if (rnode != (TypeRegistryNode *)NULL) { + name << rnode->_name; + name << " (index " << handle._index << ")"; + } else { + name << "NULL (index " << handle._index << ")"; + } + } else { + name << "index " << handle._index; + } + if (handle == object->get_type()) { // Problem solved! cerr - << "Type " << handle << " was unregistered!\n"; + << "Type " << name.str() << " was unregistered!\n"; } else { // No good; it looks like the TypeHandle belongs to a class // that defined get_type(), but didn't define // force_init_type(). cerr << "Attempt to reference unregistered TypeHandle. Type is of some\n" - << "class derived from " << handle << " that doesn't define a good\n" - << "force_init_type() method.\n"; + << "class derived from type " << name.str() << " that doesn't define\n" + << "a good force_init_type() method.\n"; return NULL; } @@ -736,7 +759,7 @@ look_up(TypeHandle handle, TypedObject *object) const { cerr << "Attempt to reference unregistered TypeHandle!\n" << "Registered TypeHandles are:\n"; - write(cerr); + do_write(cerr); return NULL; } } @@ -757,7 +780,7 @@ look_up(TypeHandle handle, TypedObject *object) const { // Function: get_best_parent_from_Set // Access: Private /////////////////////////////////////////////////////////////////// -extern "C" int +extern "C" int get_best_parent_from_Set(int id, const std::set &this_set) { // most common case.. if (this_set.find(id) != this_set.end()) { @@ -771,4 +794,3 @@ get_best_parent_from_Set(int id, const std::set &this_set) { return th.get_best_parent_from_Set(this_set); } - diff --git a/dtool/src/dtoolbase/typedObject.h b/dtool/src/dtoolbase/typedObject.h index 8b0e8cbb31..f86b9cc242 100644 --- a/dtool/src/dtoolbase/typedObject.h +++ b/dtool/src/dtoolbase/typedObject.h @@ -32,7 +32,7 @@ // return the specific type of the derived class. // Inheriting from this automatically provides support // for is_of_type() and is_exact_type(). -// +// // All classes that inherit directly or indirectly from // TypedObject should redefine get_type() and // force_init_type(), as shown below. Some classes that @@ -44,7 +44,7 @@ // do not inherit from TypedObject need not define the // virtual functions get_type() and force_init_type() // (or any other virtual functions). -// +// // There is a specific layout for defining the // overrides from this class. Keeping the definitions // formatted just like these examples will allow @@ -53,10 +53,10 @@ // rearranging the braces or the order of the functions // unless you're ready to change them in every file all // at once. -// +// // What follows are some examples that can be used in // new classes that you create. -// +// // @par In the class definition (.h file): // @code // public: @@ -76,16 +76,16 @@ // return get_class_type(); // } // virtual TypeHandle force_init_type() {init_type(); return get_class_type();} -// +// // private: // static TypeHandle _type_handle; // @endcode -// +// // @par In the class .cxx file: // @code // TypeHandle <<>>::_type_handle; // @endcode -// +// // @par In the class config_<<>>.cxx file: // @code // ConfigureFn(config_<<>>) { @@ -124,7 +124,7 @@ public: // This pair of methods exists mainly for the convenience of // unambiguous upcasting. Interrogate generates code to call this // method instead of making an explicit cast to (TypedObject *); - // this allows classes who multiply inherit from TypedObejct to + // this allows classes who multiply inherit from TypedObject to // override these methods and disambiguate the cast. It doesn't // have to be a virtual method, since this is just a static upcast. INLINE TypedObject *as_typed_object(); diff --git a/dtool/src/dtoolutil/preprocess_argv.cxx b/dtool/src/dtoolutil/preprocess_argv.cxx index 328df86a6e..26f4899e7b 100755 --- a/dtool/src/dtoolutil/preprocess_argv.cxx +++ b/dtool/src/dtoolutil/preprocess_argv.cxx @@ -35,6 +35,8 @@ void preprocess_argv(int &argc, char **&argv) { #ifndef _WIN32 // Not Windows: do nothing. + (void) argc; + (void) argv; #else // _WIN32 // Temporarily commenting out to fix build. Revisit shortly. static Win32ArgParser parser; diff --git a/dtool/src/prc/pnotify.h b/dtool/src/prc/pnotify.h index 763fab1653..b45747860b 100644 --- a/dtool/src/prc/pnotify.h +++ b/dtool/src/prc/pnotify.h @@ -127,6 +127,10 @@ private: // checking user input parameters, where optimal performance is not // paramount. +// nassert_static() is a compile-time assertion. It should only be +// used with constant expressions and compilation will fail if the +// assertion is not true. + #ifdef NDEBUG #define nassertr(condition, return_value) @@ -190,6 +194,15 @@ private: #endif // NDEBUG +#if __cplusplus >= 201103 +#define __nassert_static(condition, line, file) static_assert((condition), #condition " at line " #line " of " file) +#define _nassert_static(condition, line, file) __nassert_static(condition, line, file) +#define nassert_static(condition) _nassert_static(condition, __LINE__, __FILE__) +#else +#define __nassert_static(condition, suffix) typedef char nassert_static_ ## suffix [(condition) ? 1 : -1]; +#define _nassert_static(condition, suffix) __nassert_static(condition, suffix) +#define nassert_static(condition) _nassert_static(condition, __COUNTER__) +#endif #include "pnotify.I" diff --git a/dtool/src/prc/streamWrapper.I b/dtool/src/prc/streamWrapper.I index d97eb575af..44518f9a84 100644 --- a/dtool/src/prc/streamWrapper.I +++ b/dtool/src/prc/streamWrapper.I @@ -127,8 +127,10 @@ get() { INLINE OStreamWrapper:: OStreamWrapper(ostream *stream, bool owns_pointer, bool stringstream_hack) : _ostream(stream), - _owns_pointer(owns_pointer), - _stringstream_hack(stringstream_hack) + _owns_pointer(owns_pointer) +#ifdef WIN32_VC +, _stringstream_hack(stringstream_hack) +#endif { } @@ -140,8 +142,10 @@ OStreamWrapper(ostream *stream, bool owns_pointer, bool stringstream_hack) : INLINE OStreamWrapper:: OStreamWrapper(ostream &stream) : _ostream(&stream), - _owns_pointer(false), - _stringstream_hack(false) + _owns_pointer(false) +#ifdef WIN32_VC +, _stringstream_hack(false) +#endif { } diff --git a/dtool/src/prc/streamWrapper.h b/dtool/src/prc/streamWrapper.h index 1b64fde3f6..6a16deecf3 100644 --- a/dtool/src/prc/streamWrapper.h +++ b/dtool/src/prc/streamWrapper.h @@ -105,7 +105,9 @@ private: // this flag is set true, we know we have a possibly-empty // stringstream, so we allow seekp(0) to fail silently, knowing that // there's no harm in this case. +#ifdef WIN32_VC bool _stringstream_hack; +#endif }; //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/pystub/pystub.cxx b/dtool/src/pystub/pystub.cxx index 1553819636..116da89ee7 100644 --- a/dtool/src/pystub/pystub.cxx +++ b/dtool/src/pystub/pystub.cxx @@ -28,6 +28,7 @@ extern "C" { EXPCL_PYSTUB int PyCFunction_New(...); EXPCL_PYSTUB int PyCFunction_NewEx(...); EXPCL_PYSTUB int PyCallable_Check(...); + EXPCL_PYSTUB int PyDict_DelItem(...); EXPCL_PYSTUB int PyDict_DelItemString(...); EXPCL_PYSTUB int PyDict_GetItem(...); EXPCL_PYSTUB int PyDict_GetItemString(...); @@ -63,6 +64,7 @@ extern "C" { EXPCL_PYSTUB int PyInt_AsLong(...); EXPCL_PYSTUB int PyInt_AsSsize_t(...); EXPCL_PYSTUB int PyInt_FromLong(...); + EXPCL_PYSTUB int PyInt_FromSize_t(...); EXPCL_PYSTUB int PyInt_Type(...); EXPCL_PYSTUB int PyList_Append(...); EXPCL_PYSTUB int PyList_AsTuple(...); @@ -81,6 +83,7 @@ extern "C" { EXPCL_PYSTUB int PyLong_FromUnsignedLongLong(...); EXPCL_PYSTUB int PyLong_Type(...); EXPCL_PYSTUB int PyMapping_GetItemString(...); + EXPCL_PYSTUB int PyMem_Free(...); EXPCL_PYSTUB int PyMemoryView_FromObject(...); EXPCL_PYSTUB int PyModule_AddIntConstant(...); EXPCL_PYSTUB int PyModule_AddObject(...); @@ -191,6 +194,8 @@ extern "C" { EXPCL_PYSTUB extern void *PyExc_ValueError; EXPCL_PYSTUB extern void *_Py_NoneStruct; EXPCL_PYSTUB extern void *_Py_NotImplementedStruct; + EXPCL_PYSTUB extern void *_Py_TrueStruct; + EXPCL_PYSTUB extern void *_Py_ZeroStruct; }; @@ -207,6 +212,7 @@ int PyBytes_Size(...) { return 0; } int PyCFunction_New(...) { return 0; }; int PyCFunction_NewEx(...) { return 0; }; int PyCallable_Check(...) { return 0; } +int PyDict_DelItem(...) { return 0; } int PyDict_DelItemString(...) { return 0; } int PyDict_GetItem(...) { return 0; } int PyDict_GetItemString(...) { return 0; } @@ -242,6 +248,7 @@ int PyImport_GetModuleDict(...) { return 0; } int PyInt_AsLong(...) { return 0; } int PyInt_AsSsize_t(...) { return 0; } int PyInt_FromLong(...) { return 0; } +int PyInt_FromSize_t(...) { return 0; } int PyInt_Type(...) { return 0; } int PyList_Append(...) { return 0; } int PyList_AsTuple(...) { return 0; } @@ -260,6 +267,7 @@ int PyLong_FromUnsignedLong(...) { return 0; } int PyLong_FromUnsignedLongLong(...) { return 0; } int PyLong_Type(...) { return 0; } int PyMapping_GetItemString(...) { return 0; } +int PyMem_Free(...) { return 0; } int PyMemoryView_FromObject(...) { return 0; } int PyModule_AddIntConstant(...) { return 0; }; int PyModule_AddObject(...) { return 0; }; @@ -375,6 +383,8 @@ void *PyExc_TypeError = (void *)NULL; void *PyExc_ValueError = (void *)NULL; void *_Py_NoneStruct = (void *)NULL; void *_Py_NotImplementedStruct = (void *)NULL; +void *_Py_TrueStruct = (void *)NULL; +void *_Py_ZeroStruct = (void *)NULL; void diff --git a/panda/src/bullet/bulletContactResult.I b/panda/src/bullet/bulletContactResult.I index fe78cedbe7..cf1612aa73 100644 --- a/panda/src/bullet/bulletContactResult.I +++ b/panda/src/bullet/bulletContactResult.I @@ -51,7 +51,7 @@ get_manifold_point() { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const int BulletContact:: +INLINE int BulletContact:: get_idx0() const { return _idx0; @@ -62,7 +62,7 @@ get_idx0() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const int BulletContact:: +INLINE int BulletContact:: get_idx1() const { return _idx1; @@ -73,7 +73,7 @@ get_idx1() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const int BulletContact:: +INLINE int BulletContact:: get_part_id0() const { return _part_id0; @@ -84,7 +84,7 @@ get_part_id0() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const int BulletContact:: +INLINE int BulletContact:: get_part_id1() const { return _part_id1; @@ -112,4 +112,3 @@ get_contact(int idx) { nassertr(idx >= 0 && idx < (int)_contacts.size(), _empty); return _contacts[idx]; } - diff --git a/panda/src/bullet/bulletContactResult.h b/panda/src/bullet/bulletContactResult.h index 6de4962ae5..f44e52688c 100644 --- a/panda/src/bullet/bulletContactResult.h +++ b/panda/src/bullet/bulletContactResult.h @@ -24,7 +24,7 @@ //////////////////////////////////////////////////////////////////// // Class : BulletContact -// Description : +// Description : //////////////////////////////////////////////////////////////////// struct EXPCL_PANDABULLET BulletContact { @@ -36,10 +36,10 @@ PUBLISHED: INLINE BulletManifoldPoint &get_manifold_point(); INLINE PandaNode *get_node0() const; INLINE PandaNode *get_node1() const; - INLINE const int get_idx0() const; - INLINE const int get_idx1() const; - INLINE const int get_part_id0() const; - INLINE const int get_part_id1() const; + INLINE int get_idx0() const; + INLINE int get_idx1() const; + INLINE int get_part_id0() const; + INLINE int get_part_id1() const; private: static btManifoldPoint _empty; @@ -59,7 +59,7 @@ private: //////////////////////////////////////////////////////////////////// // Class : BulletContactResult -// Description : +// Description : //////////////////////////////////////////////////////////////////// struct EXPCL_PANDABULLET BulletContactResult : public btCollisionWorld::ContactResultCallback { diff --git a/panda/src/collide/collisionFloorMesh.I b/panda/src/collide/collisionFloorMesh.I index 3ee05b3e0d..8b2c5465e1 100755 --- a/panda/src/collide/collisionFloorMesh.I +++ b/panda/src/collide/collisionFloorMesh.I @@ -56,24 +56,23 @@ add_vertex(const LPoint3 &vert) { _vertices.push_back(vert); } -INLINE const unsigned int CollisionFloorMesh:: +INLINE unsigned int CollisionFloorMesh:: get_num_vertices() const { return _vertices.size(); } -INLINE const LPoint3 CollisionFloorMesh:: +INLINE const LPoint3 &CollisionFloorMesh:: get_vertex(unsigned int index) const { return _vertices[index]; } -INLINE const unsigned int CollisionFloorMesh:: +INLINE unsigned int CollisionFloorMesh:: get_num_triangles() const { return _triangles.size(); } -INLINE const LPoint3d CollisionFloorMesh:: +INLINE LPoint3i CollisionFloorMesh:: get_triangle(unsigned int index) const { CollisionFloorMesh::TriangleIndices tri = _triangles[index]; - return LPoint3d(tri.p1, tri.p2, tri.p3); + return LPoint3i(tri.p1, tri.p2, tri.p3); } - diff --git a/panda/src/collide/collisionFloorMesh.h b/panda/src/collide/collisionFloorMesh.h index b162cb8f64..31a6b1d62d 100755 --- a/panda/src/collide/collisionFloorMesh.h +++ b/panda/src/collide/collisionFloorMesh.h @@ -41,19 +41,18 @@ public: PN_stdfloat max_y; } TriangleIndices; - PUBLISHED: INLINE CollisionFloorMesh(); - + INLINE void add_vertex(const LPoint3 &vert); void add_triangle(unsigned int pointA, unsigned int pointB, unsigned int pointC); - INLINE const unsigned int get_num_vertices() const; - INLINE const LPoint3 get_vertex(unsigned int index) const; + INLINE unsigned int get_num_vertices() const; + INLINE const LPoint3 &get_vertex(unsigned int index) const; MAKE_SEQ(get_vertices, get_num_vertices, get_vertex); - INLINE const unsigned int get_num_triangles() const; - INLINE const LPoint3d get_triangle(unsigned int index) const; + INLINE unsigned int get_num_triangles() const; + INLINE LPoint3i get_triangle(unsigned int index) const; MAKE_SEQ(get_triangles, get_num_triangles, get_triangle); virtual LPoint3 get_collision_origin() const; @@ -63,7 +62,7 @@ public: virtual CollisionSolid *make_copy(); public: - + virtual void xform(const LMatrix4 &mat); virtual PStatCollector &get_volume_pcollector(); @@ -90,7 +89,7 @@ private: Vertices _vertices; Triangles _triangles; - + static PStatCollector _volume_pcollector; static PStatCollector _test_pcollector; @@ -101,7 +100,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter* manager, Datagram &me); - static TypedWritable *make_CollisionFloorMesh(const FactoryParams ¶ms); + static TypedWritable *make_CollisionFloorMesh(const FactoryParams ¶ms); static TypeHandle get_class_type() { return _type_handle; } @@ -122,5 +121,3 @@ private: #include "collisionFloorMesh.I" #endif - - diff --git a/panda/src/collide/collisionRay.h b/panda/src/collide/collisionRay.h index 27eb84720d..a8a5861c43 100644 --- a/panda/src/collide/collisionRay.h +++ b/panda/src/collide/collisionRay.h @@ -18,8 +18,7 @@ #include "pandabase.h" #include "collisionSolid.h" - -class LensNode; +#include "lensNode.h" //////////////////////////////////////////////////////////////////// // Class : CollisionRay diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 860f93a541..884bbb822b 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -235,8 +235,8 @@ get_num_colliders() const { //////////////////////////////////////////////////////////////////// NodePath CollisionTraverser:: get_collider(int n) const { - nassertr(_ordered_colliders.size() == _colliders.size(), NULL); - nassertr(n >= 0 && n < (int)_ordered_colliders.size(), NULL); + nassertr(_ordered_colliders.size() == _colliders.size(), NodePath()); + nassertr(n >= 0 && n < (int)_ordered_colliders.size(), NodePath()); return _ordered_colliders[n]._node_path; } diff --git a/panda/src/gobj/shader.I b/panda/src/gobj/shader.I index 3c0d2c9db9..b33c3d1ff0 100755 --- a/panda/src/gobj/shader.I +++ b/panda/src/gobj/shader.I @@ -92,7 +92,7 @@ get_text(const ShaderType &type) const { // error. This doesn't tell you whether or not the // shader is supported on the current video card. //////////////////////////////////////////////////////////////////// -INLINE const bool Shader:: +INLINE bool Shader:: get_error_flag() const { return _error_flag; } diff --git a/panda/src/gobj/shader.h b/panda/src/gobj/shader.h index 42a83cdc65..e62435d6a0 100755 --- a/panda/src/gobj/shader.h +++ b/panda/src/gobj/shader.h @@ -98,7 +98,7 @@ PUBLISHED: INLINE Filename get_filename(const ShaderType &type = ST_none) const; INLINE const string &get_text(const ShaderType &type = ST_none) const; - INLINE const bool get_error_flag() const; + INLINE bool get_error_flag() const; INLINE ShaderLanguage get_language() const; INLINE static ShaderUtilization get_shader_utilization(); diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 8cb6784f2a..2a756faaff 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -2079,6 +2079,86 @@ mult_sub_image(const PfmFile ©, int xto, int yto, } } +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::divide_sub_image +// Access: Published +// Description: Behaves like copy_sub_image(), except the copy pixels +// are divided into the pixels of the destination, after +// scaling by the specified pixel_scale. +// dest(x, y) = dest(x, y) / (copy(x, y) * pixel_scale). +//////////////////////////////////////////////////////////////////// +void PfmFile:: +divide_sub_image(const PfmFile ©, int xto, int yto, + int xfrom, int yfrom, int x_size, int y_size, + double pixel_scale) { + int xmin, ymin, xmax, ymax; + setup_sub_image(copy, xto, yto, xfrom, yfrom, x_size, y_size, + xmin, ymin, xmax, ymax); + + int x, y; + switch (_num_channels) { + case 1: + { + for (y = ymin; y < ymax; y++) { + for (x = xmin; x < xmax; x++) { + if (has_point(x, y) && copy.has_point(x - xmin + xfrom, y - ymin + yfrom)) { + set_point1(x, y, get_point1(x, y) / copy.get_point1(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale); + } + } + } + } + break; + + case 2: + { + for (y = ymin; y < ymax; y++) { + for (x = xmin; x < xmax; x++) { + if (has_point(x, y) && copy.has_point(x - xmin + xfrom, y - ymin + yfrom)) { + LPoint2f p = copy.get_point2(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale; + LPoint2f &t = modify_point2(x, y); + t[0] /= p[0]; + t[1] /= p[1]; + } + } + } + } + break; + + case 3: + { + for (y = ymin; y < ymax; y++) { + for (x = xmin; x < xmax; x++) { + if (has_point(x, y) && copy.has_point(x - xmin + xfrom, y - ymin + yfrom)) { + LPoint3f p = copy.get_point3(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale; + LPoint3f &t = modify_point3(x, y); + t[0] /= p[0]; + t[1] /= p[1]; + t[2] /= p[2]; + } + } + } + } + break; + + case 4: + { + for (y = ymin; y < ymax; y++) { + for (x = xmin; x < xmax; x++) { + if (has_point(x, y) && copy.has_point(x - xmin + xfrom, y - ymin + yfrom)) { + LPoint4f p = copy.get_point4(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale; + LPoint4f &t = modify_point4(x, y); + t[0] /= p[0]; + t[1] /= p[1]; + t[2] /= p[2]; + t[3] /= p[3]; + } + } + } + } + break; + } +} + //////////////////////////////////////////////////////////////////// // Function: PfmFile::operator *= // Access: Published diff --git a/panda/src/pnmimage/pfmFile.h b/panda/src/pnmimage/pfmFile.h index b88d7d4dc1..d08ebaf17e 100644 --- a/panda/src/pnmimage/pfmFile.h +++ b/panda/src/pnmimage/pfmFile.h @@ -148,6 +148,10 @@ PUBLISHED: int xfrom = 0, int yfrom = 0, int x_size = -1, int y_size = -1, double pixel_scale = 1.0); + void divide_sub_image(const PfmFile ©, int xto, int yto, + int xfrom = 0, int yfrom = 0, + int x_size = -1, int y_size = -1, + double pixel_scale = 1.0); void operator *= (double multiplier);