At 8:10 AM -0800 3/29/06, Lo Saeteurn wrote:
It was initially designed to use the built-in trimesh classes, but I
ran into the problem of not being able to add a trimesh into an
object3D. The advantage of using an object3d as opposed to a trimesh
is the ability to clone. Cloning is useful because I can reuse the
same character multiple times without rebuilding it--this is
important to dynamically change text with speed.
Hmm... that's an interesting point. You can duplicate a TriMesh and
share the texture data, which is the vast majority of it (I assume
each character is just 4 vertices and 2 triangles, right?), but you
can't share the vertex and triangle data itself.
Thinking out loud here... So each character is a separate object?
Even when they're clones, I would think that this might bog the
system down a bit if you have lots of characters on screen. I wonder
if it'd be better to have a single Trimesh for each "block" of text
(where a block could be the whole screen, or could be just a
rectangular area on one portion of the screen), and then have 4
vertices + 2 triangles for each character to display. Attached to
this TriMesh would be a single texture containing all the character
images. To change the text, you'd simply change the UV coordiantes
of the corresponding 4 vertices.
The advantage of this approach, in terms of speed, is that there's
only one object. Yes, it'd have a lot of triangnles, but no more
than the separate-objects approach. And Rb3D tends to be much more
efficient when handling a single object with lots of triangles, than
when handling many objects. It also means that you can change the
text pretty much instantly; no need to clone anything or move any
objects around.
The disadvantage, I suppose, is that reorganizing your Trimesh every
time to optimize it for the number (and position) of characters
actually displayed would be a PITA to code. But you might just keep
all the triangles for every character present all the time (I'm
assuming a monospaced display, like a Terminal window), and just flip
the unused spaces around or point them at a transparent part of the
texture or some such.
Best,
- Joe
--
Joseph J. Strout
joe at strout dot net
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|