Working the "view"

Published January 26, 2011
Advertisement
[BLURB]: Studying VBOs and trying to determine the best method for rendering.

[DEVELOPMENT: Archetype Engine]


Yes, to be perfectly honest, I've been a little lazy the last few nights. Not that I haven't done any work, but it's been light; reordering classes and files, mostly.
That said, some of the reason I've slowed is I'm trying to wrap my brain around a decent method for rendering geometry. Ok, it's a little more detailed than that, so, perhaps I'll break down the dilemma... I want to keep my "data" and my "renderer" separated, that's just good programing, but there are some points where it gets a little fuzzy on how to do that. For instance, 3D models. Obviously the model loader doesn't need to know anything about the renderer, but the data it loads (vertex, normal, color, tex, etc, etc) is, almost exclusively data used by the view. As for as the logic of the engine is concerned the geometry information doesn't exist. Yet, I know I want to setup a difference between the model data and an "instance" of the model, allowing, for example, two instances to share the same base model, but have two different animations running. When I think of this, it sounds like I should make the "base" model part of the "data" of my engine and the instances part of the "view", but, still, the base model would only be for the view's use, so should it also be part of the view?

This leads to other issues in which I'm trying to do a bit of homework and, as such, has slowed down my work. The slow down is for the better, I suppose. Nothing worse than diving right in then finding I'd need to completely rewrite the engine because I missed something. On the other hand, I hear it's better to just get something working, and worry about refining it later... I mean, tons of developers find they have to start over a few times. Ah well, I'll figure this out eventually.

If anyone has any suggestions I'm more than willing to hear them out! :D

Short post... no screen shots... ahh well.
0 likes 2 comments

Comments

Mike Bossy
The way I separate model/mesh data from the rest of the renderable objects is to treat that data as just another resource. Similar to something like a texture that could be shared between multiple models the original mesh data should be able to be shared between multiple instances. Your mesh data should be in some normalized object space that your objects then move into world space so there's no reason it can't be shared as a single data blob between multiple in-world instances. Outsourcing loading and formatting that data to something like a resource manager object also makes it easy to ensure that you'll only have one instance of the data loaded.
January 26, 2011 05:51 AM
ObsidianBlk
Hey Mike...
I was thinking along those lines, actually. Have the geometry stored in "resting" state and just point to the geometry with my instance object. For animated models, I just make a request to get a copy of the vertex data transformed for the animation frame I want and send that along to the renderer.

I'm actually off to do some more programing, so we'll see what I come up with :)
Thanks for the insight!
January 27, 2011 01:12 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement