diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 909b878adf..401527dfb1 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -391,7 +391,7 @@ cp_dependency(ShaderMatInput inp) { dep |= SSD_colorscale; } if (inp == SMO_attr_fog || inp == SMO_attr_fogcolor) { - dep |= SSD_fog; + dep |= SSD_fog | SSD_frame; } if ((inp == SMO_model_to_view) || (inp == SMO_view_to_model) || diff --git a/panda/src/pgraph/pandaNode.I b/panda/src/pgraph/pandaNode.I index a79fb75a5c..c00f489e1a 100644 --- a/panda/src/pgraph/pandaNode.I +++ b/panda/src/pgraph/pandaNode.I @@ -1532,6 +1532,14 @@ has_tag(const std::string &key) const { return _cdata->_tag_data.find(key) >= 0; } +/** + * Returns the "into" collide mask for this node. + */ +INLINE CollideMask PandaNodePipelineReader:: +get_into_collide_mask() const { + return _cdata->_into_collide_mask; +} + /** * Returns the union of all into_collide_mask() values set at CollisionNodes * at this level and below. diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 00f0d76143..a2af9829d6 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -2910,11 +2910,21 @@ get_component(NodePathComponent *parent, PandaNode *child_node, // First, walk through the list of NodePathComponents we already have on the // child, looking for one that already exists, referencing the indicated // parent component. - Paths::const_iterator pi; - for (pi = child_node->_paths.begin(); pi != child_node->_paths.end(); ++pi) { - if ((*pi)->get_next(pipeline_stage, current_thread) == parent) { + for (NodePathComponent *child : child_node->_paths) { + if (child->get_next(pipeline_stage, current_thread) == parent) { // If we already have such a component, just return it. - return (*pi); + // But before we do, we have to make sure it's not in the middle of being + // destructed. +#ifdef HAVE_THREADS + if (child->ref_if_nonzero()) { + PT(NodePathComponent) result; + result.cheat() = child; + return result; + } +#else + // If we're not building with threading, increment as normal. + return child; +#endif } } @@ -2952,11 +2962,21 @@ get_top_component(PandaNode *child_node, bool force, int pipeline_stage, // Walk through the list of NodePathComponents we already have on the child, // looking for one that already exists as a top node. - Paths::const_iterator pi; - for (pi = child_node->_paths.begin(); pi != child_node->_paths.end(); ++pi) { - if ((*pi)->is_top_node(pipeline_stage, current_thread)) { + for (NodePathComponent *child : child_node->_paths) { + if (child->is_top_node(pipeline_stage, current_thread)) { // If we already have such a component, just return it. - return (*pi); + // But before we do, we have to make sure it's not in the middle of being + // destructed. +#ifdef HAVE_THREADS + if (child->ref_if_nonzero()) { + PT(NodePathComponent) result; + result.cheat() = child; + return result; + } +#else + // If we're not building with threading, increment as normal. + return child; +#endif } } diff --git a/panda/src/pgraph/pandaNode.h b/panda/src/pgraph/pandaNode.h index 7542fae076..62e472d16c 100644 --- a/panda/src/pgraph/pandaNode.h +++ b/panda/src/pgraph/pandaNode.h @@ -902,6 +902,7 @@ public: INLINE std::string get_tag(const std::string &key) const; INLINE bool has_tag(const std::string &key) const; + INLINE CollideMask get_into_collide_mask() const; INLINE CollideMask get_net_collide_mask() const; INLINE const RenderAttrib *get_off_clip_planes() const; INLINE const BoundingVolume *get_bounds() const;