Is Irrlicht can cut overlapped objects?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Chmel_Tolstiy
Posts: 41
Joined: Mon Feb 11, 2008 3:06 pm

Post by Chmel_Tolstiy »

May be anyone can say me how save zbuffer to file for watching it later. Thank you.
Chmel_Tolstiy
Posts: 41
Joined: Mon Feb 11, 2008 3:06 pm

Post by Chmel_Tolstiy »

I found some interesting thing:
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;
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.
Chmel_Tolstiy
Posts: 41
Joined: Mon Feb 11, 2008 3:06 pm

Post by Chmel_Tolstiy »

Chmel_Tolstiy wrote:I found some interesting thing:
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;
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.
this problem is solved.

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.
Post Reply