init dynpip bag
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "math/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
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "math/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
|
||||||
+5
-5
@@ -13,19 +13,19 @@
|
|||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include "math/m4x4.hpp"
|
#include "math/m4x4.hpp"
|
||||||
#include "math/vec4.hpp"
|
#include "math/vec4.hpp"
|
||||||
#include "../../stapip_shading_type.hpp"
|
#include "./pipeline_shading_type.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class StaPipInfoBag {
|
class PipelineInfoBag {
|
||||||
public:
|
public:
|
||||||
StaPipInfoBag();
|
PipelineInfoBag();
|
||||||
~StaPipInfoBag();
|
~PipelineInfoBag();
|
||||||
|
|
||||||
/** Mandatory. Model matrix */
|
/** Mandatory. Model matrix */
|
||||||
M4x4* model;
|
M4x4* model;
|
||||||
|
|
||||||
StaPipShadingType shadingType;
|
PipelineShadingType shadingType;
|
||||||
bool blendingEnabled;
|
bool blendingEnabled;
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
bool noClipChecks;
|
bool noClipChecks;
|
||||||
+5
-5
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
enum StaPipLightingBagMode { Auto, Manual };
|
enum PipelineLightingBagMode { Auto, Manual };
|
||||||
|
|
||||||
class StaPipLightingBag {
|
class PipelineLightingBag {
|
||||||
public:
|
public:
|
||||||
explicit StaPipLightingBag(const bool& manual = false);
|
explicit PipelineLightingBag(const bool& manual = false);
|
||||||
~StaPipLightingBag();
|
~PipelineLightingBag();
|
||||||
|
|
||||||
Vec4* normals;
|
Vec4* normals;
|
||||||
M4x4* lightMatrix;
|
M4x4* lightMatrix;
|
||||||
@@ -47,7 +47,7 @@ class StaPipLightingBag {
|
|||||||
void deallocate();
|
void deallocate();
|
||||||
void forceDeallocate();
|
void forceDeallocate();
|
||||||
u8 isAllocated;
|
u8 isAllocated;
|
||||||
StaPipLightingBagMode mode;
|
PipelineLightingBagMode mode;
|
||||||
|
|
||||||
Vec4* lightColors;
|
Vec4* lightColors;
|
||||||
Vec4* lightDirections;
|
Vec4* lightDirections;
|
||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
enum StaPipShadingType {
|
enum PipelineShadingType {
|
||||||
StaPipShadingFlat,
|
StaPipShadingFlat,
|
||||||
StaPipShadingGouraud,
|
StaPipShadingGouraud,
|
||||||
};
|
};
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "math/vec4.hpp"
|
#include "math/vec4.hpp"
|
||||||
#include "./stapip_lighting_bag.hpp"
|
#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp"
|
||||||
#include "./stapip_info_bag.hpp"
|
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||||
#include "./stapip_color_bag.hpp"
|
#include "./stapip_color_bag.hpp"
|
||||||
#include "./stapip_texture_bag.hpp"
|
#include "./stapip_texture_bag.hpp"
|
||||||
#include "renderer/core/texture/models/texture.hpp"
|
#include "renderer/core/texture/models/texture.hpp"
|
||||||
@@ -22,7 +22,7 @@ namespace Tyra {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 3D Render data bag.
|
* @brief 3D Render data bag.
|
||||||
* Supports frustum culling, clipping, lighting,
|
* Supports frustum culling, full plane clipping, lighting,
|
||||||
* texture and single color / many colors.
|
* texture and single color / many colors.
|
||||||
*/
|
*/
|
||||||
class StaPipBag {
|
class StaPipBag {
|
||||||
@@ -31,7 +31,7 @@ class StaPipBag {
|
|||||||
~StaPipBag();
|
~StaPipBag();
|
||||||
|
|
||||||
/** Mandatory. Object info. */
|
/** Mandatory. Object info. */
|
||||||
StaPipInfoBag* info;
|
PipelineInfoBag* info;
|
||||||
|
|
||||||
/** Mandatory. Object color(s). */
|
/** Mandatory. Object color(s). */
|
||||||
StaPipColorBag* color;
|
StaPipColorBag* color;
|
||||||
@@ -46,7 +46,7 @@ class StaPipBag {
|
|||||||
StaPipTextureBag* texture;
|
StaPipTextureBag* texture;
|
||||||
|
|
||||||
/** Optional. Object lighting. */
|
/** Optional. Object lighting. */
|
||||||
StaPipLightingBag* lighting;
|
PipelineLightingBag* lighting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param maxVertCount This parameter is available in renderer API.
|
* @param maxVertCount This parameter is available in renderer API.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StaPipQBufferRenderer {
|
|||||||
|
|
||||||
void setMaxVertCount(const u32& count);
|
void setMaxVertCount(const u32& count);
|
||||||
|
|
||||||
void setInfo(StaPipInfoBag* bag);
|
void setInfo(PipelineInfoBag* bag);
|
||||||
|
|
||||||
/** Fast render with culling */
|
/** Fast render with culling */
|
||||||
void cull(StaPipQBuffer* buffer);
|
void cull(StaPipQBuffer* buffer);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "./stapip_shading_type.hpp"
|
#include "renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp"
|
||||||
#include "./stapip_lighting_options.hpp"
|
#include "./stapip_lighting_options.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
@@ -20,7 +20,7 @@ class StaPipOptions {
|
|||||||
StaPipOptions() {}
|
StaPipOptions() {}
|
||||||
~StaPipOptions() {}
|
~StaPipOptions() {}
|
||||||
|
|
||||||
StaPipShadingType shadingType;
|
PipelineShadingType shadingType;
|
||||||
bool blendingEnabled;
|
bool blendingEnabled;
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
bool noClipChecks;
|
bool noClipChecks;
|
||||||
|
|||||||
@@ -41,16 +41,16 @@ class StaticPipeline : public Renderer3DPipeline {
|
|||||||
|
|
||||||
void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag,
|
void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||||
StaPipInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
|
PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
|
||||||
M4x4* model) const;
|
M4x4* model) const;
|
||||||
StaPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
|
StaPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||||
StaPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
|
StaPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo);
|
MeshFrame* frameFrom, MeshFrame* frameTo);
|
||||||
StaPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
|
PipelineLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||||
M4x4* model, MeshFrame* frameFrom,
|
M4x4* model, MeshFrame* frameFrom,
|
||||||
MeshFrame* frameTo,
|
MeshFrame* frameTo,
|
||||||
const StaPipOptions* options) const;
|
const StaPipOptions* options) const;
|
||||||
void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const;
|
void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const;
|
||||||
|
|
||||||
void setLightingColorsCache(StaPipLightingOptions* lightingOptions);
|
void setLightingColorsCache(StaPipLightingOptions* lightingOptions);
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp"
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
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
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp"
|
||||||
|
|
||||||
|
namespace Tyra {
|
||||||
|
|
||||||
|
DynPipColorBag::DynPipColorBag() {
|
||||||
|
single = nullptr;
|
||||||
|
many = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynPipColorBag::~DynPipColorBag() {}
|
||||||
|
|
||||||
|
} // namespace Tyra
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp"
|
||||||
|
|
||||||
|
namespace Tyra {
|
||||||
|
|
||||||
|
DynPipTextureBag::DynPipTextureBag() {
|
||||||
|
coordinates = nullptr;
|
||||||
|
texture = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynPipTextureBag::~DynPipTextureBag() {}
|
||||||
|
|
||||||
|
} // namespace Tyra
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_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 "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"
|
#include "src/renderer/3d/pipeline/minecraft/programs/as_is/macros.i"
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_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 "inc/renderer/3d/pipeline/minecraft/programs/cull/mcpip_vu1_cull_shared_defines.h"
|
||||||
#include "src/renderer/3d/pipeline/minecraft/programs/cull/macros.i"
|
#include "src/renderer/3d/pipeline/minecraft/programs/cull/macros.i"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -8,17 +8,17 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp"
|
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
StaPipInfoBag::StaPipInfoBag() {
|
PipelineInfoBag::PipelineInfoBag() {
|
||||||
shadingType = StaPipShadingFlat;
|
shadingType = StaPipShadingFlat;
|
||||||
blendingEnabled = true;
|
blendingEnabled = true;
|
||||||
antiAliasingEnabled = false;
|
antiAliasingEnabled = false;
|
||||||
model = nullptr;
|
model = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
StaPipInfoBag::~StaPipInfoBag() {}
|
PipelineInfoBag::~PipelineInfoBag() {}
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
+19
-19
@@ -9,11 +9,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug/debug.hpp"
|
#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 {
|
namespace Tyra {
|
||||||
|
|
||||||
StaPipLightingBag::StaPipLightingBag(const bool& manual) {
|
PipelineLightingBag::PipelineLightingBag(const bool& manual) {
|
||||||
isAllocated = false;
|
isAllocated = false;
|
||||||
mode = Auto;
|
mode = Auto;
|
||||||
normals = nullptr;
|
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");
|
TYRA_ASSERT(mode != Manual, "Ambient color cannot be set in manual mode");
|
||||||
lightColors[3].set(reinterpret_cast<const Vec4&>(color));
|
lightColors[3].set(reinterpret_cast<const Vec4&>(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::setDirectionalLightColors(Color* colors,
|
void PipelineLightingBag::setDirectionalLightColors(Color* colors,
|
||||||
const u8& count) {
|
const u8& count) {
|
||||||
for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i);
|
for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::setDirectionalLightDirections(Vec4* directions,
|
void PipelineLightingBag::setDirectionalLightDirections(Vec4* directions,
|
||||||
const u8& count) {
|
const u8& count) {
|
||||||
for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i);
|
for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::setDirectionalLightColor(const Color& color,
|
void PipelineLightingBag::setDirectionalLightColor(const Color& color,
|
||||||
const u8& index) {
|
const u8& index) {
|
||||||
TYRA_ASSERT(mode != Manual,
|
TYRA_ASSERT(mode != Manual,
|
||||||
"Directional lights cannot be set in manual mode");
|
"Directional lights cannot be set in manual mode");
|
||||||
TYRA_ASSERT(index < 3, "There are max 3 directional lights");
|
TYRA_ASSERT(index < 3, "There are max 3 directional lights");
|
||||||
lightColors[index].set(reinterpret_cast<const Vec4&>(color));
|
lightColors[index].set(reinterpret_cast<const Vec4&>(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
void PipelineLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
||||||
const u8& index) {
|
const u8& index) {
|
||||||
TYRA_ASSERT(mode != Manual,
|
TYRA_ASSERT(mode != Manual,
|
||||||
"Directional lights cannot be set in manual mode");
|
"Directional lights cannot be set in manual mode");
|
||||||
TYRA_ASSERT(index < 3, "There are max 3 directional lights");
|
TYRA_ASSERT(index < 3, "There are max 3 directional lights");
|
||||||
@@ -61,19 +61,19 @@ void StaPipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
|||||||
lightDirections[index].set(direction);
|
lightDirections[index].set(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
void PipelineLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
||||||
deallocate();
|
deallocate();
|
||||||
lightColors = colors;
|
lightColors = colors;
|
||||||
lightDirections = directions;
|
lightDirections = directions;
|
||||||
mode = Manual;
|
mode = Manual;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::disableManualMode() {
|
void PipelineLightingBag::disableManualMode() {
|
||||||
allocate();
|
allocate();
|
||||||
mode = Auto;
|
mode = Auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::allocate() {
|
void PipelineLightingBag::allocate() {
|
||||||
if (isAllocated) return;
|
if (isAllocated) return;
|
||||||
|
|
||||||
lightColors = new Vec4[4];
|
lightColors = new Vec4[4];
|
||||||
@@ -92,27 +92,27 @@ void StaPipLightingBag::allocate() {
|
|||||||
isAllocated = true;
|
isAllocated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::deallocate() {
|
void PipelineLightingBag::deallocate() {
|
||||||
if (!isAllocated) return;
|
if (!isAllocated) return;
|
||||||
|
|
||||||
forceDeallocate();
|
forceDeallocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::forceDeallocate() {
|
void PipelineLightingBag::forceDeallocate() {
|
||||||
forceDeallocateColors();
|
forceDeallocateColors();
|
||||||
forceDeallocateDirections();
|
forceDeallocateDirections();
|
||||||
|
|
||||||
isAllocated = false;
|
isAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::forceDeallocateColors() {
|
void PipelineLightingBag::forceDeallocateColors() {
|
||||||
if (lightColors != nullptr) {
|
if (lightColors != nullptr) {
|
||||||
delete[] lightColors;
|
delete[] lightColors;
|
||||||
lightColors = nullptr;
|
lightColors = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipLightingBag::forceDeallocateDirections() {
|
void PipelineLightingBag::forceDeallocateDirections() {
|
||||||
if (lightDirections != nullptr) {
|
if (lightDirections != nullptr) {
|
||||||
delete[] lightDirections;
|
delete[] lightDirections;
|
||||||
lightDirections = nullptr;
|
lightDirections = nullptr;
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define RGBA_STORE_OFFSET 0
|
#define RGBA_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
.init_vf_all
|
.init_vf_all
|
||||||
.init_vi_all
|
.init_vi_all
|
||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
|
||||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define STQ_STORE_OFFSET 0
|
#define STQ_STORE_OFFSET 0
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void StaPipQBufferRenderer::sendObjectData(
|
|||||||
dma_channel_send_packet2(objectDataPacket, DMA_CHANNEL_VIF1, true);
|
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.antialiasing = bag->antiAliasingEnabled;
|
||||||
rendererCore->gs.prim.blending = bag->blendingEnabled;
|
rendererCore->gs.prim.blending = bag->blendingEnabled;
|
||||||
rendererCore->gs.prim.shading = bag->shadingType;
|
rendererCore->gs.prim.shading = bag->shadingType;
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ void StaticPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StaPipInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh,
|
PipelineInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh,
|
||||||
const StaPipOptions* options,
|
const StaPipOptions* options,
|
||||||
M4x4* model) const {
|
M4x4* model) const {
|
||||||
auto* result = new StaPipInfoBag();
|
auto* result = new PipelineInfoBag();
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
||||||
@@ -163,7 +163,7 @@ StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StaPipLightingBag* StaticPipeline::getLightingBag(
|
PipelineLightingBag* StaticPipeline::getLightingBag(
|
||||||
DynamicMesh* mesh, MeshMaterial* material, M4x4* model,
|
DynamicMesh* mesh, MeshMaterial* material, M4x4* model,
|
||||||
MeshFrame* frameFrom, MeshFrame* frameTo,
|
MeshFrame* frameFrom, MeshFrame* frameTo,
|
||||||
const StaPipOptions* options) const {
|
const StaPipOptions* options) const {
|
||||||
@@ -171,7 +171,7 @@ StaPipLightingBag* StaticPipeline::getLightingBag(
|
|||||||
options->lighting == nullptr)
|
options->lighting == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto* result = new StaPipLightingBag(true);
|
auto* result = new PipelineLightingBag(true);
|
||||||
result->lightMatrix = model;
|
result->lightMatrix = model;
|
||||||
|
|
||||||
result->setLightsManually(colorsCache,
|
result->setLightsManually(colorsCache,
|
||||||
|
|||||||
Reference in New Issue
Block a user