Is Irrlicht can cut overlapped objects?
-
- Posts: 41
- Joined: Mon Feb 11, 2008 3:06 pm
-
- Posts: 41
- Joined: Mon Feb 11, 2008 3:06 pm
I found some interesting thing:
when I use such code
with #if (FALSE) it works correctly, but with
#if (TRUE) does not. I think it's very strange.
P.S. It's part of function void CD3D9Driver::runQuery( scene::ISceneNode* vNode ).
q[qn]->getBoundingMesh() - it's handmade mesh like in CubeSceneNode.
when I use such code
Code: Select all
pID3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
setTransform(video::ETS_WORLD, ident);
q[qn]->Query->Issue(D3DISSUE_BEGIN);
SMaterial matetial;
matetial.BackfaceCulling = true;
setMaterial(matetial);
#if (FALSE)
drawMeshBuffer(q[qn]->getBoundingMesh());
#else
if (true) {
core::triangle3df tri;
for (int i = 0; i < q[qn]->getBoundingMesh()->getIndexCount(); i += 3) {
int i0 = q[qn]->getBoundingMesh()->getIndices()[i+0];
int i1 = q[qn]->getBoundingMesh()->getIndices()[i+1];
int i2 = q[qn]->getBoundingMesh()->getIndices()[i+2];
void* p1 = q[qn]->getBoundingMesh()->getVertices();
tri.pointA = ((video::S3DVertex*)p1 + i0)->Pos;
tri.pointB = ((video::S3DVertex*)p1 + i1)->Pos;
tri.pointC = ((video::S3DVertex*)p1 + i2)->Pos;
setTransform(video::ETS_WORLD, core::matrix4());
draw3DTriangle(tri);
}
}
#endif
q[qn]->Query->Issue(D3DISSUE_END);
HRESULT res;
while( (res = q[qn]->Query->GetData( (void*)&q[qn]->QueryResult, sizeof(DWORD), D3DGETDATA_FLUSH)) == S_FALSE )
{
}
int qr = q[qn]->QueryResult;
#if (TRUE) does not. I think it's very strange.
P.S. It's part of function void CD3D9Driver::runQuery( scene::ISceneNode* vNode ).
q[qn]->getBoundingMesh() - it's handmade mesh like in CubeSceneNode.
-
- Posts: 41
- Joined: Mon Feb 11, 2008 3:06 pm
this problem is solved.Chmel_Tolstiy wrote:I found some interesting thing:
when I use such codewith #if (FALSE) it works correctly, but withCode: Select all
pID3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); setTransform(video::ETS_WORLD, ident); q[qn]->Query->Issue(D3DISSUE_BEGIN); SMaterial matetial; matetial.BackfaceCulling = true; setMaterial(matetial); #if (FALSE) drawMeshBuffer(q[qn]->getBoundingMesh()); #else if (true) { core::triangle3df tri; for (int i = 0; i < q[qn]->getBoundingMesh()->getIndexCount(); i += 3) { int i0 = q[qn]->getBoundingMesh()->getIndices()[i+0]; int i1 = q[qn]->getBoundingMesh()->getIndices()[i+1]; int i2 = q[qn]->getBoundingMesh()->getIndices()[i+2]; void* p1 = q[qn]->getBoundingMesh()->getVertices(); tri.pointA = ((video::S3DVertex*)p1 + i0)->Pos; tri.pointB = ((video::S3DVertex*)p1 + i1)->Pos; tri.pointC = ((video::S3DVertex*)p1 + i2)->Pos; setTransform(video::ETS_WORLD, core::matrix4()); draw3DTriangle(tri); } } #endif q[qn]->Query->Issue(D3DISSUE_END); HRESULT res; while( (res = q[qn]->Query->GetData( (void*)&q[qn]->QueryResult, sizeof(DWORD), D3DGETDATA_FLUSH)) == S_FALSE ) { } int qr = q[qn]->QueryResult;
#if (TRUE) does not. I think it's very strange.
P.S. It's part of function void CD3D9Driver::runQuery( scene::ISceneNode* vNode ).
q[qn]->getBoundingMesh() - it's handmade mesh like in CubeSceneNode.
But now I can't find way how to render only to z-buffer (but not render to screen). If it's possible. Be cause now my problem, that rewriting pixels on screen is too slow (tested with PerfHud). Can anyone say me is it possible to render only to z-buffer?
Thanks.