diff --git a/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp new file mode 100644 index 0000000..1a9cfc9 --- /dev/null +++ b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp @@ -0,0 +1,56 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#pragma once + +#include "math/vec4.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp" +#include "./dynpip_color_bag.hpp" +#include "./dynpip_texture_bag.hpp" +#include "renderer/core/texture/models/texture.hpp" + +namespace Tyra { + +/** + * @brief 3D Animated render data bag. + * Supports frustum culling, simple clipping (culling), lighting, + * texture and single color / many colors. + */ +class DynPipBag { + public: + DynPipBag(); + ~DynPipBag(); + + /** Mandatory. Object info. */ + PipelineInfoBag* info; + + /** Mandatory. Object color(s). */ + DynPipColorBag* color; + + /** Mandatory. Vertex count. */ + u32 count; + + /** Mandatory. Vertices. */ + Vec4* vertices; + + /** Optional. Texture coordinates and image. */ + DynPipTextureBag* texture; + + /** Optional. Object lighting. */ + PipelineLightingBag* lighting; + + 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; +}; + +} // namespace Tyra diff --git a/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp new file mode 100644 index 0000000..5ffeb32 --- /dev/null +++ b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp @@ -0,0 +1,32 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#pragma once + +#include "renderer/models/color.hpp" + +namespace Tyra { + +/** + * @brief Color data. At least one color data is required (single/many). + */ +class DynPipColorBag { + public: + DynPipColorBag(); + ~DynPipColorBag(); + + /** Optional. Single color for all vertices. */ + Color* single; + + /** Optional. Color per vertex. */ + Color* many; +}; + +} // namespace Tyra diff --git a/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp new file mode 100644 index 0000000..cc3a6bf --- /dev/null +++ b/engine/inc/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp @@ -0,0 +1,30 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#pragma once + +#include "math/vec4.hpp" +#include "renderer/core/texture/models/texture.hpp" + +namespace Tyra { + +class DynPipTextureBag { + public: + DynPipTextureBag(); + ~DynPipTextureBag(); + + /** Mandatory. Texture coordinates per vertex. */ + Vec4* coordinates; + + /** Mandatory. Texture image. */ + Texture* texture; +}; + +} // namespace Tyra diff --git a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp similarity index 79% rename from engine/inc/renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp rename to engine/inc/renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp index ba79e59..a9a99bd 100644 --- a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp +++ b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp @@ -13,19 +13,19 @@ #include #include "math/m4x4.hpp" #include "math/vec4.hpp" -#include "../../stapip_shading_type.hpp" +#include "./pipeline_shading_type.hpp" namespace Tyra { -class StaPipInfoBag { +class PipelineInfoBag { public: - StaPipInfoBag(); - ~StaPipInfoBag(); + PipelineInfoBag(); + ~PipelineInfoBag(); /** Mandatory. Model matrix */ M4x4* model; - StaPipShadingType shadingType; + PipelineShadingType shadingType; bool blendingEnabled; bool antiAliasingEnabled; bool noClipChecks; diff --git a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.hpp b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp similarity index 86% rename from engine/inc/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.hpp rename to engine/inc/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp index 1eebdb5..ae75e8e 100644 --- a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.hpp +++ b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp @@ -16,12 +16,12 @@ namespace Tyra { -enum StaPipLightingBagMode { Auto, Manual }; +enum PipelineLightingBagMode { Auto, Manual }; -class StaPipLightingBag { +class PipelineLightingBag { public: - explicit StaPipLightingBag(const bool& manual = false); - ~StaPipLightingBag(); + explicit PipelineLightingBag(const bool& manual = false); + ~PipelineLightingBag(); Vec4* normals; M4x4* lightMatrix; @@ -47,7 +47,7 @@ class StaPipLightingBag { void deallocate(); void forceDeallocate(); u8 isAllocated; - StaPipLightingBagMode mode; + PipelineLightingBagMode mode; Vec4* lightColors; Vec4* lightDirections; diff --git a/engine/inc/renderer/3d/pipeline/static/stapip_shading_type.hpp b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp similarity index 89% rename from engine/inc/renderer/3d/pipeline/static/stapip_shading_type.hpp rename to engine/inc/renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp index 544242b..441beee 100644 --- a/engine/inc/renderer/3d/pipeline/static/stapip_shading_type.hpp +++ b/engine/inc/renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp @@ -12,7 +12,7 @@ namespace Tyra { -enum StaPipShadingType { +enum PipelineShadingType { StaPipShadingFlat, StaPipShadingGouraud, }; diff --git a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_bag.hpp b/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_bag.hpp index c3cc7af..a4dcff0 100644 --- a/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_bag.hpp +++ b/engine/inc/renderer/3d/pipeline/static/core/bag/stapip_bag.hpp @@ -11,8 +11,8 @@ #pragma once #include "math/vec4.hpp" -#include "./stapip_lighting_bag.hpp" -#include "./stapip_info_bag.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp" #include "./stapip_color_bag.hpp" #include "./stapip_texture_bag.hpp" #include "renderer/core/texture/models/texture.hpp" @@ -22,7 +22,7 @@ namespace Tyra { /** * @brief 3D Render data bag. - * Supports frustum culling, clipping, lighting, + * Supports frustum culling, full plane clipping, lighting, * texture and single color / many colors. */ class StaPipBag { @@ -31,7 +31,7 @@ class StaPipBag { ~StaPipBag(); /** Mandatory. Object info. */ - StaPipInfoBag* info; + PipelineInfoBag* info; /** Mandatory. Object color(s). */ StaPipColorBag* color; @@ -46,7 +46,7 @@ class StaPipBag { StaPipTextureBag* texture; /** Optional. Object lighting. */ - StaPipLightingBag* lighting; + PipelineLightingBag* lighting; /** * @param maxVertCount This parameter is available in renderer API. diff --git a/engine/inc/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp b/engine/inc/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp index 1dfba35..9426861 100644 --- a/engine/inc/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp +++ b/engine/inc/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp @@ -46,7 +46,7 @@ class StaPipQBufferRenderer { void setMaxVertCount(const u32& count); - void setInfo(StaPipInfoBag* bag); + void setInfo(PipelineInfoBag* bag); /** Fast render with culling */ void cull(StaPipQBuffer* buffer); diff --git a/engine/inc/renderer/3d/pipeline/static/stapip_options.hpp b/engine/inc/renderer/3d/pipeline/static/stapip_options.hpp index 2630ce0..ccad0be 100644 --- a/engine/inc/renderer/3d/pipeline/static/stapip_options.hpp +++ b/engine/inc/renderer/3d/pipeline/static/stapip_options.hpp @@ -10,7 +10,7 @@ #pragma once -#include "./stapip_shading_type.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp" #include "./stapip_lighting_options.hpp" namespace Tyra { @@ -20,7 +20,7 @@ class StaPipOptions { StaPipOptions() {} ~StaPipOptions() {} - StaPipShadingType shadingType; + PipelineShadingType shadingType; bool blendingEnabled; bool antiAliasingEnabled; bool noClipChecks; diff --git a/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp b/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp index 6647910..a384218 100644 --- a/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp +++ b/engine/inc/renderer/3d/pipeline/static/static_pipeline.hpp @@ -41,16 +41,16 @@ class StaticPipeline : public Renderer3DPipeline { void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag, MeshFrame* frameFrom, MeshFrame* frameTo) const; - StaPipInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options, - M4x4* model) 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, - const StaPipOptions* options) const; + PipelineLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material, + M4x4* model, MeshFrame* frameFrom, + MeshFrame* frameTo, + const StaPipOptions* options) const; void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const; void setLightingColorsCache(StaPipLightingOptions* lightingOptions); diff --git a/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_bag.cpp b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_bag.cpp new file mode 100644 index 0000000..52dfab3 --- /dev/null +++ b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_bag.cpp @@ -0,0 +1,79 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#include "renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp" +#include +#include + +namespace Tyra { + +DynPipBag::DynPipBag() { + info = nullptr; + color = nullptr; + texture = nullptr; + lighting = nullptr; +} + +DynPipBag::~DynPipBag() {} + +void DynPipBag::print() const { + auto text = getPrint(nullptr); + printf("%s\n", text.c_str()); +} + +void DynPipBag::print(const char* name) const { + auto text = getPrint(name); + printf("%s\n", text.c_str()); +} + +std::string DynPipBag::getPrint(const char* name) const { + std::stringstream res; + if (name) { + res << name << "("; + } else { + res << "DynPipBag("; + } + res << std::fixed << std::setprecision(4); + res << std::endl; + res << "Count: " << count << ", " << std::endl; + res << "Vertices present: " << (vertices != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Info present: " << (info != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Color present: " << (color != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Texture present: " << (texture != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Lighting present: " << (lighting != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Model matrix: " << info->model->getPrint() << ", " << std::endl; + if (color->single) { + res << "Color single: " << color->single->getPrint() << ", " << std::endl; + } else { + res << "Color many: " << color->many->getPrint() << ", " << std::endl; + } + if (texture) { + res << "Texture coords present: " + << (texture->coordinates != nullptr ? "Yes" : "No") << ", " + << std::endl; + res << "Texture: " << texture->texture->getPrint() << ", " << std::endl; + } + if (lighting) { + res << "Lighting normals present: " << (lighting->normals ? "Yes" : "No") + << ", " << std::endl; + res << "Lighting matrix: " << lighting->lightMatrix->getPrint() << ", " + << std::endl; + } + res << ")"; + + return res.str(); +} + +} // namespace Tyra diff --git a/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.cpp b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.cpp new file mode 100644 index 0000000..18f43b2 --- /dev/null +++ b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.cpp @@ -0,0 +1,22 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#include "renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp" + +namespace Tyra { + +DynPipColorBag::DynPipColorBag() { + single = nullptr; + many = nullptr; +} + +DynPipColorBag::~DynPipColorBag() {} + +} // namespace Tyra diff --git a/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.cpp b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.cpp new file mode 100644 index 0000000..d5c7f7e --- /dev/null +++ b/engine/src/renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.cpp @@ -0,0 +1,22 @@ +/* +# ______ ____ ___ +# | \/ ____| |___| +# | | | \ | | +#----------------------------------------------------------------------- +# Copyright 2022, tyra - https://github.com/h4570/tyra +# Licenced under Apache License 2.0 +# Sandro Sobczyński +*/ + +#include "renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp" + +namespace Tyra { + +DynPipTextureBag::DynPipTextureBag() { + coordinates = nullptr; + texture = nullptr; +} + +DynPipTextureBag::~DynPipTextureBag() {} + +} // namespace Tyra diff --git a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_c_vu1.vclpp b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_c_vu1.vclpp index 0fce4aa..93308c8 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_c_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_c_vu1.vclpp @@ -19,8 +19,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_d_vu1.vclpp b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_d_vu1.vclpp index 4a05c78..34290f7 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_d_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_d_vu1.vclpp @@ -19,8 +19,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_tc_vu1.vclpp b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_tc_vu1.vclpp index e01494f..93a2ad7 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_tc_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_tc_vu1.vclpp @@ -19,8 +19,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_td_vu1.vclpp b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_td_vu1.vclpp index 8f46639..cc4f20d 100644 --- a/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_td_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/dynamic/programs/dynpip_td_vu1.vclpp @@ -19,8 +19,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_as_is_vu1.vclpp b/engine/src/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_as_is_vu1.vclpp index 7d89c7d..a706e90 100644 --- a/engine/src/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_as_is_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_as_is_vu1.vclpp @@ -21,7 +21,7 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" #include "inc/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_vu1_as_is_shared_defines.h" #include "src/renderer/3d/pipeline/minecraft/programs/as_is/macros.i" diff --git a/engine/src/renderer/3d/pipeline/minecraft/programs/cull/mcpip_cull_vu1.vclpp b/engine/src/renderer/3d/pipeline/minecraft/programs/cull/mcpip_cull_vu1.vclpp index 2e71c13..5e2c1a6 100644 --- a/engine/src/renderer/3d/pipeline/minecraft/programs/cull/mcpip_cull_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/minecraft/programs/cull/mcpip_cull_vu1.vclpp @@ -21,7 +21,7 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" #include "inc/renderer/3d/pipeline/minecraft/programs/cull/mcpip_vu1_cull_shared_defines.h" #include "src/renderer/3d/pipeline/minecraft/programs/cull/macros.i" diff --git a/engine/src/renderer/3d/pipeline/static/core/bag/stapip_info_bag.cpp b/engine/src/renderer/3d/pipeline/shared/bag/pipeline_info_bag.cpp similarity index 76% rename from engine/src/renderer/3d/pipeline/static/core/bag/stapip_info_bag.cpp rename to engine/src/renderer/3d/pipeline/shared/bag/pipeline_info_bag.cpp index 9dd6b34..2389618 100644 --- a/engine/src/renderer/3d/pipeline/static/core/bag/stapip_info_bag.cpp +++ b/engine/src/renderer/3d/pipeline/shared/bag/pipeline_info_bag.cpp @@ -8,17 +8,17 @@ # Sandro Sobczyński */ -#include "renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp" namespace Tyra { -StaPipInfoBag::StaPipInfoBag() { +PipelineInfoBag::PipelineInfoBag() { shadingType = StaPipShadingFlat; blendingEnabled = true; antiAliasingEnabled = false; model = nullptr; } -StaPipInfoBag::~StaPipInfoBag() {} +PipelineInfoBag::~PipelineInfoBag() {} } // namespace Tyra diff --git a/engine/src/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.cpp b/engine/src/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.cpp similarity index 63% rename from engine/src/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.cpp rename to engine/src/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.cpp index 4f56e2e..b32a500 100644 --- a/engine/src/renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.cpp +++ b/engine/src/renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.cpp @@ -9,11 +9,11 @@ */ #include "debug/debug.hpp" -#include "renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.hpp" +#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp" namespace Tyra { -StaPipLightingBag::StaPipLightingBag(const bool& manual) { +PipelineLightingBag::PipelineLightingBag(const bool& manual) { isAllocated = false; mode = Auto; normals = nullptr; @@ -27,33 +27,33 @@ StaPipLightingBag::StaPipLightingBag(const bool& manual) { } } -StaPipLightingBag::~StaPipLightingBag() { deallocate(); } +PipelineLightingBag::~PipelineLightingBag() { deallocate(); } -void StaPipLightingBag::setAmbientColor(const Color& color) { +void PipelineLightingBag::setAmbientColor(const Color& color) { TYRA_ASSERT(mode != Manual, "Ambient color cannot be set in manual mode"); lightColors[3].set(reinterpret_cast(color)); } -void StaPipLightingBag::setDirectionalLightColors(Color* colors, - const u8& count) { +void PipelineLightingBag::setDirectionalLightColors(Color* colors, + const u8& count) { for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i); } -void StaPipLightingBag::setDirectionalLightDirections(Vec4* directions, - const u8& count) { +void PipelineLightingBag::setDirectionalLightDirections(Vec4* directions, + const u8& count) { for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i); } -void StaPipLightingBag::setDirectionalLightColor(const Color& color, - const u8& index) { +void PipelineLightingBag::setDirectionalLightColor(const Color& color, + const u8& index) { TYRA_ASSERT(mode != Manual, "Directional lights cannot be set in manual mode"); TYRA_ASSERT(index < 3, "There are max 3 directional lights"); lightColors[index].set(reinterpret_cast(color)); } -void StaPipLightingBag::setDirectionalLightDirection(const Vec4& direction, - const u8& index) { +void PipelineLightingBag::setDirectionalLightDirection(const Vec4& direction, + const u8& index) { TYRA_ASSERT(mode != Manual, "Directional lights cannot be set in manual mode"); TYRA_ASSERT(index < 3, "There are max 3 directional lights"); @@ -61,19 +61,19 @@ void StaPipLightingBag::setDirectionalLightDirection(const Vec4& direction, lightDirections[index].set(direction); } -void StaPipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) { +void PipelineLightingBag::setLightsManually(Vec4* colors, Vec4* directions) { deallocate(); lightColors = colors; lightDirections = directions; mode = Manual; } -void StaPipLightingBag::disableManualMode() { +void PipelineLightingBag::disableManualMode() { allocate(); mode = Auto; } -void StaPipLightingBag::allocate() { +void PipelineLightingBag::allocate() { if (isAllocated) return; lightColors = new Vec4[4]; @@ -92,27 +92,27 @@ void StaPipLightingBag::allocate() { isAllocated = true; } -void StaPipLightingBag::deallocate() { +void PipelineLightingBag::deallocate() { if (!isAllocated) return; forceDeallocate(); } -void StaPipLightingBag::forceDeallocate() { +void PipelineLightingBag::forceDeallocate() { forceDeallocateColors(); forceDeallocateDirections(); isAllocated = false; } -void StaPipLightingBag::forceDeallocateColors() { +void PipelineLightingBag::forceDeallocateColors() { if (lightColors != nullptr) { delete[] lightColors; lightColors = nullptr; } } -void StaPipLightingBag::forceDeallocateDirections() { +void PipelineLightingBag::forceDeallocateDirections() { if (lightDirections != nullptr) { delete[] lightDirections; lightDirections = nullptr; diff --git a/engine/src/renderer/3d/pipeline/shared_macros/tyra_macros.i b/engine/src/renderer/3d/pipeline/shared/tyra_macros.i similarity index 100% rename from engine/src/renderer/3d/pipeline/shared_macros/tyra_macros.i rename to engine/src/renderer/3d/pipeline/shared/tyra_macros.i diff --git a/engine/src/renderer/3d/pipeline/shared_macros/vcl_sml.i b/engine/src/renderer/3d/pipeline/shared/vcl_sml.i similarity index 100% rename from engine/src/renderer/3d/pipeline/shared_macros/vcl_sml.i rename to engine/src/renderer/3d/pipeline/shared/vcl_sml.i diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1.vclpp index a2a13c1..1c63352 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1.vclpp index 7f04ebd..d9071fa 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1.vclpp index 0f30a7c..90775ab 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1.vclpp index 8c85a57..b072c83 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1.vclpp index b0dbeb0..27067f1 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1.vclpp index 0fae0e5..0894b9a 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define RGBA_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1.vclpp index b73cf12..5aae3b7 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1.vclpp b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1.vclpp index 1f833a2..3a7c3ff 100644 --- a/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1.vclpp +++ b/engine/src/renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1.vclpp @@ -18,8 +18,8 @@ .init_vf_all .init_vi_all -#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i" -#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i" +#include "src/renderer/3d/pipeline/shared/vcl_sml.i" +#include "src/renderer/3d/pipeline/shared/tyra_macros.i" #include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h" #define STQ_STORE_OFFSET 0 diff --git a/engine/src/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.cpp b/engine/src/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.cpp index c859392..195b295 100644 --- a/engine/src/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.cpp +++ b/engine/src/renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.cpp @@ -130,7 +130,7 @@ void StaPipQBufferRenderer::sendObjectData( dma_channel_send_packet2(objectDataPacket, DMA_CHANNEL_VIF1, true); } -void StaPipQBufferRenderer::setInfo(StaPipInfoBag* bag) { +void StaPipQBufferRenderer::setInfo(PipelineInfoBag* bag) { rendererCore->gs.prim.antialiasing = bag->antiAliasingEnabled; rendererCore->gs.prim.blending = bag->blendingEnabled; rendererCore->gs.prim.shading = bag->shadingType; diff --git a/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp b/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp index 834edf4..008dd5e 100644 --- a/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp +++ b/engine/src/renderer/3d/pipeline/static/static_pipeline.cpp @@ -83,10 +83,10 @@ void StaticPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material, } } -StaPipInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh, - const StaPipOptions* options, - M4x4* model) const { - auto* result = new StaPipInfoBag(); +PipelineInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh, + const StaPipOptions* options, + M4x4* model) const { + auto* result = new PipelineInfoBag(); if (options) { result->antiAliasingEnabled = options->antiAliasingEnabled; @@ -163,7 +163,7 @@ StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh, return result; } -StaPipLightingBag* StaticPipeline::getLightingBag( +PipelineLightingBag* StaticPipeline::getLightingBag( DynamicMesh* mesh, MeshMaterial* material, M4x4* model, MeshFrame* frameFrom, MeshFrame* frameTo, const StaPipOptions* options) const { @@ -171,7 +171,7 @@ StaPipLightingBag* StaticPipeline::getLightingBag( options->lighting == nullptr) return nullptr; - auto* result = new StaPipLightingBag(true); + auto* result = new PipelineLightingBag(true); result->lightMatrix = model; result->setLightsManually(colorsCache,