[DEBUG] some icosphere correction

This commit is contained in:
Edouard DUPIN 2014-10-02 23:22:51 +02:00
parent fd136fb656
commit 9930ce56c4
3 changed files with 12 additions and 10 deletions

View File

@ -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();
}

View File

@ -72,7 +72,7 @@ namespace ege {
std::shared_ptr<ewol::resource::VirtualBufferObject> 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);

View File

@ -181,7 +181,9 @@ void ege::icoSphere::create(etk::Hash<ege::Material*>& _materials, etk::Hash<Fac
face.m_uv[1] = face.m_vertex[1];
face.m_uv[2] = face.m_vertex[2];
// mauvaus coter ...
if (_listVertex[face.m_vertex[0]].x() < 0) {
if ( _listVertex[face.m_vertex[0]].x() < 0
|| _listVertex[face.m_vertex[1]].x() < 0
|| _listVertex[face.m_vertex[2]].x() < 0) {
if (y0 < 0) {
if (y1 < 0) {
if (y2 >= 0) {