fix decal problems with DepthWriteTransition under decals

This commit is contained in:
David Rose 2001-07-30 23:16:22 +00:00
parent 5c5f2a6b22
commit 363005d9ce
7 changed files with 25 additions and 7 deletions

View File

@ -596,9 +596,14 @@ wants_colors() const {
// the GSG will render normally; subsequent geometry
// rendered up until the next call of end_decal() should
// be rendered as decals of the base_geom.
//
// The attributes wrapper is the current state as of the
// base geometry node. It may or may not be modified by
// the GSG to reflect whatever rendering state is
// necessary to render the decals properly.
////////////////////////////////////////////////////////////////////
void GraphicsStateGuardian::
begin_decal(GeomNode *base_geom) {
begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib) {
base_geom->draw(this);
}

View File

@ -124,7 +124,7 @@ public:
virtual bool wants_texcoords(void) const;
virtual bool wants_colors(void) const;
virtual void begin_decal(GeomNode *base_geom);
virtual void begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib);
virtual void end_decal(GeomNode *base_geom);
virtual void reset();

View File

@ -4982,9 +4982,14 @@ wants_texcoords() const {
// the GSG will render normally; subsequent geometry
// rendered up until the next call of end_decal() should
// be rendered as decals of the base_geom.
//
// The attributes wrapper is the current state as of the
// base geometry node. It may or may not be modified by
// the GSG to reflect whatever rendering state is
// necessary to render the decals properly.
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian::
begin_decal(GeomNode *base_geom) {
begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib) {
nassertv(base_geom != (GeomNode *)NULL);
_decal_level++;

View File

@ -184,7 +184,7 @@ public:
virtual bool wants_texcoords(void) const;
virtual bool wants_colors(void) const;
virtual void begin_decal(GeomNode *base_geom);
virtual void begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib);
virtual void end_decal(GeomNode *base_geom);
INLINE float compute_distance_to(const LPoint3f &point) const;

View File

@ -3390,9 +3390,14 @@ wants_colors() const {
// the GSG will render normally; subsequent geometry
// rendered up until the next call of end_decal() should
// be rendered as decals of the base_geom.
//
// The attributes wrapper is the current state as of the
// base geometry node. It may or may not be modified by
// the GSG to reflect whatever rendering state is
// necessary to render the decals properly.
////////////////////////////////////////////////////////////////////
void GLGraphicsStateGuardian::
begin_decal(GeomNode *base_geom) {
begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib) {
nassertv(base_geom != (GeomNode *)NULL);
_decal_level++;
@ -3416,6 +3421,9 @@ begin_decal(GeomNode *base_geom) {
} else {
// Turn off writing the depth buffer to render the base geometry.
call_glDepthMask(false);
DepthWriteAttribute *dwa = new DepthWriteAttribute;
dwa->set_off();
attrib.set_attribute(DepthWriteTransition::get_class_type(), dwa);
// Now render the base geometry.
base_geom->draw(this);

View File

@ -162,7 +162,7 @@ public:
virtual bool wants_texcoords(void) const;
virtual bool wants_colors(void) const;
virtual void begin_decal(GeomNode *base_geom);
virtual void begin_decal(GeomNode *base_geom, AllAttributesWrapper &attrib);
virtual void end_decal(GeomNode *base_geom);
virtual float compute_distance_to(const LPoint3f &point) const;

View File

@ -196,7 +196,7 @@ reached_node(Node *node, AllAttributesWrapper &render_state,
return false;
}
#endif
_gsg->begin_decal(geom);
_gsg->begin_decal(geom, render_state);
} else {
geom->draw(_gsg);