FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Geometric object center

2 posters

Go down

Geometric object center Empty Geometric object center

Post  VictorTiamat 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

Back to top Go down

Geometric object center Empty Re: Geometric object center

Post  sio2interactive Fri Feb 06, 2009 6:11 am

Check sio2MapBuffer in the sio2ObjectDuplicate function...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Geometric object center Empty Re: Geometric object center

Post  VictorTiamat 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

Back to top Go down

Geometric object center Empty Re: Geometric object center

Post  sio2interactive 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 );

sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Geometric object center Empty Re: Geometric object center

Post  VictorTiamat Mon Feb 09, 2009 12:34 am

Thank you so much!!!!

VictorTiamat

Posts : 6
Join date : 2009-02-06

Back to top Go down

Geometric object center Empty Re: Geometric object center

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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