*** empty log message ***

This commit is contained in:
David Rose 2001-01-11 02:39:57 +00:00
parent 820f77f19a
commit ee7cc2ccce
20 changed files with 161 additions and 91 deletions

View File

@ -13,14 +13,6 @@
// files.
// Check the version of ppremake in use. This is temporary until
// everyone gets up to at least 0.50. After that, the test in dtool
// will suffice.
#if $[not $[>= $[PPREMAKE_VERSION],0.50]]
#error You need at least ppremake version 0.50 to process this tree.
#endif
// What is the name and version of this source tree?
#if $[eq $[PACKAGE],]
#define PACKAGE panda

View File

@ -408,6 +408,32 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
arc->has_transition(DecalTransition::get_class_type());
}
#ifndef NDEBUG
if (support_subrender == SD_off) {
node_has_sub_render = false;
arc_has_sub_render = false;
} else if (support_subrender == SD_hide) {
if ((node_has_sub_render || arc_has_sub_render) &&
!arc->has_transition(DecalTransition::get_class_type())) {
return false;
}
node_has_sub_render = false;
arc_has_sub_render = false;
}
#endif
#ifndef NDEBUG
if (support_direct == SD_off) {
has_direct_render = false;
} else if (support_direct == SD_hide) {
if (has_direct_render) {
return false;
}
}
#endif
if (arc_has_sub_render) {
level_state._now = UpdateSeq::fresh();
}

View File

@ -41,11 +41,10 @@ class EXPCL_PANDA GraphicsStateGuardian : public GraphicsStateGuardianBase {
public:
GraphicsStateGuardian(GraphicsWindow *win);
PUBLISHED:
INLINE void set_render_traverser(RenderTraverser *rt);
INLINE RenderTraverser *get_render_traverser() const;
void release_all_textures();
virtual void set_color_clear_value(const Colorf& value);
virtual void set_depth_clear_value(const float value);
virtual void set_stencil_clear_value(const bool value);
@ -62,6 +61,10 @@ public:
INLINE Colorf get_accum_clear_value(void) const {
return _accum_clear_value;
}
public:
void release_all_textures();
virtual void clear(const RenderBuffer &buffer)=0;
virtual void clear(const RenderBuffer &buffer, const DisplayRegion* region)=0;
@ -187,8 +190,7 @@ private:
public:
INLINE GraphicsWindow* get_window(void) const { return _win; }
PUBLISHED:
public:
static TypeHandle get_class_type() {
return _type_handle;
}

View File

@ -22,9 +22,12 @@
lmatrix4fTransition.cxx lmatrix4fTransition.h \
matrixAttribute.I matrixAttribute.h matrixTransition.I \
matrixTransition.h \
multiAttribute.I multiAttribute.h \
multiNodeAttribute.I \
multiNodeAttribute.cxx multiNodeAttribute.h multiNodeTransition.I \
multiNodeTransition.cxx multiNodeTransition.h namedNode.I \
multiNodeTransition.cxx multiNodeTransition.h \
multiTransition.I multiTransition.h multiTransitionHelpers.I \
multiTransitionHelpers.h namedNode.I \
namedNode.cxx namedNode.h node.I node.cxx node.h nodeAttribute.I \
nodeAttribute.N nodeAttribute.cxx nodeAttribute.h \
nodeAttributeWrapper.I nodeAttributeWrapper.cxx \

View File

@ -3,11 +3,8 @@
//
////////////////////////////////////////////////////////////////////
/* okcircular */
#include "multiTransition.h"
#include "multiTransitionHelpers.h"
#include <indent.h>
#include <algorithm>
template<class Property, class NameClass>
TypeHandle MultiAttribute<Property, NameClass>::_type_handle;

View File

@ -9,6 +9,10 @@
#include <pandabase.h>
#include "nodeAttribute.h"
#include "multiTransitionHelpers.h"
#include <indent.h>
#include <algorithm>
template<class Property, class NameClass>
class MultiTransition;
@ -27,7 +31,7 @@ protected:
MultiAttribute(const MultiAttribute &copy);
void operator = (const MultiAttribute &copy);
public:
PUBLISHED:
void set_on(const Property &prop);
void set_off(const Property &prop);
@ -36,6 +40,7 @@ public:
INLINE bool get_properties_is_on() const;
public:
virtual void output(ostream &out) const;
virtual void write(ostream &out, int indent_level = 0) const;

View File

@ -3,10 +3,9 @@
//
////////////////////////////////////////////////////////////////////
#include "multiTransitionHelpers.h"
/* okcircular */
#include "multiAttribute.h"
#include <indent.h>
template<class Property, class NameClass>
TypeHandle MultiTransition<Property, NameClass>::_type_handle;

View File

@ -10,6 +10,9 @@
#include "nodeTransition.h"
#include "transitionDirection.h"
#include "multiTransitionHelpers.h"
#include <indent.h>
////////////////////////////////////////////////////////////////////
// Class : MultiTransition
@ -43,7 +46,7 @@ protected:
MultiTransition(const MultiTransition &copy);
void operator = (const MultiTransition &copy);
public:
PUBLISHED:
void clear();
bool is_identity() const;
@ -71,6 +74,7 @@ public:
bool is_on(const Property &prop) const;
bool is_off(const Property &prop) const;
public:
virtual NodeTransition *make_identity() const=0;
virtual NodeTransition *compose(const NodeTransition *other) const;

View File

@ -8,6 +8,8 @@
#include <pandabase.h>
#include "transitionDirection.h"
////////////////////////////////////////////////////////////////////
// Function: dmap_compose
// Description: Accepts two DirectionMaps, and builds a new

View File

@ -27,18 +27,20 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA AmbientLight : public Light, public NamedNode
{
public:
PUBLISHED:
AmbientLight( const string& name = "" );
~AmbientLight( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
public:
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
public:
static TypeHandle get_class_type( void ) {

View File

@ -0,0 +1,2 @@
forcetype MultiTransition<PT_Light, LightNameClass>
forcetype MultiAttribute<PT_Light, LightNameClass>

View File

@ -27,21 +27,23 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA DirectionalLight : public Light, public NamedNode
{
public:
PUBLISHED:
DirectionalLight( const string& name = "" );
~DirectionalLight( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
INLINE Colorf get_specular( void ) const;
INLINE void set_specular( const Colorf& color );
public:
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
protected:
Colorf _specular;

View File

@ -25,19 +25,20 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA Light : virtual public ReferenceCount
{
public:
PUBLISHED:
Light( void ) { _color.set(0.0, 0.0, 0.0, 1.0); }
virtual ~Light( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) = 0;
INLINE Colorf get_color(void) const { return _color; }
INLINE void set_color(const Colorf& color) { _color = color; }
virtual void output(ostream &out) const=0;
virtual void write(ostream &out, int indent_level = 0) const=0;
public:
virtual void apply( GraphicsStateGuardian* gsg ) = 0;
protected:
Colorf _color;

View File

@ -26,9 +26,10 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_LIGHT);
// Description : See LightTransition.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA LightAttribute : public MultiAttribute<PT_Light, LightNameClass> {
public:
PUBLISHED:
INLINE LightAttribute();
public:
virtual TypeHandle get_handle() const;
virtual NodeAttribute *make_copy() const;
virtual NodeAttribute *make_initial() const;

View File

@ -30,10 +30,11 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTITRANSITION_LIGHT);
// indicated lights in effect.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA LightTransition : public MultiTransition<PT_Light, LightNameClass> {
public:
PUBLISHED:
INLINE LightTransition();
INLINE static LightTransition all_off();
public:
virtual NodeTransition *make_copy() const;
virtual NodeAttribute *make_attrib() const;
virtual NodeTransition *make_identity() const;

View File

@ -27,18 +27,11 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA PointLight : public Light, public NamedNode
{
public:
PUBLISHED:
PointLight( const string& name = "" );
~PointLight( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
INLINE Colorf get_specular( void ) const;
INLINE void set_specular( const Colorf& color );
@ -51,6 +44,15 @@ class EXPCL_PANDA PointLight : public Light, public NamedNode
INLINE float get_quadratic_attenuation( void ) const;
INLINE void set_quadratic_attenuation( float att );
public:
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
protected:
Colorf _specular;

View File

@ -29,18 +29,11 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA Spotlight : public Light, public ProjectionNode
{
public:
PUBLISHED:
Spotlight( const string& name = "" );
~Spotlight( void ) { }
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
INLINE float get_exponent( void ) const;
INLINE void set_exponent( float exponent );
@ -58,6 +51,15 @@ class EXPCL_PANDA Spotlight : public Light, public ProjectionNode
INLINE float get_quadratic_attenuation( void ) const;
INLINE void set_quadratic_attenuation( float att );
public:
virtual void output( ostream &out ) const;
virtual void write( ostream &out, int indent_level = 0 ) const;
virtual void apply( GraphicsStateGuardian* gsg ) {
gsg->apply_light( this );
}
bool make_image(Texture* texture, float radius = 0.7);
NamedNode* make_geometry(float intensity = 0.05, float length = 20.0,
int num_facets = 36);

View File

@ -64,29 +64,44 @@ Configure(config_sgattrib);
NotifyCategoryDef(sgattrib, "");
// 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:
// For performance testing reasons, it may be useful to support
// certain rendering special effects that require a special-case
// direct render traversal to varying less-than-complete degrees. The
// variables support-decals, support-subrender, or support-direct may
// be set to change these. support-decals specifically controls the
// rendering of decal geometry (polygons against a coplanar
// background), while support-subrender controls other effects such as
// LOD's and billboards. support-direct controls any effect which
// requires switching to DirectRenderTraverser from a CullTraverser,
// including decals and things specifically flagged with a
// DirectRenderTransition.
//
// on - This is the default, and causes decals to be rendered
// The legal values for each variable are:
//
// on - This is the default, and causes the effect 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.
// off - The special effect is ignored, and the geometry is rendered
// as if the effect were not set at all. The result will
// generally be horrible looking, for instance with decals
// Z-fighting with the base geometry. This is equivalent to
// #f.
//
// hide - Decals are not drawn at all.
// hide - The nested geometry--the decals, or the billboards, or
// whatever--is not drawn at all.
//
// If compiled in NDEBUG mode, this variable is ignored and decals are
// always on.
// If compiled in NDEBUG mode, this variable is ignored and decals
// etc. are always on.
//
SupportDecals support_decals = SD_on;
SupportDirect support_decals = SD_on;
SupportDirect support_subrender = SD_on;
SupportDirect support_direct = SD_on;
static SupportDecals
parse_support_decals(const string &type) {
static SupportDirect
get_support_direct(const string &varname) {
string type = config_sgattrib.GetString(varname, "");
if (type == "on") {
return SD_on;
} else if (type == "off") {
@ -94,18 +109,19 @@ parse_support_decals(const string &type) {
} else if (type == "hide") {
return SD_hide;
}
return SD_invalid;
// None of the above, so use #t/#f.
if (config_sgattrib.GetBool(varname, true)) {
return SD_on;
} else {
return SD_off;
}
}
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;
}
}
support_decals = get_support_direct("support-decals");
support_subrender = get_support_direct("support-subrender");
support_direct = get_support_direct("support-direct");
// MPG - we want to ensure that texture transitions are applied
// before texgen transitions, so the texture transition must be

View File

@ -12,13 +12,14 @@
NotifyCategoryDecl(sgattrib, EXPCL_PANDA, EXPTP_PANDA);
// Configure variables for sgattrib package.
enum SupportDecals {
enum SupportDirect {
SD_on,
SD_off,
SD_hide,
SD_invalid
SD_hide
};
extern EXPCL_PANDA SupportDecals support_decals;
extern EXPCL_PANDA SupportDirect support_decals;
extern EXPCL_PANDA SupportDirect support_subrender;
extern EXPCL_PANDA SupportDirect support_direct;
#endif

View File

@ -130,10 +130,15 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
AllTransitionsWrapper new_trans;
if (!node->sub_render(render_state, new_trans, this)) {
return false;
}
render_state.apply_in_place(new_trans);
#ifndef NDEBUG
if (support_subrender == SD_on)
#endif
{
if (!node->sub_render(render_state, new_trans, this)) {
return false;
}
render_state.apply_in_place(new_trans);
}
if (node->is_of_type(GeomNode::get_class_type())) {
_gsg->set_state(render_state.get_attributes(), true);
@ -190,15 +195,20 @@ forward_arc(NodeRelation *arc, AllTransitionsWrapper &trans,
mark_forward_arc(arc);
AllTransitionsWrapper::const_iterator nti;
for (nti = trans.begin(); nti != trans.end(); ++nti) {
NodeTransition *t = (*nti).second.get_trans();
AllTransitionsWrapper new_trans;
if (!t->sub_render(arc, post, new_trans, this)) {
carry_on = false;
#ifndef NDEBUG
if (support_subrender == SD_on)
#endif
{
AllTransitionsWrapper::const_iterator nti;
for (nti = trans.begin(); nti != trans.end(); ++nti) {
NodeTransition *t = (*nti).second.get_trans();
AllTransitionsWrapper new_trans;
if (!t->sub_render(arc, post, new_trans, this)) {
carry_on = false;
}
post.apply_in_place(new_trans);
}
}
post.apply_in_place(new_trans);
}
if (!carry_on) {
mark_backward_arc(arc);