Original Post
Hey guys Ive been working on a render state system for my project for a few days now, but im just not happy with the design. So, for a few hours I have been rethinking things and came up with a few alternatives, but Im curious to see how you guys approach this. Basically, right now what I have is a simple renderstate class which has a list of which states are enabled and thier properties. For example: mBlendingEnable... mBlendSrcFunc, mBlendDstFunc... When you want to change how something is rendered, you would simply create a new RenderState instance, set the values accordingly and set it as the current rendering state to use. Now, I had originally had a few renderstate management functions in my rendersystem class, such as push/pop state, getcurrent etc. However, I wasn't considering state changes and so, im thinking im going to need to create a much more complex system to incorporate state sorting and such. However, what would be cool about this method is that, I could have a "RenderState modifier" class which would simply define it's own renderstate instance and then set the linked object's current renderstate with the modified. Alrighty, well, im rambling on so i'll get to the point.. How do you guys approach state swapping and sorting? I figure that I could always overload the == operator to check if which states are the same and then group all of the entities together like that, but... idk. Hmmmm.