Last night Dirk commited the first in a series of changes I have proposed to him in the TXFFace interface. The change he commited adds an offset parameter to the geo building interfaces. I found that I commonly wanted to offset the text layout a little bit to position it relative to other graphics I had already drawn. This parameter makes that very simple and easy to do. It also leads into the next proposed changed I have....

I found that I really wanted the ability to add text to a geometry node multiple times. As an example, this would allow me to position some layed out text in the upper left of a virtual UI and then to position some additional text in the lower right without having to create a new geometry core and nodes and groups, etc. I just wanted more text with the same font.

While adding support for this, I also began thinking that it would be nice if I could specify the color of the text to be added. Since the code just uses a modulating texture environment it is possible to support this pretty easily using vertex colors on the glyph quads.

Anyway, I extended/refined the TextTXFFace interface with the following methods: (note: the params are pretty self explanitory so I left those comments out of this mail.)

   /** Fills a geometry with a new text. */
void fillGeo(GeometryPtr &geoPtr, const TextLayoutResult &layoutResult, Real32 scale = 1.f,
                Vec2f offset = Vec2f(0,0), Color3f color = Color3f(1,1,1));

   /** Adds geometry for new text to an existing text geometry. */
void addToGeom(GeometryPtr &geoPtr, const TextLayoutResult &layoutResult, Real32 scale = 1.f, Vec2f offset = Vec2f(0,0), Color3f color = Color3f(1,1,1));

   /** Creates a new text geometry.  */
GeometryPtr makeGeo(const TextLayoutResult &layoutResult, Real32 scale = 1.f, Vec2f offset = Vec2f(0,0), Color3f color = Color3f(1,1,1));

   /** Creates a new node with a text geometry.  */
NodePtr makeNode(const TextLayoutResult &layoutResult, Real32 scale = 1.f, Vec2f offset = Vec2f(0,0), Color3f color = Color3f(1,1,1));

The key changes were to:

- Refactor the geometry data format used to not use any indexing. Dirk tells me that multi-indexing can perform poorly and it just makes it easier to implement... - Added a method (addToGeom) that allows text to be added to an existing text geometry node
- Added color data to the geometry to allow for colored text

I updated the text param test program to use these additons. You can see a screen shot of the application below. Please note that all the text shown is contained in one single geometry core.

http://www.vrsource.org/~allenb/OpenSG_TextStuff.png

So, what do people think of this proposed change. If it sounds good, I can pass the patch on to Dirk later today to commit.

-Allen



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to