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

@@ -0,0 +1,81 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ANIMATION_HPP
#define NAZARA_ANIMATION_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/Resource.hpp>
#include <Nazara/Utility/ResourceLoader.hpp>
#include <list>
#include <map>
struct NzAnimationParams
{
unsigned int endFrame = static_cast<unsigned int>(-1);
unsigned int startFrame = 0;
bool IsValid() const;
};
struct NzSequence
{
NzString name;
unsigned int firstFrame;
unsigned int lastFrame;
unsigned int framePerSecond;
};
class NzAnimation;
typedef NzResourceLoader<NzAnimation, NzAnimationParams> NzAnimationLoader;
struct NzAnimationImpl;
class NAZARA_API NzAnimation : public NzResource
{
friend class NzResourceLoader<NzAnimation, NzAnimationParams>;
public:
NzAnimation() = default;
~NzAnimation();
unsigned int AddSequence(const NzSequence& sequence);
bool Create(nzAnimationType type, unsigned int frameCount);
void Destroy();
unsigned int GetFrameCount() const;
NzSequence* GetSequence(const NzString& sequenceName);
NzSequence* GetSequence(unsigned int index);
const NzSequence* GetSequence(const NzString& sequenceName) const;
const NzSequence* GetSequence(unsigned int index) const;
unsigned int GetSequenceCount() const;
nzAnimationType GetType() const;
bool HasSequence(const NzString& sequenceName) const;
bool HasSequence(unsigned int index = 0) const;
bool IsValid() const;
bool LoadFromFile(const NzString& filePath, const NzAnimationParams& params = NzAnimationParams());
bool LoadFromMemory(const void* data, std::size_t size, const NzAnimationParams& params = NzAnimationParams());
bool LoadFromStream(NzInputStream& stream, const NzAnimationParams& params = NzAnimationParams());
void RemoveSequence(const NzString& sequenceName);
void RemoveSequence(unsigned int index);
private:
NzAnimationImpl* m_impl = nullptr;
static std::list<NzAnimationLoader::MemoryLoader> s_memoryLoaders;
static std::list<NzAnimationLoader::StreamLoader> s_streamLoaders;
static std::multimap<NzString, NzAnimationLoader::LoadFileFunction> s_fileLoaders;
};
#endif // NAZARA_ANIMATION_HPP