fix ff_tc_index some more

This commit is contained in:
David Rose 2008-04-16 00:30:50 +00:00
parent 38051b1591
commit 96e4739426
3 changed files with 53 additions and 26 deletions

View File

@ -264,16 +264,49 @@ OnStageNode(TextureStage *stage, unsigned int implicit_sort) :
{
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::OnStageNode::Comparison Operator
// Function: TextureAttrib::CompareTextureStagePriorities::operator ()
// Access: Public
// Description:
// Description: This STL function object is used to sort a list of
// texture stages in reverse order by priority, and
// within priority, within order by sort.
////////////////////////////////////////////////////////////////////
INLINE bool TextureAttrib::OnStageNode::
operator < (const TextureAttrib::OnStageNode &other) const {
if (_stage->get_sort() != other._stage->get_sort()) {
return _stage->get_sort() < other._stage->get_sort();
INLINE bool TextureAttrib::CompareTextureStagePriorities::
operator () (const TextureAttrib::OnStageNode &a,
const TextureAttrib::OnStageNode &b) const {
if (a._stage->get_priority() != b._stage->get_priority()) {
return a._stage->get_priority() > b._stage->get_priority();
}
return _implicit_sort < other._implicit_sort;
if (a._stage->get_sort() != b._stage->get_sort()) {
return a._stage->get_sort() > b._stage->get_sort();
}
return a._implicit_sort < b._implicit_sort;
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::CompareTextureStageSort::operator ()
// Access: Public
// Description: This STL function object is used to sort a list of
// texture stages in order by sort.
////////////////////////////////////////////////////////////////////
INLINE bool TextureAttrib::CompareTextureStageSort::
operator () (const TextureAttrib::OnStageNode &a,
const TextureAttrib::OnStageNode &b) const {
if (a._stage->get_sort() != b._stage->get_sort()) {
return a._stage->get_sort() > b._stage->get_sort();
}
return a._implicit_sort < b._implicit_sort;
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::CompareTextureStagePointer::operator ()
// Access: Public
// Description: This STL function object is used to sort a list of
// texture stages in order by pointer.
////////////////////////////////////////////////////////////////////
INLINE bool TextureAttrib::CompareTextureStagePointer::
operator () (const TextureAttrib::OnStageNode &a,
const TextureAttrib::OnStageNode &b) const {
return a._stage < b._stage;
}

View File

@ -30,21 +30,6 @@ CPT(RenderAttrib) TextureAttrib::_empty_attrib;
CPT(RenderAttrib) TextureAttrib::_all_off_attrib;
TypeHandle TextureAttrib::_type_handle;
// This STL Function object is used in filter_to_max(), below, to sort
// a list of TextureStages in reverse order by priority and, within
// priority, in order by sort.
bool TextureAttrib::CompareTextureStagePriorities::
operator () (const TextureAttrib::OnStageNode &a,
const TextureAttrib::OnStageNode &b) const {
if (a._stage->get_priority() != b._stage->get_priority()) {
return a._stage->get_priority() > b._stage->get_priority();
}
if (a._stage->get_sort() != b._stage->get_sort()) {
return a._stage->get_sort() > b._stage->get_sort();
}
return a._implicit_sort < b._implicit_sort;
}
////////////////////////////////////////////////////////////////////
// Function: TextureAttrib::make
@ -960,7 +945,7 @@ sort_on_stages() {
// It's important that this assignment not be based on the whims of
// render order--it mustn't change arbitrarily--so we must first
// sort the on_stages list into pointer order for this purpose.
sort(_on_stages.begin(), _on_stages.end());
sort(_on_stages.begin(), _on_stages.end(), CompareTextureStagePointer());
typedef pmap<const InternalName *, int> UsedTexcoordIndex;
UsedTexcoordIndex used_texcoord_index;
@ -986,7 +971,7 @@ sort_on_stages() {
}
// Now we can sort the on_stages map into render order.
sort(_on_stages.begin(), _on_stages.end());
sort(_on_stages.begin(), _on_stages.end(), CompareTextureStageSort());
_sort_seq = TextureStage::get_sort_seq();

View File

@ -101,7 +101,6 @@ private:
class OnStageNode {
public:
INLINE OnStageNode(TextureStage *stage, unsigned int implicit_sort);
INLINE bool operator < (const OnStageNode &other) const;
PT(TextureStage) _stage;
unsigned int _implicit_sort;
@ -109,7 +108,17 @@ private:
class CompareTextureStagePriorities {
public:
bool operator () (const TextureAttrib::OnStageNode &a, const TextureAttrib::OnStageNode &b) const;
INLINE bool operator () (const TextureAttrib::OnStageNode &a, const TextureAttrib::OnStageNode &b) const;
};
class CompareTextureStageSort {
public:
INLINE bool operator () (const TextureAttrib::OnStageNode &a, const TextureAttrib::OnStageNode &b) const;
};
class CompareTextureStagePointer {
public:
INLINE bool operator () (const TextureAttrib::OnStageNode &a, const TextureAttrib::OnStageNode &b) const;
};
typedef pvector<OnStageNode> OnStages;