RenderState(s) reuse...

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

RenderState(s) reuse...

ThomasR
Hi,

Can the same instance of the various RenderStates be used across multiple Node in the scene? Some
cursory reading of the code looks like RenderStates might automatically be cached for reuse. Am I reading this right.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

gouessej
Administrator
Hi

Which render states would you like to reuse?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

ThomasR
Sorry somehow I missed your reply:

In situations with large number of independent Spatials which may have the same RenderState, but it's not possible
to assign them in advance to a parent with that common State. We had to have our mechanism for caching Java3D Appearances due to performance/memory issues in this situation.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

gouessej
Administrator
Ok but which kind of render states would you like to share?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

ThomasR
I guess one might be MaterialState, does that make any sense?
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

ThomasR
hi,

unless you have any other thoughts, we can probably just repurpose what we already have for caching.
Reply | Threaded
Open this post in threaded view
|

Re: RenderState(s) reuse...

gouessej
Administrator
I would use the design pattern "flyweight" by creating custom material states storing common information into a single object. That way, each spatial would use a separate render state but the heavy data would be in a single place.
Julien Gouesse | Personal blog | Website