mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
add RenderAttrib::always_reissue()
This commit is contained in:
parent
9f1d280aad
commit
4cbaf55032
@ -92,3 +92,18 @@ compare_to(const RenderAttrib &other) const {
|
||||
// We only call compare_to_impl() if they have the same type.
|
||||
return compare_to_impl(&other);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: RenderAttrib::always_reissue
|
||||
// Access: Public
|
||||
// Description: Returns true if the RenderAttrib should be reissued
|
||||
// to the GSG with every state change, even if it is the
|
||||
// same pointer as it was before; or false for the
|
||||
// normal case, to reissue only when the RenderAttrib
|
||||
// pointer changes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool RenderAttrib::
|
||||
always_reissue() const {
|
||||
return _always_reissue;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ RenderAttrib() {
|
||||
_attribs = new Attribs;
|
||||
}
|
||||
_saved_entry = _attribs->end();
|
||||
|
||||
_always_reissue = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -112,12 +114,6 @@ output(ostream &out) const {
|
||||
out << get_type();
|
||||
}
|
||||
|
||||
void RenderAttrib::
|
||||
output_comparefunc(ostream &out,PandaCompareFunc fn) const {
|
||||
static char *FuncStrs[M_always+1] = {"none","never","less","equal", "less or equal","greater","not equal","greater or equal","always"};
|
||||
out << FuncStrs[fn];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: RenderAttrib::write
|
||||
// Access: Published, Virtual
|
||||
@ -223,6 +219,53 @@ invert_compose_impl(const RenderAttrib *other) const {
|
||||
return other;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: RenderAttrib::output_comparefunc
|
||||
// Access: Protected
|
||||
// Description: Outputs a string representation of the given
|
||||
// PandaCompareFunc object.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void RenderAttrib::
|
||||
output_comparefunc(ostream &out, PandaCompareFunc fn) const {
|
||||
switch (fn) {
|
||||
case M_none:
|
||||
out << "none";
|
||||
break;
|
||||
|
||||
case M_never:
|
||||
out << "never";
|
||||
break;
|
||||
|
||||
case M_less:
|
||||
out << "less";
|
||||
break;
|
||||
|
||||
case M_equal:
|
||||
out << "equal";
|
||||
break;
|
||||
|
||||
case M_less_equal:
|
||||
out << "less_equal";
|
||||
break;
|
||||
|
||||
case M_greater:
|
||||
out << "greater";
|
||||
break;
|
||||
|
||||
case M_not_equal:
|
||||
out << "not_equal";
|
||||
break;
|
||||
|
||||
case M_greater_equal:
|
||||
out << "greater_equal";
|
||||
break;
|
||||
|
||||
case M_always:
|
||||
out << "always";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: RenderAttrib::make_default_impl
|
||||
// Access: Protected, Virtual
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
INLINE int compare_to(const RenderAttrib &other) const;
|
||||
virtual void issue(GraphicsStateGuardianBase *gsg) const;
|
||||
|
||||
INLINE bool always_reissue() const;
|
||||
|
||||
PUBLISHED:
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level) const;
|
||||
@ -93,7 +95,10 @@ protected:
|
||||
virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
|
||||
virtual CPT(RenderAttrib) invert_compose_impl(const RenderAttrib *other) const;
|
||||
virtual RenderAttrib *make_default_impl() const=0;
|
||||
void output_comparefunc(ostream &out,PandaCompareFunc fn) const;
|
||||
void output_comparefunc(ostream &out, PandaCompareFunc fn) const;
|
||||
|
||||
protected:
|
||||
bool _always_reissue;
|
||||
|
||||
private:
|
||||
typedef pset<const RenderAttrib *, IndirectCompareTo<RenderAttrib> > Attribs;
|
||||
|
@ -842,7 +842,11 @@ issue_delta_modify(const RenderState *other,
|
||||
if ((*ai)._attrib != (*bi)._attrib) {
|
||||
any_changed = true;
|
||||
(*bi)._attrib->issue(gsg);
|
||||
|
||||
} else if ((*bi)._attrib->always_reissue()) {
|
||||
(*bi)._attrib->issue(gsg);
|
||||
}
|
||||
|
||||
*result = *bi;
|
||||
++ai;
|
||||
++bi;
|
||||
@ -910,7 +914,7 @@ issue_delta_set(const RenderState *other,
|
||||
} else {
|
||||
// Here is an attribute we have in both. Issue the new one if
|
||||
// it's different.
|
||||
if ((*ai)._attrib != (*bi)._attrib) {
|
||||
if ((*ai)._attrib != (*bi)._attrib || (*bi)._attrib->always_reissue()) {
|
||||
(*bi)._attrib->issue(gsg);
|
||||
}
|
||||
++ai;
|
||||
|
Loading…
x
Reference in New Issue
Block a user