[DEV] add convex hull parsing

This commit is contained in:
Edouard DUPIN 2013-08-18 20:51:17 +02:00
parent e95323e974
commit d4dfe30d23
5 changed files with 25 additions and 13 deletions

View File

@ -109,7 +109,7 @@ class ImportEMF(bpy.types.Operator, ImportHelper):
('-Y', "-Y Forward", ""),
('-Z', "-Z Forward", ""),
),
default='-Z',
default='-X',
)
axis_up = EnumProperty(
@ -121,7 +121,7 @@ class ImportEMF(bpy.types.Operator, ImportHelper):
('-Y', "-Y Up", ""),
('-Z', "-Z Up", ""),
),
default='Y',
default='Z',
)
def execute(self, context):

View File

@ -64,7 +64,7 @@ def out_quaternion_z_up( q ):
return "%g %g %g %g" % ( q.w, q.x, q.y, q.z )
def getPhysicsShape(obj, mainObjScale, use_y_up=True):
def getPhysicsShape(obj, mainObjScale, use_y_up=False):
shape = ""
props = { }
name = obj.name.lower()

2
external/ege vendored

@ -1 +1 @@
Subproject commit eefbe48546e8f0b6f35de975d66e921b041d4dc7
Subproject commit 327367b1a73be036a447c1f0b5e43f3af43ca0c2

View File

@ -16,11 +16,28 @@ bool ewol::PhysicsConvexHull::Parse(const char* _line)
return true;
}
if(0==strncmp(_line, "points : ", 8) ) {
EWOL_TODO("convex hull point parsing ...");
//EWOL_DEBUG("convex hull point parsing " << _line);
char* base = (char*)(&_line[8]);
char* tmp= strchr(base, '|');
vec3 pos(0,0,0);
while (tmp != NULL) {
*tmp = '\0';
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos);
base = tmp+1;
tmp= strchr(base, '|');
}
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos);
/*
for (int32_t iii=0; iii<m_points.Size(); iii++) {
EWOL_DEBUG(" parsed " << m_points[iii]);
}
*/
return true;
}
if(0==strncmp(_line, "scale : ", 8) ) {
sscanf(&_line[8], "%f", &m_scale );
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EWOL_DEBUG(" scale=" << m_scale);
return true;
}

View File

@ -32,13 +32,8 @@ namespace ewol
vec3 GetScale(void) const { return m_scale; };
private:
etk::Vector<vec3> m_points;
/*
mesh = obj.to_mesh( bpy.context.scene, True, 'PREVIEW' )
props["points"] = ""
for v in mesh.vertices:
props["points"] += "" + out_point3( v.co ) + "|"
props["points"] = props["points"].rstrip("|")
*/
public:
const etk::Vector<vec3>& GetPointList(void) const { return m_points; };
public:
virtual const PhysicsConvexHull* ToConvexHull(void) const { return this; };
virtual PhysicsConvexHull* ToConvexHull(void) { return this; };