mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
+ | Texture parsing on obj
This commit is contained in:
@ -51,16 +51,22 @@ class Triangle : public Object
|
||||
|
||||
_mat_index = mat_index;
|
||||
}
|
||||
Triangle(const glm::vec3& position, const glm::vec3& vertex2, const glm::vec3& vertex3, const int mat_index)
|
||||
: Object(position, mat_index), _vertex2(vertex2), _vertex3(vertex3) {
|
||||
Triangle(const glm::vec3& position, const glm::vec3& vertex2, const glm::vec3& vertex3,
|
||||
const glm::vec2& vt1, const glm::vec2& vt2, const glm::vec2& vt3, const int mat_index)
|
||||
: Object(position, mat_index), _vertex2(vertex2), _vertex3(vertex3),
|
||||
_texture_vertex1(vt1), _texture_vertex2(vt2), _texture_vertex3(vt3)
|
||||
{
|
||||
|
||||
_normal = glm::normalize(glm::cross(_vertex2 - _position, _vertex3 - _position)); //optimization
|
||||
_centroid = (_position + _vertex2 + _vertex3) / 3.0f;
|
||||
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
}
|
||||
|
||||
const glm::vec2 &getTextureVertex1() const {return (_texture_vertex1); }
|
||||
const glm::vec2 &getTextureVertex2() const {return (_texture_vertex2); }
|
||||
const glm::vec2 &getTextureVertex3() const {return (_texture_vertex3); }
|
||||
|
||||
const glm::vec3 &getVertex2() const { return (_vertex2); }
|
||||
const glm::vec3 &getVertex3() const { return (_vertex3); }
|
||||
const glm::vec3 &getNormal() const { return (_normal); }
|
||||
@ -73,6 +79,11 @@ class Triangle : public Object
|
||||
glm::vec3 _vertex2;
|
||||
glm::vec3 _vertex3;
|
||||
|
||||
glm::vec2 _texture_vertex1;
|
||||
glm::vec2 _texture_vertex2;
|
||||
glm::vec2 _texture_vertex3;
|
||||
|
||||
|
||||
glm::vec3 _normal;
|
||||
|
||||
glm::vec3 _centroid;
|
||||
|
Reference in New Issue
Block a user