mesh base

This commit is contained in:
h4570
2022-07-18 20:08:57 +02:00
parent ecfaef1b85
commit c56c3d76db
24 changed files with 86 additions and 27 deletions
+1
View File
@@ -12,6 +12,7 @@
#include "math/vec4.hpp" #include "math/vec4.hpp"
#include "math/math.hpp" #include "math/math.hpp"
#include <string>
namespace Tyra { namespace Tyra {
+2
View File
@@ -10,6 +10,8 @@
#pragma once #pragma once
#include "./vec4.hpp"
#include <string>
namespace Tyra { namespace Tyra {
-1
View File
@@ -15,7 +15,6 @@ extern "C" {
#include <tamtypes.h> #include <tamtypes.h>
} }
#include <iomanip>
#include <string> #include <string>
#include "math/math.hpp" #include "math/math.hpp"
-3
View File
@@ -16,9 +16,6 @@ extern "C" {
} }
#include <math3d.h> #include <math3d.h>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <string> #include <string>
#include "math/math.hpp" #include "math/math.hpp"
@@ -14,26 +14,16 @@
#include "./dynamic_mesh_frame.hpp" #include "./dynamic_mesh_frame.hpp"
#include "./dynamic_mesh_material_frame.hpp" #include "./dynamic_mesh_material_frame.hpp"
#include "./dynamic_mesh_anim_state.hpp" #include "./dynamic_mesh_anim_state.hpp"
#include "../mesh.hpp"
namespace Tyra { namespace Tyra {
class DynamicMesh { class DynamicMesh : public Mesh {
public: public:
explicit DynamicMesh(const MeshBuilderData& data); explicit DynamicMesh(const MeshBuilderData& data);
explicit DynamicMesh(const DynamicMesh& mesh); explicit DynamicMesh(const DynamicMesh& mesh);
~DynamicMesh(); ~DynamicMesh();
/** Translation matrix */
M4x4 translation;
/** Rotation matrix */
M4x4 rotation;
/** Scale matrix */
M4x4 scale;
const u32& getId() const { return id; }
const u8& isMother() const { return _isMother; } const u8& isMother() const { return _isMother; }
/** Get position from translation matrix */ /** Get position from translation matrix */
@@ -113,7 +103,7 @@ class DynamicMesh {
void initMesh(); void initMesh();
DynamicMeshAnimState animState; DynamicMeshAnimState animState;
u8 _isMother; u8 _isMother;
u32 id, framesCount, materialsCount; u32 framesCount, materialsCount;
DynamicMeshFrame** frames; DynamicMeshFrame** frames;
DynamicMeshMaterial** materials; DynamicMeshMaterial** materials;
}; };
+38
View File
@@ -0,0 +1,38 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "math/m4x4.hpp"
#include <tamtypes.h>
namespace Tyra {
class Mesh {
public:
explicit Mesh();
~Mesh();
/** Translation matrix */
M4x4 translation;
/** Rotation matrix */
M4x4 rotation;
/** Scale matrix */
M4x4 scale;
const u32& getId() const { return id; }
protected:
u32 id;
};
} // namespace Tyra
@@ -12,7 +12,6 @@
#include <math3d.h> #include <math3d.h>
#include <string> #include <string>
#include <sstream>
#include "debug/debug.hpp" #include "debug/debug.hpp"
#include "./bag/packaging/stapip_bag_package.hpp" #include "./bag/packaging/stapip_bag_package.hpp"
#include "./bag/stapip_bag.hpp" #include "./bag/stapip_bag.hpp"
@@ -11,6 +11,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <string>
#include "./core_bbox_frustum.hpp" #include "./core_bbox_frustum.hpp"
#include "math/m4x4.hpp" #include "math/m4x4.hpp"
#include "math/plane.hpp" #include "math/plane.hpp"
@@ -10,7 +10,7 @@
#pragma once #pragma once
#include <sstream> #include <string>
#include "renderer/renderer_settings.hpp" #include "renderer/renderer_settings.hpp"
#include "./camera_info_3d.hpp" #include "./camera_info_3d.hpp"
#include "math/plane.hpp" #include "math/plane.hpp"
+1 -1
View File
@@ -9,7 +9,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string> #include <iomanip>
#include <sstream> #include <sstream>
#include "math/m4x4.hpp" #include "math/m4x4.hpp"
+2 -1
View File
@@ -8,8 +8,9 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com> # Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/ */
#include <string>
#include "math/vec4.hpp" #include "math/vec4.hpp"
#include <iomanip>
#include <sstream>
#include "math/plane.hpp" #include "math/plane.hpp"
namespace Tyra { namespace Tyra {
+1
View File
@@ -9,6 +9,7 @@
*/ */
#include "math/vec2.hpp" #include "math/vec2.hpp"
#include <iomanip>
namespace Tyra { namespace Tyra {
+3
View File
@@ -9,6 +9,9 @@
*/ */
#include "math/vec4.hpp" #include "math/vec4.hpp"
#include <iomanip>
#include <cmath>
#include <sstream>
namespace Tyra { namespace Tyra {
@@ -16,8 +16,6 @@
namespace Tyra { namespace Tyra {
DynamicMesh::DynamicMesh(const MeshBuilderData& data) { DynamicMesh::DynamicMesh(const MeshBuilderData& data) {
id = rand() % 1000000;
framesCount = data.framesCount; framesCount = data.framesCount;
TYRA_ASSERT(framesCount > 0, "Frames count must be greater than 0"); TYRA_ASSERT(framesCount > 0, "Frames count must be greater than 0");
@@ -42,8 +40,6 @@ DynamicMesh::DynamicMesh(const MeshBuilderData& data) {
} }
DynamicMesh::DynamicMesh(const DynamicMesh& mesh) { DynamicMesh::DynamicMesh(const DynamicMesh& mesh) {
id = rand() % 1000000;
framesCount = mesh.framesCount; framesCount = mesh.framesCount;
materialsCount = mesh.materialsCount; materialsCount = mesh.materialsCount;
@@ -11,6 +11,7 @@
#include "debug/debug.hpp" #include "debug/debug.hpp"
#include <tamtypes.h> #include <tamtypes.h>
#include <iomanip>
#include <string> #include <string>
#include "math/vec4.hpp" #include "math/vec4.hpp"
#include "renderer/models/color.hpp" #include "renderer/models/color.hpp"
@@ -12,6 +12,7 @@
#include <tamtypes.h> #include <tamtypes.h>
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <iomanip>
#include "renderer/3d/mesh/dynamic/dynamic_mesh_material.hpp" #include "renderer/3d/mesh/dynamic/dynamic_mesh_material.hpp"
namespace Tyra { namespace Tyra {
+20
View File
@@ -0,0 +1,20 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/mesh/mesh.hpp"
namespace Tyra {
Mesh::Mesh() { id = rand() % 1000000; }
Mesh::~Mesh() {}
} // namespace Tyra
@@ -11,6 +11,7 @@
#include <tamtypes.h> #include <tamtypes.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip>
#include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_package.hpp" #include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_package.hpp"
namespace Tyra { namespace Tyra {
@@ -11,6 +11,7 @@
#include <tamtypes.h> #include <tamtypes.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip>
#include <vector> #include <vector>
#include "debug/debug.hpp" #include "debug/debug.hpp"
#include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_packages_bbox.hpp" #include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_packages_bbox.hpp"
@@ -8,8 +8,9 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com> # Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/ */
#include <string>
#include "renderer/3d/pipeline/static/core/bag/stapip_bag.hpp" #include "renderer/3d/pipeline/static/core/bag/stapip_bag.hpp"
#include <sstream>
#include <iomanip>
namespace Tyra { namespace Tyra {
@@ -9,6 +9,8 @@
*/ */
#include "renderer/3d/pipeline/static/core/stapip_qbuffer.hpp" #include "renderer/3d/pipeline/static/core/stapip_qbuffer.hpp"
#include <sstream>
#include <iomanip>
namespace Tyra { namespace Tyra {
@@ -10,6 +10,7 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip>
#include "renderer/core/3d/bbox/core_bbox.hpp" #include "renderer/core/3d/bbox/core_bbox.hpp"
namespace Tyra { namespace Tyra {
@@ -8,8 +8,9 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com> # Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/ */
#include <string>
#include "debug/debug.hpp" #include "debug/debug.hpp"
#include <iomanip>
#include <sstream>
#include "renderer/core/3d/renderer_3d_frustum_planes.hpp" #include "renderer/core/3d/renderer_3d_frustum_planes.hpp"
namespace Tyra { namespace Tyra {
+2
View File
@@ -9,6 +9,8 @@
*/ */
#include "renderer/models/color.hpp" #include "renderer/models/color.hpp"
#include <sstream>
#include <iomanip>
namespace Tyra { namespace Tyra {