Added Primitive(List)
Former-commit-id: 3080a1846616fb2dac25e6d341c8a9220f406de4
This commit is contained in:
@@ -33,6 +33,15 @@ enum nzPlugin
|
||||
nzPlugin_FreeType
|
||||
};
|
||||
|
||||
enum nzPrimitiveType
|
||||
{
|
||||
nzPrimitiveType_Cube,
|
||||
nzPrimitiveType_Plane,
|
||||
nzPrimitiveType_Sphere,
|
||||
|
||||
nzPrimitiveType_Max = nzPrimitiveType_Sphere
|
||||
};
|
||||
|
||||
enum nzProcessorCap
|
||||
{
|
||||
nzProcessorCap_x64,
|
||||
@@ -72,6 +81,15 @@ enum nzProcessorVendor
|
||||
nzProcessorVendor_Max = nzProcessorVendor_Vortex
|
||||
};
|
||||
|
||||
enum nzSphereType
|
||||
{
|
||||
nzSphereType_Cubic,
|
||||
nzSphereType_Ico,
|
||||
nzSphereType_UV,
|
||||
|
||||
nzSphereType_Max = nzSphereType_UV
|
||||
};
|
||||
|
||||
enum nzStreamOptionFlags
|
||||
{
|
||||
nzStreamOption_None = 0x0,
|
||||
|
||||
71
include/Nazara/Core/Primitive.hpp
Normal file
71
include/Nazara/Core/Primitive.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2013 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PRIMITIVE_HPP
|
||||
#define NAZARA_PRIMITIVE_HPP
|
||||
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Math/Cube.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Plane.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
struct NzPrimitive
|
||||
{
|
||||
nzPrimitiveType type;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
NzCubef cube;
|
||||
NzMatrix4f matrix;
|
||||
NzVector3ui subdivision;
|
||||
}
|
||||
cube;
|
||||
|
||||
struct
|
||||
{
|
||||
NzVector2f size;
|
||||
NzVector2ui subdivision;
|
||||
NzVector3f normal;
|
||||
NzVector3f position;
|
||||
}
|
||||
plane;
|
||||
|
||||
struct
|
||||
{
|
||||
nzSphereType type;
|
||||
NzMatrix4f matrix;
|
||||
float size;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned int subdivision;
|
||||
}
|
||||
cubic;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int recursionLevel;
|
||||
}
|
||||
ico;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int slices;
|
||||
unsigned int stacks;
|
||||
}
|
||||
uv;
|
||||
};
|
||||
}
|
||||
sphere;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // NAZARA_PRIMITIVE_HPP
|
||||
42
include/Nazara/Core/PrimitiveList.hpp
Normal file
42
include/Nazara/Core/PrimitiveList.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2013 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PRIMITIVELIST_HPP
|
||||
#define NAZARA_PRIMITIVELIST_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Primitive.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
|
||||
class NAZARA_API NzPrimitiveList
|
||||
{
|
||||
public:
|
||||
NzPrimitiveList() = default;
|
||||
~NzPrimitiveList() = default;
|
||||
|
||||
void AddCube(const NzCubef& box, const NzVector3ui& subdivision = NzVector3ui(0U), const NzMatrix4f& matrix = NzMatrix4f::Identity());
|
||||
void AddCube(const NzCubef& box, const NzVector3ui& subdivision, const NzVector3f& position, const NzQuaternionf& rotation = NzQuaternionf::Identity());
|
||||
void AddCubicSphere(float size, unsigned int subdivision = 4, const NzMatrix4f& matrix = NzMatrix4f::Identity());
|
||||
void AddCubicSphere(float size, unsigned int subdivision, const NzVector3f& position, const NzQuaternionf& rotation = NzQuaternionf::Identity());
|
||||
void AddIcoSphere(float size, unsigned int recursionLevel = 1, const NzMatrix4f& matrix = NzMatrix4f::Identity());
|
||||
void AddIcoSphere(float size, unsigned int recursionLevel, const NzVector3f& position, const NzQuaternionf& rotation = NzQuaternionf::Identity());
|
||||
void AddPlane(const NzPlanef& plane, const NzVector2f& size, const NzVector2ui& subdivision = NzVector2ui(0U));
|
||||
void AddPlane(const NzVector3f& position, const NzVector3f& normal, const NzVector2f& size, const NzVector2ui& subdivision = NzVector2ui(0U));
|
||||
void AddUVSphere(float size, unsigned int slices = 4, unsigned int stacks = 4, const NzMatrix4f& matrix = NzMatrix4f::Identity());
|
||||
void AddUVSphere(float size, unsigned int slices, unsigned int stacks, const NzVector3f& position, const NzQuaternionf& rotation = NzQuaternionf::Identity());
|
||||
|
||||
NzPrimitive& GetPrimitive(unsigned int i);
|
||||
const NzPrimitive& GetPrimitive(unsigned int i) const;
|
||||
unsigned int GetSize() const;
|
||||
|
||||
NzPrimitive& operator()(unsigned int i);
|
||||
const NzPrimitive& operator()(unsigned int i) const;
|
||||
|
||||
private:
|
||||
std::vector<NzPrimitive> m_primitives;
|
||||
};
|
||||
|
||||
#endif // NAZARA_PRIMITIVELIST_HPP
|
||||
Reference in New Issue
Block a user