Merged from 1.5 branch revisions 2333:2347. Fix depthbuffer under d3d, renderstates under OpenGL, stencilshadow under OpenGL.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2349 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
f84e662812
commit
bccb6e0112
|
@ -439,8 +439,17 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
|||
|
||||
// store the screen's depth buffer
|
||||
DepthBuffers.push_back(new SDepthSurface());
|
||||
pID3DDevice->GetDepthStencilSurface(&(DepthBuffers[0]->Surface));
|
||||
DepthBuffers[0]->Size=ScreenSize;
|
||||
if (SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&(DepthBuffers[0]->Surface))))
|
||||
{
|
||||
D3DSURFACE_DESC desc;
|
||||
DepthBuffers[0]->Surface->GetDesc(&desc);
|
||||
DepthBuffers[0]->Size.set(desc.Width, desc.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Was not able to get main depth buffer.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
D3DColorFormat = D3DFMT_A8R8G8B8;
|
||||
IDirect3DSurface9* bb=0;
|
||||
|
@ -2814,7 +2823,8 @@ void CD3D9Driver::checkDepthBuffer(ITexture* tex)
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
depth=DepthBuffers.getLast();
|
||||
depth->Size=optSize;
|
||||
depth->Surface->GetDesc(&desc);
|
||||
depth->Size.set(desc.Width, desc.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -24,7 +24,12 @@ namespace video
|
|||
{
|
||||
struct SDepthSurface : public IReferenceCounted
|
||||
{
|
||||
SDepthSurface() : Surface(0) {}
|
||||
SDepthSurface() : Surface(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("SDepthSurface");
|
||||
#endif
|
||||
}
|
||||
virtual ~SDepthSurface()
|
||||
{
|
||||
if (Surface)
|
||||
|
|
|
@ -278,7 +278,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
|||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
|
|
|
@ -297,7 +297,7 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(const SIrrlichtCreationParameters& params)
|
|||
// Register Class
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wc.lpfnWndProc = WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
|
|
|
@ -555,6 +555,10 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
// create matrix for flipping textures
|
||||
TextureFlipMatrix.buildTextureTransform(0.0f, core::vector2df(0,0), core::vector2df(0,1.0f), core::vector2df(1.0f,-1.0f));
|
||||
|
||||
// We need to reset once more at the beginning of the first rendering.
|
||||
// This fixes problems with intermediate changes to the material during texture load.
|
||||
ResetRenderStates = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2707,20 +2711,23 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glColor4ub(leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha());
|
||||
glVertex3f(-1.1f,-1.1f,0.9f);
|
||||
glVertex3f(-1.f,-1.f,-0.9f);
|
||||
|
||||
glColor4ub(leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha());
|
||||
glVertex3f(-1.1f, 1.1f,0.9f);
|
||||
glVertex3f(-1.f, 1.f,-0.9f);
|
||||
|
||||
glColor4ub(rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha());
|
||||
glVertex3f(1.1f, 1.1f,0.9f);
|
||||
glVertex3f(1.f, 1.f,-0.9f);
|
||||
|
||||
glColor4ub(rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha());
|
||||
glVertex3f(1.1f,-1.1f,0.9f);
|
||||
glVertex3f(1.f,-1.f,-0.9f);
|
||||
|
||||
glEnd();
|
||||
|
||||
|
@ -2728,6 +2735,8 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef
|
|||
|
||||
// restore settings
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue