diff --git a/blender/io_scene_emf/__init__.py b/blender/io_scene_emf/__init__.py index 85e74f74..47a549fd 100644 --- a/blender/io_scene_emf/__init__.py +++ b/blender/io_scene_emf/__init__.py @@ -46,60 +46,6 @@ class ImportEMF(bpy.types.Operator, ImportHelper): options={'HIDDEN'}, ) - use_ngons = BoolProperty( - name="NGons", - description="Import faces with more than 4 verts as ngons", - default=True, - ) - use_edges = BoolProperty( - name="Lines", - description="Import lines and faces with 2 verts as edge", - default=True, - ) - use_smooth_groups = BoolProperty( - name="Smooth Groups", - description="Surround smooth groups by sharp edges", - default=True, - ) - - use_split_objects = BoolProperty( - name="Object", - description="Import EMF Objects into Blender Objects", - default=True, - ) - use_split_groups = BoolProperty( - name="Group", - description="Import EMF Groups into Blender Objects", - default=True, - ) - - use_groups_as_vgroups = BoolProperty( - name="Poly Groups", - description="Import EMF groups as vertex groups", - default=False, - ) - - use_image_search = BoolProperty( - name="Image Search", - description="Search subdirs for any associated images " - "(Warning, may be slow)", - default=True, - ) - - split_mode = EnumProperty( - name="Split", - items=(('ON', "Split", "Split geometry, omits unused verts"), - ('OFF', "Keep Vert Order", "Keep vertex order from file"), - ), - ) - - global_clamp_size = FloatProperty( - name="Clamp Size", - description="Clamp bounds under this value (zero to disable)", - min=0.0, max=1000.0, - soft_min=0.0, soft_max=1000.0, - default=0.0, - ) axis_forward = EnumProperty( name="Forward", items=(('X', "X Forward", ""), @@ -128,12 +74,6 @@ class ImportEMF(bpy.types.Operator, ImportHelper): # print("Selected: " + context.active_object.name) from . import import_obj - if self.split_mode == 'OFF': - self.use_split_objects = False - self.use_split_groups = False - else: - self.use_groups_as_vgroups = False - keywords = self.as_keywords(ignore=("axis_forward", "axis_up", "filter_glob", @@ -152,18 +92,6 @@ class ImportEMF(bpy.types.Operator, ImportHelper): row = layout.row(align=True) - box = layout.box() - row = box.row() - row.prop(self, "split_mode", expand=True) - - row = box.row() - if self.split_mode == 'ON': - row.label(text="Split by:") - row.prop(self, "use_split_objects") - row.prop(self, "use_split_groups") - else: - row.prop(self, "use_groups_as_vgroups") - row = layout.split(percentage=0.67) row.prop(self, "global_clamp_size") layout.prop(self, "axis_forward") diff --git a/blender/io_scene_emf/export_emf.py b/blender/io_scene_emf/export_emf.py index a9b3bc7d..4e0907b7 100644 --- a/blender/io_scene_emf/export_emf.py +++ b/blender/io_scene_emf/export_emf.py @@ -161,7 +161,7 @@ def mesh_triangulate(me): import bmesh bm = bmesh.new() bm.from_mesh(me) - bmesh.ops.triangulate(bm, faces=bm.faces) + bmesh.ops.triangulate(bm, faces=bm.faces)#, use_beauty=False) bm.to_mesh(me) bm.free() @@ -364,9 +364,13 @@ def write_file(filepath, idMesh = idMesh+1; fw('Mesh : %d\n' % idMesh) me.transform(EXPORT_GLOBAL_MATRIX * ob_mat) + #print("ploppp : " + str(EXPORT_GLOBAL_MATRIX) ) + #print("ploppp : " + str(ob_mat) ) # _must_ do this first since it re-allocs arrays # triangulate all the mesh : mesh_triangulate(me) + # calculated normals: + me.calc_normals() # export UV mapping : faceuv = len(me.uv_textures) > 0 if faceuv: @@ -381,8 +385,7 @@ def write_file(filepath, # clean up bpy.data.meshes.remove(me) continue # dont bother with this mesh. - # calculated normals: - me.calc_normals() + materials = me.materials[:] material_names = [m.name if m else None for m in materials] # avoid bad index errors diff --git a/external/ege b/external/ege index 327367b1..c741f6e1 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 327367b1a73be036a447c1f0b5e43f3af43ca0c2 +Subproject commit c741f6e1c8fe23e68a56937ecea08d6972fa3fd3 diff --git a/external/ejson b/external/ejson index 2627da57..3c102ab2 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit 2627da57d8555bd69facc1cff923ab0b8d498893 +Subproject commit 3c102ab263a93b410c3e0cd118bb8d2bc67e0b28 diff --git a/sources/ewol/renderer/resources/Mesh.cpp b/sources/ewol/renderer/resources/Mesh.cpp index fc525543..43d43b78 100644 --- a/sources/ewol/renderer/resources/Mesh.cpp +++ b/sources/ewol/renderer/resources/Mesh.cpp @@ -23,7 +23,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName) // get the shader resource : m_GLPosition = 0; - m_light.SetDirection(vec3(0,cos(M_PI/4),sin(M_PI/4))); + m_light.SetDirection(vec3(0,-cos(M_PI/4),0)); m_light.SetHalfPlane(vec3(1,0,0)); m_light.SetAmbientColor(vec4(1,1,1,1)); m_light.SetDiffuseColor(vec4(1.0,1.0,1.0,1)); @@ -70,7 +70,7 @@ ewol::Mesh::~Mesh(void) ewol::resource::Release(m_verticesVBO); } -#define DISPLAY_NB_VERTEX_DISPLAYED +//#define DISPLAY_NB_VERTEX_DISPLAYED void ewol::Mesh::Draw(mat4& positionMatrix) { @@ -126,7 +126,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix) etk::Vector& tmppIndex = m_listFaces.GetValue(kkk).m_index; if (normalModeFace == m_normalMode) { for(int32_t iii=0; iii= 0.0f) { + if(btDot(mattttt * m_listFacesNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= 0.0f) { tmpIndexResult.PushBack(iii*3); tmpIndexResult.PushBack(iii*3+1); tmpIndexResult.PushBack(iii*3+2); @@ -134,9 +134,9 @@ void ewol::Mesh::Draw(mat4& positionMatrix) } } else { for(int32_t iii=0; iii= -0.2f) - || (btDot(mattttt*m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f) - || (btDot(mattttt*m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) { + if( (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[0]], cameraNormal) >= -0.2f) + || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f) + || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) { tmpIndexResult.PushBack(iii*3); tmpIndexResult.PushBack(iii*3+1); tmpIndexResult.PushBack(iii*3+2); @@ -151,59 +151,13 @@ void ewol::Mesh::Draw(mat4& positionMatrix) } } #ifdef DISPLAY_NB_VERTEX_DISPLAYED - EWOL_DEBUG("Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); + EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); #endif m_GLprogram->UnUse(); ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); // TODO : UNDERSTAND why ... it is needed glBindBuffer(GL_ARRAY_BUFFER,0); } -void ewol::Mesh::Draw2(mat4& positionMatrix) -{ - if (m_GLprogram==NULL) { - EWOL_ERROR("No shader ..."); - return; - } - ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); - //EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); - m_GLprogram->Use(); - // set Matrix : translation/positionMatrix - mat4 projMatrix = ewol::openGL::GetMatrix(); - mat4 tmpMatrix = projMatrix; - m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); - m_GLprogram->UniformMatrix4fv(m_GLMatrixPosition, 1, positionMatrix.m_mat); - // position : - m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); - // Texture : - m_GLprogram->SendAttributePointer(m_GLtexture, 2/*u,v*/, m_verticesVBO, MESH_VBO_TEXTURE); - // position : - m_GLprogram->SendAttributePointer(m_GLNormal, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES_NORMAL); - m_light.Draw(m_GLprogram); - - // draw materials : - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - int32_t nbElementDraw = 0; - #endif - for (esize_t kkk=0; kkkDraw(m_GLprogram, m_GLMaterial); - ewol::openGL::DrawElements(GL_TRIANGLES, m_listFaces.GetValue(kkk).m_index); - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - nbElementDraw += m_listFaces.GetValue(kkk).m_index.Size(); - #endif - } - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - EWOL_DEBUG("Request Draw : " << m_listFaces.Size() << ":" << nbElementDraw << " elements [" << m_name << "]"); - #endif - m_GLprogram->UnUse(); - ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); - // TODO : UNDERSTAND why ... it is needed - glBindBuffer(GL_ARRAY_BUFFER,0); -} - // normal calculation of the normal face is really easy : void ewol::Mesh::CalculateNormaleFace(void) diff --git a/sources/ewol/renderer/resources/Mesh.h b/sources/ewol/renderer/resources/Mesh.h index 196be647..e0f88f2d 100644 --- a/sources/ewol/renderer/resources/Mesh.h +++ b/sources/ewol/renderer/resources/Mesh.h @@ -112,7 +112,6 @@ namespace ewol virtual ~Mesh(void); virtual const char* GetType(void) { return "ewol::Mesh"; }; virtual void Draw(mat4& positionMatrix); - virtual void Draw2(mat4& positionMatrix); void GenerateVBO(void); private: void CalculateNormaleFace(void); diff --git a/sources/ewol/widget/Mesh.cpp b/sources/ewol/widget/Mesh.cpp index 70f3d010..7a1c66b4 100644 --- a/sources/ewol/widget/Mesh.cpp +++ b/sources/ewol/widget/Mesh.cpp @@ -53,7 +53,7 @@ void widget::Mesh::OnDraw(void) * etk::matRotate(vec3(0,1,0),m_angle.y()) * etk::matRotate(vec3(0,0,1),m_angle.z()); if (NULL != m_object) { - m_object->Draw2(transformationMatrix); + m_object->Draw(transformationMatrix); } }