mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
15ad1a476a
commit
c590240157
@ -20,6 +20,7 @@
|
|||||||
#include <nodeTransitionWrapper.h>
|
#include <nodeTransitionWrapper.h>
|
||||||
#include <indent.h>
|
#include <indent.h>
|
||||||
#include <config_sgraphutil.h> // for implicit_app_traversal
|
#include <config_sgraphutil.h> // for implicit_app_traversal
|
||||||
|
#include <config_sgattrib.h> // for support_decals
|
||||||
#include <pStatTimer.h>
|
#include <pStatTimer.h>
|
||||||
|
|
||||||
TypeHandle CullTraverser::_type_handle;
|
TypeHandle CullTraverser::_type_handle;
|
||||||
@ -392,9 +393,20 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
|
|||||||
bool is_geom = node->is_of_type(GeomNode::get_class_type());
|
bool is_geom = node->is_of_type(GeomNode::get_class_type());
|
||||||
bool node_has_sub_render = node->has_sub_render();
|
bool node_has_sub_render = node->has_sub_render();
|
||||||
bool arc_has_sub_render = arc->has_sub_render_trans();
|
bool arc_has_sub_render = arc->has_sub_render_trans();
|
||||||
bool has_direct_render =
|
bool has_direct_render;
|
||||||
arc->has_transition(DirectRenderTransition::get_class_type()) ||
|
|
||||||
arc->has_transition(DecalTransition::get_class_type());
|
#ifndef NDEBUG
|
||||||
|
if (support_decals != SD_on) {
|
||||||
|
has_direct_render =
|
||||||
|
arc->has_transition(DirectRenderTransition::get_class_type()) &&
|
||||||
|
!arc->has_transition(DecalTransition::get_class_type());
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
has_direct_render =
|
||||||
|
arc->has_transition(DirectRenderTransition::get_class_type()) ||
|
||||||
|
arc->has_transition(DecalTransition::get_class_type());
|
||||||
|
}
|
||||||
|
|
||||||
if (arc_has_sub_render) {
|
if (arc_has_sub_render) {
|
||||||
level_state._now = UpdateSeq::fresh();
|
level_state._now = UpdateSeq::fresh();
|
||||||
@ -477,5 +489,13 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
|
|||||||
add_geom_node(DCAST(GeomNode, node), trans, level_state);
|
add_geom_node(DCAST(GeomNode, node), trans, level_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (support_decals == SD_hide &&
|
||||||
|
arc->has_transition(DecalTransition::get_class_type())) {
|
||||||
|
mark_backward_arc(arc);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,53 @@ Configure(config_sgattrib);
|
|||||||
NotifyCategoryDef(sgattrib, "");
|
NotifyCategoryDef(sgattrib, "");
|
||||||
|
|
||||||
|
|
||||||
// MPG - we want to ensure that texture transitions are applied before
|
// For performance testing reasons, it may be useful to support decals
|
||||||
// texgen transitions, so the texture transition must be initialized
|
// (specially rendered coplanar geometry) to varying
|
||||||
// first.
|
// less-than-complete degrees. Modify the variable support-decals to
|
||||||
|
// change this. The legal values are:
|
||||||
|
//
|
||||||
|
// on - This is the default, and causes decals to be rendered
|
||||||
|
// properly (if supported by the gsg backend). This could have
|
||||||
|
// performance implications in fill, transform, and
|
||||||
|
// state-sorting. This is equivalent to #t.
|
||||||
|
//
|
||||||
|
// off - Decals are rendered as if they were not decalled at all.
|
||||||
|
// The result will generally be horrible looking, with each
|
||||||
|
// decal Z-fighting with its base. This is equivalent to #f.
|
||||||
|
//
|
||||||
|
// hide - Decals are not drawn at all.
|
||||||
|
//
|
||||||
|
// If compiled in NDEBUG mode, this variable is ignored and decals are
|
||||||
|
// always on.
|
||||||
|
//
|
||||||
|
SupportDecals support_decals = SD_on;
|
||||||
|
|
||||||
|
static SupportDecals
|
||||||
|
parse_support_decals(const string &type) {
|
||||||
|
if (type == "on") {
|
||||||
|
return SD_on;
|
||||||
|
} else if (type == "off") {
|
||||||
|
return SD_off;
|
||||||
|
} else if (type == "hide") {
|
||||||
|
return SD_hide;
|
||||||
|
}
|
||||||
|
return SD_invalid;
|
||||||
|
}
|
||||||
|
|
||||||
ConfigureFn(config_sgattrib) {
|
ConfigureFn(config_sgattrib) {
|
||||||
|
string support_decals_str = config_sgattrib.GetString("support-decals", "");
|
||||||
|
if (!support_decals_str.empty()) {
|
||||||
|
support_decals = parse_support_decals(support_decals_str);
|
||||||
|
if (support_decals == SD_invalid) {
|
||||||
|
support_decals =
|
||||||
|
config_sgattrib.GetBool("support-decals", true) ? SD_on : SD_off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MPG - we want to ensure that texture transitions are applied
|
||||||
|
// before texgen transitions, so the texture transition must be
|
||||||
|
// initialized first.
|
||||||
|
|
||||||
RenderRelation::init_type();
|
RenderRelation::init_type();
|
||||||
TextureTransition::init_type();
|
TextureTransition::init_type();
|
||||||
TextureAttribute::init_type();
|
TextureAttribute::init_type();
|
||||||
@ -140,4 +182,3 @@ ConfigureFn(config_sgattrib) {
|
|||||||
ColorMatrixTransition::register_with_read_factory();
|
ColorMatrixTransition::register_with_read_factory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,4 +11,14 @@
|
|||||||
|
|
||||||
NotifyCategoryDecl(sgattrib, EXPCL_PANDA, EXPTP_PANDA);
|
NotifyCategoryDecl(sgattrib, EXPCL_PANDA, EXPTP_PANDA);
|
||||||
|
|
||||||
|
// Configure variables for sgattrib package.
|
||||||
|
enum SupportDecals {
|
||||||
|
SD_on,
|
||||||
|
SD_off,
|
||||||
|
SD_hide,
|
||||||
|
SD_invalid
|
||||||
|
};
|
||||||
|
|
||||||
|
extern EXPCL_PANDA SupportDecals support_decals;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <decalTransition.h>
|
#include <decalTransition.h>
|
||||||
#include <decalAttribute.h>
|
#include <decalAttribute.h>
|
||||||
#include <pStatTimer.h>
|
#include <pStatTimer.h>
|
||||||
|
#include <config_sgattrib.h> // for support_decals
|
||||||
|
|
||||||
TypeHandle DirectRenderTraverser::_type_handle;
|
TypeHandle DirectRenderTraverser::_type_handle;
|
||||||
PStatCollector DirectRenderTraverser::_draw_pcollector =
|
PStatCollector DirectRenderTraverser::_draw_pcollector =
|
||||||
@ -70,12 +71,17 @@ traverse(Node *root,
|
|||||||
|
|
||||||
DirectRenderLevelState level_state;
|
DirectRenderLevelState level_state;
|
||||||
|
|
||||||
DecalAttribute *decal_attrib;
|
#ifndef NDEBUG
|
||||||
if (get_attribute_into(decal_attrib, render_state,
|
if (support_decals != SD_off)
|
||||||
DecalTransition::get_class_type())) {
|
#endif
|
||||||
level_state._decal_mode = decal_attrib->is_on();
|
{
|
||||||
}
|
DecalAttribute *decal_attrib;
|
||||||
|
if (get_attribute_into(decal_attrib, render_state,
|
||||||
|
DecalTransition::get_class_type())) {
|
||||||
|
level_state._decal_mode = decal_attrib->is_on();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Determine the relative transform matrix from the camera to our
|
// Determine the relative transform matrix from the camera to our
|
||||||
// starting node. This is important for proper view-frustum
|
// starting node. This is important for proper view-frustum
|
||||||
// culling.
|
// culling.
|
||||||
@ -96,6 +102,11 @@ traverse(Node *root,
|
|||||||
|
|
||||||
if (level_state._decal_mode &&
|
if (level_state._decal_mode &&
|
||||||
root->is_of_type(GeomNode::get_class_type())) {
|
root->is_of_type(GeomNode::get_class_type())) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (support_decals == SD_hide) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// Close the decal.
|
// Close the decal.
|
||||||
_gsg->end_decal(DCAST(GeomNode, root));
|
_gsg->end_decal(DCAST(GeomNode, root));
|
||||||
}
|
}
|
||||||
@ -132,13 +143,25 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
|
|||||||
GeomNode *geom = DCAST(GeomNode, node);
|
GeomNode *geom = DCAST(GeomNode, node);
|
||||||
|
|
||||||
// We must make decals a special case, because they're so strange.
|
// We must make decals a special case, because they're so strange.
|
||||||
DecalAttribute *decal_attrib;
|
#ifndef NDEBUG
|
||||||
if (get_attribute_into(decal_attrib, render_state,
|
if (support_decals != SD_off)
|
||||||
DecalTransition::get_class_type())) {
|
#endif
|
||||||
level_state._decal_mode = decal_attrib->is_on();
|
{
|
||||||
}
|
DecalAttribute *decal_attrib;
|
||||||
|
if (get_attribute_into(decal_attrib, render_state,
|
||||||
|
DecalTransition::get_class_type())) {
|
||||||
|
level_state._decal_mode = decal_attrib->is_on();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (level_state._decal_mode) {
|
if (level_state._decal_mode) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (support_decals == SD_hide) {
|
||||||
|
level_state._decal_mode = false;
|
||||||
|
geom->draw(_gsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
_gsg->begin_decal(geom);
|
_gsg->begin_decal(geom);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user