Moved AxisAlignedBox to mathematic module

Former-commit-id: 2cb5b151941a431b5c12457f0decf7b39195052d
This commit is contained in:
Lynix
2013-02-19 12:32:11 +01:00
parent d56900fe01
commit add363a290
21 changed files with 762 additions and 399 deletions

View File

@@ -1,61 +0,0 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#ifndef NAZARA_AXISALIGNEDBOX_HPP
#define NAZARA_AXISALIGNEDBOX_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Math/Cube.hpp>
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Utility/Enums.hpp>
class NAZARA_API NzAxisAlignedBox
{
public:
NzAxisAlignedBox();
NzAxisAlignedBox(const NzCubef& cube);
NzAxisAlignedBox(const NzVector3f& vec1, const NzVector3f& vec2);
NzAxisAlignedBox(nzExtend extend);
bool Contains(const NzAxisAlignedBox& box);
bool Contains(const NzVector3f& vector);
void ExtendTo(const NzAxisAlignedBox& box);
void ExtendTo(const NzVector3f& vector);
NzVector3f GetCorner(nzCorner corner) const;
NzCubef GetCube() const;
nzExtend GetExtend() const;
NzVector3f GetMaximum() const;
NzVector3f GetMinimum() const;
bool IsFinite() const;
bool IsInfinite() const;
bool IsNull() const;
void SetInfinite();
void SetExtends(const NzVector3f& vec1, const NzVector3f& vec2);
void SetNull();
NzString ToString() const;
void Transform(const NzMatrix4f& matrix, bool applyTranslation = true);
operator NzString() const;
static NzAxisAlignedBox Lerp(const NzAxisAlignedBox& from, const NzAxisAlignedBox& to, float interpolation);
static const NzAxisAlignedBox Infinite;
static const NzAxisAlignedBox Null;
private:
nzExtend m_extend;
NzCubef m_cube;
};
NAZARA_API std::ostream& operator<<(std::ostream& out, const NzAxisAlignedBox& aabb);
#endif // NAZARA_AXISALIGNEDBOX_HPP

View File

@@ -128,15 +128,6 @@ enum nzEventType
nzEventType_Max = nzEventType_TextEntered
};
enum nzExtend
{
nzExtend_Finite,
nzExtend_Infinite,
nzExtend_Null,
nzExtend_Max = nzExtend_Null
};
enum nzImageType
{
nzImageType_1D,

View File

@@ -28,7 +28,7 @@ class NAZARA_API NzKeyframeMesh final : public NzSubMesh
void GenerateAABBs();
const NzAxisAlignedBox& GetAABB() const override;
const NzAxisAlignedBoxf& GetAABB() const override;
nzAnimationType GetAnimationType() const override;
unsigned int GetFrameCount() const;
const NzIndexBuffer* GetIndexBuffer() const override;
@@ -46,7 +46,7 @@ class NAZARA_API NzKeyframeMesh final : public NzSubMesh
bool IsAnimated() const override;
bool IsValid();
void SetAABB(unsigned int frameIndex, const NzAxisAlignedBox& aabb);
void SetAABB(unsigned int frameIndex, const NzAxisAlignedBoxf& aabb);
void SetIndexBuffer(const NzIndexBuffer* indexBuffer);
void SetNormal(unsigned int frameIndex, unsigned int vertexIndex, const NzVector3f& normal);
void SetPosition(unsigned int frameIndex, unsigned int vertexIndex, const NzVector3f& position);

View File

@@ -13,7 +13,7 @@
#include <Nazara/Core/ResourceListener.hpp>
#include <Nazara/Core/ResourceLoader.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Utility/AxisAlignedBox.hpp>
#include <Nazara/Math/AxisAlignedBox.hpp>
#include <Nazara/Utility/Skeleton.hpp>
#include <Nazara/Utility/SubMesh.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
@@ -59,7 +59,7 @@ class NAZARA_API NzMesh : public NzResource, NzResourceListener
void GenerateNormalsAndTangents();
void GenerateTangents();
const NzAxisAlignedBox& GetAABB() const;
const NzAxisAlignedBoxf& GetAABB() const;
NzString GetAnimation() const;
nzAnimationType GetAnimationType() const;
unsigned int GetJointCount() const;

View File

@@ -37,7 +37,7 @@ class NAZARA_API NzSkeletalMesh final : public NzSubMesh
void Finish();
const NzAxisAlignedBox& GetAABB() const;
const NzAxisAlignedBoxf& GetAABB() const;
nzAnimationType GetAnimationType() const final;
void* GetBindPoseBuffer();
const void* GetBindPoseBuffer() const;

View File

@@ -8,7 +8,7 @@
#define NAZARA_SKELETON_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/AxisAlignedBox.hpp>
#include <Nazara/Math/AxisAlignedBox.hpp>
#include <Nazara/Utility/Joint.hpp>
#include <vector>
@@ -26,7 +26,7 @@ class NAZARA_API NzSkeleton
bool Create(unsigned int jointCount);
void Destroy();
const NzAxisAlignedBox& GetAABB() const;
const NzAxisAlignedBoxf& GetAABB() const;
NzJoint* GetJoint(const NzString& jointName);
NzJoint* GetJoint(unsigned int index);
const NzJoint* GetJoint(const NzString& jointName) const;

View File

@@ -24,7 +24,7 @@ class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
bool GenerateAABB();
const NzAxisAlignedBox& GetAABB() const override;
const NzAxisAlignedBoxf& GetAABB() const override;
nzAnimationType GetAnimationType() const final;
const NzIndexBuffer* GetIndexBuffer() const override;
NzVertexBuffer* GetVertexBuffer() override;
@@ -33,13 +33,13 @@ class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
bool IsAnimated() const final;
bool IsValid() const;
void SetAABB(const NzAxisAlignedBox& aabb);
void SetAABB(const NzAxisAlignedBoxf& aabb);
void SetIndexBuffer(const NzIndexBuffer* indexBuffer);
private:
void OnResourceReleased(const NzResource* resource, int index) override;
NzAxisAlignedBox m_aabb;
NzAxisAlignedBoxf m_aabb;
const NzIndexBuffer* m_indexBuffer = nullptr;
NzVertexBuffer* m_vertexBuffer = nullptr;
};

View File

@@ -9,7 +9,7 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Utility/AxisAlignedBox.hpp>
#include <Nazara/Math/AxisAlignedBox.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
@@ -27,7 +27,7 @@ class NAZARA_API NzSubMesh : public NzResource
virtual void Finish() = 0; ///DOC: Mets le mesh dans sa position d'origine et calcule son AABB
virtual const NzAxisAlignedBox& GetAABB() const = 0;
virtual const NzAxisAlignedBoxf& GetAABB() const = 0;
virtual nzAnimationType GetAnimationType() const = 0;
virtual const NzIndexBuffer* GetIndexBuffer() const = 0;
unsigned int GetMaterialIndex() const;