Added Meshes and Animations (And many more)

Added NzTexture::IsMipmappingSupported
Color::(FromTo)HSV now takes hue and saturation in degrees
Fixed Context::EnsureContext
Fixed COW thread-safety (String, Image, Matrix4)
Fixed Quatenion<T>::operator*(const Vector3<T>&)
Fixed ResourceLoader
Fixed String::Resize with a size of 0
Fixed Texture mipmapping crash
Fixed per-class thread-safety
IndexBuffer and VertexBuffer are now resources
It is now possible to use more than 8 texcoords per shader
Moved all enumerations into separate files (Core/Enums.hpp,
Utility/Enums.hpp, ..)
Removed NzContextParameters::defaultWindow
VertexDeclaration has been rewritten (New interface/COW)
This commit is contained in:
Lynix
2012-07-13 15:22:14 +02:00
parent 5f95f0b677
commit 06eda4eba9
75 changed files with 3385 additions and 861 deletions

View File

@@ -6,70 +6,48 @@
#define NAZARA_VERTEXDECLARATION_HPP
#include <Nazara/Prerequesites.hpp>
#include <vector>
enum nzElementType
{
nzElementType_Color,
nzElementType_Double1,
nzElementType_Double2,
nzElementType_Double3,
nzElementType_Double4,
nzElementType_Float1,
nzElementType_Float2,
nzElementType_Float3,
nzElementType_Float4
};
enum nzElementUsage
{
nzElementUsage_Diffuse,
nzElementUsage_Normal,
nzElementUsage_Position,
nzElementUsage_Tangent,
nzElementUsage_TexCoord
};
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/Resource.hpp>
struct NzVertexElement
{
NzVertexElement() : stream(0), usageIndex(0) {}
unsigned int offset;
unsigned int stream;
unsigned int usageIndex;
unsigned int usageIndex = 0;
nzElementStream stream = nzElementStream_VertexData;
nzElementType type;
nzElementUsage usage;
};
class NAZARA_API NzVertexDeclaration
struct NzVertexDeclarationImpl;
class NAZARA_API NzVertexDeclaration : public NzResource
{
public:
struct Element
{
unsigned int offset;
unsigned int usageIndex;
nzElementType type;
nzElementUsage usage;
};
NzVertexDeclaration() = default;
~NzVertexDeclaration() = default;
NzVertexDeclaration(const NzVertexElement* elements, unsigned int elementCount);
NzVertexDeclaration(const NzVertexDeclaration& declaration);
NzVertexDeclaration(NzVertexDeclaration&& declaration);
~NzVertexDeclaration();
bool Create(const NzVertexElement* elements, unsigned int elementCount);
void Destroy();
const Element* GetElement(unsigned int i, unsigned int stream = 0) const;
unsigned int GetElementCount(unsigned int stream = 0) const;
unsigned int GetStreamCount() const;
unsigned int GetStride(unsigned int stream = 0) const;
const NzVertexElement* GetElement(unsigned int i) const;
const NzVertexElement* GetElement(nzElementStream stream, unsigned int i) const;
const NzVertexElement* GetElement(nzElementStream stream, nzElementUsage usage, unsigned int usageIndex = 0) const;
unsigned int GetElementCount() const;
unsigned int GetElementCount(nzElementStream stream) const;
unsigned int GetStride(nzElementStream stream) const;
bool HasStream(nzElementStream stream) const;
bool IsValid() const;
NzVertexDeclaration& operator=(const NzVertexDeclaration& declaration);
NzVertexDeclaration& operator=(NzVertexDeclaration&& declaration);
private:
struct Stream
{
std::vector<Element> elements;
unsigned int stride;
};
std::vector<Stream> m_streams;
NzVertexDeclarationImpl* m_sharedImpl = nullptr;
};
#endif // NAZARA_VERTEXDECLARATION_HPP