[DEBUG] correct the VBO FULL implement

This commit is contained in:
Edouard DUPIN 2016-11-08 22:17:47 +01:00
parent 2305cdbbcc
commit 21c6ab2f80
3 changed files with 37 additions and 33 deletions

View File

@ -90,36 +90,38 @@ ege::Ray ege::camera::View::getRayFromScreen(const vec2& _offset) {
return out;
}
void ege::camera::View::drawDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera) {
mat4 mat;
if (_camera != sharedFromThis()) {
#ifndef __TARGET_OS__Web
void ege::camera::View::drawDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera) {
mat4 mat;
if (_camera != sharedFromThis()) {
mat.identity();
vec2 angles = tansformPositionToAngle(-getViewVector());
mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f);
mat.rotate(vec3(1,0,0), -M_PI*0.5f + angles.y());
mat.translate(vec3(0,0,getViewVector().length()));
mat.rotate(vec3(0,0,1), m_angle);
//mat.translate(vec3(m_eye.x(), m_eye.y(), m_eye.z()));
_draw->drawSquare(vec3(2,2,2), mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
std::vector<vec3> EwolVertices;
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,-5,-5));
EwolVertices.push_back(vec3(5,-5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(5,-5,-5));
EwolVertices.push_back(vec3(5,5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(5,5,-5));
EwolVertices.push_back(vec3(-5,5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,5,-5));
EwolVertices.push_back(vec3(-5,-5,-5));
_draw->draw(EwolVertices, etk::Color<float>(0.0f, 0.0f, 1.0f, 0.5f), mat);
}
mat.identity();
vec2 angles = tansformPositionToAngle(-getViewVector());
mat.rotate(vec3(0,0,1), angles.x() - M_PI/2.0f);
mat.rotate(vec3(1,0,0), -M_PI*0.5f + angles.y());
mat.translate(vec3(0,0,getViewVector().length()));
mat.rotate(vec3(0,0,1), m_angle);
//mat.translate(vec3(m_eye.x(), m_eye.y(), m_eye.z()));
_draw->drawSquare(vec3(2,2,2), mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
std::vector<vec3> EwolVertices;
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,-5,-5));
EwolVertices.push_back(vec3(5,-5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(5,-5,-5));
EwolVertices.push_back(vec3(5,5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(5,5,-5));
EwolVertices.push_back(vec3(-5,5,-5));
EwolVertices.push_back(vec3(0,0,0));
EwolVertices.push_back(vec3(-5,5,-5));
EwolVertices.push_back(vec3(-5,-5,-5));
_draw->draw(EwolVertices, etk::Color<float>(0.0f, 0.0f, 1.0f, 0.5f), mat);
mat.translate(m_target);
_draw->drawSphere(1, 3, 3, mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
}
mat.identity();
mat.translate(m_target);
_draw->drawSphere(1, 3, 3, mat, etk::Color<float>(0.0f, 0.0f, 1.0f, 1.0f));
}
#endif

View File

@ -73,7 +73,9 @@ namespace ege {
virtual vec3 getViewVector() const;
public:
virtual ege::Ray getRayFromScreen(const vec2& _offset);
#ifndef __TARGET_OS__Web
virtual void drawDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera);
#endif
virtual float getTetha();
virtual float getPsy();
};

View File

@ -60,7 +60,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
EGE_ERROR("can not instanciate VBO ...");
return;
}
// TO facilitate some debugs we add a name of the VBO :
// TO facilitate some debugs we add a name of the VBO:
m_verticesVBO->setName("[VBO] of " + _fileName);
// load the curent file :
std::string tmpName = etk::tolower(_fileName);
@ -148,7 +148,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
#else
}
#endif
// position :
// colors :
m_GLprogram->sendAttributePointer(m_GLColor, m_verticesVBO, MESH_VBO_COLOR);
// draw lights :
m_light.draw(m_GLprogram);