Files
NazaraEngine/include/Nazara/Graphics/ParticleMapper.inl
Lynix df8da275c4 Switch from Nz prefix to namespace Nz
What a huge commit


Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
2015-09-25 19:20:05 +02:00

54 lines
1.5 KiB
C++

// Copyright (C) 2015 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
#include <Nazara/Core/Error.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
template <typename T>
SparsePtr<T> ParticleMapper::GetComponentPtr(ParticleComponent component)
{
// Ensuite le composant qui nous intéresse
bool enabled;
ComponentType type;
unsigned int offset;
m_declaration->GetComponent(component, &enabled, &type, &offset);
if (enabled)
{
///TODO: Vérifier le rapport entre le type de l'attribut et le type template ?
return SparsePtr<T>(m_ptr + offset, m_declaration->GetStride());
}
else
{
NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled");
return SparsePtr<T>();
}
}
template <typename T>
SparsePtr<const T> ParticleMapper::GetComponentPtr(ParticleComponent component) const
{
// Ensuite le composant qui nous intéresse
bool enabled;
ComponentType type;
unsigned int offset;
m_declaration->GetComponent(component, &enabled, &type, &offset);
if (enabled)
{
///TODO: Vérifier le rapport entre le type de l'attribut et le type template ?
return SparsePtr<const T>(m_ptr + offset, m_declaration->GetStride());
}
else
{
NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled");
return SparsePtr<const T>();
}
}
}
#include <Nazara/Graphics/DebugOff.hpp>