diff --git a/panda/src/gobj/geomVertexData.h b/panda/src/gobj/geomVertexData.h index 57db6ef421..7772330a70 100644 --- a/panda/src/gobj/geomVertexData.h +++ b/panda/src/gobj/geomVertexData.h @@ -256,7 +256,9 @@ public: return _type_handle; } static void init_type() { - register_type(_type_handle, "GeomVertexData::CacheEntry"); + GeomCacheEntry::init_type(); + register_type(_type_handle, "GeomVertexData::CacheEntry", + GeomCacheEntry::get_class_type()); } private: diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index dc0b3d4c05..a7c7bd4c37 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -736,7 +736,7 @@ get_hash_impl() const { Planes::const_iterator li; for (li = _on_planes.begin(); li != _on_planes.end(); ++li) { NodePath plane = (*li); - hash = int_hash::add_hash(hash, plane.get_key()); + hash = plane.add_hash(hash); } // This bool value goes here, between the two lists, to @@ -745,7 +745,7 @@ get_hash_impl() const { for (li = _off_planes.begin(); li != _off_planes.end(); ++li) { NodePath plane = (*li); - hash = int_hash::add_hash(hash, plane.get_key()); + hash = plane.add_hash(hash); } return hash; diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index d096ea3cf0..08b2806fee 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -768,7 +768,7 @@ get_hash_impl() const { Lights::const_iterator li; for (li = _on_lights.begin(); li != _on_lights.end(); ++li) { NodePath light = (*li); - hash = int_hash::add_hash(hash, light.get_key()); + hash = light.add_hash(hash); } // This bool value goes here, between the two lists, to @@ -777,7 +777,7 @@ get_hash_impl() const { for (li = _off_lights.begin(); li != _off_lights.end(); ++li) { NodePath light = (*li); - hash = int_hash::add_hash(hash, light.get_key()); + hash = light.add_hash(hash); } return hash; diff --git a/panda/src/pgraph/nodePath.I b/panda/src/pgraph/nodePath.I index e21512eb78..5305b38a9f 100644 --- a/panda/src/pgraph/nodePath.I +++ b/panda/src/pgraph/nodePath.I @@ -271,6 +271,26 @@ get_key() const { return _head->get_key(); } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::add_hash +// Access: Published +// Description: Adds the NodePath into the running hash. This is +// intended to be used by lower-level code that computes +// a hash for each NodePath. It modifies the hash value +// passed in by a unique adjustment for each NodePath, +// and returns the modified hash. +// +// This is similar to the unique integer returned by +// get_key(), but it is not guaranteed to remain unique +// beyond the lifetime of this particular NodePath. +// Once this NodePath destructs, a different NodePath +// may be created which shares the same hash value. +//////////////////////////////////////////////////////////////////// +INLINE size_t NodePath:: +add_hash(size_t hash) const { + return pointer_hash::add_hash(hash, _head); +} + //////////////////////////////////////////////////////////////////// // Function: NodePath::is_same_graph // Access: Published diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 03afbe8784..668e3b651f 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -37,6 +37,7 @@ #include "pta_LVecBase4f.h" #include "pta_LVecBase3f.h" #include "pta_LVecBase2f.h" +#include "stl_compares.h" class NodePathCollection; class FindApproxPath; @@ -211,6 +212,7 @@ PUBLISHED: INLINE PandaNode *node() const; INLINE int get_key() const; + INLINE size_t add_hash(size_t hash) const; INLINE bool is_same_graph(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; INLINE bool is_ancestor_of(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; diff --git a/panda/src/pgraph/texGenAttrib.cxx b/panda/src/pgraph/texGenAttrib.cxx index c772b391c4..95867948eb 100755 --- a/panda/src/pgraph/texGenAttrib.cxx +++ b/panda/src/pgraph/texGenAttrib.cxx @@ -432,7 +432,7 @@ get_hash_impl() const { hash = pointer_hash::add_hash(hash, stage); hash = int_hash::add_hash(hash, (int)mode_def._mode); hash = string_hash::add_hash(hash, mode_def._source_name); - hash = int_hash::add_hash(hash, mode_def._light.get_key()); + hash = mode_def._light.add_hash(hash); hash = mode_def._constant_value.add_hash(hash); }