*** empty log message ***

This commit is contained in:
David Rose 2001-01-10 01:10:02 +00:00
parent 15ad1a476a
commit c590240157
4 changed files with 112 additions and 18 deletions

View File

@ -20,6 +20,7 @@
#include <nodeTransitionWrapper.h>
#include <indent.h>
#include <config_sgraphutil.h> // for implicit_app_traversal
#include <config_sgattrib.h> // for support_decals
#include <pStatTimer.h>
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 node_has_sub_render = node->has_sub_render();
bool arc_has_sub_render = arc->has_sub_render_trans();
bool has_direct_render =
arc->has_transition(DirectRenderTransition::get_class_type()) ||
arc->has_transition(DecalTransition::get_class_type());
bool has_direct_render;
#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) {
level_state._now = UpdateSeq::fresh();
@ -477,5 +489,13 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
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;
}

View File

@ -64,11 +64,53 @@ Configure(config_sgattrib);
NotifyCategoryDef(sgattrib, "");
// MPG - we want to ensure that texture transitions are applied before
// texgen transitions, so the texture transition must be initialized
// first.
// For performance testing reasons, it may be useful to support decals
// (specially rendered coplanar geometry) to varying
// 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) {
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();
TextureTransition::init_type();
TextureAttribute::init_type();
@ -140,4 +182,3 @@ ConfigureFn(config_sgattrib) {
ColorMatrixTransition::register_with_read_factory();
}

View File

@ -11,4 +11,14 @@
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

View File

@ -24,6 +24,7 @@
#include <decalTransition.h>
#include <decalAttribute.h>
#include <pStatTimer.h>
#include <config_sgattrib.h> // for support_decals
TypeHandle DirectRenderTraverser::_type_handle;
PStatCollector DirectRenderTraverser::_draw_pcollector =
@ -70,11 +71,16 @@ traverse(Node *root,
DirectRenderLevelState level_state;
DecalAttribute *decal_attrib;
if (get_attribute_into(decal_attrib, render_state,
DecalTransition::get_class_type())) {
level_state._decal_mode = decal_attrib->is_on();
}
#ifndef NDEBUG
if (support_decals != SD_off)
#endif
{
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
// starting node. This is important for proper view-frustum
@ -96,6 +102,11 @@ traverse(Node *root,
if (level_state._decal_mode &&
root->is_of_type(GeomNode::get_class_type())) {
#ifndef NDEBUG
if (support_decals == SD_hide) {
return;
}
#endif
// Close the decal.
_gsg->end_decal(DCAST(GeomNode, root));
}
@ -132,13 +143,25 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
GeomNode *geom = DCAST(GeomNode, node);
// We must make decals a special case, because they're so strange.
DecalAttribute *decal_attrib;
if (get_attribute_into(decal_attrib, render_state,
DecalTransition::get_class_type())) {
level_state._decal_mode = decal_attrib->is_on();
}
#ifndef NDEBUG
if (support_decals != SD_off)
#endif
{
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) {
#ifndef NDEBUG
if (support_decals == SD_hide) {
level_state._decal_mode = false;
geom->draw(_gsg);
return false;
}
#endif
_gsg->begin_decal(geom);
} else {