fix NodePath::adjust_all_priorities() for textures

This commit is contained in:
David Rose 2010-08-21 00:22:44 +00:00
parent ae77c767c2
commit 17535c41a6
2 changed files with 39 additions and 0 deletions

View File

@ -317,6 +317,44 @@ filter_to_max(int max_texture_stages) const {
return tex_attrib;
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::lower_attrib_can_override
// Access: Public, Virtual
// Description: Intended to be overridden by derived RenderAttrib
// types to specify how two consecutive RenderAttrib
// objects of the same type interact.
//
// This should return false if a RenderAttrib on a
// higher node will compose into a RenderAttrib on a
// lower node that has a higher override value, or false
// if the lower RenderAttrib will completely replace the
// state.
//
// The default behavior is false: normally, a
// RenderAttrib in the graph cannot completely override
// a RenderAttrib above it, regardless of its override
// value--instead, the two attribs are composed. But
// for some kinds of RenderAttribs, it is useful to
// allow this kind of override.
//
// This method only handles the one special case of a
// lower RenderAttrib with a higher override value. If
// the higher RenderAttrib has a higher override value,
// it always completely overrides. And if both
// RenderAttribs have the same override value, they are
// always composed.
////////////////////////////////////////////////////////////////////
bool TextureAttrib::
lower_attrib_can_override() const {
// A TextureAttrib doesn't compose through an override. Normally,
// there won't be a scene-graph override on a TextureAttrib anyway,
// since the NodePath::set_texture() override is applied to the
// per-TextureStage override value. But there might be a
// scene-graph override if NodePath::adjust_all_priorities() is
// used, and in this case, we'd like for it to stick.
return true;
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::output
// Access: Public, Virtual

View File

@ -82,6 +82,7 @@ PUBLISHED:
public:
CPT(TextureAttrib) filter_to_max(int max_texture_stages) const;
virtual bool lower_attrib_can_override() const;
virtual void output(ostream &out) const;
virtual bool has_cull_callback() const;