From 9d93fc22a98d0ab8a15d709c53965aef856c8100 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Wed, 3 Feb 2021 19:20:21 +0100 Subject: [PATCH] Make assimp setter in Vertex class only available if assimp is available --- openVulkanoCpp/Scene/Vertex.hpp | 82 +++++++++++++++++---------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/openVulkanoCpp/Scene/Vertex.hpp b/openVulkanoCpp/Scene/Vertex.hpp index 0ade909..9637a3a 100644 --- a/openVulkanoCpp/Scene/Vertex.hpp +++ b/openVulkanoCpp/Scene/Vertex.hpp @@ -8,9 +8,11 @@ #include "Math/Math.hpp" #include "VertexInputDescription.hpp" +#if __has_include("assimp/vector2.h") #include #include #include +#endif namespace openVulkanoCpp { @@ -21,9 +23,6 @@ namespace openVulkanoCpp Vertex() = default; - Vertex(const aiVector3D& pos) : position(pos.x, pos.y, pos.z), normal(), tangent(), biTangent(), textureCoordinates(), color() - {} - Vertex(const float& x, const float& y, const float& z, const float& nx, const float& ny, const float& nz, const float& u, const float& v) : position({ x, y, z }), normal({ nx, ny, nz }), tangent(), biTangent(), textureCoordinates({ u, v, 0 }), color() {} @@ -48,11 +47,6 @@ namespace openVulkanoCpp this->position = position; } - void Set(const aiVector3D& position) - { - this->position = { position.x, position.y, position.z }; - } - void Set(const float& x, const float& y, const float& z, const float& nx, const float& ny, const float& nz, const float& u, const float& v) { this->position = { x, y, z }; @@ -86,11 +80,6 @@ namespace openVulkanoCpp this->normal = normal; } - void SetNormal(const aiVector3D& normal) - { - this->normal = { normal.x, normal.y, normal.z }; - } - void SetTangent(const float& tx, const float& ty, const float& tz) { this->tangent = { tx, ty, tz }; @@ -101,11 +90,6 @@ namespace openVulkanoCpp this->tangent = tangent; } - void SetTangent(const aiVector3D& tangent) - { - this->tangent = { tangent.x, tangent.y, tangent.z }; - } - void SetTangentAndBiTangent(const float& tx, const float& ty, const float& tz, const float& bx, const float& by, const float& bz) { this->biTangent = { bx, by, bz }; @@ -118,12 +102,6 @@ namespace openVulkanoCpp this->tangent = tangent; } - void SetTangentAndBiTangent(const aiVector3D& tangent, const aiVector3D& biTangent) - { - this->tangent = { tangent.x, tangent.y, tangent.z }; - this->biTangent = { biTangent.x, biTangent.y, biTangent.z }; - } - void SetBiTangent(const float& bx, const float& by, const float& bz) { this->biTangent = { bx, by, bz }; @@ -134,11 +112,6 @@ namespace openVulkanoCpp this->biTangent = biTangent; } - void SetBiTangent(const aiVector3D& biTangent) - { - this->biTangent = { biTangent.x, biTangent.y, biTangent.z }; - } - void SetTextureCoordinates(const float& u, const float& v) { this->textureCoordinates = { u, v, 0 }; @@ -159,16 +132,6 @@ namespace openVulkanoCpp this->textureCoordinates = textureCoordinates; } - void SetTextureCoordinates(const aiVector2D& textureCoordinates) - { - this->textureCoordinates = { textureCoordinates.x, textureCoordinates.y, 0 }; - } - - void SetTextureCoordinates(const aiVector3D& textureCoordinates) - { - this->textureCoordinates = { textureCoordinates.x, textureCoordinates.y, textureCoordinates.z }; - } - void SetColor(const float& r, const float& g, const float& b, const float& a = 1) { color = { r,g,b,a }; @@ -179,10 +142,51 @@ namespace openVulkanoCpp this->color = color; } +#if __has_include("assimp/vector2.h") + Vertex(const aiVector3D& pos) : position(pos.x, pos.y, pos.z), normal(), tangent(), biTangent(), textureCoordinates(), color() + {} + + void Set(const aiVector3D& position) + { + this->position = { position.x, position.y, position.z }; + } + + void SetNormal(const aiVector3D& normal) + { + this->normal = { normal.x, normal.y, normal.z }; + } + + void SetTangent(const aiVector3D& tangent) + { + this->tangent = { tangent.x, tangent.y, tangent.z }; + } + + void SetTangentAndBiTangent(const aiVector3D& tangent, const aiVector3D& biTangent) + { + this->tangent = { tangent.x, tangent.y, tangent.z }; + this->biTangent = { biTangent.x, biTangent.y, biTangent.z }; + } + + void SetBiTangent(const aiVector3D& biTangent) + { + this->biTangent = { biTangent.x, biTangent.y, biTangent.z }; + } + + void SetTextureCoordinates(const aiVector2D& textureCoordinates) + { + this->textureCoordinates = { textureCoordinates.x, textureCoordinates.y, 0 }; + } + + void SetTextureCoordinates(const aiVector3D& textureCoordinates) + { + this->textureCoordinates = { textureCoordinates.x, textureCoordinates.y, textureCoordinates.z }; + } + void SetColor(const aiColor4D& color) { this->color = { color.r, color.g, color.b, color.a }; } +#endif static VertexInputDescription GetVertexInputDescription() {