Parametric Manual Meshes for GUI

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
chilly willy
Halfling
Posts: 65
Joined: Tue Jun 02, 2020 4:11 am
x 19

Parametric Manual Meshes for GUI

Post by chilly willy »

I am making a game where the player can control multiple units of different sizes. I want little GUI rings around the feet of each unit that change colors to indicate things. I implemented this using MeshManager::createManual and programmatically creating ring meshes of different sizes. I gave the materials some self-illumination and gave them some depth-bias so that they can be located at the units' feet and still appear above the flat ground. It works and looks good. My first question is, is this a good approach or is there a better way to do simple GUI?

To work with the Ogre resource management, I thought I should make a ManualResourceLoader for these rings so they could be reloaded if necessary. To create rings of different sizes I thought I could pass the radius and thickness in the createParams argument of MeshManager::create() and then the ManualResourceLoader::loadResource() would retrieve them using Resource::getParameter(). However the parameters did not arrive and after a little digging it looks like only some subclasses of StringInterface create a ParamDictionary and Meshes do not. Am I misunderstanding the purpose of createParams? How can I pass info into the resource loader other than encoding it in the resource name?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2108
Joined: Sun Mar 30, 2014 2:51 pm
x 1134

Re: Parametric Manual Meshes for GUI

Post by paroj »

StringInterface is not supposed to be used for arbitrary user data. Ogre provides UserObjectBindings for that - however Mesh currently lacks them.

see this how to work around that: https://github.com/OGRECave/ogre/blob/e ... r.cpp#L190

However, note that each mesh results in one draw-call which slows rendering down. A BillboardSet might be a better alternative as it is only one draw-call for the whole set. See e.g. https://github.com/OGRECave/ogre/blob/b ... ter.h#L232 where one is used for the rain-splashes effect.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2108
Joined: Sun Mar 30, 2014 2:51 pm
x 1134

Re: Parametric Manual Meshes for GUI

Post by paroj »

scheduled this feature for 13.4, as it will also simplify Ogre internal code:
https://github.com/OGRECave/ogre/pull/2421