mesh -> dynamicmesh
This commit is contained in:
+14
-14
@@ -11,17 +11,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||
#include "./mesh_frame.hpp"
|
||||
#include "./mesh_material_frame.hpp"
|
||||
#include "./mesh_anim_state.hpp"
|
||||
#include "./dynamic_mesh_frame.hpp"
|
||||
#include "./dynamic_mesh_material_frame.hpp"
|
||||
#include "./dynamic_mesh_anim_state.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Mesh {
|
||||
class DynamicMesh {
|
||||
public:
|
||||
explicit Mesh(const MeshBuilderData& data);
|
||||
explicit Mesh(const Mesh& mesh);
|
||||
~Mesh();
|
||||
explicit DynamicMesh(const MeshBuilderData& data);
|
||||
explicit DynamicMesh(const DynamicMesh& mesh);
|
||||
~DynamicMesh();
|
||||
|
||||
/** Translation matrix */
|
||||
M4x4 translation;
|
||||
@@ -47,17 +47,17 @@ class Mesh {
|
||||
}
|
||||
|
||||
/** 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 MeshAnimState& getAnimState() const { return animState; }
|
||||
const DynamicMeshAnimState& getAnimState() const { return animState; }
|
||||
|
||||
/** Count of all vertices. */
|
||||
u32 getVertexCount() { return frames[0]->getVertexCount(); }
|
||||
|
||||
/** 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. */
|
||||
const u32& getFramesCount() const { return framesCount; }
|
||||
@@ -78,7 +78,7 @@ class Mesh {
|
||||
// * Returns material, which is a mesh "subgroup".
|
||||
// * 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. */
|
||||
const BBox& getCurrentBoundingBox() const {
|
||||
@@ -111,11 +111,11 @@ class Mesh {
|
||||
|
||||
private:
|
||||
void initMesh();
|
||||
MeshAnimState animState;
|
||||
DynamicMeshAnimState animState;
|
||||
u8 _isMother;
|
||||
u32 id, framesCount, materialsCount;
|
||||
MeshFrame** frames;
|
||||
MeshMaterial** materials;
|
||||
DynamicMeshFrame** frames;
|
||||
DynamicMeshMaterial** materials;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
+1
-1
@@ -25,6 +25,6 @@ typedef struct {
|
||||
u32 animType;
|
||||
u32 currentFrame;
|
||||
u32 nextFrame;
|
||||
} MeshAnimState;
|
||||
} DynamicMeshAnimState;
|
||||
|
||||
} // namespace Tyra
|
||||
+5
-5
@@ -10,17 +10,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "renderer/3d/mesh/mesh_material.hpp"
|
||||
#include "./dynamic_mesh_material.hpp"
|
||||
#include "loaders/3d/builder/mesh_builder_data.hpp"
|
||||
#include "renderer/3d/bbox/bbox.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class MeshFrame {
|
||||
class DynamicMeshFrame {
|
||||
public:
|
||||
explicit MeshFrame(const MeshBuilderData& data, const u32& index);
|
||||
explicit MeshFrame(const MeshFrame& frame);
|
||||
~MeshFrame();
|
||||
explicit DynamicMeshFrame(const MeshBuilderData& data, const u32& index);
|
||||
explicit DynamicMeshFrame(const DynamicMeshFrame& frame);
|
||||
~DynamicMeshFrame();
|
||||
|
||||
const u32& getId() const { return id; }
|
||||
const u32& getVertexCount() const { return vertexCount; }
|
||||
+8
-7
@@ -12,15 +12,16 @@
|
||||
|
||||
#include "debug/debug.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 {
|
||||
|
||||
class MeshMaterial {
|
||||
class DynamicMeshMaterial {
|
||||
public:
|
||||
explicit MeshMaterial(const MeshBuilderData& data, const u32& materialIndex);
|
||||
explicit MeshMaterial(const MeshMaterial& material);
|
||||
~MeshMaterial();
|
||||
explicit DynamicMeshMaterial(const MeshBuilderData& data,
|
||||
const u32& materialIndex);
|
||||
explicit DynamicMeshMaterial(const DynamicMeshMaterial& material);
|
||||
~DynamicMeshMaterial();
|
||||
|
||||
Color singleColor;
|
||||
|
||||
@@ -34,7 +35,7 @@ class MeshMaterial {
|
||||
u32* getTextureCoordFaces() const { return textureCoordFaces; }
|
||||
u32* getNormalFaces() 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;
|
||||
|
||||
@@ -46,7 +47,7 @@ class MeshMaterial {
|
||||
std::string getPrint(const char* name = nullptr) const;
|
||||
|
||||
private:
|
||||
MeshMaterialFrame** frames;
|
||||
DynamicMeshMaterialFrame** frames;
|
||||
|
||||
std::string _name;
|
||||
u8 _isMother, singleColorFlag;
|
||||
+6
-5
@@ -14,12 +14,13 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class MeshMaterialFrame {
|
||||
class DynamicMeshMaterialFrame {
|
||||
public:
|
||||
explicit MeshMaterialFrame(const MeshBuilderData& data, const u32& frameIndex,
|
||||
const u32& materialIndex);
|
||||
explicit MeshMaterialFrame(const MeshMaterialFrame& frame);
|
||||
~MeshMaterialFrame();
|
||||
explicit DynamicMeshMaterialFrame(const MeshBuilderData& data,
|
||||
const u32& frameIndex,
|
||||
const u32& materialIndex);
|
||||
explicit DynamicMeshMaterialFrame(const DynamicMeshMaterialFrame& frame);
|
||||
~DynamicMeshMaterialFrame();
|
||||
|
||||
const u32& getId() const { return id; }
|
||||
const u8& isMother() const { return _isMother; }
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../renderer_3d_pipeline.hpp"
|
||||
#include "./stapip_options.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"
|
||||
|
||||
namespace Tyra {
|
||||
@@ -32,26 +32,31 @@ class Stapipeline : public Renderer3DPipeline {
|
||||
* Render 3D data via "meshes".
|
||||
* 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:
|
||||
StapipelineCore core;
|
||||
RendererCore* rendererCore;
|
||||
Vec4* colorsCache;
|
||||
|
||||
void addVertices(Mesh* mesh, MeshMaterial* material, StapipBag* bag,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||
StapipInfoBag* getInfoBag(Mesh* mesh, const StapipOptions* options,
|
||||
void addVertices(DynamicMesh* mesh, DynamicMeshMaterial* material,
|
||||
StapipBag* bag, DynamicMeshFrame* frameFrom,
|
||||
DynamicMeshFrame* frameTo) const;
|
||||
StapipInfoBag* getInfoBag(DynamicMesh* mesh, const StapipOptions* options,
|
||||
M4x4* model) const;
|
||||
StapipColorBag* getColorBag(Mesh* mesh, MeshMaterial* material,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||
StapipTextureBag* getTextureBag(Mesh* mesh, MeshMaterial* material,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo);
|
||||
StapipLightingBag* getLightingBag(Mesh* mesh, MeshMaterial* material,
|
||||
M4x4* model, MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo,
|
||||
StapipColorBag* getColorBag(DynamicMesh* mesh, DynamicMeshMaterial* material,
|
||||
DynamicMeshFrame* frameFrom,
|
||||
DynamicMeshFrame* frameTo) const;
|
||||
StapipTextureBag* getTextureBag(DynamicMesh* mesh,
|
||||
DynamicMeshMaterial* material,
|
||||
DynamicMeshFrame* frameFrom,
|
||||
DynamicMeshFrame* frameTo);
|
||||
StapipLightingBag* getLightingBag(DynamicMesh* mesh,
|
||||
DynamicMeshMaterial* material, M4x4* model,
|
||||
DynamicMeshFrame* frameFrom,
|
||||
DynamicMeshFrame* frameTo,
|
||||
const StapipOptions* options) const;
|
||||
void deallocDrawBags(StapipBag* bag, MeshMaterial* material) const;
|
||||
void deallocDrawBags(StapipBag* bag, DynamicMeshMaterial* material) const;
|
||||
|
||||
void setLightingColorsCache(StapipLightingOptions* lightingOptions);
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <draw_buffers.h>
|
||||
#include <vector>
|
||||
#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 <string>
|
||||
|
||||
@@ -93,12 +93,13 @@ class TextureRepository {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
inline void addByMesh(Mesh* mesh, const std::string& directory,
|
||||
inline void addByMesh(DynamicMesh* mesh, const std::string& directory,
|
||||
const char* extension) {
|
||||
addByMesh(mesh, directory.c_str(), extension);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user