m-dual-flash
This commit is contained in:
parent
bf8e7a911f
commit
ff5e3de5da
|
|
@ -96,6 +96,8 @@ const bool m_dual = config_pgraph.GetBool("m-dual", true);
|
|||
const bool m_dual_opaque = config_pgraph.GetBool("m-dual-opaque", true);
|
||||
// Set this false to disable just the transparent part of M_dual.
|
||||
const bool m_dual_transparent = config_pgraph.GetBool("m-dual-transparent", true);
|
||||
// Set this true to flash any objects that use M_dual, for debugging.
|
||||
const bool m_dual_flash = config_pgraph.GetBool("m-dual-flash", false);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libpgraph
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ extern const bool unambiguous_graph;
|
|||
extern const bool m_dual;
|
||||
extern const bool m_dual_opaque;
|
||||
extern const bool m_dual_transparent;
|
||||
extern const bool m_dual_flash;
|
||||
|
||||
extern EXPCL_PANDA void init_libpgraph();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "alphaTestAttrib.h"
|
||||
#include "transparencyAttrib.h"
|
||||
#include "renderState.h"
|
||||
#include "clockObject.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CullResult::make_next
|
||||
|
|
@ -209,6 +210,10 @@ get_binary_state() {
|
|||
return state;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
static const double m_dual_flash_rate = 1.0; // 1 state change per second
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CullResult::get_dual_transparent_state
|
||||
// Access: Private
|
||||
|
|
@ -223,6 +228,20 @@ get_dual_transparent_state() {
|
|||
TransparencyAttrib::make(TransparencyAttrib::M_alpha),
|
||||
RenderState::get_max_priority());
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (m_dual_flash) {
|
||||
int cycle = (int)(ClockObject::get_global_clock()->get_real_time() * m_dual_flash_rate);
|
||||
if ((cycle & 1) == 0) {
|
||||
static CPT(RenderState) flash_state = NULL;
|
||||
if (flash_state == (const RenderState *)NULL) {
|
||||
flash_state = state->add_attrib(ColorScaleAttrib::make(LVecBase4f(0.8f, 0.2f, 0.2f, 1.0f)));
|
||||
}
|
||||
return flash_state;
|
||||
}
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
@ -240,5 +259,19 @@ get_dual_opaque_state() {
|
|||
TransparencyAttrib::make(TransparencyAttrib::M_none),
|
||||
RenderState::get_max_priority());
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (m_dual_flash) {
|
||||
int cycle = (int)(ClockObject::get_global_clock()->get_real_time() * m_dual_flash_rate);
|
||||
if ((cycle & 1) == 0) {
|
||||
static CPT(RenderState) flash_state = NULL;
|
||||
if (flash_state == (const RenderState *)NULL) {
|
||||
flash_state = state->add_attrib(ColorScaleAttrib::make(LVecBase4f(0.2f, 0.2f, 0.8f, 1.0f)));
|
||||
}
|
||||
return flash_state;
|
||||
}
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue