From c5aea0d50f2e3fe20961474f555daf9ee06544cb Mon Sep 17 00:00:00 2001 From: h4570 Date: Fri, 22 Jul 2022 00:12:36 +0200 Subject: [PATCH] spamming with multiple buffers to vu1 --- engine/inc/renderer/3d/mesh/mesh_frame.hpp | 13 +- engine/inc/renderer/3d/mesh/mesh_material.hpp | 19 ++- .../renderer/3d/mesh/mesh_material_frame.hpp | 24 ++- .../3d/pipeline/dynamic/core/dynpip_core.hpp | 3 + .../pipeline/dynamic/core/dynpip_renderer.hpp | 3 + .../3d/pipeline/dynamic/dynamic_pipeline.hpp | 23 +-- .../3d/pipeline/static/static_pipeline.hpp | 21 +-- .../3d/builder/mesh_builder_frame_data.cpp | 15 +- .../3d/builder/mesh_builder_material_data.cpp | 15 +- engine/src/renderer/3d/mesh/mesh_frame.cpp | 79 +--------- engine/src/renderer/3d/mesh/mesh_material.cpp | 82 +--------- .../renderer/3d/mesh/mesh_material_frame.cpp | 130 ++++++++++++++++ .../3d/pipeline/dynamic/core/dynpip_core.cpp | 4 + .../pipeline/dynamic/core/dynpip_renderer.cpp | 35 ++++- .../3d/pipeline/dynamic/dynamic_pipeline.cpp | 140 +++++++++--------- .../3d/pipeline/static/static_pipeline.cpp | 109 +++----------- samples/h4570/src/h4570.cpp | 27 +++- 17 files changed, 382 insertions(+), 360 deletions(-) diff --git a/engine/inc/renderer/3d/mesh/mesh_frame.hpp b/engine/inc/renderer/3d/mesh/mesh_frame.hpp index 1acdb57..8bc7bcb 100644 --- a/engine/inc/renderer/3d/mesh/mesh_frame.hpp +++ b/engine/inc/renderer/3d/mesh/mesh_frame.hpp @@ -23,18 +23,9 @@ class MeshFrame { ~MeshFrame(); const u32& getId() const { return id; } - const u32& getVertexCount() const { return vertexCount; } - const u32& getTextureCoordsCount() const { return textureCoordsCount; } - const u32& getNormalsCount() const { return normalsCount; } - const u32& getColorsCount() const { return colorsCount; } const u8& isMother() const { return _isMother; } const BBox& getBBox() const { return *bbox; } - Vec4* getVertices() const { return vertices; } - Vec4* getNormals() const { return normals; } - Vec4* getTextureCoords() const { return textureCoords; } - Color* getColors() const { return colors; } - void print() const; void print(const char* name) const; void print(const std::string& name) const { print(name.c_str()); } @@ -43,9 +34,7 @@ class MeshFrame { private: u8 _isMother; BBox* bbox; - u32 id, vertexCount, textureCoordsCount, normalsCount, colorsCount; - Vec4 *vertices, *textureCoords, *normals; - Color* colors; + u32 id; }; } // namespace Tyra diff --git a/engine/inc/renderer/3d/mesh/mesh_material.hpp b/engine/inc/renderer/3d/mesh/mesh_material.hpp index 1a7253f..063c94f 100644 --- a/engine/inc/renderer/3d/mesh/mesh_material.hpp +++ b/engine/inc/renderer/3d/mesh/mesh_material.hpp @@ -22,18 +22,18 @@ class MeshMaterial { explicit MeshMaterial(const MeshMaterial& material); ~MeshMaterial(); - Color singleColor; + Color color; const u32& getId() const { return id; } const std::string& getName() const { return _name; } - const u32& getFacesCount() const { return facesCount; } const u8& isMother() const { return _isMother; } - const u8& isSingleColorActivated() const { return singleColorFlag; } - u32* getVertexFaces() const { return vertexFaces; } - u32* getTextureCoordFaces() const { return textureCoordFaces; } - u32* getNormalFaces() const { return normalFaces; } - u32* getColorFaces() const { return normalFaces; } - MeshMaterialFrame* getFrames() const { return *frames; } + const u32& getFramesCount() const { return framesCount; } + const u8& isSingleColorActivated() const { + return singleColorFlag; + } // TODO: colormode -> color / lightmap + + MeshMaterialFrame** getFrames() const { return frames; } + MeshMaterialFrame* getFrame(const u32& i) const { return frames[i]; } const BBox& getBBox(const u32& frame) const; void setSingleColorFlag(const u8& flag); @@ -48,8 +48,7 @@ class MeshMaterial { std::string _name; u8 _isMother, singleColorFlag; - u32 id, facesCount, framesCount; - u32 *vertexFaces, *textureCoordFaces, *normalFaces, *colorFaces; + u32 id, framesCount; }; } // namespace Tyra diff --git a/engine/inc/renderer/3d/mesh/mesh_material_frame.hpp b/engine/inc/renderer/3d/mesh/mesh_material_frame.hpp index d2fa17c..330744a 100644 --- a/engine/inc/renderer/3d/mesh/mesh_material_frame.hpp +++ b/engine/inc/renderer/3d/mesh/mesh_material_frame.hpp @@ -26,11 +26,33 @@ class MeshMaterialFrame { const u8& isMother() const { return _isMother; } const BBox& getBBox() const { return *bbox; } + const u32& getVertexCount() const { return vertexCount; } + Vec4* getVertices() const { return vertices; } + Vec4* getNormals() const { return normals; } + Vec4* getTextureCoords() const { return textureCoords; } + Color* getColors() const { return colors; } + + void print() const; + void print(const char* name) const; + void print(const std::string& name) const { print(name.c_str()); } + std::string getPrint(const char* name = nullptr) const; + private: + void allocateVertices(const MeshBuilderData& data, const u32& frameIndex, + const u32& materialIndex); + void allocateTextureCoords(const MeshBuilderData& data, const u32& frameIndex, + const u32& materialIndex); + void allocateNormals(const MeshBuilderData& data, const u32& frameIndex, + const u32& materialIndex); + void allocateColors(const MeshBuilderData& data, const u32& frameIndex, + const u32& materialIndex); + BBox* bbox; u8 _isMother; - u32 id; + u32 id, vertexCount; + Vec4 *vertices, *textureCoords, *normals; + Color* colors; }; } // namespace Tyra diff --git a/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_core.hpp b/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_core.hpp index 3b4e31e..664f717 100644 --- a/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_core.hpp +++ b/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_core.hpp @@ -36,6 +36,9 @@ class DynPipCore { */ void initParts(DynPipBag* data); + // TODO: TEST! + void renderTEST(DynPipBag** bags, const u32& count); + /** Render 3D via "bags" */ void renderPart(DynPipBag* data, const bool& frustumCull = true); diff --git a/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_renderer.hpp b/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_renderer.hpp index 3fced1d..8b95cad 100644 --- a/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_renderer.hpp +++ b/engine/inc/renderer/3d/pipeline/dynamic/core/dynpip_renderer.hpp @@ -29,6 +29,7 @@ class DynPipRenderer { RendererCoreTextureBuffers* texBuffers) const; void render(DynPipBag* bag); + void renderTEST(DynPipBag** bags, const u32& count); void clearLastProgramName(); @@ -40,6 +41,8 @@ class DynPipRenderer { void uploadPrograms(); void setDoubleBuffer(); + void addBufferDataToPacketTEST(DynPipVU1Program* program, DynPipBag** bags, + const u32& count); void addBufferDataToPacket(DynPipVU1Program* program, DynPipBag* bag); void sendPacket(); diff --git a/engine/inc/renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp b/engine/inc/renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp index 9c6ceb4..b3ab7fb 100644 --- a/engine/inc/renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp +++ b/engine/inc/renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp @@ -40,21 +40,24 @@ class DynamicPipeline : public Renderer3DPipeline { RendererCore* rendererCore; Vec4* colorsCache; - void addVertices(DynamicMesh* mesh, MeshMaterial* material, DynPipBag* bag, - MeshFrame* frameFrom, MeshFrame* frameTo, + void addVertices(MeshMaterialFrame* materialFrameFrom, + MeshMaterialFrame* materialFrameTo, DynPipBag* bag, const u32& startIndex) const; + PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const DynPipOptions* options, M4x4* model) const; + DynPipColorBag* getColorBag(MeshMaterial* material) const; - DynPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material, - MeshFrame* frameFrom, MeshFrame* frameTo, - const u32& count, const u32& startIndex); - DynPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material, - M4x4* model, MeshFrame* frameFrom, - MeshFrame* frameTo, - const DynPipOptions* options, + + DynPipTextureBag* getTextureBag(MeshMaterial* material, + MeshMaterialFrame* materialFrameFrom, + MeshMaterialFrame* materialFrameTo, + const u32& startIndex); + + DynPipLightingBag* getLightingBag(MeshMaterialFrame* materialFrameFrom, + MeshMaterialFrame* materialFrameTo, + M4x4* model, const DynPipOptions* options, PipelineDirLightsBag* dirLightsBag, - const u32& count, const u32& startIndex) const; void setLightingColorsCache(PipelineLightingOptions* lightingOptions); diff --git a/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp b/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp index 09fa39f..8ec7172 100644 --- a/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp +++ b/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp @@ -41,18 +41,21 @@ class StaticPipeline : public Renderer3DPipeline { RendererCore* rendererCore; Vec4* colorsCache; - void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag, - MeshFrame* frameFrom, MeshFrame* frameTo) const; + void addVertices(MeshMaterialFrame* materialFrame, StaPipBag* bag) const; + PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options, M4x4* model) const; - StaPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material, - MeshFrame* frameFrom, MeshFrame* frameTo) const; - StaPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material, - MeshFrame* frameFrom, MeshFrame* frameTo); - StaPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material, - M4x4* model, MeshFrame* frameFrom, - MeshFrame* frameTo, + + StaPipColorBag* getColorBag(MeshMaterial* material, + MeshMaterialFrame* materialFrame) const; + + StaPipTextureBag* getTextureBag(MeshMaterial* material, + MeshMaterialFrame* materialFrame); + + StaPipLightingBag* getLightingBag(MeshMaterialFrame* materialFrame, + M4x4* model, const StaPipOptions* options) const; + void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const; void setLightingColorsCache(PipelineLightingOptions* lightingOptions); diff --git a/engine/src/loaders/3d/builder/mesh_builder_frame_data.cpp b/engine/src/loaders/3d/builder/mesh_builder_frame_data.cpp index c8f0b4e..e7d7513 100644 --- a/engine/src/loaders/3d/builder/mesh_builder_frame_data.cpp +++ b/engine/src/loaders/3d/builder/mesh_builder_frame_data.cpp @@ -24,7 +24,20 @@ MeshBuilderFrameData::MeshBuilderFrameData() { colorsCount = 0; } -MeshBuilderFrameData::~MeshBuilderFrameData() {} +MeshBuilderFrameData::~MeshBuilderFrameData() { + if (vertices) { + delete[] vertices; + } + if (normals) { + delete[] normals; + } + if (textureCoords) { + delete[] textureCoords; + } + if (colors) { + delete[] colors; + } +} void MeshBuilderFrameData::allocateTextureCoords(const u32& count) { textureCoordsCount = count; diff --git a/engine/src/loaders/3d/builder/mesh_builder_material_data.cpp b/engine/src/loaders/3d/builder/mesh_builder_material_data.cpp index 712daec..7eff1e7 100644 --- a/engine/src/loaders/3d/builder/mesh_builder_material_data.cpp +++ b/engine/src/loaders/3d/builder/mesh_builder_material_data.cpp @@ -22,7 +22,20 @@ MeshBuilderMaterialData::MeshBuilderMaterialData() { count = 0; } -MeshBuilderMaterialData::~MeshBuilderMaterialData() {} +MeshBuilderMaterialData::~MeshBuilderMaterialData() { + if (vertexFaces) { + delete[] vertexFaces; + } + if (textureCoordFaces) { + delete[] textureCoordFaces; + } + if (normalFaces) { + delete[] normalFaces; + } + if (colorFaces) { + delete[] colorFaces; + } +} void MeshBuilderMaterialData::allocateFaces(const u32& t_count) { vertexFaces = new u32[t_count]; diff --git a/engine/src/renderer/3d/mesh/mesh_frame.cpp b/engine/src/renderer/3d/mesh/mesh_frame.cpp index 0d47b2e..a3e8b47 100644 --- a/engine/src/renderer/3d/mesh/mesh_frame.cpp +++ b/engine/src/renderer/3d/mesh/mesh_frame.cpp @@ -25,38 +25,6 @@ MeshFrame::MeshFrame(const MeshBuilderData& data, const u32& index) { id = rand() % 1000000; - vertices = data.frames[index]->vertices; - TYRA_ASSERT(vertices != nullptr, "Vertices are required"); - vertexCount = data.frames[index]->verticesCount; - TYRA_ASSERT(vertexCount > 0, "Vertices count must be greater than 0"); - - if (data.normalsEnabled) { - normals = data.frames[index]->normals; - normalsCount = data.frames[index]->normalsCount; - TYRA_ASSERT(normals != nullptr, "Normals are required"); - } else { - normalsCount = 0; - normals = nullptr; - } - - if (data.textureCoordsEnabled) { - textureCoords = data.frames[index]->textureCoords; - textureCoordsCount = data.frames[index]->textureCoordsCount; - TYRA_ASSERT(textureCoords != nullptr, "Texture coordinates are required"); - } else { - textureCoordsCount = 0; - textureCoords = nullptr; - } - - if (data.manyColorsEnabled) { - colors = data.frames[index]->colors; - colorsCount = data.frames[index]->colorsCount; - TYRA_ASSERT(colors != nullptr, "Colors are required"); - } else { - colorsCount = 0; - colors = nullptr; - } - bbox = new BBox(data.frames[index]->vertices, data.frames[index]->verticesCount); @@ -66,16 +34,6 @@ MeshFrame::MeshFrame(const MeshBuilderData& data, const u32& index) { MeshFrame::MeshFrame(const MeshFrame& frame) { id = rand() % 1000000; - vertices = frame.vertices; - normals = frame.normals; - textureCoords = frame.textureCoords; - colors = frame.colors; - - vertexCount = frame.vertexCount; - normalsCount = frame.normalsCount; - textureCoordsCount = frame.textureCoordsCount; - colorsCount = frame.colorsCount; - bbox = frame.bbox; _isMother = false; @@ -83,10 +41,6 @@ MeshFrame::MeshFrame(const MeshFrame& frame) { MeshFrame::~MeshFrame() { if (_isMother) { - delete[] vertices; - if (normals) delete[] normals; - if (textureCoords) delete[] textureCoords; - if (colors) delete[] colors; delete bbox; } } @@ -109,40 +63,9 @@ std::string MeshFrame::getPrint(const char* name) const { res << "MeshFrame("; } res << std::fixed << std::setprecision(2); - + res << "Id: " << id << ", " << std::endl; - res << "VertexCount: " << vertexCount << ", " << std::endl; - res << "NormalsCount: " << normalsCount << ", " << std::endl; - res << "TextureCoordsCount: " << textureCoordsCount << ", " << std::endl; - res << "ColorsCount: " << colorsCount << ", " << std::endl; res << "BBox: " << bbox->getPrint() << ", " << std::endl; - - res << "Vertices: "; - for (u32 i = 0; i < vertexCount; i++) { - res << vertices[i].getPrint() << ", " << std::endl; - } - - if (normals) { - res << "Normals: "; - for (u32 i = 0; i < normalsCount; i++) { - res << normals[i].getPrint() << ", " << std::endl; - } - } - - if (textureCoords) { - res << "TextureCoords: "; - for (u32 i = 0; i < textureCoordsCount; i++) { - res << textureCoords[i].getPrint() << ", " << std::endl; - } - } - - if (colors) { - res << "Colors: "; - for (u32 i = 0; i < colorsCount; i++) { - res << colors[i].getPrint() << ", " << std::endl; - } - } - res << ")"; return res.str(); diff --git a/engine/src/renderer/3d/mesh/mesh_material.cpp b/engine/src/renderer/3d/mesh/mesh_material.cpp index e791505..8c583d5 100644 --- a/engine/src/renderer/3d/mesh/mesh_material.cpp +++ b/engine/src/renderer/3d/mesh/mesh_material.cpp @@ -19,43 +19,20 @@ namespace Tyra { MeshMaterial::MeshMaterial(const MeshBuilderData& data, const u32& materialIndex) - : singleColor(false) { + : color(false) { TYRA_ASSERT(materialIndex < data.materialsCount && materialIndex >= 0, "Provided index \"", materialIndex, "\" is out of range"); id = rand() % 1000000; - vertexFaces = data.materials[materialIndex]->vertexFaces; - TYRA_ASSERT(vertexFaces != nullptr, "Vertex faces are required"); - - if (data.textureCoordsEnabled) { - textureCoordFaces = data.materials[materialIndex]->textureCoordFaces; - TYRA_ASSERT(textureCoordFaces != nullptr, - "Texture coord faces are required"); - } else { - textureCoordFaces = nullptr; - } - - if (data.normalsEnabled) { - normalFaces = data.materials[materialIndex]->normalFaces; - TYRA_ASSERT(normalFaces != nullptr, "Normal faces are required"); - } else { - normalFaces = nullptr; - } - if (data.manyColorsEnabled) { - colorFaces = data.materials[materialIndex]->colorFaces; singleColorFlag = false; - TYRA_ASSERT(colorFaces != nullptr, "Colors faces are required"); + TYRA_ASSERT(data.frames[0]->colors != nullptr, "Colors faces are required"); } else { - colorFaces = nullptr; singleColorFlag = true; } - singleColor.set(128.0F, 128.0F, 128.0F, 128.0F); - - facesCount = data.materials[materialIndex]->count; - TYRA_ASSERT(facesCount > 0, "Faces count must be greater than 0"); + color.set(128.0F, 128.0F, 128.0F, 128.0F); _name = data.materials[materialIndex]->name; TYRA_ASSERT(_name.length() > 0, "MeshMaterial name cannot be empty"); @@ -72,16 +49,11 @@ MeshMaterial::MeshMaterial(const MeshBuilderData& data, MeshMaterial::MeshMaterial(const MeshMaterial& mesh) { id = rand() % 1000000; - vertexFaces = mesh.vertexFaces; - textureCoordFaces = mesh.textureCoordFaces; - normalFaces = mesh.normalFaces; - colorFaces = mesh.colorFaces; - - facesCount = mesh.facesCount; + singleColorFlag = mesh.singleColorFlag; framesCount = mesh.framesCount; _name = mesh._name; - singleColor.set(128.0F, 128.0F, 128.0F, 128.0F); + color.set(128.0F, 128.0F, 128.0F, 128.0F); frames = new MeshMaterialFrame*[framesCount]; for (u32 i = 0; i < framesCount; i++) { @@ -92,13 +64,6 @@ MeshMaterial::MeshMaterial(const MeshMaterial& mesh) { } MeshMaterial::~MeshMaterial() { - if (_isMother) { - delete[] vertexFaces; - if (textureCoordFaces) delete[] textureCoordFaces; - if (normalFaces) delete[] normalFaces; - if (colorFaces) delete[] colorFaces; - } - for (u32 i = 0; i < framesCount; i++) { delete frames[i]; } @@ -111,7 +76,7 @@ const BBox& MeshMaterial::getBBox(const u32& frame) const { void MeshMaterial::setSingleColorFlag(const u8& flag) { TYRA_ASSERT( - colorFaces != nullptr, + frames[0]->getColors() != nullptr, "Colors and color faces are required to use color-per-vertex mode"); singleColorFlag = flag; @@ -139,39 +104,8 @@ std::string MeshMaterial::getPrint(const char* name) const { res << std::fixed << std::setprecision(2); res << "Id: " << id << ", " << std::endl; res << "Name: " << _name << ", " << std::endl; - res << "FacesCount: " << facesCount << ", " << std::endl; - res << "FramesCount: " << framesCount << ", " << std::endl; - - res << "vertexFaces: " << std::endl; - for (u32 i = 0; i < facesCount; i++) { - res << vertexFaces[i] << ", "; - if (i % 3 == 2) res << std::endl; - } - - if (textureCoordFaces) { - res << "TextureCoordFaces: " << std::endl; - for (u32 i = 0; i < facesCount; i++) { - res << textureCoordFaces[i] << ", "; - if (i % 3 == 2) res << std::endl; - } - } - - if (normalFaces) { - res << "NormalFaces: " << std::endl; - for (u32 i = 0; i < facesCount; i++) { - res << normalFaces[i] << ", "; - if (i % 3 == 2) res << std::endl; - } - } - - if (colorFaces) { - res << "ColorFaces: " << std::endl; - for (u32 i = 0; i < facesCount; i++) { - res << colorFaces[i] << ", "; - if (i % 3 == 2) res << std::endl; - } - } - + res << "Frames count: " << framesCount << ", " << std::endl; + res << "Single color?: " << static_cast(singleColorFlag) << std::endl; res << ")"; return res.str(); diff --git a/engine/src/renderer/3d/mesh/mesh_material_frame.cpp b/engine/src/renderer/3d/mesh/mesh_material_frame.cpp index f4e8519..d151cb5 100644 --- a/engine/src/renderer/3d/mesh/mesh_material_frame.cpp +++ b/engine/src/renderer/3d/mesh/mesh_material_frame.cpp @@ -11,6 +11,8 @@ #include "debug/debug.hpp" #include +#include +#include #include "renderer/models/color.hpp" #include "loaders/3d/builder/mesh_builder_data.hpp" #include "renderer/3d/mesh/mesh_material_frame.hpp" @@ -31,12 +33,24 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshBuilderData& data, data.materials[materialIndex]->vertexFaces, data.materials[materialIndex]->count); + allocateVertices(data, frameIndex, materialIndex); + allocateNormals(data, frameIndex, materialIndex); + allocateTextureCoords(data, frameIndex, materialIndex); + allocateColors(data, frameIndex, materialIndex); + _isMother = true; } MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) { id = rand() % 1000000; + vertexCount = frame.vertexCount; + + vertices = frame.vertices; + normals = frame.normals; + textureCoords = frame.textureCoords; + colors = frame.colors; + bbox = frame.bbox; _isMother = false; @@ -44,8 +58,124 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) { MeshMaterialFrame::~MeshMaterialFrame() { if (_isMother) { + delete[] vertices; + if (normals) delete[] normals; + if (textureCoords) delete[] textureCoords; + if (colors) delete[] colors; delete bbox; } } +std::string MeshMaterialFrame::getPrint(const char* name) const { + std::stringstream res; + if (name) { + res << name << "("; + } else { + res << "MeshMaterialFrame("; + } + res << std::fixed << std::setprecision(2); + + res << "Id: " << id << ", " << std::endl; + res << "Vertex count: " << vertexCount << ", " << std::endl; + res << "BBox: " << bbox->getPrint() << ", " << std::endl; + + res << "Vertices: "; + for (u32 i = 0; i < vertexCount; i++) { + res << vertices[i].getPrint() << ", " << std::endl; + } + + if (normals) { + res << "Normals: "; + for (u32 i = 0; i < vertexCount; i++) { + res << normals[i].getPrint() << ", " << std::endl; + } + } + + if (textureCoords) { + res << "TextureCoords: "; + for (u32 i = 0; i < vertexCount; i++) { + res << textureCoords[i].getPrint() << ", " << std::endl; + } + } + + if (colors) { + res << "Colors: "; + for (u32 i = 0; i < vertexCount; i++) { + res << colors[i].getPrint() << ", " << std::endl; + } + } + + res << ")"; + + return res.str(); +} + +void MeshMaterialFrame::allocateVertices(const MeshBuilderData& data, + const u32& frameIndex, + const u32& materialIndex) { + vertexCount = data.materials[materialIndex]->count; // faces count + vertices = new Vec4[vertexCount]; + + TYRA_ASSERT(vertexCount > 0, "Vertex count must be greater than 0"); + + auto* rolled = data.frames[frameIndex]->vertices; + auto* faces = data.materials[materialIndex]->vertexFaces; + + TYRA_ASSERT(rolled != nullptr, "Vertices are required"); + TYRA_ASSERT(faces != nullptr, "Vertex faces are required"); + + for (u32 i = 0; i < vertexCount; i++) vertices[i] = rolled[faces[i]]; +} + +void MeshMaterialFrame::allocateTextureCoords(const MeshBuilderData& data, + const u32& frameIndex, + const u32& materialIndex) { + textureCoords = nullptr; + if (!data.textureCoordsEnabled) return; + + textureCoords = new Vec4[vertexCount]; + + auto* rolled = data.frames[frameIndex]->textureCoords; + auto* faces = data.materials[materialIndex]->textureCoordFaces; + + TYRA_ASSERT(rolled != nullptr, "Texture coordinates are required"); + TYRA_ASSERT(faces != nullptr, "Texture coordinate faces are required"); + + for (u32 i = 0; i < vertexCount; i++) textureCoords[i] = rolled[faces[i]]; +} + +void MeshMaterialFrame::allocateNormals(const MeshBuilderData& data, + const u32& frameIndex, + const u32& materialIndex) { + normals = nullptr; + if (!data.normalsEnabled) return; + + normals = new Vec4[vertexCount]; + + auto* rolled = data.frames[frameIndex]->normals; + auto* faces = data.materials[materialIndex]->normalFaces; + + TYRA_ASSERT(rolled != nullptr, "Normals are required"); + TYRA_ASSERT(faces != nullptr, "Normal faces are required"); + + for (u32 i = 0; i < vertexCount; i++) normals[i] = rolled[faces[i]]; +} + +void MeshMaterialFrame::allocateColors(const MeshBuilderData& data, + const u32& frameIndex, + const u32& materialIndex) { + colors = nullptr; + if (!data.manyColorsEnabled) return; + + colors = new Color[vertexCount]; + + auto* rolled = data.frames[frameIndex]->colors; + auto* faces = data.materials[materialIndex]->colorFaces; + + TYRA_ASSERT(rolled != nullptr, "Colors are required"); + TYRA_ASSERT(faces != nullptr, "Color faces are required"); + + for (u32 i = 0; i < vertexCount; i++) colors[i] = rolled[faces[i]]; +} + } // namespace Tyra diff --git a/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_core.cpp b/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_core.cpp index 946b655..4f519d1 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_core.cpp +++ b/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_core.cpp @@ -46,6 +46,10 @@ void DynPipCore::initParts(DynPipBag* bag) { delete texBuffers; } +void DynPipCore::renderTEST(DynPipBag** bags, const u32& count) { + qbufferRenderer.renderTEST(bags, count); +} + void DynPipCore::renderPart(DynPipBag* bag, const bool& frustumCull) { if (bag->count <= 0) return; diff --git a/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_renderer.cpp b/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_renderer.cpp index 56c0b52..438a7a8 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_renderer.cpp +++ b/engine/src/renderer/3d/pipeline/dynamic/core/dynpip_renderer.cpp @@ -41,7 +41,7 @@ void DynPipRenderer::init(RendererCore* t_core, dma_channel_initialize(DMA_CHANNEL_VIF1, NULL, 0); dma_channel_fast_waits(DMA_CHANNEL_VIF1); - const u32 VU1_PACKET_SIZE = 16; + const u32 VU1_PACKET_SIZE = 256; packets[0] = packet2_create(VU1_PACKET_SIZE, P2_TYPE_NORMAL, P2_MODE_CHAIN, true); @@ -143,10 +143,40 @@ void DynPipRenderer::render(DynPipBag* bag) { sendPacket(); } +void DynPipRenderer::renderTEST(DynPipBag** bags, const u32& count) { + if (count <= 0) return; + + auto* program = programsRepo->getProgramByBag(bags[0]); + addBufferDataToPacketTEST(program, bags, count); + sendPacket(); +} + +void DynPipRenderer::addBufferDataToPacketTEST(DynPipVU1Program* program, + DynPipBag** bags, + const u32& count) { + currentPacket = packets[context]; + packet2_reset(currentPacket, false); + + for (u32 i = 0; i < count; i++) { + program->addBufferDataToPacket(currentPacket, bags[i], + &rendererCore->gs.prim); + } + + if (lastProgramName != program->getName()) { + packet2_utils_vu_add_start_program(currentPacket, + program->getDestinationAddress()); + lastProgramName = program->getName(); + } else { + packet2_utils_vu_add_continue_program(currentPacket); + } + packet2_utils_vu_add_end_tag(currentPacket); +} + void DynPipRenderer::addBufferDataToPacket(DynPipVU1Program* program, DynPipBag* bag) { currentPacket = packets[context]; packet2_reset(currentPacket, false); + program->addBufferDataToPacket(currentPacket, bag, &rendererCore->gs.prim); if (lastProgramName != program->getName()) { @@ -163,6 +193,9 @@ void DynPipRenderer::sendPacket() { dma_channel_wait(DMA_CHANNEL_VIF1, 0); dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true); + // TODO + // TYRA_LOG(packet2_get_qw_count(currentPacket)); + // Switch packet, so we can proceed during DMA transfer context = !context; } diff --git a/engine/src/renderer/3d/pipeline/dynamic/dynamic_pipeline.cpp b/engine/src/renderer/3d/pipeline/dynamic/dynamic_pipeline.cpp index e5fc654..f1bd708 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/dynamic_pipeline.cpp +++ b/engine/src/renderer/3d/pipeline/dynamic/dynamic_pipeline.cpp @@ -23,16 +23,17 @@ void DynamicPipeline::init(RendererCore* t_core) { void DynamicPipeline::onUse() { core.reinitVU1Programs(); } +#define BUFFER_COUNT 64 + void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) { auto model = mesh->getModelMatrix(); - auto* frameFrom = mesh->getFrame(mesh->getCurrentAnimationFrame()); - auto* frameTo = mesh->getFrame(mesh->getNextAnimationFrame()); auto* infoBag = getInfoBag(mesh, options, &model); PipelineDirLightsBag* dirLights = nullptr; auto frustumCulling = options ? options->frustumCulling : DynPipFrustumCulling_Simple; if (frustumCulling == DynPipFrustumCulling_Simple) { + auto* frameTo = mesh->getFrame(mesh->getNextAnimationFrame()); if (frameTo->getBBox().isInFrustum( rendererCore->renderer3D.frustumPlanes.getAll(), model) == CoreBBoxFrustum::OUTSIDE_FRUSTUM) { @@ -47,7 +48,7 @@ void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) { options->lighting->directionalDirections); } - DynPipBag buffers[2]; + DynPipBag buffers[BUFFER_COUNT]; u8 context = 0; setBuffersDefaultVars(buffers, mesh, infoBag); @@ -55,54 +56,78 @@ void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) { for (u32 i = 0; i < mesh->getMaterialsCount(); i++) { auto* material = mesh->getMaterial(i); - auto partSize = core.getMaxVertCountByParams( - options && options->lighting, material->getTextureCoordFaces()); + auto* frameFrom = material->getFrame(mesh->getCurrentAnimationFrame()); + auto* frameTo = material->getFrame(mesh->getNextAnimationFrame()); + + auto partSize = + core.getMaxVertCountByParams(options && options->lighting, + material->getFrame(0)->getTextureCoords()); + u32 partsCount = - ceil(material->getFacesCount() / static_cast(partSize)); + ceil(frameFrom->getVertexCount() / static_cast(partSize)); + auto* colorBag = getColorBag(material); + setBuffersColorBag(buffers, colorBag); u8 isPartInitialized = false; - for (u32 j = 0; j < partsCount; j++) { - auto& buffer = buffers[context]; + for (u32 k = 0; k < partsCount; k++) { + auto& buffer = buffers[context++]; freeBuffer(&buffer); - buffer.count = j == partsCount - 1 - ? material->getFacesCount() - j * partSize + buffer.count = k == partsCount - 1 + ? frameFrom->getVertexCount() - k * partSize : partSize; - u32 startIndex = j * partSize; + u32 startIndex = k * partSize; - addVertices(mesh, material, &buffer, frameFrom, frameTo, startIndex); - buffer.texture = getTextureBag(mesh, material, frameFrom, frameTo, - buffer.count, startIndex); - buffer.lighting = - getLightingBag(mesh, material, &model, frameFrom, frameTo, options, - dirLights, buffer.count, startIndex); + addVertices(frameFrom, frameTo, &buffer, startIndex); + buffer.texture = getTextureBag(material, frameFrom, frameTo, startIndex); + buffer.lighting = getLightingBag(frameFrom, frameTo, &model, options, + dirLights, startIndex); if (!isPartInitialized) { core.initParts(&buffer); isPartInitialized = true; } - core.renderPart(&buffer, frustumCulling == DynPipFrustumCulling_Precise); + // core.renderPart(&buffer, frustumCulling == + // DynPipFrustumCulling_Precise); - context = !context; + if (context == BUFFER_COUNT / 2 || context == BUFFER_COUNT) { + DynPipBag** sendBuffers = new DynPipBag*[BUFFER_COUNT / 2]; + for (u32 i = 0; i < BUFFER_COUNT / 2; i++) { + sendBuffers[i] = &buffers[context - ((BUFFER_COUNT / 2) - i)]; + } + core.renderTEST(sendBuffers, BUFFER_COUNT / 2); + + delete[] sendBuffers; + if (context == BUFFER_COUNT) context = 0; + } } - freeBuffer(&buffers[context]); - freeBuffer(&buffers[!context]); - delete colorBag; } + // TODO: Refactor (define itd, wywalic te wszystkie TEST i poprawic) + // TODO: Rozmiar pakietu VU1 na podstawie rozmiaru buforow + // TODO: Dorenderowac brakujace (np gdy context == 1-buffersize-1 itd) + // TODO: Program renderujacy w VU1 + // TODO: Github: Ten sam myk zrobic w static pipeline? + + for (u32 i = 0; i < BUFFER_COUNT; i++) freeBuffer(&buffers[i]); + + if (dirLights) { + delete dirLights; + } + delete infoBag; } void DynamicPipeline::setBuffersDefaultVars(DynPipBag* buffers, DynamicMesh* mesh, PipelineInfoBag* infoBag) { - for (int i = 0; i < 2; i++) { + for (int i = 0; i < BUFFER_COUNT; i++) { buffers[i].info = infoBag; buffers[i].interpolation = mesh->getAnimState().interpolation; } @@ -110,29 +135,19 @@ void DynamicPipeline::setBuffersDefaultVars(DynPipBag* buffers, void DynamicPipeline::setBuffersColorBag(DynPipBag* buffers, DynPipColorBag* colorBag) { - for (int i = 0; i < 2; i++) { + for (int i = 0; i < BUFFER_COUNT; i++) { buffers[i].color = colorBag; } } void DynamicPipeline::freeBuffer(DynPipBag* bag) { if (bag->texture) { - bag->texture->freeCoords(); delete bag->texture; } if (bag->lighting) { - bag->lighting->freeNormals(); delete bag->lighting; } - - if (bag->verticesFrom) { - delete[] bag->verticesFrom; - } - - if (bag->verticesTo) { - delete[] bag->verticesTo; - } } PipelineInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh, @@ -155,57 +170,42 @@ PipelineInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh, return result; } -void DynamicPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material, - DynPipBag* bag, MeshFrame* frameFrom, - MeshFrame* frameTo, - const u32& startIndex) const { - bag->verticesFrom = new Vec4[bag->count]; - bag->verticesTo = new Vec4[bag->count]; - - for (u32 i = startIndex; i < startIndex + bag->count; i++) { - auto& face = material->getVertexFaces()[i]; - auto offset = i - startIndex; - bag->verticesFrom[offset] = frameFrom->getVertices()[face]; - bag->verticesTo[offset] = frameTo->getVertices()[face]; - } +void DynamicPipeline::addVertices(MeshMaterialFrame* materialFrameFrom, + MeshMaterialFrame* materialFrameTo, + DynPipBag* bag, const u32& startIndex) const { + bag->verticesFrom = &materialFrameFrom->getVertices()[startIndex]; + bag->verticesTo = &materialFrameTo->getVertices()[startIndex]; } DynPipColorBag* DynamicPipeline::getColorBag(MeshMaterial* material) const { auto* result = new DynPipColorBag(); - result->single = &material->singleColor; + result->single = &material->color; return result; } DynPipTextureBag* DynamicPipeline::getTextureBag( - DynamicMesh* mesh, MeshMaterial* material, MeshFrame* frameFrom, - MeshFrame* frameTo, const u32& count, const u32& startIndex) { - if (!material->getTextureCoordFaces()) return nullptr; + MeshMaterial* material, MeshMaterialFrame* materialFrameFrom, + MeshMaterialFrame* materialFrameTo, const u32& startIndex) { + if (!materialFrameFrom->getTextureCoords()) return nullptr; auto* result = new DynPipTextureBag(); + result->texture = rendererCore->texture.repository.getBySpriteOrMesh(material->getId()); TYRA_ASSERT(result->texture, "Texture for material id: ", material->getId(), "was not found in texture repository!"); - result->coordinatesFrom = new Vec4[count]; - result->coordinatesTo = new Vec4[count]; - - for (u32 i = startIndex; i < startIndex + count; i++) { - auto& face = material->getTextureCoordFaces()[i]; - auto offset = i - startIndex; - result->coordinatesFrom[offset] = frameFrom->getTextureCoords()[face]; - result->coordinatesTo[offset] = frameTo->getTextureCoords()[face]; - } + result->coordinatesFrom = &materialFrameFrom->getTextureCoords()[startIndex]; + result->coordinatesTo = &materialFrameTo->getTextureCoords()[startIndex]; return result; } DynPipLightingBag* DynamicPipeline::getLightingBag( - DynamicMesh* mesh, MeshMaterial* material, M4x4* model, - MeshFrame* frameFrom, MeshFrame* frameTo, const DynPipOptions* options, - PipelineDirLightsBag* dirLightsBag, const u32& count, - const u32& startIndex) const { - if (!material->getNormalFaces() || options == nullptr || + MeshMaterialFrame* materialFrameFrom, MeshMaterialFrame* materialFrameTo, + M4x4* model, const DynPipOptions* options, + PipelineDirLightsBag* dirLightsBag, const u32& startIndex) const { + if (!materialFrameFrom->getNormals() || options == nullptr || options->lighting == nullptr) return nullptr; @@ -213,15 +213,9 @@ DynPipLightingBag* DynamicPipeline::getLightingBag( result->lightMatrix = model; result->dirLights = dirLightsBag; - result->normalsFrom = new Vec4[count]; - result->normalsTo = new Vec4[count]; - for (u32 i = startIndex; i < startIndex + count; i++) { - auto& face = material->getNormalFaces()[i]; - auto offset = i - startIndex; - result->normalsFrom[offset] = frameFrom->getNormals()[face]; - result->normalsTo[offset] = frameTo->getNormals()[face]; - } + result->normalsFrom = &materialFrameFrom->getNormals()[startIndex]; + result->normalsTo = &materialFrameTo->getNormals()[startIndex]; return result; } diff --git a/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp b/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp index 2e069c1..5f774ca 100644 --- a/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp +++ b/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp @@ -25,21 +25,13 @@ void StaticPipeline::onUse() { core.reinitVU1Programs(); } void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) { auto model = mesh->getModelMatrix(); - - MeshFrame* frameFrom = mesh->getFramesCount() > 0 - ? mesh->getFrame(mesh->getCurrentAnimationFrame()) - : mesh->getFrame(0); - - MeshFrame* frameTo = mesh->getFramesCount() > 0 - ? mesh->getFrame(mesh->getNextAnimationFrame()) - : nullptr; - auto* infoBag = getInfoBag(mesh, options, &model); if (options && options->lighting) setLightingColorsCache(options->lighting); for (u32 i = 0; i < mesh->getMaterialsCount(); i++) { auto* material = mesh->getMaterial(i); + auto* materialFrame = material->getFrame(0); // 2x bufory[maxVertCount*2] -> pętla po mniejszych częściach i czestsze // rendery @@ -50,12 +42,11 @@ void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) { // material->getTextureCoordFaces()); StaPipBag bag; - addVertices(mesh, material, &bag, frameFrom, frameTo); + addVertices(materialFrame, &bag); bag.info = infoBag; - bag.color = getColorBag(mesh, material, frameFrom, frameTo); - bag.texture = getTextureBag(mesh, material, frameFrom, frameTo); - bag.lighting = - getLightingBag(mesh, material, &model, frameFrom, frameTo, options); + bag.color = getColorBag(material, materialFrame); + bag.texture = getTextureBag(material, materialFrame); + bag.lighting = getLightingBag(materialFrame, &model, options); core.render(&bag); @@ -65,22 +56,10 @@ void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) { delete infoBag; } -void StaticPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material, - StaPipBag* bag, MeshFrame* frameFrom, - MeshFrame* frameTo) const { - bag->count = material->getFacesCount(); - bag->vertices = new Vec4[bag->count]; - - for (u32 i = 0; i < bag->count; i++) { - auto& face = material->getVertexFaces()[i]; - if (frameTo == nullptr) { - bag->vertices[i] = frameFrom->getVertices()[face]; - } else { - Vec4::setLerp(&bag->vertices[i], frameFrom->getVertices()[face], - frameTo->getVertices()[face], - mesh->getAnimState().interpolation); - } - } +void StaticPipeline::addVertices(MeshMaterialFrame* materialFrame, + StaPipBag* bag) const { + bag->count = materialFrame->getVertexCount(); + bag->vertices = materialFrame->getVertices(); } PipelineInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh, @@ -105,39 +84,22 @@ PipelineInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh, return result; } -StaPipColorBag* StaticPipeline::getColorBag(DynamicMesh* mesh, - MeshMaterial* material, - MeshFrame* frameFrom, - MeshFrame* frameTo) const { +StaPipColorBag* StaticPipeline::getColorBag( + MeshMaterial* material, MeshMaterialFrame* materialFrame) const { auto* result = new StaPipColorBag(); if (material->isSingleColorActivated()) { - result->single = &material->singleColor; + result->single = &material->color; } else { - result->many = new Color[material->getFacesCount()]; - - for (u32 i = 0; i < material->getFacesCount(); i++) { - auto& face = material->getColorFaces()[i]; - if (frameTo == nullptr) { - result->many[i] = frameFrom->getColors()[face]; - } else { - Vec4::setLerp( - reinterpret_cast(&result->many[i]), - reinterpret_cast(frameFrom->getColors()[face]), - reinterpret_cast(frameTo->getColors()[face]), - mesh->getAnimState().interpolation); - } - } + result->many = materialFrame->getColors(); } return result; } -StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh, - MeshMaterial* material, - MeshFrame* frameFrom, - MeshFrame* frameTo) { - if (!material->getTextureCoordFaces()) return nullptr; +StaPipTextureBag* StaticPipeline::getTextureBag( + MeshMaterial* material, MeshMaterialFrame* materialFrame) { + if (!materialFrame->getTextureCoords()) return nullptr; auto* result = new StaPipTextureBag(); @@ -146,28 +108,15 @@ StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh, TYRA_ASSERT(result->texture, "Texture for material id: ", material->getId(), "was not found in texture repository!"); - result->coordinates = new Vec4[material->getFacesCount()]; - - for (u32 i = 0; i < material->getFacesCount(); i++) { - auto& face = material->getTextureCoordFaces()[i]; - if (frameTo == nullptr) { - result->coordinates[i] = frameFrom->getTextureCoords()[face]; - } else { - Vec4::setLerp(&result->coordinates[i], - frameFrom->getTextureCoords()[face], - frameTo->getTextureCoords()[face], - mesh->getAnimState().interpolation); - } - } + result->coordinates = materialFrame->getTextureCoords(); return result; } StaPipLightingBag* StaticPipeline::getLightingBag( - DynamicMesh* mesh, MeshMaterial* material, M4x4* model, - MeshFrame* frameFrom, MeshFrame* frameTo, + MeshMaterialFrame* materialFrame, M4x4* model, const StaPipOptions* options) const { - if (!material->getNormalFaces() || options == nullptr || + if (!materialFrame->getNormals() || options == nullptr || options->lighting == nullptr) return nullptr; @@ -181,18 +130,7 @@ StaPipLightingBag* StaticPipeline::getLightingBag( result->dirLights->setLightsManually( colorsCache, options->lighting->directionalDirections); - result->normals = new Vec4[material->getFacesCount()]; - - for (u32 i = 0; i < material->getFacesCount(); i++) { - auto& face = material->getNormalFaces()[i]; - if (frameTo == nullptr) { - result->normals[i] = frameFrom->getNormals()[face]; - } else { - Vec4::setLerp(&result->normals[i], frameFrom->getNormals()[face], - frameTo->getNormals()[face], - mesh->getAnimState().interpolation); - } - } + result->normals = materialFrame->getNormals(); return result; } @@ -208,22 +146,15 @@ void StaticPipeline::setLightingColorsCache( void StaticPipeline::deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const { - if (bag->color->many) { - delete[] bag->color->many; - } - if (bag->texture) { - delete[] bag->texture->coordinates; delete bag->texture; } if (bag->lighting) { - delete[] bag->lighting->normals; delete bag->lighting->dirLights; // TODO delete bag->lighting; } - delete[] bag->vertices; delete bag->color; } diff --git a/samples/h4570/src/h4570.cpp b/samples/h4570/src/h4570.cpp index a92de55..bf40fb6 100644 --- a/samples/h4570/src/h4570.cpp +++ b/samples/h4570/src/h4570.cpp @@ -104,7 +104,7 @@ void H4570::init() { } engine->audio.playSong(); - // engine->renderer.setFrameLimit(false); + engine->renderer.setFrameLimit(false); } u32 counter = 0; @@ -149,9 +149,34 @@ void H4570::loop() { engine->renderer.renderer3D.usePipeline(&dynpip); { dynpip.render(warrior, dynOptions); + // dynpip.render(warrior2, dynOptions); // dynpip.render(warrior3, dynOptions); // dynpip.render(warrior4, dynOptions); + + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + // dynpip.render(warrior2, dynOptions); + + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); + // dynpip.render(warrior3, dynOptions); } engine->renderer.renderer3D.usePipeline(&mcPip);