Fixed repo

Former-commit-id: 5992da5ec759f05dabf82009e660ec58eed96365
This commit is contained in:
Lynix
2012-11-29 10:15:10 +01:00
parent 0a2e19fa22
commit a2eb55e74a
14 changed files with 692 additions and 23 deletions

38
include/Nazara/3D.hpp Normal file
View File

@@ -0,0 +1,38 @@
// This file was automatically generated by Nazara
/*
Nazara Engine - 3D module
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_3D_HPP
#define NAZARA_GLOBAL_3D_HPP
#include <Nazara/3D/3D.hpp>
#include <Nazara/3D/Config.hpp>
#include <Nazara/3D/Enums.hpp>
#include <Nazara/3D/Model.hpp>
#include <Nazara/3D/SceneNode.hpp>
#endif // NAZARA_GLOBAL_3D_HPP

View File

@@ -0,0 +1,17 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - 3D module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ENUMS_3D_HPP
#define NAZARA_ENUMS_3D_HPP
enum nzSceneNodeType
{
nzSceneNodeType_Model,
nzSceneNodeType_Max = nzSceneNodeType_Model
};
#endif // NAZARA_ENUMS_3D_HPP

View File

@@ -0,0 +1,71 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - 3D Module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_MODEL_HPP
#define NAZARA_MODEL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/3D/SceneNode.hpp>
#include <Nazara/Renderer/Material.hpp>
#include <Nazara/Utility/Animation.hpp>
#include <Nazara/Utility/Mesh.hpp>
struct NzModelParameters
{
bool loadAnimation = true;
bool loadMaterials = true;
NzAnimationParams animationParams;
NzMaterialParams materialParams;
};
class NAZARA_API NzModel : public NzSceneNode
{
public:
NzModel();
NzModel(const NzModel& model);
~NzModel();
const NzAnimation* GetAnimation() const;
const NzMaterial* GetMaterial(unsigned int matIndex) const;
const NzMaterial* GetMaterial(unsigned int skinIndex, unsigned int matIndex) const;
unsigned int GetMaterialCount() const;
unsigned int GetSkinCount() const;
const NzMesh* GetMesh() const;
nzSceneNodeType GetSceneNodeType() const override;
const NzSkeleton* GetSkeleton() const;
bool HasAnimation() const;
bool LoadFromFile(const NzString& meshPath, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
bool LoadFromMemory(const void* data, std::size_t size, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
bool LoadFromStream(NzInputStream& stream, const NzMeshParams& meshParameters = NzMeshParams(), const NzModelParameters& modelParameters = NzModelParameters());
void Reset();
bool SetAnimation(const NzAnimation* animation);
void SetMaterial(unsigned int matIndex, const NzMaterial* material);
void SetMaterial(unsigned int skinIndex, unsigned int matIndex, const NzMaterial* material);
void SetMesh(const NzMesh* mesh, const NzModelParameters& parameters = NzModelParameters());
void SetSkinCount(unsigned int skinCount);
bool SetSequence(const NzString& sequenceName);
void SetSequence(unsigned int sequenceIndex);
void Update(float elapsedTime);
private:
std::vector<const NzMaterial*> m_materials;
NzSkeleton m_skeleton; // Uniquement pour les animations squelettiques
const NzAnimation* m_animation;
const NzMesh* m_mesh;
const NzSequence* m_currentSequence;
float m_interpolation;
unsigned int m_currentFrame;
unsigned int m_matCount;
unsigned int m_nextFrame;
unsigned int m_skinCount;
};
#endif // NAZARA_MODEL_HPP

View File

@@ -0,0 +1,22 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - 3D Module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_SCENENODE_HPP
#define NAZARA_SCENENODE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/3D/Enums.hpp>
#include <Nazara/Utility/Node.hpp>
class NzSceneNode : public NzNode
{
public:
virtual ~NzSceneNode();
virtual nzSceneNodeType GetSceneNodeType() const = 0;
};
#endif // NAZARA_SCENENODE_HPP

View File

@@ -40,13 +40,13 @@ class NAZARA_API NzMaterial : public NzResource
NzColor GetAmbientColor() const;
NzColor GetDiffuseColor() const;
const NzTexture* GetDiffuseMap() const;
nzBlendFunc GetDstAlpha() const;
nzBlendFunc GetDstBlend() const;
nzFaceCulling GetFaceCulling() const;
nzFaceFilling GetFaceFilling() const;
float GetShininess() const;
NzColor GetSpecularColor() const;
const NzTexture* GetSpecularMap() const;
nzBlendFunc GetSrcAlpha() const;
nzBlendFunc GetSrcBlend() const;
nzRendererComparison GetZTestCompare() const;
bool IsAlphaBlendingEnabled() const;
@@ -62,20 +62,20 @@ class NAZARA_API NzMaterial : public NzResource
void SetAmbientColor(const NzColor& ambient);
void SetDiffuseColor(const NzColor& diffuse);
void SetDiffuseMap(const NzTexture* map);
void SetDstAlpha(nzBlendFunc func);
void SetDstBlend(nzBlendFunc func);
void SetFaceCulling(nzFaceCulling culling);
void SetFaceFilling(nzFaceFilling filling);
void SetShininess(float shininess);
void SetSpecularColor(const NzColor& specular);
void SetSpecularMap(const NzTexture* map);
void SetSrcAlpha(nzBlendFunc func);
void SetSrcBlend(nzBlendFunc func);
void SetZTestCompare(nzRendererComparison compareFunc);
static const NzMaterial* GetDefault();
private:
nzBlendFunc m_dstAlpha;
nzBlendFunc m_srcAlpha;
nzBlendFunc m_dstBlend;
nzBlendFunc m_srcBlend;
nzFaceCulling m_faceCulling;
nzFaceFilling m_faceFilling;
nzRendererComparison m_zTestCompareFunc;

View File

@@ -18,6 +18,7 @@
class NzColor;
class NzContext;
class NzIndexBuffer;
class NzMaterial;
class NzRenderTarget;
class NzShader;
class NzVertexBuffer;
@@ -29,6 +30,8 @@ class NAZARA_API NzRenderer
NzRenderer() = delete;
~NzRenderer() = delete;
static void ApplyMaterial(const NzMaterial* material);
static void Clear(unsigned long flags = nzRendererClear_Color | nzRendererClear_Depth);
static void DrawIndexedPrimitives(nzPrimitiveType primitive, unsigned int firstIndex, unsigned int indexCount);
@@ -54,11 +57,12 @@ class NAZARA_API NzRenderer
static bool IsEnabled(nzRendererParameter parameter);
static bool IsInitialized();
static void SetBlendFunc(nzBlendFunc src, nzBlendFunc dest);
static void SetBlendFunc(nzBlendFunc srcBlend, nzBlendFunc destBlend);
static void SetClearColor(const NzColor& color);
static void SetClearColor(nzUInt8 r, nzUInt8 g, nzUInt8 b, nzUInt8 a = 255);
static void SetClearDepth(double depth);
static void SetClearStencil(unsigned int value);
static void SetDepthFunc(nzRendererComparison compareFunc);
static void SetFaceCulling(nzFaceCulling cullingMode);
static void SetFaceFilling(nzFaceFilling fillingMode);
static bool SetIndexBuffer(const NzIndexBuffer* indexBuffer);

View File

@@ -53,7 +53,6 @@
#include <Nazara/Utility/StaticMesh.hpp>
#include <Nazara/Utility/SubMesh.hpp>
#include <Nazara/Utility/Utility.hpp>
#include <Nazara/Utility/Vertex.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/VertexStruct.hpp>

View File

@@ -45,6 +45,7 @@ class NAZARA_API NzAnimation : public NzResource
void Destroy();
unsigned int GetFrameCount() const;
unsigned int GetJointCount() const;
NzSequence* GetSequence(const NzString& sequenceName);
NzSequence* GetSequence(unsigned int index);
const NzSequence* GetSequence(const NzString& sequenceName) const;

View File

@@ -15,7 +15,7 @@ class NzSkeleton;
struct NzVertexWeight
{
std::vector<unsigned int> weights;
std::vector<unsigned int> weights; ///FIXME: Niveau fragmentation mémoire ça doit pas être génial
};
struct NzWeight