Geometric object center
2 posters
Geometric object center
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?
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
Re: Geometric object center
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.
Thank you.
VictorTiamat- Posts : 6
Join date : 2009-02-06
Re: Geometric object center
- 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 );
Similar topics
» Add/remove object
» physics object inside another physics object
» Physic object
» how can move other object near
» Duplicate an object programmatically
» physics object inside another physics object
» Physic object
» how can move other object near
» Duplicate an object programmatically
Permissions in this forum:
You cannot reply to topics in this forum
|
|