From 48efe503a7de6977ae78d4ea726f16785af37ac0 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 22 May 2017 23:34:05 +0000 Subject: [PATCH] [DEV] AABB draw lines --- ewol/resource/Colored3DObject.cpp | 49 +++++++++++++++++++++++++++++++ ewol/resource/Colored3DObject.hpp | 6 ++++ 2 files changed, 55 insertions(+) diff --git a/ewol/resource/Colored3DObject.cpp b/ewol/resource/Colored3DObject.cpp index bcf7298b..3d8285bd 100644 --- a/ewol/resource/Colored3DObject.cpp +++ b/ewol/resource/Colored3DObject.cpp @@ -156,6 +156,55 @@ void ewol::resource::Colored3DObject::drawLine(std::vector& _vertices, } } + +void ewol::resource::Colored3DObject::drawCubeLine(const vec3& _min, + const vec3& _max, + const etk::Color& _color, + mat4& _transformationMatrix, + bool _updateDepthBuffer, + bool _depthtest) { + std::vector vertices; + vertices.push_back(vec3(_min.x(), _min.y(),_min.z())); + vertices.push_back(vec3(_max.x(), _min.y(),_min.z())); + + vertices.push_back(vec3(_max.x(), _min.y(),_min.z())); + vertices.push_back(vec3(_max.x(), _min.y(),_max.z())); + + vertices.push_back(vec3(_max.x(), _min.y(),_max.z())); + vertices.push_back(vec3(_min.x(), _min.y(),_max.z())); + + vertices.push_back(vec3(_min.x(), _min.y(),_max.z())); + vertices.push_back(vec3(_min.x(), _min.y(),_min.z())); + + + vertices.push_back(vec3(_min.x(), _max.y(),_min.z())); + vertices.push_back(vec3(_max.x(), _max.y(),_min.z())); + + vertices.push_back(vec3(_max.x(), _max.y(),_min.z())); + vertices.push_back(vec3(_max.x(), _max.y(),_max.z())); + + vertices.push_back(vec3(_max.x(), _max.y(),_max.z())); + vertices.push_back(vec3(_min.x(), _max.y(),_max.z())); + + vertices.push_back(vec3(_min.x(), _max.y(),_max.z())); + vertices.push_back(vec3(_min.x(), _max.y(),_min.z())); + + + vertices.push_back(vec3(_min.x(), _min.y(),_min.z())); + vertices.push_back(vec3(_min.x(), _max.y(),_min.z())); + + vertices.push_back(vec3(_max.x(), _min.y(),_min.z())); + vertices.push_back(vec3(_max.x(), _max.y(),_min.z())); + + vertices.push_back(vec3(_max.x(), _min.y(),_max.z())); + vertices.push_back(vec3(_max.x(), _max.y(),_max.z())); + + vertices.push_back(vec3(_min.x(), _min.y(),_max.z())); + vertices.push_back(vec3(_min.x(), _max.y(),_max.z())); + + drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest); +} + void ewol::resource::Colored3DObject::drawSquare(const vec3& _size, mat4& _transformationMatrix, const etk::Color& _tmpColor) { diff --git a/ewol/resource/Colored3DObject.hpp b/ewol/resource/Colored3DObject.hpp index 97b0822f..bad77b28 100644 --- a/ewol/resource/Colored3DObject.hpp +++ b/ewol/resource/Colored3DObject.hpp @@ -44,6 +44,12 @@ namespace ewol { mat4& _transformationMatrix, bool _updateDepthBuffer=true, bool _depthtest=true); + virtual void drawCubeLine(const vec3& _min, + const vec3& _max, + const etk::Color& _color, + mat4& _transformationMatrix, + bool _updateDepthBuffer=true, + bool _depthtest=true); public: void drawSquare(const vec3& _size, mat4& _transformationMatrix,