More elements for ManualObjects.
Posted: Wed Nov 27, 2013 6:58 am
[Edit: I mention ManualObjects not supporting tangents in this first post. That's wrong, they do support tangent, so ignore that. Just focus on the specular part.]
This is in 1.8.1, so I don't know if it's still relevant to 1.9.
I construct my map from manual objects and then convert to mesh later, it's just much easier than constructing a mesh from scratch. I decided to do some memory optimizing for my map, converting the normal and tangent to diffuse and specular colours, so that they'd each take only 4 bytes instead of 12 bytes.
Problem was, ManualObjects will only take a diffuse colour, not a specular one. At least, as far as I can tell. It would have been a major pain to re-write my map construction function to build a mesh from scratch rather than use a manual object. So I went to the Ogre source and modified it. It was actually very simple to enable adding specular as well as diffuse colouring, I basically just copied what was already being done for diffuse. (It might now matter whether I add diffuse or spec first... since I always add diffuse first, it isn't a problem.) So far my addition seems to work fine, and the resulting meshes are indeed more compact.
Several times I've run into the hassle of manual objects not supporting enough elements. They seem to only support position, colour, normal and uv. From looking at the source code, and doing my own modification, it seems very easy to improve on this, and allow the user to add things like specular colour or tangents as well.
I think the current ManualObject type is overly sparse. I understand that it's supposed to be simple, but there's such a big jump between what you can do with meshes and what you can do with manual objects, and there needn't be. Creating manual objects is much simpler and more convenient that constructing a mesh, so it'd be very handy if you could add things like specular colour and maybe tangents as well.
It wouldn't really make ManualObjects any more complicated for new users, since they can simply ignore adding specular and tangent if they want.
So anyhow, a vote for adding specular and maybe tangent to the ManualObjects. It's a very easy fix and adds a lot to the usefulness of manual objects.
This is in 1.8.1, so I don't know if it's still relevant to 1.9.
I construct my map from manual objects and then convert to mesh later, it's just much easier than constructing a mesh from scratch. I decided to do some memory optimizing for my map, converting the normal and tangent to diffuse and specular colours, so that they'd each take only 4 bytes instead of 12 bytes.
Problem was, ManualObjects will only take a diffuse colour, not a specular one. At least, as far as I can tell. It would have been a major pain to re-write my map construction function to build a mesh from scratch rather than use a manual object. So I went to the Ogre source and modified it. It was actually very simple to enable adding specular as well as diffuse colouring, I basically just copied what was already being done for diffuse. (It might now matter whether I add diffuse or spec first... since I always add diffuse first, it isn't a problem.) So far my addition seems to work fine, and the resulting meshes are indeed more compact.
Several times I've run into the hassle of manual objects not supporting enough elements. They seem to only support position, colour, normal and uv. From looking at the source code, and doing my own modification, it seems very easy to improve on this, and allow the user to add things like specular colour or tangents as well.
I think the current ManualObject type is overly sparse. I understand that it's supposed to be simple, but there's such a big jump between what you can do with meshes and what you can do with manual objects, and there needn't be. Creating manual objects is much simpler and more convenient that constructing a mesh, so it'd be very handy if you could add things like specular colour and maybe tangents as well.
It wouldn't really make ManualObjects any more complicated for new users, since they can simply ignore adding specular and tangent if they want.
So anyhow, a vote for adding specular and maybe tangent to the ManualObjects. It's a very easy fix and adds a lot to the usefulness of manual objects.