mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
fix untextured poly problem
This commit is contained in:
parent
827d1ac12d
commit
6788d08998
@ -620,57 +620,6 @@ enable_color_material(bool val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian::enable_texturing
|
|
||||||
// Access:
|
|
||||||
// Description:
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void DXGraphicsStateGuardian::
|
|
||||||
enable_texturing(bool val) {
|
|
||||||
if (_texturing_enabled != val) {
|
|
||||||
_texturing_enabled = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
// assert(_pCurTexContext!=NULL); we're definitely called with it NULL for both true and false
|
|
||||||
|
|
||||||
/*
|
|
||||||
old way to disable texturing
|
|
||||||
if(val == FALSE) {
|
|
||||||
_d3dDevice->SetTexture(0,NULL);
|
|
||||||
} else {
|
|
||||||
if(_pCurTexContext!=NULL) {
|
|
||||||
_d3dDevice->SetTexture(0,_pCurTexContext->_surface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(val == FALSE) {
|
|
||||||
if(_pCurTexContext!=NULL) {
|
|
||||||
_d3dDevice->GetTextureStageState(0,D3DTSS_COLOROP,(DWORD*)&(_pCurTexContext->_SavedStage0_ColorOp));
|
|
||||||
}
|
|
||||||
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE);
|
|
||||||
} else {
|
|
||||||
// note: if we set D3DTSS_COLOROP to something other than disable and then
|
|
||||||
// call "enable_texturing(), conflict will occur
|
|
||||||
#if 0
|
|
||||||
// we need to set D3DTSS_COLOROP,D3DTOP_MODULATE if pCurTextContext is null and tex enabled true,
|
|
||||||
// so this test is impossible now
|
|
||||||
DWORD dwColOpVal=0;
|
|
||||||
_d3dDevice->GetTextureStageState(0,D3DTSS_COLOROP,&dwColOpVal);
|
|
||||||
if(dwColOpVal!=D3DTOP_DISABLE) {
|
|
||||||
dxgsg_cat.error() << "Error in enable_texturing(true), someone set D3DTSS_COLOROP to non-disabled value\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(_pCurTexContext!=NULL) {
|
|
||||||
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,_pCurTexContext->_SavedStage0_ColorOp);
|
|
||||||
} else {
|
|
||||||
// not sure this is the right thing to do
|
|
||||||
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian::enable_clip_plane
|
// Function: DXGraphicsStateGuardian::enable_clip_plane
|
||||||
// Access:
|
// Access:
|
||||||
|
@ -480,9 +480,9 @@ init_dx( LPDIRECTDRAW7 context,
|
|||||||
cfa->issue(this);
|
cfa->issue(this);
|
||||||
la->issue(this);
|
la->issue(this);
|
||||||
|
|
||||||
|
_CurTexBlendMode = TextureApplyProperty::M_modulate;
|
||||||
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); // disables texturing
|
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); // disables texturing
|
||||||
ta->issue(this); // no curtextcontext, this does nothing. dx should already be properly inited above anyway
|
ta->issue(this); // no curtextcontext, this does nothing. dx should already be properly inited above anyway
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -3284,15 +3284,8 @@ issue_color_blend(const ColorBlendAttribute *attrib) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
void DXGraphicsStateGuardian::SetTextureBlendMode(TextureApplyProperty::Mode TexBlendMode) {
|
||||||
// Function: DXGraphicsStateGuardian::issue_texture_apply
|
switch(TexBlendMode) {
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description:
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian::
|
|
||||||
issue_texture_apply(const TextureApplyAttribute *attrib) {
|
|
||||||
|
|
||||||
switch(attrib->get_mode()) {
|
|
||||||
case TextureApplyProperty::M_modulate:
|
case TextureApplyProperty::M_modulate:
|
||||||
// emulates GL_MODULATE glTexEnv mode
|
// emulates GL_MODULATE glTexEnv mode
|
||||||
// want to multiply tex-color*pixel color to emulate GL modulate blend (see glTexEnv)
|
// want to multiply tex-color*pixel color to emulate GL modulate blend (see glTexEnv)
|
||||||
@ -3335,7 +3328,7 @@ issue_texture_apply(const TextureApplyAttribute *attrib) {
|
|||||||
break;
|
break;
|
||||||
case TextureApplyProperty::M_blend:
|
case TextureApplyProperty::M_blend:
|
||||||
dxgsg_cat.error()
|
dxgsg_cat.error()
|
||||||
<< "Impossible to emulate GL_BLEND in DX exactly " << (int) attrib->get_mode() << endl;
|
<< "Impossible to emulate GL_BLEND in DX exactly " << (int) TexBlendMode << endl;
|
||||||
/*
|
/*
|
||||||
// emulate GL_BLEND glTexEnv
|
// emulate GL_BLEND glTexEnv
|
||||||
|
|
||||||
@ -3362,11 +3355,49 @@ issue_texture_apply(const TextureApplyAttribute *attrib) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dxgsg_cat.error() << "Unknown texture blend mode " << (int) attrib->get_mode() << endl;
|
dxgsg_cat.error() << "Unknown texture blend mode " << (int) TexBlendMode << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian::enable_texturing
|
||||||
|
// Access:
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DXGraphicsStateGuardian::
|
||||||
|
enable_texturing(bool val) {
|
||||||
|
if (_texturing_enabled != val) {
|
||||||
|
_texturing_enabled = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert(_pCurTexContext!=NULL); we're definitely called with it NULL for both true and false
|
||||||
|
|
||||||
|
if((val == FALSE) || (_pCurTexContext==NULL)) {
|
||||||
|
_d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE);
|
||||||
|
} else {
|
||||||
|
SetTextureBlendMode(_CurTexBlendMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXGraphicsStateGuardian::issue_texture_apply
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DXGraphicsStateGuardian::
|
||||||
|
issue_texture_apply(const TextureApplyAttribute *attrib) {
|
||||||
|
|
||||||
|
_CurTexBlendMode = attrib->get_mode();
|
||||||
|
|
||||||
|
if(!_texturing_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTextureBlendMode(_CurTexBlendMode);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian::issue_color_mask
|
// Function: DXGraphicsStateGuardian::issue_color_mask
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -221,60 +221,6 @@ protected:
|
|||||||
INLINE void enable_clip_plane(int clip_plane, bool val);
|
INLINE void enable_clip_plane(int clip_plane, bool val);
|
||||||
INLINE void enable_fog(bool val);
|
INLINE void enable_fog(bool val);
|
||||||
|
|
||||||
#ifdef WBD_GL_MODE
|
|
||||||
void print_gfx_visual();
|
|
||||||
INLINE void call_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
|
|
||||||
GLclampf alpha);
|
|
||||||
INLINE void call_glClearDepth(GLclampd depth);
|
|
||||||
INLINE void call_glClearStencil(GLint s);
|
|
||||||
INLINE void call_glClearAccum(GLclampf red, GLclampf green, GLclampf blue,
|
|
||||||
GLclampf alpha);
|
|
||||||
INLINE void call_glDrawBuffer(GLenum mode);
|
|
||||||
INLINE void call_glReadBuffer(GLenum mode);
|
|
||||||
INLINE void call_glShadeModel(GLenum mode);
|
|
||||||
INLINE void call_glCullFace(GLenum mode);
|
|
||||||
INLINE void call_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
|
||||||
INLINE void call_glLightModelAmbient(const Colorf& color);
|
|
||||||
INLINE void call_glLightModelLocal(GLboolean local);
|
|
||||||
INLINE void call_glLightModelTwoSide(GLboolean twoside);
|
|
||||||
INLINE void call_glMaterialAmbient(bool twoside, const Colorf& color);
|
|
||||||
INLINE void call_glMaterialDiffuse(bool twoside, const Colorf& color);
|
|
||||||
INLINE void call_glMaterialAmbientDiffuse(bool twoside, const Colorf& color);
|
|
||||||
INLINE void call_glMaterialSpecular(bool twoside, const Colorf& color);
|
|
||||||
INLINE void call_glMaterialShininess(bool twoside, float shininess);
|
|
||||||
INLINE void call_glMaterialEmission(bool twoside, const Colorf& color);
|
|
||||||
INLINE void call_glStencilFunc(GLenum func);
|
|
||||||
INLINE void call_glStencilOp(GLenum op);
|
|
||||||
INLINE void call_glClipPlane(GLenum plane, const double equation[4]);
|
|
||||||
INLINE void call_glLineWidth(GLfloat width);
|
|
||||||
INLINE void call_glPointSize(GLfloat size);
|
|
||||||
INLINE void call_glDepthMask(GLboolean mask);
|
|
||||||
INLINE void call_glFogMode(GLint mode);
|
|
||||||
INLINE void call_glFogStart(GLfloat start);
|
|
||||||
INLINE void call_glFogEnd(GLfloat end);
|
|
||||||
INLINE void call_glFogDensity(GLfloat density);
|
|
||||||
INLINE void call_glFogColor(const Colorf &color);
|
|
||||||
INLINE void call_glPolygonMode(GLenum mode);
|
|
||||||
|
|
||||||
INLINE GLenum get_light_id(int index) const;
|
|
||||||
INLINE GLenum get_clip_plane_id(int index) const;
|
|
||||||
|
|
||||||
GLenum get_image_type(PixelBuffer::Type type);
|
|
||||||
GLenum get_external_image_format(PixelBuffer::Format format);
|
|
||||||
GLenum get_internal_image_format(PixelBuffer::Format format);
|
|
||||||
GLint get_texture_apply_mode_type( TextureApplyProperty::Mode am ) const;
|
|
||||||
|
|
||||||
GLenum _draw_buffer_mode;
|
|
||||||
GLenum _read_buffer_mode;
|
|
||||||
GLenum _shade_model_mode;
|
|
||||||
GLboolean _lmodel_local;
|
|
||||||
GLboolean _lmodel_twoside;
|
|
||||||
GLenum _polygon_mode;
|
|
||||||
GLenum _stencil_func;
|
|
||||||
GLenum _stencil_op;
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
/* INLINE void enable_multisample_alpha_one(bool val);
|
/* INLINE void enable_multisample_alpha_one(bool val);
|
||||||
INLINE void enable_multisample_alpha_mask(bool val);
|
INLINE void enable_multisample_alpha_mask(bool val);
|
||||||
INLINE void enable_multisample(bool val, LPDIRECT3DDEVICE7 d3dDevice);
|
INLINE void enable_multisample(bool val, LPDIRECT3DDEVICE7 d3dDevice);
|
||||||
@ -321,9 +267,6 @@ protected:
|
|||||||
Geom::TexCoordIterator ti;
|
Geom::TexCoordIterator ti;
|
||||||
Geom::ColorIterator ci;
|
Geom::ColorIterator ci;
|
||||||
|
|
||||||
|
|
||||||
#endif // WBD_GL_MODE
|
|
||||||
|
|
||||||
float _clear_color_red, _clear_color_green, _clear_color_blue,_clear_color_alpha;
|
float _clear_color_red, _clear_color_green, _clear_color_blue,_clear_color_alpha;
|
||||||
double _clear_depth;
|
double _clear_depth;
|
||||||
int _clear_stencil;
|
int _clear_stencil;
|
||||||
@ -355,6 +298,8 @@ protected:
|
|||||||
D3DBLEND _blend_source_func;
|
D3DBLEND _blend_source_func;
|
||||||
D3DBLEND _blend_dest_func;
|
D3DBLEND _blend_dest_func;
|
||||||
|
|
||||||
|
TextureApplyProperty::Mode _CurTexBlendMode;
|
||||||
|
|
||||||
int _pack_alignment;
|
int _pack_alignment;
|
||||||
int _unpack_alignment;
|
int _unpack_alignment;
|
||||||
|
|
||||||
@ -418,6 +363,7 @@ public:
|
|||||||
INLINE void Set_HDC(HDC hdc) { _hdc = hdc; }
|
INLINE void Set_HDC(HDC hdc) { _hdc = hdc; }
|
||||||
void adjust_view_rect(int x, int y);
|
void adjust_view_rect(int x, int y);
|
||||||
INLINE void SetDXStatus(bool stat) { _dx_ready = stat; }
|
INLINE void SetDXStatus(bool stat) { _dx_ready = stat; }
|
||||||
|
void DXGraphicsStateGuardian::SetTextureBlendMode(TextureApplyProperty::Mode TexBlendMode);
|
||||||
|
|
||||||
void dx_cleanup();
|
void dx_cleanup();
|
||||||
void dx_setup_after_resize(RECT viewrect,HWND mwindow) ;
|
void dx_setup_after_resize(RECT viewrect,HWND mwindow) ;
|
||||||
|
@ -852,7 +852,6 @@ DXTextureContext(Texture *tex) :
|
|||||||
#endif
|
#endif
|
||||||
_surface = NULL;
|
_surface = NULL;
|
||||||
_tex = tex;
|
_tex = tex;
|
||||||
_SavedStage0_ColorOp=D3DTOP_MODULATE; // this is default when texturing is enabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DXTextureContext::
|
DXTextureContext::
|
||||||
|
@ -31,7 +31,6 @@ public:
|
|||||||
|
|
||||||
LPDIRECTDRAWSURFACE7 _surface;
|
LPDIRECTDRAWSURFACE7 _surface;
|
||||||
Texture *_tex; // ptr to parent, primarily for access to namestr
|
Texture *_tex; // ptr to parent, primarily for access to namestr
|
||||||
D3DTEXTUREOP _SavedStage0_ColorOp;
|
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE7 CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT pTexPixFmts);
|
LPDIRECTDRAWSURFACE7 CreateTexture( HDC hdc, LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT pTexPixFmts);
|
||||||
void DeleteTexture();
|
void DeleteTexture();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user