Page 1 of 5

Request: manage which passes are drawn by smgr->drawall

Posted: Sun Jan 08, 2012 10:52 am
by hendu
A similar variable like the OverrideMaterial.EnableFlags could be added to the scene manager, to manage which passes are drawn.

The structure for it is already there, the scene manager sections are already separated and listed in an enum.

Unlike OverrideMaterial's, it should default to "all on".


This would be useful for example to only draw the solid objects for some pass (shadows, etc).

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Sun Jan 08, 2012 6:44 pm
by ACE247
Good idea hendu, I too would like to see this added.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Sun Jan 08, 2012 7:11 pm
by Radikalizm
Agreed, I have a similar way of enabling/disabling render passes in my engine and it's really helpful in a lot of situations

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Sun Jan 08, 2012 9:22 pm
by hybrid
Ok, I think I understand the idea. Sounds simple and easy to integrate. Moving to open discussions for possible further discussion.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 1:39 am
by 3DModelerMan
Yeah, that would be really nice. It would make deferred rendering a lot easier too.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 9:52 am
by Radikalizm
3DModelerMan wrote:Yeah, that would be really nice. It would make deferred rendering a lot easier too.
And debugging for that matter

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 2:32 pm
by Erelas
I second this. For us it would be a great addition to improve our code for imposter rendering and the rendering of reflecting surfaces.
And I can imagine multiple other uses for this. Good idea Hendu!

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 2:58 pm
by hendu
Hybrid, are you going to do this or should I? If me, how would you like the interface?

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 8:55 pm
by hybrid
Easy way would be an enum and a method, together with an internal variable in the scene manager. I think this is enough here, as the scene manager has other problems with add methods, but not with those control API. Name should probably be enableRenderStates()

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Mon Jan 09, 2012 10:09 pm
by 3DModelerMan
It should probably be: disableRenderPass(E_SCENE_NODE_RENDER_PASS pass) and that way you would call it before smgr->drawAll(); instead of disabling it once and having all smgr->drawAll calls ignore those render passes.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Tue Jan 10, 2012 10:26 am
by hendu
Heh, and what I had in mind was a public u32 just as in OverrideMaterial ;) Perhaps we need to discuss the interface more, with so different ideas?

With a function that takes a single enum you would need several function calls if you wanted to toggle more than one state.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Tue Jan 10, 2012 1:14 pm
by greenya
Please don't use unnamed u32 type, define an enumeration.

Personally i would suggest define enum E_RENDER_STATE (use values 0x1, 0x2, 0x4, 0x8, 0x10, and so on) and the mehods:

Code: Select all

private: 
E_RENDER_STATE currentRenderState = ERS_flag1 | ERS_flag2 ... ; // some default render state combination OR simply 0xFFFFFFFF (which means "all turned on")
 
public:
inline void setRenderStates(E_RENDER_STATE flags) { currentRenderState = flags; }
inline E_RENDER_STATE getRenderStates() { return currentRenderState; }
inline void enableRenderState(E_RENDER_STATE flag) { currentRenderState |= flag; }
inline void disableRenderState(E_RENDER_STATE flag) { currentRenderState &= 0xFFFFFFF ^ flag; }
Also ISceneManager::drawAll() still doesn't have any arguments, so we can add it like:

Code: Select all

void drawAll(E_RENDER_STATE flags = 0xFFFFFFFF);

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Tue Jan 10, 2012 2:03 pm
by ACE247
Adding arguments to drawAll is probably one of the best options.
That way we can either just call drawAll to render all passes, or easily disable render passes.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Tue Jan 10, 2012 2:53 pm
by hendu
@greenya

The enum is already defined for use in OverrideMaterial?

While having it wrapped with a set function would remove the objection of many function calls, it's ugly having to cast it then for every setRenderStates call.

Re: Request: manage which passes are drawn by smgr->drawall

Posted: Tue Jan 10, 2012 3:21 pm
by greenya
@hendu

Yes, i see E_SCENE_NODE_RENDER_PASS http://irrlicht.sourceforge.net/docu/na ... bb8200d67f
Maybe simply adding an overloadig to "ISceneManager::drawAll(E_SCENE_NODE_RENDER_PASS pass = (u32)-1)" will fulfill all needs.