80 lines
2.4 KiB
C++
80 lines
2.4 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
|
|
|
|
#pragma once
|
|
|
|
#ifndef NAZARA_PARTICLEDECLARATION_HPP
|
|
#define NAZARA_PARTICLEDECLARATION_HPP
|
|
|
|
#include <Nazara/Prerequesites.hpp>
|
|
#include <Nazara/Core/ObjectLibrary.hpp>
|
|
#include <Nazara/Core/ObjectRef.hpp>
|
|
#include <Nazara/Core/RefCounted.hpp>
|
|
#include <Nazara/Core/Signal.hpp>
|
|
#include <Nazara/Graphics/Config.hpp>
|
|
#include <Nazara/Graphics/Enums.hpp>
|
|
#include <Nazara/Utility/Enums.hpp>
|
|
|
|
namespace Nz
|
|
{
|
|
class ParticleDeclaration;
|
|
|
|
using ParticleDeclarationConstRef = ObjectRef<const ParticleDeclaration>;
|
|
using ParticleDeclarationLibrary = ObjectLibrary<ParticleDeclaration>;
|
|
using ParticleDeclarationRef = ObjectRef<ParticleDeclaration>;
|
|
|
|
class NAZARA_GRAPHICS_API ParticleDeclaration : public RefCounted
|
|
{
|
|
friend ParticleDeclarationLibrary;
|
|
friend class Graphics;
|
|
|
|
public:
|
|
ParticleDeclaration();
|
|
ParticleDeclaration(const ParticleDeclaration& declaration);
|
|
~ParticleDeclaration();
|
|
|
|
void DisableComponent(ParticleComponent component);
|
|
void EnableComponent(ParticleComponent component, ComponentType type, unsigned int offset);
|
|
|
|
void GetComponent(ParticleComponent component, bool* enabled, ComponentType* type, unsigned int* offset) const;
|
|
unsigned int GetStride() const;
|
|
|
|
void SetStride(unsigned int stride);
|
|
|
|
ParticleDeclaration& operator=(const ParticleDeclaration& declaration);
|
|
|
|
static ParticleDeclaration* Get(ParticleLayout layout);
|
|
static bool IsTypeSupported(ComponentType type);
|
|
|
|
// Signals:
|
|
NazaraSignal(OnParticleDeclarationRelease, const ParticleDeclaration* /*particleDeclaration*/);
|
|
|
|
private:
|
|
static bool Initialize();
|
|
static void Uninitialize();
|
|
|
|
struct Component
|
|
{
|
|
ComponentType type;
|
|
bool enabled = false;
|
|
unsigned int offset;
|
|
|
|
/*
|
|
** -Lynix:
|
|
** Il serait aussi possible de préciser le stride de façon indépendante, ce que je ne permets pas
|
|
** pour décomplexifier l'interface en enlevant quelque chose que je juge inutile.
|
|
** Si vous pensez que ça peut être utile, n'hésitez pas à me le faire savoir !
|
|
*/
|
|
};
|
|
|
|
Component m_components[ParticleComponent_Max+1];
|
|
unsigned int m_stride;
|
|
|
|
static ParticleDeclaration s_declarations[ParticleLayout_Max+1];
|
|
static ParticleDeclarationLibrary::LibraryMap s_library;
|
|
};
|
|
}
|
|
|
|
#endif // NAZARA_PARTICLEDECLARATION_HPP
|