Updated ComputeAAB and TransformVertices functions
They now take sparse pointers instead of template type Former-commit-id: 92a3de59b6a321136b8bad324048239f83381534
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
// Copyright (C) 2015 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
|
||||
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
template<typename T>
|
||||
NzBoxf NzComputeAABB(const T* vertices, unsigned int vertexCount)
|
||||
{
|
||||
NzBoxf aabb;
|
||||
if (vertexCount > 0)
|
||||
{
|
||||
aabb.Set(vertices->position.x, vertices->position.y, vertices->position.z, 0.f, 0.f, 0.f);
|
||||
vertices++;
|
||||
|
||||
for (unsigned int i = 1; i < vertexCount; ++i)
|
||||
{
|
||||
aabb.ExtendTo(vertices->position);
|
||||
vertices++;
|
||||
}
|
||||
}
|
||||
else
|
||||
aabb.MakeZero();
|
||||
|
||||
return aabb;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzTransformVertices(T* vertices, unsigned int vertexCount, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzVector3f scale = matrix.GetScale();
|
||||
|
||||
for (unsigned int i = 0; i < vertexCount; ++i)
|
||||
{
|
||||
vertices->normal = matrix.Transform(vertices->normal, 0.f) / scale;
|
||||
vertices->position = matrix.Transform(vertices->position);
|
||||
vertices->tangent = matrix.Transform(vertices->tangent, 0.f) / scale;
|
||||
vertices++;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user