From 9930ce56c42052db422eef3de0d5494d3ccd3f10 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 2 Oct 2014 23:22:51 +0200 Subject: [PATCH] [DEBUG] some icosphere correction --- ege/resource/Mesh.cpp | 14 +++++++------- ege/resource/Mesh.h | 4 ++-- ege/resource/tools/icoSphere.cpp | 4 +++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ege/resource/Mesh.cpp b/ege/resource/Mesh.cpp index 15d5f7a..4a55d24 100644 --- a/ege/resource/Mesh.cpp +++ b/ege/resource/Mesh.cpp @@ -32,11 +32,11 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string& // get the shader resource : m_GLPosition = 0; - 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)); - m_light.setSpecularColor(vec4(0.0,0.0,0.0,1)); + m_light.setDirection(vec3(0.0f,-cos(M_PI/4),0.0f)); + m_light.setHalfPlane(vec3(1.0f,0.0f,0.0f)); + m_light.setAmbientColor(vec4(1.0f,1.0f,1.0f,1.0f)); + m_light.setDiffuseColor(vec4(1.0f,1.0f,1.0f,1.0f)); + m_light.setSpecularColor(vec4(0.0f,0.0f,0.0f,1.0f)); //EGE_DEBUG(m_name << " " << m_light); m_GLprogram = ewol::resource::Program::create(_shaderName); @@ -314,10 +314,10 @@ void ege::resource::Mesh::createViewBox(const std::string& _materialName,float _ calculateNormaleFace(); } -void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float _size) { +void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float _size, int32_t _subdivision) { m_normalMode = normalModeNone; ege::icoSphere::create(m_materials, m_listFaces, m_listVertex, m_listUV, - _materialName, _size, 3); + _materialName, _size, _subdivision); calculateNormaleFace(); } diff --git a/ege/resource/Mesh.h b/ege/resource/Mesh.h index e79cd36..f9419c8 100644 --- a/ege/resource/Mesh.h +++ b/ege/resource/Mesh.h @@ -72,7 +72,7 @@ namespace ege { std::shared_ptr m_verticesVBO; protected: Mesh(); - void init(const std::string& _fileName, const std::string& _shaderName="DATA:textured3D2.prog"); + void init(const std::string& _fileName="---", const std::string& _shaderName="DATA:textured3D2.prog"); public: virtual ~Mesh(); DECLARE_RESOURCE_NAMED_FACTORY(Mesh); @@ -90,7 +90,7 @@ namespace ege { void calculateNormaleEdge(); public : void createViewBox(const std::string& _materialName,float _size=1.0); - void createIcoSphere(const std::string& _materialName,float _size=1.0); + void createIcoSphere(const std::string& _materialName,float _size=1.0, int32_t _subdivision=3); private: bool loadOBJ(const std::string& _fileName); bool loadEMF(const std::string& _fileName); diff --git a/ege/resource/tools/icoSphere.cpp b/ege/resource/tools/icoSphere.cpp index ede8ddf..20a50a7 100644 --- a/ege/resource/tools/icoSphere.cpp +++ b/ege/resource/tools/icoSphere.cpp @@ -181,7 +181,9 @@ void ege::icoSphere::create(etk::Hash& _materials, etk::Hash= 0) {