realbasic-games
[Top] [All Lists]

Re: Cloning Trimesh

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Cloning Trimesh
From: Joseph Nastasi <joe at pyramiddesign dot us>
Date: Tue, 8 Nov 2005 14:23:10 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <14e78666b84e09bd1739f7ef5e4a01b6 at pyramiddesign dot us> <a0620070bbf967cab0ba4 at [10 dot 0 dot 1 dot 4]> <ba36e5adaa59b4786c9fd43570d48b38 at pyramiddesign dot us> <a06200715bf96a5d4b160 at [10 dot 0 dot 1 dot 4]>

On Nov 8, 2005, at 2:03 PM, Joseph J. Strout wrote:
Probably all that time is going into this line:

  clone.Material.Texture = original.Material.Texture

...which converts the internal texture into a Picture (on the right-hand side), and then converts a Picture into an internal texture (on the left-hand side). These are very expensive operations.

But I think you should be able to share the texture, like so:

  clone.Material = original.Material

which means you don't have a fully separate clone; a change to the material in one place would affect it in the other. But it sounds like that is fine for your purposes, and would be much faster.

That's okay. The texture is the same, just the UVs change for each clone. And it works and it IS faster loading for, now obvious, reasons.


Also... if you really do want to have the same object appearing multiple times in the scene, all with the same texture, then you'd be better off not using TriMesh at all, but using Object3D, which you could load once and then .Clone it (which really does share all the geometry data, unlike our trimesh cloning here). Is there some reason you can't do that -- the image not being available until runtime, perhaps?

It's to create an LCD display and there's no way of knowing the size or the texture to be used in advance. Also, this depends on using the UV to "select" a character from a strip of characters, so Object3D wouldn't work.

If so, we may be able to hack something out using Object3D.AddShapeHandle, given the Trimesh handle -- I don't have the code or docs handy at the moment, so I can't be sure this is supported, but it might be. Let me know where you are and we'll keep working on it.

No, that looks fine. It was the loading that was killing be and obviously I needed to share the image rather than reloading.

Thanks!
--
Joseph Nastasi
Pyramid Design - a software development firm
http://www.pyramiddesign.us
Voice 609 601-0814      Fax 609 601-0815
Products:
A-OK! Spacecraft Simulation System - http://aok.pyramiddesign.us
A-OK! The Wings of Mercury http://www.aokwom.com
FTP Suite for REALbasic - http://ftpsuite.pyramiddesign.us
Columnist for REALbasic Developer Magazine
Proud Sponsors of REALbasic Olympics 2005




_______________________________________________
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>

<Prev in Thread] Current Thread [Next in Thread>