Where is the draw method for the solid pass?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
GueZt_Coders
Posts: 44
Joined: Tue Jan 17, 2006 4:04 am

Where is the draw method for the solid pass?

Post by GueZt_Coders »

Im a little bit lost, why is that the driver->drawMeshBuffer(mb);
takes place only in transparent pass, My inquiry is Where is the
draw method for the solid pass. since whether it is solid or
transparent pass both pass call the render of a scenenode.

Tnx.
Just part of irrlicht related project| CLEAR CODE NOTATIONS IS LARGELY SELF CODUMENTING!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

There is a method that you can call on the scene manager to find out what pass is currently being rendered. See ISceneManager::getSceneNodeRenderPass().

Of course your scene node render method will only be called once for each render pass that it is registered. If you only register for rendering with the transparent pass, your scene node will only be rendered in the transparent pass. If you want to render as part of the solid pass and the transparent pass, you must call registerNodeForRendering() twice, once for each pass that you wish to register with.

Travis
GueZt_Coders
Posts: 44
Joined: Tue Jan 17, 2006 4:04 am

Post by GueZt_Coders »

Tnx vitek,

:D But "Where is the driver drawing method for the solid pass"

Code: Select all


//| THIS IS THE THE DRIVER DRAWING METHOD FOR 
//| TRANSPARENT PASS e.g for Animatedmesh
//|
//| WHERE IS THE DRIVER DRAWING METHOD FOR SOLID PASS ? 
//|
if( transparent == isTransparentPass ) 
{
     scene::IMeshBuffer* mb = m->getMeshBuffer(i);
     driver->setMaterial(Materials[i]);
     driver->drawMeshBuffer(mb);  
}

Just part of irrlicht related project| CLEAR CODE NOTATIONS IS LARGELY SELF CODUMENTING!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think about a year ago someone else did not understand this code fragment, too. Just read what the values for the participating variables can be and write the possible combinations to a piece of paper. You'll see it works for both passes.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Yeah. You left out the most important lines in that function...

Code: Select all

	bool isTransparentPass = 
		SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;

	for (s32 i=0; i<Mesh->getMeshBufferCount(); ++i)
	{
		video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType);
		bool transparent = (rnd && rnd->isTransparent());

		// only render transparent buffer if this is the transparent render pass
		// and solid only in solid pass
		if (transparent == isTransparentPass) 
		{
			scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
			driver->setMaterial(Materials[i]);
			driver->drawMeshBuffer(mb);
		}
	}
If the material renderer for that material type matches the pass type then it will be rendered. i.e. if this is the solid render pass and the material is a solid material type, or this is the transparent render pass and the material is a transparent type the buffer is rendered.
GueZt_Coders
Posts: 44
Joined: Tue Jan 17, 2006 4:04 am

Post by GueZt_Coders »

I get it! from a piece of paper, lols .T.=.T. and .F.=.F. :lol:
it used by both passes. hehe for 5 yrs in xbase programming
this c++ fragments of codes gaves me a boolean mind bugs
it is always arise specially when your analizing the codes of other.

Thanks from both ov u guys, hybrid & vitek.
Just part of irrlicht related project| CLEAR CODE NOTATIONS IS LARGELY SELF CODUMENTING!
Post Reply