Make assimp setter in Vertex class only available if assimp is available
This commit is contained in:
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
#include "Math/Math.hpp"
|
#include "Math/Math.hpp"
|
||||||
#include "VertexInputDescription.hpp"
|
#include "VertexInputDescription.hpp"
|
||||||
|
#if __has_include("assimp/vector2.h")
|
||||||
#include <assimp/vector2.h>
|
#include <assimp/vector2.h>
|
||||||
#include <assimp/vector3.h>
|
#include <assimp/vector3.h>
|
||||||
#include <assimp/color4.h>
|
#include <assimp/color4.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace openVulkanoCpp
|
namespace openVulkanoCpp
|
||||||
{
|
{
|
||||||
@@ -21,9 +23,6 @@ namespace openVulkanoCpp
|
|||||||
|
|
||||||
Vertex() = default;
|
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)
|
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()
|
: position({ x, y, z }), normal({ nx, ny, nz }), tangent(), biTangent(), textureCoordinates({ u, v, 0 }), color()
|
||||||
{}
|
{}
|
||||||
@@ -48,11 +47,6 @@ namespace openVulkanoCpp
|
|||||||
this->position = position;
|
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)
|
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 };
|
this->position = { x, y, z };
|
||||||
@@ -86,11 +80,6 @@ namespace openVulkanoCpp
|
|||||||
this->normal = normal;
|
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)
|
void SetTangent(const float& tx, const float& ty, const float& tz)
|
||||||
{
|
{
|
||||||
this->tangent = { tx, ty, tz };
|
this->tangent = { tx, ty, tz };
|
||||||
@@ -101,11 +90,6 @@ namespace openVulkanoCpp
|
|||||||
this->tangent = tangent;
|
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)
|
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 };
|
this->biTangent = { bx, by, bz };
|
||||||
@@ -118,12 +102,6 @@ namespace openVulkanoCpp
|
|||||||
this->tangent = tangent;
|
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)
|
void SetBiTangent(const float& bx, const float& by, const float& bz)
|
||||||
{
|
{
|
||||||
this->biTangent = { bx, by, bz };
|
this->biTangent = { bx, by, bz };
|
||||||
@@ -134,11 +112,6 @@ namespace openVulkanoCpp
|
|||||||
this->biTangent = biTangent;
|
this->biTangent = biTangent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBiTangent(const aiVector3D& biTangent)
|
|
||||||
{
|
|
||||||
this->biTangent = { biTangent.x, biTangent.y, biTangent.z };
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetTextureCoordinates(const float& u, const float& v)
|
void SetTextureCoordinates(const float& u, const float& v)
|
||||||
{
|
{
|
||||||
this->textureCoordinates = { u, v, 0 };
|
this->textureCoordinates = { u, v, 0 };
|
||||||
@@ -159,16 +132,6 @@ namespace openVulkanoCpp
|
|||||||
this->textureCoordinates = textureCoordinates;
|
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)
|
void SetColor(const float& r, const float& g, const float& b, const float& a = 1)
|
||||||
{
|
{
|
||||||
color = { r,g,b,a };
|
color = { r,g,b,a };
|
||||||
@@ -179,10 +142,51 @@ namespace openVulkanoCpp
|
|||||||
this->color = color;
|
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)
|
void SetColor(const aiColor4D& color)
|
||||||
{
|
{
|
||||||
this->color = { color.r, color.g, color.b, color.a };
|
this->color = { color.r, color.g, color.b, color.a };
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VertexInputDescription GetVertexInputDescription()
|
static VertexInputDescription GetVertexInputDescription()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user