Sunday, October 07, 2007

Progress

After getting sucked up by school again, I've finally started dedicating myself to writing personal code. I'm still reworking behind the scenes to find a very awesome framework. I'm almost at the point where I have an Entity editor where you can bring in arbitrary SceneObjects (not just necessarily Ogre specific classes) and attach them to the Entity. The Entity itself has no idea what is being attached to it and the other object has no idea it is being attached to an Entity. It simply knows that each object supports the appropriate commands to just have it work.

In the process, I've realized that I'm going to need a generic "instance provider" for each type. That is, I need a way, given a particular type, to ask somehow about the names of all of the objects that exist of that type. I also need a way to say "create a sample preview in this scene of that particular type" without knowing what it is exactly I'm constructing. What this means is that, for example, the Entity is constructed very differently than a particle system. I don't want the editor to know about these types so I would like a way for the entity editor to query for the names of entities and the names of particle systems. Then I need some "preview provider" to be able to say, "create an 'entity' with the name 'xx' attached to this parent." and "create a 'particle system' with the name 'xx' attached to this parent". I don't want those to be two different operations. If I get this, it would mean that any object in the future that provides these things will automatically get picked up by the entity editor as potential things to be attached to bones as well as being able to provide an automatic preview of the object itself. That's the ideal goal.

I've already got a decent amount of this working. I already have the list of 'types' that will provide me with the commands and properties I need to accomplish my goals at run-time so now I just need to be able to produce a list of instance names as well as provide an automatic preview for any given type and I'm all set. That's what I'm working on now.

In the following shot, you can see that I've added a wireframe overlay on to the selected objects. This is an automatic thing that happens now on any selected entity which is rather nice. I didn't create this effect, credit goes to someone in the forums (I can't remember where I saw it). It's done at run-time as follows:
  1. Create an additional pass on each material for the Entity
  2. Disable lighting on the new pass
  3. Set the polygon mode as PM_WIREFRAME
  4. Set a depth bias so that the wireframe doesn't z-fight with the actual object. (I'm using 10.0)
Works rather nicely.

You can also see that I have a sword in the lizard mans hands in the entity editor. That was actually created, placed, rotated, and positioned correctly using nothing but the editor. Each viewport can have their own gizmos which is nice. This came for free from the 'scene' concept. Each scene has its own set of gizmos. There is always the default world scene but anything is able to create additional scenes. The ResourceBrowser creates an additional scene for its preview window and the EntityEditor creates its own.

Each scene has the following unique instances:
  • Ogre::SceneManager
  • Selection Manager
  • Gizmo Manager
  • Sceneobject Manager
Anyways. I'm back to implementing this 'generic browser'. It'll eventually be used for everything that creates an object so you can hit 'New Object' and each editor piece will be able to control what shows up in window.


No comments: