Geometric object center

View previous topic View next topic Go down

Geometric object center

Post  VictorTiamat on Fri Feb 06, 2009 4:41 am

I have a question. How can I calculate an object geometric center?
The object center is different to blender object center. As a solution I want to sum all specific coordinates and divide by their amount. so I get the geometric center, but I don't know how to get vertexes coordinates. All I can do its just see them in .sio2 file in object folder. So how can I get them using SIO2 engine?

VictorTiamat

Posts : 6
Join date : 2009-02-06

View user profile

Back to top Go down

Re: Geometric object center

Post  sio2interactive on Fri Feb 06, 2009 6:11 am

Check sio2MapBuffer in the sio2ObjectDuplicate function...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Geometric object center

Post  VictorTiamat on Fri Feb 06, 2009 7:04 am

Thank you. I have been starting to study this engine and I can't understand many things. Would you mind providing me with small example how to get vertexes from object, please?

Thank you.

VictorTiamat

Posts : 6
Join date : 2009-02-06

View user profile

Back to top Go down

Re: Geometric object center

Post  sio2interactive on Fri Feb 06, 2009 5:00 pm

Code:


         SIO2object *tmp = sio2ResourceGetObject( sio2->_SIO2resource, "name of your object" );

         tmp->buf = ( unsigned char * )sio2MapBuffer( tmp->vbo, GL_ARRAY_BUFFER );

         unsigned int i = 0,
                n_vert = sio2ObjectGetNumVert( tmp );
            
         while( i != n_vert )
         {
            vec3 v;

            memcpy( &v, &tmp->buf[ i * 12 ], 12 );
            
            printf("%f %f %f\n", v.x, v.y, v.z);
         
            ++i;
         }

         tmp->buf = ( unsigned char * )sio2UnmapBuffer( GL_ARRAY_BUFFER );

avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Geometric object center

Post  VictorTiamat on Mon Feb 09, 2009 12:34 am

Thank you so much!!!!

VictorTiamat

Posts : 6
Join date : 2009-02-06

View user profile

Back to top Go down

Re: Geometric object center

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum