mesh -> dynamicmesh
This commit is contained in:
+14
-14
@@ -11,17 +11,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||||
#include "./mesh_frame.hpp"
|
#include "./dynamic_mesh_frame.hpp"
|
||||||
#include "./mesh_material_frame.hpp"
|
#include "./dynamic_mesh_material_frame.hpp"
|
||||||
#include "./mesh_anim_state.hpp"
|
#include "./dynamic_mesh_anim_state.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class Mesh {
|
class DynamicMesh {
|
||||||
public:
|
public:
|
||||||
explicit Mesh(const MeshBuilderData& data);
|
explicit DynamicMesh(const MeshBuilderData& data);
|
||||||
explicit Mesh(const Mesh& mesh);
|
explicit DynamicMesh(const DynamicMesh& mesh);
|
||||||
~Mesh();
|
~DynamicMesh();
|
||||||
|
|
||||||
/** Translation matrix */
|
/** Translation matrix */
|
||||||
M4x4 translation;
|
M4x4 translation;
|
||||||
@@ -47,17 +47,17 @@ class Mesh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns material, which is a mesh "subgroup". */
|
/** Returns material, which is a mesh "subgroup". */
|
||||||
MeshMaterial* getMaterial(const u32& i) const { return materials[i]; }
|
DynamicMeshMaterial* getMaterial(const u32& i) const { return materials[i]; }
|
||||||
|
|
||||||
const u32& getMaterialsCount() const { return materialsCount; }
|
const u32& getMaterialsCount() const { return materialsCount; }
|
||||||
|
|
||||||
const MeshAnimState& getAnimState() const { return animState; }
|
const DynamicMeshAnimState& getAnimState() const { return animState; }
|
||||||
|
|
||||||
/** Count of all vertices. */
|
/** Count of all vertices. */
|
||||||
u32 getVertexCount() { return frames[0]->getVertexCount(); }
|
u32 getVertexCount() { return frames[0]->getVertexCount(); }
|
||||||
|
|
||||||
/** Returns single frame. */
|
/** Returns single frame. */
|
||||||
MeshFrame* getFrame(const u32& i) const { return frames[i]; }
|
DynamicMeshFrame* getFrame(const u32& i) const { return frames[i]; }
|
||||||
|
|
||||||
/** Count of frames. Static object (not animated) will have only 1 frame. */
|
/** Count of frames. Static object (not animated) will have only 1 frame. */
|
||||||
const u32& getFramesCount() const { return framesCount; }
|
const u32& getFramesCount() const { return framesCount; }
|
||||||
@@ -78,7 +78,7 @@ class Mesh {
|
|||||||
// * Returns material, which is a mesh "subgroup".
|
// * Returns material, which is a mesh "subgroup".
|
||||||
// * NULL if not found.
|
// * NULL if not found.
|
||||||
// */
|
// */
|
||||||
// MeshMaterial* getMaterialById(const u32& t_id) const;
|
// DynamicMeshMaterial* getMaterialById(const u32& t_id) const;
|
||||||
|
|
||||||
/** @returns bounding box object of current frame. */
|
/** @returns bounding box object of current frame. */
|
||||||
const BBox& getCurrentBoundingBox() const {
|
const BBox& getCurrentBoundingBox() const {
|
||||||
@@ -111,11 +111,11 @@ class Mesh {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void initMesh();
|
void initMesh();
|
||||||
MeshAnimState animState;
|
DynamicMeshAnimState animState;
|
||||||
u8 _isMother;
|
u8 _isMother;
|
||||||
u32 id, framesCount, materialsCount;
|
u32 id, framesCount, materialsCount;
|
||||||
MeshFrame** frames;
|
DynamicMeshFrame** frames;
|
||||||
MeshMaterial** materials;
|
DynamicMeshMaterial** materials;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
+1
-1
@@ -25,6 +25,6 @@ typedef struct {
|
|||||||
u32 animType;
|
u32 animType;
|
||||||
u32 currentFrame;
|
u32 currentFrame;
|
||||||
u32 nextFrame;
|
u32 nextFrame;
|
||||||
} MeshAnimState;
|
} DynamicMeshAnimState;
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
+5
-5
@@ -10,17 +10,17 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "renderer/3d/mesh/mesh_material.hpp"
|
#include "./dynamic_mesh_material.hpp"
|
||||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||||
#include "renderer/3d/bbox/bbox.hpp"
|
#include "renderer/3d/bbox/bbox.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class MeshFrame {
|
class DynamicMeshFrame {
|
||||||
public:
|
public:
|
||||||
explicit MeshFrame(const MeshBuilderData& data, const u32& index);
|
explicit DynamicMeshFrame(const MeshBuilderData& data, const u32& index);
|
||||||
explicit MeshFrame(const MeshFrame& frame);
|
explicit DynamicMeshFrame(const DynamicMeshFrame& frame);
|
||||||
~MeshFrame();
|
~DynamicMeshFrame();
|
||||||
|
|
||||||
const u32& getId() const { return id; }
|
const u32& getId() const { return id; }
|
||||||
const u32& getVertexCount() const { return vertexCount; }
|
const u32& getVertexCount() const { return vertexCount; }
|
||||||
+8
-7
@@ -12,15 +12,16 @@
|
|||||||
|
|
||||||
#include "debug/debug.hpp"
|
#include "debug/debug.hpp"
|
||||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||||
#include "renderer/3d/mesh/mesh_material_frame.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh_material_frame.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class MeshMaterial {
|
class DynamicMeshMaterial {
|
||||||
public:
|
public:
|
||||||
explicit MeshMaterial(const MeshBuilderData& data, const u32& materialIndex);
|
explicit DynamicMeshMaterial(const MeshBuilderData& data,
|
||||||
explicit MeshMaterial(const MeshMaterial& material);
|
const u32& materialIndex);
|
||||||
~MeshMaterial();
|
explicit DynamicMeshMaterial(const DynamicMeshMaterial& material);
|
||||||
|
~DynamicMeshMaterial();
|
||||||
|
|
||||||
Color singleColor;
|
Color singleColor;
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ class MeshMaterial {
|
|||||||
u32* getTextureCoordFaces() const { return textureCoordFaces; }
|
u32* getTextureCoordFaces() const { return textureCoordFaces; }
|
||||||
u32* getNormalFaces() const { return normalFaces; }
|
u32* getNormalFaces() const { return normalFaces; }
|
||||||
u32* getColorFaces() const { return normalFaces; }
|
u32* getColorFaces() const { return normalFaces; }
|
||||||
MeshMaterialFrame* getFrames() const { return *frames; }
|
DynamicMeshMaterialFrame* getFrames() const { return *frames; }
|
||||||
|
|
||||||
const BBox& getBBox(const u32& frame) const;
|
const BBox& getBBox(const u32& frame) const;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ class MeshMaterial {
|
|||||||
std::string getPrint(const char* name = nullptr) const;
|
std::string getPrint(const char* name = nullptr) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MeshMaterialFrame** frames;
|
DynamicMeshMaterialFrame** frames;
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
u8 _isMother, singleColorFlag;
|
u8 _isMother, singleColorFlag;
|
||||||
+6
-5
@@ -14,12 +14,13 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class MeshMaterialFrame {
|
class DynamicMeshMaterialFrame {
|
||||||
public:
|
public:
|
||||||
explicit MeshMaterialFrame(const MeshBuilderData& data, const u32& frameIndex,
|
explicit DynamicMeshMaterialFrame(const MeshBuilderData& data,
|
||||||
const u32& materialIndex);
|
const u32& frameIndex,
|
||||||
explicit MeshMaterialFrame(const MeshMaterialFrame& frame);
|
const u32& materialIndex);
|
||||||
~MeshMaterialFrame();
|
explicit DynamicMeshMaterialFrame(const DynamicMeshMaterialFrame& frame);
|
||||||
|
~DynamicMeshMaterialFrame();
|
||||||
|
|
||||||
const u32& getId() const { return id; }
|
const u32& getId() const { return id; }
|
||||||
const u8& isMother() const { return _isMother; }
|
const u8& isMother() const { return _isMother; }
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "../renderer_3d_pipeline.hpp"
|
#include "../renderer_3d_pipeline.hpp"
|
||||||
#include "./stapip_options.hpp"
|
#include "./stapip_options.hpp"
|
||||||
#include "renderer/core/renderer_core.hpp"
|
#include "renderer/core/renderer_core.hpp"
|
||||||
#include "renderer/3d/mesh/mesh.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
#include "./core/static_pipeline_core.hpp"
|
#include "./core/static_pipeline_core.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
@@ -32,26 +32,31 @@ class Stapipeline : public Renderer3DPipeline {
|
|||||||
* Render 3D data via "meshes".
|
* Render 3D data via "meshes".
|
||||||
* This render() method is a bridge to core.renderer3D.render() method.
|
* This render() method is a bridge to core.renderer3D.render() method.
|
||||||
*/
|
*/
|
||||||
void render(Mesh* mesh, const StapipOptions* options = nullptr);
|
void render(DynamicMesh* mesh, const StapipOptions* options = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StapipelineCore core;
|
StapipelineCore core;
|
||||||
RendererCore* rendererCore;
|
RendererCore* rendererCore;
|
||||||
Vec4* colorsCache;
|
Vec4* colorsCache;
|
||||||
|
|
||||||
void addVertices(Mesh* mesh, MeshMaterial* material, StapipBag* bag,
|
void addVertices(DynamicMesh* mesh, DynamicMeshMaterial* material,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
StapipBag* bag, DynamicMeshFrame* frameFrom,
|
||||||
StapipInfoBag* getInfoBag(Mesh* mesh, const StapipOptions* options,
|
DynamicMeshFrame* frameTo) const;
|
||||||
|
StapipInfoBag* getInfoBag(DynamicMesh* mesh, const StapipOptions* options,
|
||||||
M4x4* model) const;
|
M4x4* model) const;
|
||||||
StapipColorBag* getColorBag(Mesh* mesh, MeshMaterial* material,
|
StapipColorBag* getColorBag(DynamicMesh* mesh, DynamicMeshMaterial* material,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
DynamicMeshFrame* frameFrom,
|
||||||
StapipTextureBag* getTextureBag(Mesh* mesh, MeshMaterial* material,
|
DynamicMeshFrame* frameTo) const;
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo);
|
StapipTextureBag* getTextureBag(DynamicMesh* mesh,
|
||||||
StapipLightingBag* getLightingBag(Mesh* mesh, MeshMaterial* material,
|
DynamicMeshMaterial* material,
|
||||||
M4x4* model, MeshFrame* frameFrom,
|
DynamicMeshFrame* frameFrom,
|
||||||
MeshFrame* frameTo,
|
DynamicMeshFrame* frameTo);
|
||||||
|
StapipLightingBag* getLightingBag(DynamicMesh* mesh,
|
||||||
|
DynamicMeshMaterial* material, M4x4* model,
|
||||||
|
DynamicMeshFrame* frameFrom,
|
||||||
|
DynamicMeshFrame* frameTo,
|
||||||
const StapipOptions* options) const;
|
const StapipOptions* options) const;
|
||||||
void deallocDrawBags(StapipBag* bag, MeshMaterial* material) const;
|
void deallocDrawBags(StapipBag* bag, DynamicMeshMaterial* material) const;
|
||||||
|
|
||||||
void setLightingColorsCache(StapipLightingOptions* lightingOptions);
|
void setLightingColorsCache(StapipLightingOptions* lightingOptions);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <draw_buffers.h>
|
#include <draw_buffers.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "./models/texture.hpp"
|
#include "./models/texture.hpp"
|
||||||
#include "renderer/3d/mesh/mesh.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
#include "loaders/texture/base/texture_loader_selector.hpp"
|
#include "loaders/texture/base/texture_loader_selector.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -93,12 +93,13 @@ class TextureRepository {
|
|||||||
/**
|
/**
|
||||||
* Add linked textures in given path for mesh material names.
|
* Add linked textures in given path for mesh material names.
|
||||||
*/
|
*/
|
||||||
void addByMesh(Mesh* mesh, const char* directory, const char* extension);
|
void addByMesh(DynamicMesh* mesh, const char* directory,
|
||||||
|
const char* extension);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add linked textures in given path for mesh material names.
|
* Add linked textures in given path for mesh material names.
|
||||||
*/
|
*/
|
||||||
inline void addByMesh(Mesh* mesh, const std::string& directory,
|
inline void addByMesh(DynamicMesh* mesh, const std::string& directory,
|
||||||
const char* extension) {
|
const char* extension) {
|
||||||
addByMesh(mesh, directory.c_str(), extension);
|
addByMesh(mesh, directory.c_str(), extension);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-18
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
#include "math/m4x4.hpp"
|
#include "math/m4x4.hpp"
|
||||||
#include "renderer/3d/mesh/mesh.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
Mesh::Mesh(const MeshBuilderData& data) {
|
DynamicMesh::DynamicMesh(const MeshBuilderData& data) {
|
||||||
id = rand() % 1000000;
|
id = rand() % 1000000;
|
||||||
|
|
||||||
framesCount = data.framesCount;
|
framesCount = data.framesCount;
|
||||||
@@ -24,14 +24,14 @@ Mesh::Mesh(const MeshBuilderData& data) {
|
|||||||
materialsCount = data.materialsCount;
|
materialsCount = data.materialsCount;
|
||||||
TYRA_ASSERT(materialsCount > 0, "Materials count must be greater than 0");
|
TYRA_ASSERT(materialsCount > 0, "Materials count must be greater than 0");
|
||||||
|
|
||||||
frames = new MeshFrame*[framesCount];
|
frames = new DynamicMeshFrame*[framesCount];
|
||||||
for (u32 i = 0; i < framesCount; i++) {
|
for (u32 i = 0; i < framesCount; i++) {
|
||||||
frames[i] = new MeshFrame(data, i);
|
frames[i] = new DynamicMeshFrame(data, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
materials = new MeshMaterial*[materialsCount];
|
materials = new DynamicMeshMaterial*[materialsCount];
|
||||||
for (u32 i = 0; i < materialsCount; i++) {
|
for (u32 i = 0; i < materialsCount; i++) {
|
||||||
materials[i] = new MeshMaterial(data, i);
|
materials[i] = new DynamicMeshMaterial(data, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
translation.translate(Vec4(0.0F, 0.0F, 0.0F, 1.0F));
|
translation.translate(Vec4(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
@@ -41,20 +41,20 @@ Mesh::Mesh(const MeshBuilderData& data) {
|
|||||||
_isMother = true;
|
_isMother = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::Mesh(const Mesh& mesh) {
|
DynamicMesh::DynamicMesh(const DynamicMesh& mesh) {
|
||||||
id = rand() % 1000000;
|
id = rand() % 1000000;
|
||||||
|
|
||||||
framesCount = mesh.framesCount;
|
framesCount = mesh.framesCount;
|
||||||
materialsCount = mesh.materialsCount;
|
materialsCount = mesh.materialsCount;
|
||||||
|
|
||||||
frames = new MeshFrame*[framesCount];
|
frames = new DynamicMeshFrame*[framesCount];
|
||||||
for (u32 i = 0; i < framesCount; i++) {
|
for (u32 i = 0; i < framesCount; i++) {
|
||||||
frames[i] = new MeshFrame(*mesh.frames[i]);
|
frames[i] = new DynamicMeshFrame(*mesh.frames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
materials = new MeshMaterial*[materialsCount];
|
materials = new DynamicMeshMaterial*[materialsCount];
|
||||||
for (u32 i = 0; i < materialsCount; i++) {
|
for (u32 i = 0; i < materialsCount; i++) {
|
||||||
materials[i] = new MeshMaterial(*mesh.materials[i]);
|
materials[i] = new DynamicMeshMaterial(*mesh.materials[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
translation.translate(Vec4(0.0F, 0.0F, 0.0F, 1.0F));
|
translation.translate(Vec4(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
@@ -64,7 +64,7 @@ Mesh::Mesh(const Mesh& mesh) {
|
|||||||
_isMother = false;
|
_isMother = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::~Mesh() {
|
DynamicMesh::~DynamicMesh() {
|
||||||
for (u32 i = 0; i < framesCount; i++) {
|
for (u32 i = 0; i < framesCount; i++) {
|
||||||
delete frames[i];
|
delete frames[i];
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,11 @@ Mesh::~Mesh() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
M4x4 Mesh::getModelMatrix() const { return translation * rotation * scale; }
|
M4x4 DynamicMesh::getModelMatrix() const {
|
||||||
|
return translation * rotation * scale;
|
||||||
|
}
|
||||||
|
|
||||||
void Mesh::initMesh() {
|
void DynamicMesh::initMesh() {
|
||||||
animState.startFrame = 0;
|
animState.startFrame = 0;
|
||||||
animState.endFrame = 0;
|
animState.endFrame = 0;
|
||||||
animState.interpolation = 0.0F;
|
animState.interpolation = 0.0F;
|
||||||
@@ -91,7 +93,8 @@ void Mesh::initMesh() {
|
|||||||
animState.speed = 0.1F;
|
animState.speed = 0.1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::playAnimation(const u32& t_startFrame, const u32& t_endFrame) {
|
void DynamicMesh::playAnimation(const u32& t_startFrame,
|
||||||
|
const u32& t_endFrame) {
|
||||||
TYRA_ASSERT(framesCount > 0,
|
TYRA_ASSERT(framesCount > 0,
|
||||||
"Cant play animation, because no mesh data was loaded!");
|
"Cant play animation, because no mesh data was loaded!");
|
||||||
TYRA_ASSERT(framesCount != 1,
|
TYRA_ASSERT(framesCount != 1,
|
||||||
@@ -107,8 +110,8 @@ void Mesh::playAnimation(const u32& t_startFrame, const u32& t_endFrame) {
|
|||||||
animState.nextFrame = t_startFrame;
|
animState.nextFrame = t_startFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::playAnimation(const u32& t_startFrame, const u32& t_endFrame,
|
void DynamicMesh::playAnimation(const u32& t_startFrame, const u32& t_endFrame,
|
||||||
const u32& t_stayFrame) {
|
const u32& t_stayFrame) {
|
||||||
TYRA_ASSERT(framesCount > 0,
|
TYRA_ASSERT(framesCount > 0,
|
||||||
"Cant play animation, because no mesh data was loaded!");
|
"Cant play animation, because no mesh data was loaded!");
|
||||||
TYRA_ASSERT(framesCount != 1,
|
TYRA_ASSERT(framesCount != 1,
|
||||||
@@ -123,7 +126,7 @@ void Mesh::playAnimation(const u32& t_startFrame, const u32& t_endFrame,
|
|||||||
animState.nextFrame = t_startFrame;
|
animState.nextFrame = t_startFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::animate() {
|
void DynamicMesh::animate() {
|
||||||
animState.interpolation += animState.speed;
|
animState.interpolation += animState.speed;
|
||||||
if (animState.interpolation >= 1.0F) {
|
if (animState.interpolation >= 1.0F) {
|
||||||
animState.interpolation = 0.0F;
|
animState.interpolation = 0.0F;
|
||||||
+8
-7
@@ -14,11 +14,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "math/vec4.hpp"
|
#include "math/vec4.hpp"
|
||||||
#include "renderer/models/color.hpp"
|
#include "renderer/models/color.hpp"
|
||||||
#include "renderer/3d/mesh/mesh_frame.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh_frame.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
MeshFrame::MeshFrame(const MeshBuilderData& data, const u32& index) {
|
DynamicMeshFrame::DynamicMeshFrame(const MeshBuilderData& data,
|
||||||
|
const u32& index) {
|
||||||
TYRA_ASSERT(index < data.framesCount && index >= 0, "Provided index \"",
|
TYRA_ASSERT(index < data.framesCount && index >= 0, "Provided index \"",
|
||||||
index, "\" is out of range");
|
index, "\" is out of range");
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ MeshFrame::MeshFrame(const MeshBuilderData& data, const u32& index) {
|
|||||||
_isMother = true;
|
_isMother = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshFrame::MeshFrame(const MeshFrame& frame) {
|
DynamicMeshFrame::DynamicMeshFrame(const DynamicMeshFrame& frame) {
|
||||||
id = rand() % 1000000;
|
id = rand() % 1000000;
|
||||||
|
|
||||||
vertices = frame.vertices;
|
vertices = frame.vertices;
|
||||||
@@ -80,7 +81,7 @@ MeshFrame::MeshFrame(const MeshFrame& frame) {
|
|||||||
_isMother = false;
|
_isMother = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshFrame::~MeshFrame() {
|
DynamicMeshFrame::~DynamicMeshFrame() {
|
||||||
if (_isMother) {
|
if (_isMother) {
|
||||||
delete[] vertices;
|
delete[] vertices;
|
||||||
if (normals) delete[] normals;
|
if (normals) delete[] normals;
|
||||||
@@ -90,17 +91,17 @@ MeshFrame::~MeshFrame() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshFrame::print() const {
|
void DynamicMeshFrame::print() const {
|
||||||
auto text = getPrint(nullptr);
|
auto text = getPrint(nullptr);
|
||||||
printf("%s\n", text.c_str());
|
printf("%s\n", text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshFrame::print(const char* name) const {
|
void DynamicMeshFrame::print(const char* name) const {
|
||||||
auto text = getPrint(name);
|
auto text = getPrint(name);
|
||||||
printf("%s\n", text.c_str());
|
printf("%s\n", text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MeshFrame::getPrint(const char* name) const {
|
std::string DynamicMeshFrame::getPrint(const char* name) const {
|
||||||
std::stringstream res;
|
std::stringstream res;
|
||||||
if (name) {
|
if (name) {
|
||||||
res << name << "(";
|
res << name << "(";
|
||||||
+16
-16
@@ -12,12 +12,12 @@
|
|||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "renderer/3d/mesh/mesh_material.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh_material.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
MeshMaterial::MeshMaterial(const MeshBuilderData& data,
|
DynamicMeshMaterial::DynamicMeshMaterial(const MeshBuilderData& data,
|
||||||
const u32& materialIndex)
|
const u32& materialIndex)
|
||||||
: singleColor(false) {
|
: singleColor(false) {
|
||||||
TYRA_ASSERT(materialIndex < data.materialsCount && materialIndex >= 0,
|
TYRA_ASSERT(materialIndex < data.materialsCount && materialIndex >= 0,
|
||||||
"Provided index \"", materialIndex, "\" is out of range");
|
"Provided index \"", materialIndex, "\" is out of range");
|
||||||
@@ -57,18 +57,18 @@ MeshMaterial::MeshMaterial(const MeshBuilderData& data,
|
|||||||
TYRA_ASSERT(facesCount > 0, "Faces count must be greater than 0");
|
TYRA_ASSERT(facesCount > 0, "Faces count must be greater than 0");
|
||||||
|
|
||||||
_name = data.materials[materialIndex]->name;
|
_name = data.materials[materialIndex]->name;
|
||||||
TYRA_ASSERT(_name.length() > 0, "MeshMaterial name cannot be empty");
|
TYRA_ASSERT(_name.length() > 0, "DynamicMeshMaterial name cannot be empty");
|
||||||
|
|
||||||
framesCount = data.framesCount;
|
framesCount = data.framesCount;
|
||||||
frames = new MeshMaterialFrame*[framesCount];
|
frames = new DynamicMeshMaterialFrame*[framesCount];
|
||||||
for (u32 i = 0; i < framesCount; i++) {
|
for (u32 i = 0; i < framesCount; i++) {
|
||||||
frames[i] = new MeshMaterialFrame(data, i, materialIndex);
|
frames[i] = new DynamicMeshMaterialFrame(data, i, materialIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isMother = true;
|
_isMother = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshMaterial::MeshMaterial(const MeshMaterial& mesh) {
|
DynamicMeshMaterial::DynamicMeshMaterial(const DynamicMeshMaterial& mesh) {
|
||||||
id = rand() % 1000000;
|
id = rand() % 1000000;
|
||||||
|
|
||||||
vertexFaces = mesh.vertexFaces;
|
vertexFaces = mesh.vertexFaces;
|
||||||
@@ -82,15 +82,15 @@ MeshMaterial::MeshMaterial(const MeshMaterial& mesh) {
|
|||||||
|
|
||||||
singleColor.set(128.0F, 128.0F, 128.0F, 128.0F);
|
singleColor.set(128.0F, 128.0F, 128.0F, 128.0F);
|
||||||
|
|
||||||
frames = new MeshMaterialFrame*[framesCount];
|
frames = new DynamicMeshMaterialFrame*[framesCount];
|
||||||
for (u32 i = 0; i < framesCount; i++) {
|
for (u32 i = 0; i < framesCount; i++) {
|
||||||
frames[i] = new MeshMaterialFrame(*mesh.frames[i]);
|
frames[i] = new DynamicMeshMaterialFrame(*mesh.frames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isMother = false;
|
_isMother = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshMaterial::~MeshMaterial() {
|
DynamicMeshMaterial::~DynamicMeshMaterial() {
|
||||||
if (_isMother) {
|
if (_isMother) {
|
||||||
delete[] vertexFaces;
|
delete[] vertexFaces;
|
||||||
if (textureCoordFaces) delete[] textureCoordFaces;
|
if (textureCoordFaces) delete[] textureCoordFaces;
|
||||||
@@ -104,11 +104,11 @@ MeshMaterial::~MeshMaterial() {
|
|||||||
delete[] frames;
|
delete[] frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BBox& MeshMaterial::getBBox(const u32& frame) const {
|
const BBox& DynamicMeshMaterial::getBBox(const u32& frame) const {
|
||||||
return frames[frame]->getBBox();
|
return frames[frame]->getBBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshMaterial::setSingleColorFlag(const u8& flag) {
|
void DynamicMeshMaterial::setSingleColorFlag(const u8& flag) {
|
||||||
TYRA_ASSERT(
|
TYRA_ASSERT(
|
||||||
colorFaces != nullptr,
|
colorFaces != nullptr,
|
||||||
"Colors and color faces are required to use color-per-vertex mode");
|
"Colors and color faces are required to use color-per-vertex mode");
|
||||||
@@ -116,22 +116,22 @@ void MeshMaterial::setSingleColorFlag(const u8& flag) {
|
|||||||
singleColorFlag = flag;
|
singleColorFlag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshMaterial::print() const {
|
void DynamicMeshMaterial::print() const {
|
||||||
auto text = getPrint(nullptr);
|
auto text = getPrint(nullptr);
|
||||||
printf("%s\n", text.c_str());
|
printf("%s\n", text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshMaterial::print(const char* name) const {
|
void DynamicMeshMaterial::print(const char* name) const {
|
||||||
auto text = getPrint(name);
|
auto text = getPrint(name);
|
||||||
printf("%s\n", text.c_str());
|
printf("%s\n", text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MeshMaterial::getPrint(const char* name) const {
|
std::string DynamicMeshMaterial::getPrint(const char* name) const {
|
||||||
std::stringstream res;
|
std::stringstream res;
|
||||||
if (name) {
|
if (name) {
|
||||||
res << name << "(";
|
res << name << "(";
|
||||||
} else {
|
} else {
|
||||||
res << "MeshMaterial(";
|
res << "DynamicMeshMaterial(";
|
||||||
}
|
}
|
||||||
|
|
||||||
res << std::endl;
|
res << std::endl;
|
||||||
+7
-6
@@ -13,13 +13,13 @@
|
|||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
#include "renderer/models/color.hpp"
|
#include "renderer/models/color.hpp"
|
||||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||||
#include "renderer/3d/mesh/mesh_material_frame.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh_material_frame.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
MeshMaterialFrame::MeshMaterialFrame(const MeshBuilderData& data,
|
DynamicMeshMaterialFrame::DynamicMeshMaterialFrame(const MeshBuilderData& data,
|
||||||
const u32& frameIndex,
|
const u32& frameIndex,
|
||||||
const u32& materialIndex) {
|
const u32& materialIndex) {
|
||||||
TYRA_ASSERT(frameIndex < data.framesCount && frameIndex >= 0,
|
TYRA_ASSERT(frameIndex < data.framesCount && frameIndex >= 0,
|
||||||
"Provided index \"", frameIndex, "\" is out of range");
|
"Provided index \"", frameIndex, "\" is out of range");
|
||||||
TYRA_ASSERT(materialIndex < data.materialsCount && materialIndex >= 0,
|
TYRA_ASSERT(materialIndex < data.materialsCount && materialIndex >= 0,
|
||||||
@@ -34,7 +34,8 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshBuilderData& data,
|
|||||||
_isMother = true;
|
_isMother = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) {
|
DynamicMeshMaterialFrame::DynamicMeshMaterialFrame(
|
||||||
|
const DynamicMeshMaterialFrame& frame) {
|
||||||
id = rand() % 1000000;
|
id = rand() % 1000000;
|
||||||
|
|
||||||
bbox = frame.bbox;
|
bbox = frame.bbox;
|
||||||
@@ -42,7 +43,7 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) {
|
|||||||
_isMother = false;
|
_isMother = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshMaterialFrame::~MeshMaterialFrame() {
|
DynamicMeshMaterialFrame::~DynamicMeshMaterialFrame() {
|
||||||
if (_isMother) {
|
if (_isMother) {
|
||||||
delete bbox;
|
delete bbox;
|
||||||
}
|
}
|
||||||
@@ -23,16 +23,17 @@ void Stapipeline::init(RendererCore* t_core) {
|
|||||||
|
|
||||||
void Stapipeline::onUse() { core.reinitStandardVU1Programs(); }
|
void Stapipeline::onUse() { core.reinitStandardVU1Programs(); }
|
||||||
|
|
||||||
void Stapipeline::render(Mesh* mesh, const StapipOptions* options) {
|
void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||||
auto model = mesh->getModelMatrix();
|
auto model = mesh->getModelMatrix();
|
||||||
|
|
||||||
MeshFrame* frameFrom = mesh->getFramesCount() > 0
|
DynamicMeshFrame* frameFrom =
|
||||||
? mesh->getFrame(mesh->getCurrentAnimationFrame())
|
mesh->getFramesCount() > 0
|
||||||
: mesh->getFrame(0);
|
? mesh->getFrame(mesh->getCurrentAnimationFrame())
|
||||||
|
: mesh->getFrame(0);
|
||||||
|
|
||||||
MeshFrame* frameTo = mesh->getFramesCount() > 0
|
DynamicMeshFrame* frameTo =
|
||||||
? mesh->getFrame(mesh->getNextAnimationFrame())
|
mesh->getFramesCount() > 0 ? mesh->getFrame(mesh->getNextAnimationFrame())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
auto* infoBag = getInfoBag(mesh, options, &model);
|
auto* infoBag = getInfoBag(mesh, options, &model);
|
||||||
|
|
||||||
@@ -65,9 +66,9 @@ void Stapipeline::render(Mesh* mesh, const StapipOptions* options) {
|
|||||||
delete infoBag;
|
delete infoBag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stapipeline::addVertices(Mesh* mesh, MeshMaterial* material,
|
void Stapipeline::addVertices(DynamicMesh* mesh, DynamicMeshMaterial* material,
|
||||||
StapipBag* bag, MeshFrame* frameFrom,
|
StapipBag* bag, DynamicMeshFrame* frameFrom,
|
||||||
MeshFrame* frameTo) const {
|
DynamicMeshFrame* frameTo) const {
|
||||||
bag->count = material->getFacesCount();
|
bag->count = material->getFacesCount();
|
||||||
bag->vertices = new Vec4[bag->count];
|
bag->vertices = new Vec4[bag->count];
|
||||||
|
|
||||||
@@ -83,7 +84,8 @@ void Stapipeline::addVertices(Mesh* mesh, MeshMaterial* material,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StapipInfoBag* Stapipeline::getInfoBag(Mesh* mesh, const StapipOptions* options,
|
StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||||
|
const StapipOptions* options,
|
||||||
M4x4* model) const {
|
M4x4* model) const {
|
||||||
auto* result = new StapipInfoBag();
|
auto* result = new StapipInfoBag();
|
||||||
|
|
||||||
@@ -104,9 +106,10 @@ StapipInfoBag* Stapipeline::getInfoBag(Mesh* mesh, const StapipOptions* options,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StapipColorBag* Stapipeline::getColorBag(Mesh* mesh, MeshMaterial* material,
|
StapipColorBag* Stapipeline::getColorBag(DynamicMesh* mesh,
|
||||||
MeshFrame* frameFrom,
|
DynamicMeshMaterial* material,
|
||||||
MeshFrame* frameTo) const {
|
DynamicMeshFrame* frameFrom,
|
||||||
|
DynamicMeshFrame* frameTo) const {
|
||||||
auto* result = new StapipColorBag();
|
auto* result = new StapipColorBag();
|
||||||
|
|
||||||
if (material->isSingleColorActivated()) {
|
if (material->isSingleColorActivated()) {
|
||||||
@@ -131,9 +134,10 @@ StapipColorBag* Stapipeline::getColorBag(Mesh* mesh, MeshMaterial* material,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StapipTextureBag* Stapipeline::getTextureBag(Mesh* mesh, MeshMaterial* material,
|
StapipTextureBag* Stapipeline::getTextureBag(DynamicMesh* mesh,
|
||||||
MeshFrame* frameFrom,
|
DynamicMeshMaterial* material,
|
||||||
MeshFrame* frameTo) {
|
DynamicMeshFrame* frameFrom,
|
||||||
|
DynamicMeshFrame* frameTo) {
|
||||||
if (!material->getTextureCoordFaces()) return nullptr;
|
if (!material->getTextureCoordFaces()) return nullptr;
|
||||||
|
|
||||||
auto* result = new StapipTextureBag();
|
auto* result = new StapipTextureBag();
|
||||||
@@ -161,8 +165,9 @@ StapipTextureBag* Stapipeline::getTextureBag(Mesh* mesh, MeshMaterial* material,
|
|||||||
}
|
}
|
||||||
|
|
||||||
StapipLightingBag* Stapipeline::getLightingBag(
|
StapipLightingBag* Stapipeline::getLightingBag(
|
||||||
Mesh* mesh, MeshMaterial* material, M4x4* model, MeshFrame* frameFrom,
|
DynamicMesh* mesh, DynamicMeshMaterial* material, M4x4* model,
|
||||||
MeshFrame* frameTo, const StapipOptions* options) const {
|
DynamicMeshFrame* frameFrom, DynamicMeshFrame* frameTo,
|
||||||
|
const StapipOptions* options) const {
|
||||||
if (!material->getNormalFaces() || options == nullptr ||
|
if (!material->getNormalFaces() || options == nullptr ||
|
||||||
options->lighting == nullptr)
|
options->lighting == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -199,7 +204,7 @@ void Stapipeline::setLightingColorsCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Stapipeline::deallocDrawBags(StapipBag* bag,
|
void Stapipeline::deallocDrawBags(StapipBag* bag,
|
||||||
MeshMaterial* material) const {
|
DynamicMeshMaterial* material) const {
|
||||||
if (bag->color->many) {
|
if (bag->color->many) {
|
||||||
delete[] bag->color->many;
|
delete[] bag->color->many;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Texture* TextureRepository::add(const char* fullpath) {
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRepository::addByMesh(Mesh* mesh, const char* directory,
|
void TextureRepository::addByMesh(DynamicMesh* mesh, const char* directory,
|
||||||
const char* extension) {
|
const char* extension) {
|
||||||
auto& loader = texLoaderSelector.getLoaderByExtension(extension);
|
auto& loader = texLoaderSelector.getLoaderByExtension(extension);
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class H4570 : public Game {
|
|||||||
private:
|
private:
|
||||||
Engine* engine;
|
Engine* engine;
|
||||||
|
|
||||||
Mesh* warrior;
|
DynamicMesh* warrior;
|
||||||
Mesh* warrior2;
|
DynamicMesh* warrior2;
|
||||||
Mesh* warrior3;
|
DynamicMesh* warrior3;
|
||||||
Mesh* warrior4;
|
DynamicMesh* warrior4;
|
||||||
Sprite* picture;
|
Sprite* picture;
|
||||||
audsrv_adpcm_t* adpcmSample;
|
audsrv_adpcm_t* adpcmSample;
|
||||||
Timer adpcmTimer;
|
Timer adpcmTimer;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Tyra {
|
|||||||
H4570::H4570(Engine* t_engine) { engine = t_engine; }
|
H4570::H4570(Engine* t_engine) { engine = t_engine; }
|
||||||
H4570::~H4570() {}
|
H4570::~H4570() {}
|
||||||
|
|
||||||
Mesh* getWarrior(Renderer* renderer);
|
DynamicMesh* getWarrior(Renderer* renderer);
|
||||||
StapipOptions* getRenderingOptions();
|
StapipOptions* getRenderingOptions();
|
||||||
Sprite* get2DPicture(Renderer* renderer);
|
Sprite* get2DPicture(Renderer* renderer);
|
||||||
|
|
||||||
@@ -38,19 +38,19 @@ void H4570::init() {
|
|||||||
auto* warriorTex = engine->renderer.core.texture.repository.getBySpriteOrMesh(
|
auto* warriorTex = engine->renderer.core.texture.repository.getBySpriteOrMesh(
|
||||||
warrior->getMaterial(0)->getId());
|
warrior->getMaterial(0)->getId());
|
||||||
|
|
||||||
warrior2 = new Mesh(*warrior);
|
warrior2 = new DynamicMesh(*warrior);
|
||||||
warrior2->translation.translateX(-3.0F);
|
warrior2->translation.translateX(-3.0F);
|
||||||
warriorTex->addLink(warrior2->getMaterial(0)->getId());
|
warriorTex->addLink(warrior2->getMaterial(0)->getId());
|
||||||
warrior2->playAnimation(0, warrior2->getFramesCount() - 1);
|
warrior2->playAnimation(0, warrior2->getFramesCount() - 1);
|
||||||
warrior2->setAnimSpeed(0.10F);
|
warrior2->setAnimSpeed(0.10F);
|
||||||
|
|
||||||
warrior3 = new Mesh(*warrior);
|
warrior3 = new DynamicMesh(*warrior);
|
||||||
warrior3->translation.translateX(-6.0F);
|
warrior3->translation.translateX(-6.0F);
|
||||||
warriorTex->addLink(warrior3->getMaterial(0)->getId());
|
warriorTex->addLink(warrior3->getMaterial(0)->getId());
|
||||||
warrior3->playAnimation(0, warrior3->getFramesCount() - 1);
|
warrior3->playAnimation(0, warrior3->getFramesCount() - 1);
|
||||||
warrior3->setAnimSpeed(0.7F);
|
warrior3->setAnimSpeed(0.7F);
|
||||||
|
|
||||||
warrior4 = new Mesh(*warrior);
|
warrior4 = new DynamicMesh(*warrior);
|
||||||
warrior4->translation.translateX(3.0F);
|
warrior4->translation.translateX(3.0F);
|
||||||
warriorTex->addLink(warrior4->getMaterial(0)->getId());
|
warriorTex->addLink(warrior4->getMaterial(0)->getId());
|
||||||
warrior4->playAnimation(0, warrior4->getFramesCount() - 1);
|
warrior4->playAnimation(0, warrior4->getFramesCount() - 1);
|
||||||
@@ -151,10 +151,10 @@ void H4570::loop() {
|
|||||||
engine->renderer.endFrame();
|
engine->renderer.endFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh* getWarrior(Renderer* renderer) {
|
DynamicMesh* getWarrior(Renderer* renderer) {
|
||||||
MD2Loader loader;
|
MD2Loader loader;
|
||||||
auto* data = loader.load(FileUtils::fromCwd("warrior.md2"), .08F, false);
|
auto* data = loader.load(FileUtils::fromCwd("warrior.md2"), .08F, false);
|
||||||
auto* result = new Mesh(*data);
|
auto* result = new DynamicMesh(*data);
|
||||||
// result->translation.translateZ(-30.0F);
|
// result->translation.translateZ(-30.0F);
|
||||||
delete data;
|
delete data;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Wellinator : public Game {
|
|||||||
private:
|
private:
|
||||||
Engine* engine;
|
Engine* engine;
|
||||||
|
|
||||||
Mesh* warrior;
|
DynamicMesh* warrior;
|
||||||
Sprite* picture;
|
Sprite* picture;
|
||||||
audsrv_adpcm_t* adpcmSample;
|
audsrv_adpcm_t* adpcmSample;
|
||||||
Timer adpcmTimer;
|
Timer adpcmTimer;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Tyra {
|
|||||||
Wellinator::Wellinator(Engine* t_engine) { engine = t_engine; }
|
Wellinator::Wellinator(Engine* t_engine) { engine = t_engine; }
|
||||||
Wellinator::~Wellinator() {}
|
Wellinator::~Wellinator() {}
|
||||||
|
|
||||||
Mesh* getWarrior(Renderer* renderer);
|
DynamicMesh* getWarrior(Renderer* renderer);
|
||||||
StapipOptions* getRenderingOptions();
|
StapipOptions* getRenderingOptions();
|
||||||
Sprite* get2DPicture(Renderer* renderer);
|
Sprite* get2DPicture(Renderer* renderer);
|
||||||
|
|
||||||
@@ -125,10 +125,10 @@ void Wellinator::loop() {
|
|||||||
engine->renderer.endFrame();
|
engine->renderer.endFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh* getWarrior(Renderer* renderer) {
|
DynamicMesh* getWarrior(Renderer* renderer) {
|
||||||
MD2Loader loader;
|
MD2Loader loader;
|
||||||
auto* data = loader.load(FileUtils::fromCwd("warrior.md2"), .08F, false);
|
auto* data = loader.load(FileUtils::fromCwd("warrior.md2"), .08F, false);
|
||||||
auto* result = new Mesh(*data);
|
auto* result = new DynamicMesh(*data);
|
||||||
result->translation.translateZ(-30.0F);
|
result->translation.translateZ(-30.0F);
|
||||||
delete data;
|
delete data;
|
||||||
renderer->core.texture.repository.addByMesh(result, FileUtils::getCwd(),
|
renderer->core.texture.repository.addByMesh(result, FileUtils::getCwd(),
|
||||||
|
|||||||
Reference in New Issue
Block a user