mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
add m-dual* Configrc variables
This commit is contained in:
parent
c50ec902b7
commit
e86a87f2d8
@ -89,6 +89,14 @@ const bool fake_view_frustum_cull = config_pgraph.GetBool("fake-view-frustum-cul
|
|||||||
// trapped with assert-abort).
|
// trapped with assert-abort).
|
||||||
const bool unambiguous_graph = config_pgraph.GetBool("unambiguous-graph", false);
|
const bool unambiguous_graph = config_pgraph.GetBool("unambiguous-graph", false);
|
||||||
|
|
||||||
|
// Set this false to disable TransparencyAttrib::M_dual altogether
|
||||||
|
// (and use M_alpha in its place).
|
||||||
|
const bool m_dual = config_pgraph.GetBool("m-dual", true);
|
||||||
|
// Set this false to disable just the opaque part of M_dual.
|
||||||
|
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);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: init_libpgraph
|
// Function: init_libpgraph
|
||||||
// Description: Initializes the library. This must be called at
|
// Description: Initializes the library. This must be called at
|
||||||
|
@ -29,6 +29,10 @@ NotifyCategoryDecl(pgraph, EXPCL_PANDA, EXPTP_PANDA);
|
|||||||
extern const bool fake_view_frustum_cull;
|
extern const bool fake_view_frustum_cull;
|
||||||
extern const bool unambiguous_graph;
|
extern const bool unambiguous_graph;
|
||||||
|
|
||||||
|
extern const bool m_dual;
|
||||||
|
extern const bool m_dual_opaque;
|
||||||
|
extern const bool m_dual_transparent;
|
||||||
|
|
||||||
extern EXPCL_PANDA void init_libpgraph();
|
extern EXPCL_PANDA void init_libpgraph();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,7 +69,7 @@ add_object(CullableObject *object) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TransparencyAttrib::M_dual:
|
case TransparencyAttrib::M_dual:
|
||||||
{
|
if (m_dual) {
|
||||||
// M_dual is implemented by drawing the opaque parts first,
|
// M_dual is implemented by drawing the opaque parts first,
|
||||||
// without transparency, then drawing the transparent parts
|
// without transparency, then drawing the transparent parts
|
||||||
// later. This means we must copy the object and add it to
|
// later. This means we must copy the object and add it to
|
||||||
@ -81,15 +81,26 @@ add_object(CullableObject *object) {
|
|||||||
bin_attrib->get_bin_name().empty()) {
|
bin_attrib->get_bin_name().empty()) {
|
||||||
// We make a copy of the object to draw the transparent part
|
// We make a copy of the object to draw the transparent part
|
||||||
// without decals; this gets placed in the transparent bin.
|
// without decals; this gets placed in the transparent bin.
|
||||||
CullableObject *transparent_part = new CullableObject(*object);
|
#ifndef NDEBUG
|
||||||
transparent_part->_state = state->compose(get_dual_transparent_state());
|
if (m_dual_transparent)
|
||||||
CullBin *bin = get_bin(transparent_part->_state->get_bin_index());
|
#endif
|
||||||
nassertv(bin != (CullBin *)NULL);
|
{
|
||||||
bin->add_object(transparent_part);
|
CullableObject *transparent_part = new CullableObject(*object);
|
||||||
|
transparent_part->_state = state->compose(get_dual_transparent_state());
|
||||||
|
CullBin *bin = get_bin(transparent_part->_state->get_bin_index());
|
||||||
|
nassertv(bin != (CullBin *)NULL);
|
||||||
|
bin->add_object(transparent_part);
|
||||||
|
}
|
||||||
|
|
||||||
// Now we can draw the opaque part, with decals. This will
|
// Now we can draw the opaque part, with decals. This will
|
||||||
// end up in the opaque bin.
|
// end up in the opaque bin.
|
||||||
object->_state = state->compose(get_dual_opaque_state());
|
object->_state = state->compose(get_dual_opaque_state());
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (!m_dual_opaque) {
|
||||||
|
delete object;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user