Page 1 of 1

RenderRequests refactoring

PostPosted: 22 Jun 2012, 13:59
by paul424
I am at the beggining of RR refactoring. The idea is to make each RR as a separate class and put it into source/RenderRequests each one as separate *.cpp file. The RR::type would disapear, cause the RR "type " would depend on called ctor. That would make 38 new classes. Also I would rewrite the ctors , not to take the pointers , but a concrete values , either int , char or string etc. as needed. I would have been already doing that , but at OD's one must consult the council of Elders first :cool:

Re: RenderRequests refactoring

PostPosted: 22 Jun 2012, 14:23
by oln
I fully agree that this needs to be split up in classes. If they are small it might be easier to put them in one file (atleast make a separate folder). Maybe we could use functor objects (EDIT: That probably won't work). I think most of the destroy/create functions in there could be merged.

Though, maybe we should rethink the whole model instead.

Re: RenderRequests refactoring

PostPosted: 23 Jun 2012, 13:15
by oln
I think we should at least move the creation of "render request" into one class, so when a creature is moved we just do something like:
{l Code}: {l Select All Code}
renderer.moveCreature(nodeName, newPos)

And then that function will actually create the request object and put it on the queue to be run in the main thread.

Re: RenderRequests refactoring

PostPosted: 24 Jun 2012, 14:33
by paul424
Well actually that just put yet another function layer , making it like rendermanager.move -> new RenderRequest , queue.push_back(rr) , dispatcher_method in RenderManager I don't remember -> the actuall render method...
Doesn't that make it too long ?
Why we cannot we just call new RenderRequestOfDesiredType ?

Re: RenderRequests refactoring

PostPosted: 24 Jun 2012, 15:11
by oln
To keep request creation out of the classes that call the function.