Vertex declaration changes (#135)
* Add type to ComponentType conversion * Change type to ComponentType conversion * Change assert to condition, add check on particle mapper. * Change particle life type * Changes as requested * Fix Travis try 1 * Changes as requested * move IsSuitableForComponent to inl
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace Nz
|
||||
// ParticleLayout_Billboard : ParticleStruct_Billboard
|
||||
declaration = &s_declarations[ParticleLayout_Billboard];
|
||||
declaration->EnableComponent(ParticleComponent_Color, ComponentType_Color, NazaraOffsetOf(ParticleStruct_Billboard, color));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Billboard, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Billboard, life));
|
||||
declaration->EnableComponent(ParticleComponent_Normal, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Billboard, normal));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Billboard, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Billboard, rotation));
|
||||
@@ -297,7 +297,7 @@ namespace Nz
|
||||
|
||||
// ParticleLayout_Model : ParticleStruct_Model
|
||||
declaration = &s_declarations[ParticleLayout_Model];
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Model, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Model, life));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Model, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Quaternion, NazaraOffsetOf(ParticleStruct_Model, rotation));
|
||||
declaration->EnableComponent(ParticleComponent_Velocity, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Model, velocity));
|
||||
@@ -307,7 +307,7 @@ namespace Nz
|
||||
// ParticleLayout_Sprite : ParticleStruct_Sprite
|
||||
declaration = &s_declarations[ParticleLayout_Sprite];
|
||||
declaration->EnableComponent(ParticleComponent_Color, ComponentType_Color, NazaraOffsetOf(ParticleStruct_Sprite, color));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Sprite, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Sprite, life));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Sprite, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Sprite, rotation));
|
||||
declaration->EnableComponent(ParticleComponent_Velocity, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Sprite, velocity));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
#include <Nazara/Utility/Skeleton.hpp>
|
||||
#include <Nazara/Utility/SkeletalMesh.hpp>
|
||||
#include <Nazara/Utility/Skeleton.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/SkeletalMesh.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -41,6 +41,12 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vertexDeclaration == nullptr)
|
||||
{
|
||||
NazaraError("The vertex declaration can't be null");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,6 +107,7 @@ namespace Nz
|
||||
NazaraAssert(m_impl, "Mesh should be created first");
|
||||
NazaraAssert(m_impl->animationType == AnimationType_Static, "Submesh building only works for static meshes");
|
||||
NazaraAssert(params.IsValid(), "Invalid parameters");
|
||||
NazaraAssert(params.vertexDeclaration->HasComponentOfType<Vector3f>(VertexComponent_Position), "The vertex declaration doesn't have a Vector3 position component");
|
||||
|
||||
Boxf aabb;
|
||||
IndexBufferRef indexBuffer;
|
||||
@@ -109,7 +116,7 @@ namespace Nz
|
||||
Matrix4f matrix(primitive.matrix);
|
||||
matrix *= params.matrix;
|
||||
|
||||
VertexDeclaration* declaration = VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent);
|
||||
VertexDeclaration* declaration = params.vertexDeclaration;
|
||||
|
||||
switch (primitive.type)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -120,6 +120,15 @@ namespace Nz
|
||||
*offset = vertexComponent.offset;
|
||||
}
|
||||
|
||||
bool VertexDeclaration::HasComponent(VertexComponent component) const
|
||||
{
|
||||
bool enabled;
|
||||
|
||||
GetComponent(component, &enabled, nullptr, nullptr);
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
std::size_t VertexDeclaration::GetStride() const
|
||||
{
|
||||
return m_stride;
|
||||
|
||||
Reference in New Issue
Block a user