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

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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).
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

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

Post by ACE247 »

Good idea hendu, I too would like to see this added.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

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

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

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

Post by hybrid »

Ok, I think I understand the idea. Sounds simple and easy to integrate. Moving to open discussions for possible further discussion.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

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

Post by 3DModelerMan »

Yeah, that would be really nice. It would make deferred rendering a lot easier too.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

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

Post by Radikalizm »

3DModelerMan wrote:Yeah, that would be really nice. It would make deferred rendering a lot easier too.
And debugging for that matter
Erelas
Competition winner
Posts: 20
Joined: Mon Apr 18, 2011 8:40 am

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

Post 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!
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post by hendu »

Hybrid, are you going to do this or should I? If me, how would you like the interface?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

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

Post 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()
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

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

Post 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.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

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

Post 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);
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

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

Post 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.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

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

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