Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 05:09:06 pm
Xith3D CommunityGeneral CategoryGeneral Discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)runtime update of geometry coordinates
Pages: [1]
Print
Author Topic: runtime update of geometry coordinates  (Read 418 times)
mikelizzi
Just dropped in

Offline Offline

Posts: 8


View Profile Email
« on: 10. April 2011, 07:30:39 pm »

Hi,
I’m in the midst of converting a program from Java3D to xith3d.  So far, so good.
I’m now converting my geometry updater.  Java3D says use the GeometryUpdater interface to change runtime geometry.
Xith3d doesn’t seem to have a GeometryUpdater interface.  So, I wrote this test code to see if I needed it.
   …
   Geometry geometry = box.getGeometry();
   float[] coordArray = new float[geometry.getVertexCount() * 3];
   geometry.getCoordinates( 0, coordArray );

   for ( int i = 0; i < coordArray.length; ++i )
   {
      coordArray[ i ] = 2.f * coordArray[ i ];
        }
   geometry.setCoordinates( 0, coordArray );
   geometry.calculateFaceNormals();
   box.setGeometry( geometry );
   app.setTexture( app.getTexture() );
        …

It seems to work.  Is this an acceptable way or will I get into trouble later?
« Last Edit: 11. April 2011, 12:09:28 am by Marvin Fröhlich » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 11. April 2011, 12:12:40 am »

You need to do this from within a ScheduledOperation. Otherwise it is not thread safe. The rest looks good.
Logged
mikelizzi
Just dropped in

Offline Offline

Posts: 8


View Profile Email
« Reply #2 on: 03. May 2011, 07:33:53 pm »

You need to do this from within a ScheduledOperation. Otherwise it is not thread safe. The rest looks good.

 Thanks.  Making Progress.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic