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:
93
include/Nazara/Utility/Mesh.hpp
Normal file
93
include/Nazara/Utility/Mesh.hpp
Normal file
@@ -0,0 +1,93 @@
|
||||
// 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_MESH_HPP
|
||||
#define NAZARA_MESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Utility/ResourceLoader.hpp>
|
||||
#include <Nazara/Utility/Resource.hpp>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
class NzSubMesh;
|
||||
class NzVertexDeclaration;
|
||||
|
||||
struct NzMeshParams
|
||||
{
|
||||
NzAnimationParams animation;
|
||||
//const NzVertexDeclaration* declaration = nullptr;
|
||||
bool forceSoftware = false;
|
||||
bool loadAnimations = true;
|
||||
|
||||
bool IsValid() const;
|
||||
};
|
||||
|
||||
class NzMesh;
|
||||
|
||||
typedef NzResourceLoader<NzMesh, NzMeshParams> NzMeshLoader;
|
||||
|
||||
struct NzMeshImpl;
|
||||
|
||||
class NAZARA_API NzMesh : public NzResource
|
||||
{
|
||||
friend class NzResourceLoader<NzMesh, NzMeshParams>;
|
||||
|
||||
public:
|
||||
NzMesh() = default;
|
||||
~NzMesh();
|
||||
|
||||
unsigned int AddSkin(const NzString& skin, bool setDefault = false);
|
||||
nzUInt8 AddSubMesh(NzSubMesh* subMesh);
|
||||
nzUInt8 AddSubMesh(const NzString& identifier, NzSubMesh* subMesh);
|
||||
|
||||
void Animate(unsigned int frameA, unsigned int frameB, float interpolation);
|
||||
|
||||
bool Create(nzAnimationType type);
|
||||
void Destroy();
|
||||
|
||||
const NzAnimation* GetAnimation() const;
|
||||
nzAnimationType GetAnimationType() const;
|
||||
unsigned int GetFrameCount() const;
|
||||
NzString GetSkin(unsigned int index = 0) const;
|
||||
unsigned int GetSkinCount() const;
|
||||
NzSubMesh* GetSubMesh(const NzString& identifier);
|
||||
NzSubMesh* GetSubMesh(nzUInt8 index);
|
||||
const NzSubMesh* GetSubMesh(const NzString& identifier) const;
|
||||
const NzSubMesh* GetSubMesh(nzUInt8 index) const;
|
||||
nzUInt8 GetSubMeshCount() const;
|
||||
unsigned int GetVertexCount() const;
|
||||
|
||||
bool HasAnimation() const;
|
||||
bool HasSkin(unsigned int index = 0) const;
|
||||
bool HasSubMesh(const NzString& identifier) const;
|
||||
bool HasSubMesh(nzUInt8 index = 0) const;
|
||||
|
||||
bool IsAnimable() const;
|
||||
bool IsValid() const;
|
||||
|
||||
bool LoadFromFile(const NzString& filePath, const NzMeshParams& params = NzMeshParams());
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const NzMeshParams& params = NzMeshParams());
|
||||
bool LoadFromStream(NzInputStream& stream, const NzMeshParams& params = NzMeshParams());
|
||||
|
||||
void RemoveSkin(unsigned int index = 0);
|
||||
void RemoveSubMesh(const NzString& identifier);
|
||||
void RemoveSubMesh(nzUInt8 index = 0);
|
||||
|
||||
bool SetAnimation(const NzAnimation* animation);
|
||||
|
||||
private:
|
||||
NzMeshImpl* m_impl = nullptr;
|
||||
|
||||
static std::list<NzMeshLoader::MemoryLoader> s_memoryLoaders;
|
||||
static std::list<NzMeshLoader::StreamLoader> s_streamLoaders;
|
||||
static std::multimap<NzString, NzMeshLoader::LoadFileFunction> s_fileLoaders;
|
||||
};
|
||||
|
||||
#endif // NAZARA_MESH_HPP
|
||||
Reference in New Issue
Block a user