mirror of https://github.com/aap/librw.git
some fixing; may have to revisit matfx again in the future...
This commit is contained in:
parent
e9e2488834
commit
baa8666a03
|
@ -79,9 +79,10 @@ uploadEnvMatrix(Frame *frame)
|
||||||
frame = engine->currentCamera->getFrame();
|
frame = engine->currentCamera->getFrame();
|
||||||
|
|
||||||
// cache the matrix across multiple meshes
|
// cache the matrix across multiple meshes
|
||||||
if(frame == lastEnvFrame)
|
// can't do it, frame matrix may change
|
||||||
return;
|
// if(frame == lastEnvFrame)
|
||||||
lastEnvFrame = frame;
|
// return;
|
||||||
|
// lastEnvFrame = frame;
|
||||||
|
|
||||||
RawMatrix envMtx, invMtx;
|
RawMatrix envMtx, invMtx;
|
||||||
Matrix::invert(&invMat, frame->getLTM());
|
Matrix::invert(&invMat, frame->getLTM());
|
||||||
|
|
|
@ -97,6 +97,7 @@ struct RwStateCache {
|
||||||
static RwStateCache rwStateCache;
|
static RwStateCache rwStateCache;
|
||||||
|
|
||||||
void *constantVertexStream;
|
void *constantVertexStream;
|
||||||
|
static IDirect3DTexture9 *whiteTex;
|
||||||
|
|
||||||
D3dShaderState d3dShaderState;
|
D3dShaderState d3dShaderState;
|
||||||
|
|
||||||
|
@ -457,7 +458,7 @@ setRasterStage(uint32 stage, Raster *raster)
|
||||||
d3ddevice->SetTexture(stage, (IDirect3DTexture9*)d3draster->texture);
|
d3ddevice->SetTexture(stage, (IDirect3DTexture9*)d3draster->texture);
|
||||||
alpha = d3draster->hasAlpha;
|
alpha = d3draster->hasAlpha;
|
||||||
}else{
|
}else{
|
||||||
d3ddevice->SetTexture(stage, nil);
|
d3ddevice->SetTexture(stage, whiteTex);
|
||||||
alpha = 0;
|
alpha = 0;
|
||||||
}
|
}
|
||||||
if(stage == 0){
|
if(stage == 0){
|
||||||
|
@ -1830,6 +1831,17 @@ initD3D(void)
|
||||||
setAddressV(t, Texture::WRAP);
|
setAddressV(t, Texture::WRAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDirect3DSurface9 *surf;
|
||||||
|
D3DLOCKED_RECT lr;
|
||||||
|
uint8 whitepixel[4] = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
|
whiteTex = (IDirect3DTexture9*)createTexture(1, 1, 1, 0, D3DFMT_X8R8G8B8);
|
||||||
|
whiteTex->GetSurfaceLevel(0, &surf);
|
||||||
|
HRESULT res = surf->LockRect(&lr, 0, D3DLOCK_NOSYSLOCK);
|
||||||
|
assert(res == D3D_OK);
|
||||||
|
memcpy(lr.pBits, whitepixel, 4);
|
||||||
|
surf->UnlockRect();
|
||||||
|
surf->Release();
|
||||||
|
|
||||||
openIm2D();
|
openIm2D();
|
||||||
openIm3D();
|
openIm3D();
|
||||||
|
|
||||||
|
@ -1842,6 +1854,9 @@ termD3D(void)
|
||||||
destroyVertexBuffer(constantVertexStream);
|
destroyVertexBuffer(constantVertexStream);
|
||||||
constantVertexStream = nil;
|
constantVertexStream = nil;
|
||||||
|
|
||||||
|
destroyTexture(whiteTex);
|
||||||
|
whiteTex = nil;
|
||||||
|
|
||||||
closeIm3D();
|
closeIm3D();
|
||||||
closeIm2D();
|
closeIm2D();
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,10 @@ uploadEnvMatrix(Frame *frame)
|
||||||
|
|
||||||
// cache the matrix across multiple meshes
|
// cache the matrix across multiple meshes
|
||||||
static RawMatrix envMtx;
|
static RawMatrix envMtx;
|
||||||
if(frame != lastEnvFrame){
|
// can't do it, frame matrix may change
|
||||||
lastEnvFrame = frame;
|
// if(frame != lastEnvFrame){
|
||||||
|
// lastEnvFrame = frame;
|
||||||
|
{
|
||||||
|
|
||||||
RawMatrix invMtx;
|
RawMatrix invMtx;
|
||||||
Matrix::invert(&invMat, frame->getLTM());
|
Matrix::invert(&invMat, frame->getLTM());
|
||||||
|
|
|
@ -748,7 +748,7 @@ struct Camera
|
||||||
Raster *frameBuffer;
|
Raster *frameBuffer;
|
||||||
Raster *zBuffer;
|
Raster *zBuffer;
|
||||||
|
|
||||||
// Device dependant view and projection matrices
|
// Device dependent view and projection matrices
|
||||||
// optional
|
// optional
|
||||||
RawMatrix devView;
|
RawMatrix devView;
|
||||||
RawMatrix devProj;
|
RawMatrix devProj;
|
||||||
|
|
Loading…
Reference in New Issue