dynamic pipeline base
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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/dynamic_pipeline.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
DynamicPipeline::DynamicPipeline() {}
|
||||
|
||||
DynamicPipeline::~DynamicPipeline() {}
|
||||
|
||||
void DynamicPipeline::init(RendererCore* t_core) {}
|
||||
|
||||
void DynamicPipeline::onUse() {}
|
||||
|
||||
void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) {}
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackage::StapipBagPackage() {
|
||||
StaPipBagPackage::StaPipBagPackage() {
|
||||
size = 0;
|
||||
bag = nullptr;
|
||||
vertices = nullptr;
|
||||
@@ -24,24 +24,24 @@ StapipBagPackage::StapipBagPackage() {
|
||||
normals = nullptr;
|
||||
colors = nullptr;
|
||||
}
|
||||
StapipBagPackage::~StapipBagPackage() {}
|
||||
StaPipBagPackage::~StaPipBagPackage() {}
|
||||
|
||||
void StapipBagPackage::print() const {
|
||||
void StaPipBagPackage::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBagPackage::print(const char* name) const {
|
||||
void StaPipBagPackage::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBagPackage::getPrint(const char* name) const {
|
||||
std::string StaPipBagPackage::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBagPackage(";
|
||||
res << "StaPipBagPackage(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(2);
|
||||
res << std::endl;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackager::StapipBagPackager() {}
|
||||
StapipBagPackager::~StapipBagPackager() {}
|
||||
StaPipBagPackager::StaPipBagPackager() {}
|
||||
StaPipBagPackager::~StaPipBagPackager() {}
|
||||
|
||||
void StapipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
void StaPipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
frustumPlanes = t_frustumPlanes;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ void StapipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
*
|
||||
* @param size Max maxVertCount verts (VU1 buffer size)
|
||||
*/
|
||||
StapipBagPackage* StapipBagPackager::create(u16* o_size, StapipBag* data,
|
||||
StaPipBagPackage* StaPipBagPackager::create(u16* o_size, StaPipBag* data,
|
||||
u16 size) {
|
||||
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage can have max ",
|
||||
TYRA_ASSERT(size <= maxVertCount, "StaPipBagPackage can have max ",
|
||||
maxVertCount, " verts. Provided \"", size, "\"");
|
||||
|
||||
*o_size = ceil(data->count / static_cast<float>(size));
|
||||
StapipBagPackage* result = new StapipBagPackage[*o_size];
|
||||
StaPipBagPackage* result = new StaPipBagPackage[*o_size];
|
||||
|
||||
for (u16 i = 0; i < *o_size; i++) {
|
||||
result[i].bag = data;
|
||||
@@ -65,14 +65,14 @@ StapipBagPackage* StapipBagPackager::create(u16* o_size, StapipBag* data,
|
||||
*
|
||||
* @param size Max maxVertCount verts (VU1 buffer size)
|
||||
*/
|
||||
StapipBagPackage* StapipBagPackager::create(u16* o_count,
|
||||
const StapipBagPackage& pkg,
|
||||
StaPipBagPackage* StaPipBagPackager::create(u16* o_count,
|
||||
const StaPipBagPackage& pkg,
|
||||
u16 size) {
|
||||
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage can have max ",
|
||||
TYRA_ASSERT(size <= maxVertCount, "StaPipBagPackage can have max ",
|
||||
maxVertCount, " verts. Provided \"", size, "\"");
|
||||
|
||||
*o_count = ceil(pkg.size / static_cast<float>(size));
|
||||
auto* result = new StapipBagPackage[*o_count];
|
||||
auto* result = new StaPipBagPackage[*o_count];
|
||||
|
||||
for (u16 i = 0; i < *o_count; i++) {
|
||||
result[i].bag = pkg.bag;
|
||||
@@ -99,7 +99,7 @@ StapipBagPackage* StapipBagPackager::create(u16* o_count,
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreBBoxFrustum StapipBagPackager::checkFrustum(const StapipBagPackage& pkg) {
|
||||
CoreBBoxFrustum StaPipBagPackager::checkFrustum(const StaPipBagPackage& pkg) {
|
||||
if (pkg.size <= (maxVertCount / 3)) { // Is subpackage
|
||||
auto& bbox = renderBBox->getChildBBox1By3(pkg.indexOf1By3BBox);
|
||||
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
|
||||
@@ -112,7 +112,7 @@ CoreBBoxFrustum StapipBagPackager::checkFrustum(const StapipBagPackage& pkg) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipBagPackager::setMaxVertCount(const u32& count) {
|
||||
void StaPipBagPackager::setMaxVertCount(const u32& count) {
|
||||
maxVertCount = count;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
|
||||
StaPipBagPackagesBBox::StaPipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
|
||||
const u32& t_facesCount,
|
||||
const u32& t_maxVertCount) {
|
||||
u32 splitPartSize = t_maxVertCount / 3;
|
||||
@@ -35,7 +35,7 @@ StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
|
||||
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
|
||||
}
|
||||
|
||||
StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices,
|
||||
StaPipBagPackagesBBox::StaPipBagPackagesBBox(Vec4* t_vertices,
|
||||
const u32& t_count,
|
||||
const u32& t_maxVertCount) {
|
||||
u32 splitPartSize = t_maxVertCount / 3;
|
||||
@@ -52,40 +52,40 @@ StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices,
|
||||
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
|
||||
}
|
||||
|
||||
const RenderBBox& StapipBagPackagesBBox::getChildBBox1By3(
|
||||
const RenderBBox& StaPipBagPackagesBBox::getChildBBox1By3(
|
||||
const u32& index) const {
|
||||
TYRA_ASSERT(index < partsCount,
|
||||
"Index out of range. Provided index: ", index);
|
||||
return static_cast<RenderBBox&>(bboxParts->at(index));
|
||||
}
|
||||
|
||||
RenderBBox* StapipBagPackagesBBox::getMainBBox() { return mainBBox; }
|
||||
RenderBBox* StaPipBagPackagesBBox::getMainBBox() { return mainBBox; }
|
||||
|
||||
const u32& StapipBagPackagesBBox::getPartsCount() const { return partsCount; }
|
||||
const u32& StaPipBagPackagesBBox::getPartsCount() const { return partsCount; }
|
||||
|
||||
const u32& StapipBagPackagesBBox::getVertexCount() const { return vertexCount; }
|
||||
const u32& StaPipBagPackagesBBox::getVertexCount() const { return vertexCount; }
|
||||
|
||||
RenderBBox StapipBagPackagesBBox::createChildBBox(const u32& index,
|
||||
RenderBBox StaPipBagPackagesBBox::createChildBBox(const u32& index,
|
||||
const u16& partsSize) const {
|
||||
return RenderBBox(*bboxParts, index, partsSize);
|
||||
}
|
||||
|
||||
void StapipBagPackagesBBox::print() const {
|
||||
void StaPipBagPackagesBBox::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBagPackagesBBox::print(const char* name) const {
|
||||
void StaPipBagPackagesBBox::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBagPackagesBBox::getPrint(const char* name) const {
|
||||
std::string StaPipBagPackagesBBox::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBagPackagesBBox(";
|
||||
res << "StaPipBagPackagesBBox(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(2);
|
||||
res << std::endl;
|
||||
@@ -106,7 +106,7 @@ std::string StapipBagPackagesBBox::getPrint(const char* name) const {
|
||||
return res.str();
|
||||
}
|
||||
|
||||
StapipBagPackagesBBox::~StapipBagPackagesBBox() {
|
||||
StaPipBagPackagesBBox::~StaPipBagPackagesBBox() {
|
||||
delete bboxParts;
|
||||
delete mainBBox;
|
||||
}
|
||||
|
||||
@@ -14,37 +14,37 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBag::StapipBag() {
|
||||
StaPipBag::StaPipBag() {
|
||||
info = nullptr;
|
||||
color = nullptr;
|
||||
texture = nullptr;
|
||||
lighting = nullptr;
|
||||
}
|
||||
|
||||
StapipBag::~StapipBag() {}
|
||||
StaPipBag::~StaPipBag() {}
|
||||
|
||||
StapipBagPackagesBBox StapipBag::calculateBbox(const u32& maxVertCount) {
|
||||
StaPipBagPackagesBBox StaPipBag::calculateBbox(const u32& maxVertCount) {
|
||||
TYRA_ASSERT(vertices != nullptr, "Vertices are required to calculate bbox");
|
||||
TYRA_ASSERT(count > 0, "Count must be greater than 0 to calculate bbox");
|
||||
return StapipBagPackagesBBox(vertices, count, maxVertCount);
|
||||
return StaPipBagPackagesBBox(vertices, count, maxVertCount);
|
||||
}
|
||||
|
||||
void StapipBag::print() const {
|
||||
void StaPipBag::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBag::print(const char* name) const {
|
||||
void StaPipBag::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBag::getPrint(const char* name) const {
|
||||
std::string StaPipBag::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBag(";
|
||||
res << "StaPipBag(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(4);
|
||||
res << std::endl;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipColorBag::StapipColorBag() {
|
||||
StaPipColorBag::StaPipColorBag() {
|
||||
single = nullptr;
|
||||
many = nullptr;
|
||||
}
|
||||
|
||||
StapipColorBag::~StapipColorBag() {}
|
||||
StaPipColorBag::~StaPipColorBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipInfoBag::StapipInfoBag() {
|
||||
shadingType = StapipShadingFlat;
|
||||
StaPipInfoBag::StaPipInfoBag() {
|
||||
shadingType = StaPipShadingFlat;
|
||||
blendingEnabled = true;
|
||||
antiAliasingEnabled = false;
|
||||
model = nullptr;
|
||||
}
|
||||
|
||||
StapipInfoBag::~StapipInfoBag() {}
|
||||
StaPipInfoBag::~StaPipInfoBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipLightingBag::StapipLightingBag(const bool& manual) {
|
||||
StaPipLightingBag::StaPipLightingBag(const bool& manual) {
|
||||
isAllocated = false;
|
||||
mode = Auto;
|
||||
normals = nullptr;
|
||||
@@ -27,24 +27,24 @@ StapipLightingBag::StapipLightingBag(const bool& manual) {
|
||||
}
|
||||
}
|
||||
|
||||
StapipLightingBag::~StapipLightingBag() { deallocate(); }
|
||||
StaPipLightingBag::~StaPipLightingBag() { deallocate(); }
|
||||
|
||||
void StapipLightingBag::setAmbientColor(const Color& color) {
|
||||
void StaPipLightingBag::setAmbientColor(const Color& color) {
|
||||
TYRA_ASSERT(mode != Manual, "Ambient color cannot be set in manual mode");
|
||||
lightColors[3].set(reinterpret_cast<const Vec4&>(color));
|
||||
}
|
||||
|
||||
void StapipLightingBag::setDirectionalLightColors(Color* colors,
|
||||
void StaPipLightingBag::setDirectionalLightColors(Color* colors,
|
||||
const u8& count) {
|
||||
for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i);
|
||||
}
|
||||
|
||||
void StapipLightingBag::setDirectionalLightDirections(Vec4* directions,
|
||||
void StaPipLightingBag::setDirectionalLightDirections(Vec4* directions,
|
||||
const u8& count) {
|
||||
for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i);
|
||||
}
|
||||
|
||||
void StapipLightingBag::setDirectionalLightColor(const Color& color,
|
||||
void StaPipLightingBag::setDirectionalLightColor(const Color& color,
|
||||
const u8& index) {
|
||||
TYRA_ASSERT(mode != Manual,
|
||||
"Directional lights cannot be set in manual mode");
|
||||
@@ -52,7 +52,7 @@ void StapipLightingBag::setDirectionalLightColor(const Color& color,
|
||||
lightColors[index].set(reinterpret_cast<const Vec4&>(color));
|
||||
}
|
||||
|
||||
void StapipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
||||
void StaPipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
||||
const u8& index) {
|
||||
TYRA_ASSERT(mode != Manual,
|
||||
"Directional lights cannot be set in manual mode");
|
||||
@@ -61,19 +61,19 @@ void StapipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
||||
lightDirections[index].set(direction);
|
||||
}
|
||||
|
||||
void StapipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
||||
void StaPipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
||||
deallocate();
|
||||
lightColors = colors;
|
||||
lightDirections = directions;
|
||||
mode = Manual;
|
||||
}
|
||||
|
||||
void StapipLightingBag::disableManualMode() {
|
||||
void StaPipLightingBag::disableManualMode() {
|
||||
allocate();
|
||||
mode = Auto;
|
||||
}
|
||||
|
||||
void StapipLightingBag::allocate() {
|
||||
void StaPipLightingBag::allocate() {
|
||||
if (isAllocated) return;
|
||||
|
||||
lightColors = new Vec4[4];
|
||||
@@ -92,27 +92,27 @@ void StapipLightingBag::allocate() {
|
||||
isAllocated = true;
|
||||
}
|
||||
|
||||
void StapipLightingBag::deallocate() {
|
||||
void StaPipLightingBag::deallocate() {
|
||||
if (!isAllocated) return;
|
||||
|
||||
forceDeallocate();
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocate() {
|
||||
void StaPipLightingBag::forceDeallocate() {
|
||||
forceDeallocateColors();
|
||||
forceDeallocateDirections();
|
||||
|
||||
isAllocated = false;
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocateColors() {
|
||||
void StaPipLightingBag::forceDeallocateColors() {
|
||||
if (lightColors != nullptr) {
|
||||
delete[] lightColors;
|
||||
lightColors = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocateDirections() {
|
||||
void StaPipLightingBag::forceDeallocateDirections() {
|
||||
if (lightDirections != nullptr) {
|
||||
delete[] lightDirections;
|
||||
lightDirections = nullptr;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipTextureBag::StapipTextureBag() {
|
||||
StaPipTextureBag::StaPipTextureBag() {
|
||||
coordinates = nullptr;
|
||||
texture = nullptr;
|
||||
}
|
||||
|
||||
StapipTextureBag::~StapipTextureBag() {}
|
||||
StaPipTextureBag::~StaPipTextureBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_C
|
||||
.name StaPipVU1As_Is_C
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsC
|
||||
#vuprog StaPipVU1AsIsC
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_Is_C_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_C_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipAsIsCVU1Program::StapipAsIsCVU1Program()
|
||||
: StapipVU1Program(StapipAsIsColor, &StapipVU1As_Is_C_CodeStart,
|
||||
&StapipVU1As_Is_C_CodeEnd,
|
||||
StaPipAsIsCVU1Program::StaPipAsIsCVU1Program()
|
||||
: StaPipVU1Program(StaPipAsIsColor, &StaPipVU1As_Is_C_CodeStart,
|
||||
&StaPipVU1As_Is_C_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
|
||||
2) {}
|
||||
|
||||
StapipAsIsCVU1Program::~StapipAsIsCVU1Program() {}
|
||||
StaPipAsIsCVU1Program::~StaPipAsIsCVU1Program() {}
|
||||
|
||||
std::string StapipAsIsCVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsCVU1Program::getStringName() const {
|
||||
return std::string("As is - C");
|
||||
}
|
||||
|
||||
void StapipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_D
|
||||
.name StaPipVU1As_Is_D
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsD
|
||||
#vuprog StaPipVU1AsIsD
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_Is_D_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_D_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipAsIsDVU1Program::StapipAsIsDVU1Program()
|
||||
: StapipVU1Program(StapipAsIsDirLights, &StapipVU1As_Is_D_CodeStart,
|
||||
&StapipVU1As_Is_D_CodeEnd,
|
||||
StaPipAsIsDVU1Program::StaPipAsIsDVU1Program()
|
||||
: StaPipVU1Program(StaPipAsIsDirLights, &StaPipVU1As_Is_D_CodeStart,
|
||||
&StaPipVU1As_Is_D_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
|
||||
3) {}
|
||||
|
||||
StapipAsIsDVU1Program::~StapipAsIsDVU1Program() {}
|
||||
StaPipAsIsDVU1Program::~StaPipAsIsDVU1Program() {}
|
||||
|
||||
std::string StapipAsIsDVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsDVU1Program::getStringName() const {
|
||||
return std::string("As is - LC");
|
||||
}
|
||||
|
||||
void StapipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_TC
|
||||
.name StaPipVU1As_Is_TC
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsTC
|
||||
#vuprog StaPipVU1AsIsTC
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_Is_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipAsIsTCVU1Program::StapipAsIsTCVU1Program()
|
||||
: StapipVU1Program(StapipAsIsTextureColor, &StapipVU1As_Is_TC_CodeStart,
|
||||
&StapipVU1As_Is_TC_CodeEnd,
|
||||
StaPipAsIsTCVU1Program::StaPipAsIsTCVU1Program()
|
||||
: StaPipVU1Program(StaPipAsIsTextureColor, &StaPipVU1As_Is_TC_CodeStart,
|
||||
&StaPipVU1As_Is_TC_CodeEnd,
|
||||
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
|
||||
((u64)GIF_REG_XYZ2) << 8,
|
||||
3, 3) {}
|
||||
|
||||
StapipAsIsTCVU1Program::~StapipAsIsTCVU1Program() {}
|
||||
StaPipAsIsTCVU1Program::~StaPipAsIsTCVU1Program() {}
|
||||
|
||||
std::string StapipAsIsTCVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsTCVU1Program::getStringName() const {
|
||||
return std::string("As is - TC");
|
||||
}
|
||||
|
||||
void StapipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_TD
|
||||
.name StaPipVU1As_Is_TD
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsTD
|
||||
#vuprog StaPipVU1AsIsTD
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_Is_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1As_Is_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipAsIsTDVU1Program::StapipAsIsTDVU1Program()
|
||||
: StapipVU1Program(StapipAsIsTextureDirLights, &StapipVU1As_Is_TD_CodeStart,
|
||||
&StapipVU1As_Is_TD_CodeEnd,
|
||||
StaPipAsIsTDVU1Program::StaPipAsIsTDVU1Program()
|
||||
: StaPipVU1Program(StaPipAsIsTextureDirLights, &StaPipVU1As_Is_TD_CodeStart,
|
||||
&StaPipVU1As_Is_TD_CodeEnd,
|
||||
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
|
||||
((u64)GIF_REG_XYZ2) << 8,
|
||||
3, 4) {}
|
||||
|
||||
StapipAsIsTDVU1Program::~StapipAsIsTDVU1Program() {}
|
||||
StaPipAsIsTDVU1Program::~StaPipAsIsTDVU1Program() {}
|
||||
|
||||
std::string StapipAsIsTDVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsTDVU1Program::getStringName() const {
|
||||
return std::string("As is - LTC");
|
||||
}
|
||||
|
||||
void StapipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_C
|
||||
.name StaPipVU1Cull_C
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullC
|
||||
#vuprog StaPipVU1CullC
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,24 +11,24 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullCVU1Program::StapipCullCVU1Program()
|
||||
: StapipVU1Program(
|
||||
StapipCullColor, &StapipVU1Cull_C_CodeStart, &StapipVU1Cull_C_CodeEnd,
|
||||
StaPipCullCVU1Program::StaPipCullCVU1Program()
|
||||
: StaPipVU1Program(
|
||||
StaPipCullColor, &StaPipVU1Cull_C_CodeStart, &StaPipVU1Cull_C_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2, 2) {}
|
||||
|
||||
StapipCullCVU1Program::~StapipCullCVU1Program() {}
|
||||
StaPipCullCVU1Program::~StaPipCullCVU1Program() {}
|
||||
|
||||
std::string StapipCullCVU1Program::getStringName() const {
|
||||
std::string StaPipCullCVU1Program::getStringName() const {
|
||||
return std::string("Cull - C");
|
||||
}
|
||||
|
||||
void StapipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_D
|
||||
.name StaPipVU1Cull_D
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullD
|
||||
#vuprog StaPipVU1CullD
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullDVU1Program::StapipCullDVU1Program()
|
||||
: StapipVU1Program(StapipCullDirLights, &StapipVU1Cull_D_CodeStart,
|
||||
&StapipVU1Cull_D_CodeEnd,
|
||||
StaPipCullDVU1Program::StaPipCullDVU1Program()
|
||||
: StaPipVU1Program(StaPipCullDirLights, &StaPipVU1Cull_D_CodeStart,
|
||||
&StaPipVU1Cull_D_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
|
||||
3) {}
|
||||
|
||||
StapipCullDVU1Program::~StapipCullDVU1Program() {}
|
||||
StaPipCullDVU1Program::~StaPipCullDVU1Program() {}
|
||||
|
||||
std::string StapipCullDVU1Program::getStringName() const {
|
||||
std::string StaPipCullDVU1Program::getStringName() const {
|
||||
return std::string("Cull - LC");
|
||||
}
|
||||
|
||||
void StapipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_TC
|
||||
.name StaPipVU1Cull_TC
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullTC
|
||||
#vuprog StaPipVU1CullTC
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullTCVU1Program::StapipCullTCVU1Program()
|
||||
: StapipVU1Program(StapipCullTextureColor, &StapipVU1Cull_TC_CodeStart,
|
||||
&StapipVU1Cull_TC_CodeEnd,
|
||||
StaPipCullTCVU1Program::StaPipCullTCVU1Program()
|
||||
: StaPipVU1Program(StaPipCullTextureColor, &StaPipVU1Cull_TC_CodeStart,
|
||||
&StaPipVU1Cull_TC_CodeEnd,
|
||||
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
|
||||
((u64)GIF_REG_XYZ2) << 8,
|
||||
3, 3) {}
|
||||
|
||||
StapipCullTCVU1Program::~StapipCullTCVU1Program() {}
|
||||
StaPipCullTCVU1Program::~StaPipCullTCVU1Program() {}
|
||||
|
||||
std::string StapipCullTCVU1Program::getStringName() const {
|
||||
std::string StaPipCullTCVU1Program::getStringName() const {
|
||||
return std::string("Cull - TC");
|
||||
}
|
||||
|
||||
void StapipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_TD
|
||||
.name StaPipVU1Cull_TD
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullTD
|
||||
#vuprog StaPipVU1CullTD
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullTDVU1Program::StapipCullTDVU1Program()
|
||||
: StapipVU1Program(StapipCullTextureDirLights, &StapipVU1Cull_TD_CodeStart,
|
||||
&StapipVU1Cull_TD_CodeEnd,
|
||||
StaPipCullTDVU1Program::StaPipCullTDVU1Program()
|
||||
: StaPipVU1Program(StaPipCullTextureDirLights, &StaPipVU1Cull_TD_CodeStart,
|
||||
&StaPipVU1Cull_TD_CodeEnd,
|
||||
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
|
||||
((u64)GIF_REG_XYZ2) << 8,
|
||||
3, 4) {}
|
||||
|
||||
StapipCullTDVU1Program::~StapipCullTDVU1Program() {}
|
||||
StaPipCullTDVU1Program::~StaPipCullTDVU1Program() {}
|
||||
|
||||
std::string StapipCullTDVU1Program::getStringName() const {
|
||||
std::string StaPipCullTDVU1Program::getStringName() const {
|
||||
return std::string("Cull - LTC");
|
||||
}
|
||||
|
||||
void StapipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipClipper::StapipClipper() {}
|
||||
StapipClipper::~StapipClipper() {}
|
||||
StaPipClipper::StaPipClipper() {}
|
||||
StaPipClipper::~StaPipClipper() {}
|
||||
|
||||
void StapipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
|
||||
void StaPipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
|
||||
|
||||
void StapipClipper::init(const RendererSettings& settings) {
|
||||
void StaPipClipper::init(const RendererSettings& settings) {
|
||||
algorithm.init(settings);
|
||||
}
|
||||
|
||||
void StapipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
void StaPipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
|
||||
void StapipClipper::clip(StapipQBuffer* buffer) {
|
||||
void StaPipClipper::clip(StaPipQBuffer* buffer) {
|
||||
TYRA_ASSERT(buffer->size <= maxVertCount / 3, "Buffer should have max ",
|
||||
maxVertCount / 3, " verts if we want to clip it.");
|
||||
|
||||
@@ -64,14 +64,14 @@ void StapipClipper::clip(StapipQBuffer* buffer) {
|
||||
moveDataToBuffer(clippedVertices, buffer);
|
||||
}
|
||||
|
||||
void StapipClipper::perspectiveDivide(std::vector<Path1ClipVertex>* vertices) {
|
||||
void StaPipClipper::perspectiveDivide(std::vector<Path1ClipVertex>* vertices) {
|
||||
for (u32 i = 0; i < vertices->size(); i++) {
|
||||
(*vertices)[i].position /= (*vertices)[i].position.w;
|
||||
}
|
||||
}
|
||||
|
||||
void StapipClipper::moveDataToBuffer(
|
||||
const std::vector<Path1ClipVertex>& vertices, StapipQBuffer* buffer) {
|
||||
void StaPipClipper::moveDataToBuffer(
|
||||
const std::vector<Path1ClipVertex>& vertices, StaPipQBuffer* buffer) {
|
||||
buffer->reallocateManually(vertices.size());
|
||||
|
||||
for (u32 i = 0; i < vertices.size(); i++) {
|
||||
|
||||
@@ -12,31 +12,31 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipProgramsRepository::StapipProgramsRepository() {}
|
||||
StaPipProgramsRepository::StaPipProgramsRepository() {}
|
||||
|
||||
StapipProgramsRepository::~StapipProgramsRepository() {}
|
||||
StaPipProgramsRepository::~StaPipProgramsRepository() {}
|
||||
|
||||
StapipVU1Program* StapipProgramsRepository::getProgram(
|
||||
const StapipProgramName& name) {
|
||||
StaPipVU1Program* StaPipProgramsRepository::getProgram(
|
||||
const StaPipProgramName& name) {
|
||||
switch (name) {
|
||||
case StapipProgramName::StapipAsIsColor:
|
||||
case StaPipProgramName::StaPipAsIsColor:
|
||||
return &asIsColor;
|
||||
case StapipProgramName::StapipCullColor:
|
||||
case StaPipProgramName::StaPipCullColor:
|
||||
return &cullColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsDirLights:
|
||||
case StaPipProgramName::StaPipAsIsDirLights:
|
||||
return &asIsLightingColor;
|
||||
case StapipProgramName::StapipCullDirLights:
|
||||
case StaPipProgramName::StaPipCullDirLights:
|
||||
return &cullLightingColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsTextureDirLights:
|
||||
case StaPipProgramName::StaPipAsIsTextureDirLights:
|
||||
return &asIsLightingTextureColor;
|
||||
case StapipProgramName::StapipCullTextureDirLights:
|
||||
case StaPipProgramName::StaPipCullTextureDirLights:
|
||||
return &cullLightingTextureColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsTextureColor:
|
||||
case StaPipProgramName::StaPipAsIsTextureColor:
|
||||
return &asIsTextureColor;
|
||||
case StapipProgramName::StapipCullTextureColor:
|
||||
case StaPipProgramName::StaPipCullTextureColor:
|
||||
return &cullTextureColor;
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipQBuffer::StapipQBuffer() {
|
||||
StaPipQBuffer::StaPipQBuffer() {
|
||||
size = 0;
|
||||
_isDynamicallyAllocated = false;
|
||||
_stAllocated = false;
|
||||
@@ -27,11 +27,11 @@ StapipQBuffer::StapipQBuffer() {
|
||||
normals = nullptr;
|
||||
}
|
||||
|
||||
StapipQBuffer::~StapipQBuffer() { deallocateDynamicData(); }
|
||||
StaPipQBuffer::~StaPipQBuffer() { deallocateDynamicData(); }
|
||||
|
||||
void StapipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
void StaPipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
|
||||
void StapipQBuffer::fillByPointer(const StapipBagPackage& pkg) {
|
||||
void StaPipQBuffer::fillByPointer(const StaPipBagPackage& pkg) {
|
||||
TYRA_ASSERT(pkg.size <= maxVertCount, "VU1 buffer supports only ",
|
||||
maxVertCount, " verts. Provided: ", pkg.size);
|
||||
|
||||
@@ -45,9 +45,9 @@ void StapipQBuffer::fillByPointer(const StapipBagPackage& pkg) {
|
||||
bag = pkg.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopyMax(const StapipBagPackage& pkg1,
|
||||
const StapipBagPackage& pkg2,
|
||||
const StapipBagPackage& pkg3) {
|
||||
void StaPipQBuffer::fillByCopyMax(const StaPipBagPackage& pkg1,
|
||||
const StaPipBagPackage& pkg2,
|
||||
const StaPipBagPackage& pkg3) {
|
||||
TYRA_ASSERT(pkg1.size <= maxVertCount / 3,
|
||||
"Wrong package size (1). Provided: ", pkg1.size);
|
||||
TYRA_ASSERT(pkg2.size <= maxVertCount / 3,
|
||||
@@ -97,8 +97,8 @@ void StapipQBuffer::fillByCopyMax(const StapipBagPackage& pkg1,
|
||||
bag = pkg1.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopy1By2(const StapipBagPackage& pkg1,
|
||||
const StapipBagPackage& pkg2) {
|
||||
void StaPipQBuffer::fillByCopy1By2(const StaPipBagPackage& pkg1,
|
||||
const StaPipBagPackage& pkg2) {
|
||||
TYRA_ASSERT(pkg1.size <= maxVertCount / 3,
|
||||
"Wrong package size (1). Provided: ", pkg1.size);
|
||||
TYRA_ASSERT(pkg2.size <= maxVertCount / 3,
|
||||
@@ -133,7 +133,7 @@ void StapipQBuffer::fillByCopy1By2(const StapipBagPackage& pkg1,
|
||||
bag = pkg1.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopy1By3(const StapipBagPackage& pkg) {
|
||||
void StaPipQBuffer::fillByCopy1By3(const StaPipBagPackage& pkg) {
|
||||
TYRA_ASSERT(pkg.size <= maxVertCount / 3,
|
||||
"Wrong package size (1). Provided: ", pkg.size);
|
||||
|
||||
@@ -155,13 +155,13 @@ void StapipQBuffer::fillByCopy1By3(const StapipBagPackage& pkg) {
|
||||
bag = pkg.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::reallocateManually(const u16& t_size) {
|
||||
void StaPipQBuffer::reallocateManually(const u16& t_size) {
|
||||
deallocateDynamicData();
|
||||
allocateDynamicData(t_size, bag);
|
||||
size = t_size;
|
||||
}
|
||||
|
||||
void StapipQBuffer::deallocateDynamicData() {
|
||||
void StaPipQBuffer::deallocateDynamicData() {
|
||||
if (_isDynamicallyAllocated) {
|
||||
delete[] vertices;
|
||||
|
||||
@@ -186,7 +186,7 @@ void StapipQBuffer::deallocateDynamicData() {
|
||||
|
||||
/** When we not receive maxVertCount vertices, we must align it by ourself.
|
||||
* Too bad - not efficient. */
|
||||
void StapipQBuffer::allocateDynamicData(u16 size, StapipBag* bag) {
|
||||
void StaPipQBuffer::allocateDynamicData(u16 size, StaPipBag* bag) {
|
||||
TYRA_ASSERT(size <= maxVertCount, "Wrong size. Max buffer size in VU1 is ",
|
||||
maxVertCount, ". Provided: ", size);
|
||||
TYRA_ASSERT(!_isDynamicallyAllocated, "Buffer is already allocated");
|
||||
@@ -211,19 +211,19 @@ void StapipQBuffer::allocateDynamicData(u16 size, StapipBag* bag) {
|
||||
_isDynamicallyAllocated = true;
|
||||
}
|
||||
|
||||
bool StapipQBuffer::any() const { return size > 0; }
|
||||
bool StaPipQBuffer::any() const { return size > 0; }
|
||||
|
||||
void StapipQBuffer::print() const {
|
||||
void StaPipQBuffer::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipQBuffer::print(const char* name) const {
|
||||
void StaPipQBuffer::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipQBuffer::getPrint(const char* name) const {
|
||||
std::string StaPipQBuffer::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
|
||||
@@ -34,14 +34,14 @@ namespace Tyra {
|
||||
*
|
||||
*/
|
||||
|
||||
StapipQBufferRenderer::StapipQBufferRenderer() {
|
||||
StaPipQBufferRenderer::StaPipQBufferRenderer() {
|
||||
context = 0;
|
||||
lastProgramName = StdipUndefinedProgram;
|
||||
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||
objectDataPacket = packet2_create(16, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||
programsPacket = nullptr;
|
||||
}
|
||||
StapipQBufferRenderer::~StapipQBufferRenderer() {
|
||||
StaPipQBufferRenderer::~StaPipQBufferRenderer() {
|
||||
packet2_free(packets[0]);
|
||||
packet2_free(packets[1]);
|
||||
packet2_free(staticDataPacket);
|
||||
@@ -50,7 +50,7 @@ StapipQBufferRenderer::~StapipQBufferRenderer() {
|
||||
if (programsPacket) packet2_free(programsPacket);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::init(RendererCore* t_core) {
|
||||
void StaPipQBufferRenderer::init(RendererCore* t_core) {
|
||||
path1 = t_core->getPath1();
|
||||
clipper.init(t_core->getSettings());
|
||||
rendererCore = t_core;
|
||||
@@ -73,16 +73,16 @@ void StapipQBufferRenderer::init(RendererCore* t_core) {
|
||||
TYRA_LOG("Renderer3DQBufferRenderer initialized");
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::reinitVU1() {
|
||||
void StaPipQBufferRenderer::reinitVU1() {
|
||||
sendStaticData();
|
||||
uploadPrograms();
|
||||
setDoubleBuffer();
|
||||
}
|
||||
|
||||
StapipQBuffer* StapipQBufferRenderer::getBuffer() { return &buffers[context]; }
|
||||
StaPipQBuffer* StaPipQBufferRenderer::getBuffer() { return &buffers[context]; }
|
||||
|
||||
void StapipQBufferRenderer::sendObjectData(
|
||||
StapipBag* bag, M4x4* mvp, RendererCoreTextureBuffers* texBuffers) const {
|
||||
void StaPipQBufferRenderer::sendObjectData(
|
||||
StaPipBag* bag, M4x4* mvp, RendererCoreTextureBuffers* texBuffers) const {
|
||||
packet2_reset(objectDataPacket, false);
|
||||
packet2_utils_vu_add_unpack_data(objectDataPacket, VU1_MVP_MATRIX_ADDR,
|
||||
mvp->data, 4, false);
|
||||
@@ -130,13 +130,13 @@ void StapipQBufferRenderer::sendObjectData(
|
||||
dma_channel_send_packet2(objectDataPacket, DMA_CHANNEL_VIF1, true);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setInfo(StapipInfoBag* bag) {
|
||||
void StaPipQBufferRenderer::setInfo(StaPipInfoBag* bag) {
|
||||
rendererCore->gs.prim.antialiasing = bag->antiAliasingEnabled;
|
||||
rendererCore->gs.prim.blending = bag->blendingEnabled;
|
||||
rendererCore->gs.prim.shading = bag->shadingType;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::sendStaticData() const {
|
||||
void StaPipQBufferRenderer::sendStaticData() const {
|
||||
packet2_reset(staticDataPacket, false);
|
||||
packet2_utils_vu_open_unpack(staticDataPacket, VU1_SET_GIFTAG_ADDR, false);
|
||||
{ packet2_utils_gif_add_set(staticDataPacket, 1); }
|
||||
@@ -147,27 +147,27 @@ void StapipQBufferRenderer::sendStaticData() const {
|
||||
dma_channel_send_packet2(staticDataPacket, DMA_CHANNEL_VIF1, true);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setProgramsCache() {
|
||||
void StaPipQBufferRenderer::setProgramsCache() {
|
||||
VU1Program** programs = new VU1Program*[8];
|
||||
programs[0] = repository.getProgram(StapipCullColor);
|
||||
programs[1] = repository.getProgram(StapipAsIsColor);
|
||||
programs[2] = repository.getProgram(StapipCullDirLights);
|
||||
programs[3] = repository.getProgram(StapipAsIsDirLights);
|
||||
programs[4] = repository.getProgram(StapipCullTextureDirLights);
|
||||
programs[5] = repository.getProgram(StapipAsIsTextureDirLights);
|
||||
programs[6] = repository.getProgram(StapipCullTextureColor);
|
||||
programs[7] = repository.getProgram(StapipAsIsTextureColor);
|
||||
programs[0] = repository.getProgram(StaPipCullColor);
|
||||
programs[1] = repository.getProgram(StaPipAsIsColor);
|
||||
programs[2] = repository.getProgram(StaPipCullDirLights);
|
||||
programs[3] = repository.getProgram(StaPipAsIsDirLights);
|
||||
programs[4] = repository.getProgram(StaPipCullTextureDirLights);
|
||||
programs[5] = repository.getProgram(StaPipAsIsTextureDirLights);
|
||||
programs[6] = repository.getProgram(StaPipCullTextureColor);
|
||||
programs[7] = repository.getProgram(StaPipAsIsTextureColor);
|
||||
programsPacket = path1->createProgramsCache(programs, 8, 0);
|
||||
delete[] programs;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::uploadPrograms() {
|
||||
void StaPipQBufferRenderer::uploadPrograms() {
|
||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||
dma_channel_send_packet2(programsPacket, DMA_CHANNEL_VIF1, true);
|
||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setDoubleBuffer() {
|
||||
void StaPipQBufferRenderer::setDoubleBuffer() {
|
||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
||||
const u16 bufferMaxSize = 1000;
|
||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||
@@ -178,7 +178,7 @@ void StapipQBufferRenderer::setDoubleBuffer() {
|
||||
// buffer, to first addr of second buffer
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::cull(StaPipQBuffer* buffer) {
|
||||
if (buffer->size == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -188,8 +188,8 @@ void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
sendPacket();
|
||||
}
|
||||
|
||||
// void StapipQBufferRenderer::sendFinishTag() {
|
||||
// StapipQBufferRenderer way proposition
|
||||
// void StaPipQBufferRenderer::sendFinishTag() {
|
||||
// StaPipQBufferRenderer way proposition
|
||||
// auto program = path1->getProgramByName(Draw_Finish);
|
||||
// addBufferDataToPacket(program, nullptr);
|
||||
// sendPacket();
|
||||
@@ -206,7 +206,7 @@ void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
// packet2_free(packet2);
|
||||
// }
|
||||
|
||||
void StapipQBufferRenderer::clip(StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::clip(StaPipQBuffer* buffer) {
|
||||
if (buffer->size == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -220,12 +220,12 @@ void StapipQBufferRenderer::clip(StapipQBuffer* buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::clearLastProgramName() {
|
||||
void StaPipQBufferRenderer::clearLastProgramName() {
|
||||
lastProgramName = StdipUndefinedProgram;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::addBufferDataToPacket(StapipVU1Program* program,
|
||||
StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::addBufferDataToPacket(StaPipVU1Program* program,
|
||||
StaPipQBuffer* buffer) {
|
||||
currentPacket = packets[context];
|
||||
packet2_reset(currentPacket, false);
|
||||
|
||||
@@ -241,7 +241,7 @@ void StapipQBufferRenderer::addBufferDataToPacket(StapipVU1Program* program,
|
||||
packet2_utils_vu_add_end_tag(currentPacket);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::sendPacket() {
|
||||
void StaPipQBufferRenderer::sendPacket() {
|
||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
||||
|
||||
@@ -249,72 +249,72 @@ void StapipQBufferRenderer::sendPacket() {
|
||||
context = !context;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setMaxVertCount(const u32& count) {
|
||||
void StaPipQBufferRenderer::setMaxVertCount(const u32& count) {
|
||||
buffers[0].setMaxVertCount(count);
|
||||
buffers[1].setMaxVertCount(count);
|
||||
clipper.setMaxVertCount(count);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getAsIsProgramByBag(
|
||||
const StapipBag* bag) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getAsIsProgramByBag(
|
||||
const StaPipBag* bag) {
|
||||
auto programType = getDrawProgramTypeByBag(bag);
|
||||
|
||||
if (programType == StapipVU1TextureDirLights)
|
||||
return getProgramByName(StapipAsIsTextureDirLights);
|
||||
else if (programType == StapipVU1DirLights)
|
||||
return getProgramByName(StapipAsIsDirLights);
|
||||
else if (programType == StapipVU1TextureColor)
|
||||
return getProgramByName(StapipAsIsTextureColor);
|
||||
if (programType == StaPipVU1TextureDirLights)
|
||||
return getProgramByName(StaPipAsIsTextureDirLights);
|
||||
else if (programType == StaPipVU1DirLights)
|
||||
return getProgramByName(StaPipAsIsDirLights);
|
||||
else if (programType == StaPipVU1TextureColor)
|
||||
return getProgramByName(StaPipAsIsTextureColor);
|
||||
else
|
||||
return getProgramByName(StapipAsIsColor);
|
||||
return getProgramByName(StaPipAsIsColor);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getCullProgramByBag(
|
||||
const StapipBag* bag) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getCullProgramByBag(
|
||||
const StaPipBag* bag) {
|
||||
auto programType = getDrawProgramTypeByBag(bag);
|
||||
return getCullProgramByType(programType);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getProgramByName(
|
||||
const StapipProgramName& name) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getProgramByName(
|
||||
const StaPipProgramName& name) {
|
||||
return repository.getProgram(name);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getCullProgramByParams(
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getCullProgramByParams(
|
||||
const bool& isLightingEnabled, const bool& isTextureEnabled) {
|
||||
auto type = getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
|
||||
return getCullProgramByType(type);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getCullProgramByType(
|
||||
const StapipProgramType& programType) {
|
||||
if (programType == StapipVU1TextureDirLights)
|
||||
return getProgramByName(StapipCullTextureDirLights);
|
||||
else if (programType == StapipVU1DirLights)
|
||||
return getProgramByName(StapipCullDirLights);
|
||||
else if (programType == StapipVU1TextureColor)
|
||||
return getProgramByName(StapipCullTextureColor);
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getCullProgramByType(
|
||||
const StaPipProgramType& programType) {
|
||||
if (programType == StaPipVU1TextureDirLights)
|
||||
return getProgramByName(StaPipCullTextureDirLights);
|
||||
else if (programType == StaPipVU1DirLights)
|
||||
return getProgramByName(StaPipCullDirLights);
|
||||
else if (programType == StaPipVU1TextureColor)
|
||||
return getProgramByName(StaPipCullTextureColor);
|
||||
else
|
||||
return getProgramByName(StapipCullColor);
|
||||
return getProgramByName(StaPipCullColor);
|
||||
}
|
||||
|
||||
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByBag(
|
||||
const StapipBag* bag) const {
|
||||
StaPipProgramType StaPipQBufferRenderer::getDrawProgramTypeByBag(
|
||||
const StaPipBag* bag) const {
|
||||
auto isLightingEnabled = bag->lighting != nullptr;
|
||||
auto isTextureEnabled = bag->texture != nullptr;
|
||||
return getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
|
||||
}
|
||||
|
||||
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByParams(
|
||||
StaPipProgramType StaPipQBufferRenderer::getDrawProgramTypeByParams(
|
||||
const bool& isLightingEnabled, const bool& isTextureEnabled) const {
|
||||
if (isLightingEnabled && isTextureEnabled)
|
||||
return StapipVU1TextureDirLights;
|
||||
return StaPipVU1TextureDirLights;
|
||||
else if (isLightingEnabled)
|
||||
return StapipVU1DirLights;
|
||||
return StaPipVU1DirLights;
|
||||
else if (isTextureEnabled)
|
||||
return StapipVU1TextureColor;
|
||||
return StaPipVU1TextureColor;
|
||||
else
|
||||
return StapipVU1Color;
|
||||
return StaPipVU1Color;
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipVU1Program::StapipVU1Program(const StapipProgramName& t_name,
|
||||
StaPipVU1Program::StaPipVU1Program(const StaPipProgramName& t_name,
|
||||
u32* t_start, u32* t_end,
|
||||
const u32& t_reglist,
|
||||
const u8& t_reglistCount,
|
||||
@@ -26,21 +26,21 @@ StapipVU1Program::StapipVU1Program(const StapipProgramName& t_name,
|
||||
programSize = calculateProgramSize();
|
||||
}
|
||||
|
||||
StapipVU1Program::~StapipVU1Program() {}
|
||||
StaPipVU1Program::~StaPipVU1Program() {}
|
||||
|
||||
const StapipProgramName& StapipVU1Program::getName() const { return name; }
|
||||
const StaPipProgramName& StaPipVU1Program::getName() const { return name; }
|
||||
|
||||
u32& StapipVU1Program::getReglist() { return reglist; }
|
||||
u32& StaPipVU1Program::getReglist() { return reglist; }
|
||||
|
||||
void StapipVU1Program::addBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* buffer,
|
||||
void StaPipVU1Program::addBufferDataToPacket(packet2_t* packet,
|
||||
StaPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
addStandardBufferDataToPacket(packet, buffer, prim);
|
||||
addProgramQBufferDataToPacket(packet, buffer);
|
||||
}
|
||||
|
||||
void StapipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* buffer,
|
||||
void StaPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
StaPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
if (buffer->bag->texture)
|
||||
prim->mapping = 1;
|
||||
@@ -61,7 +61,7 @@ void StapipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
packet2_utils_vu_close_unpack(packet);
|
||||
}
|
||||
|
||||
u16 StapipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
u16 StaPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& bufferSize) const {
|
||||
u16 res = bufferSize - 4;
|
||||
u8 colorElementsPerVertex =
|
||||
|
||||
@@ -22,26 +22,26 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipelineCore::StapipelineCore() { maxVertCount = 0; }
|
||||
StaPipelineCore::StaPipelineCore() { maxVertCount = 0; }
|
||||
|
||||
StapipelineCore::~StapipelineCore() {}
|
||||
StaPipelineCore::~StaPipelineCore() {}
|
||||
|
||||
void StapipelineCore::init(RendererCore* t_core) {
|
||||
void StaPipelineCore::init(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
qbufferRenderer.init(t_core);
|
||||
packager.init(&rendererCore->renderer3D.frustumPlanes);
|
||||
}
|
||||
|
||||
void StapipelineCore::reinitStandardVU1Programs() {
|
||||
void StaPipelineCore::reinitStandardVU1Programs() {
|
||||
qbufferRenderer.reinitVU1();
|
||||
}
|
||||
|
||||
u32 StapipelineCore::getMaxVertCountByBag(const StapipBag* bag) {
|
||||
u32 StaPipelineCore::getMaxVertCountByBag(const StaPipBag* bag) {
|
||||
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
|
||||
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
|
||||
}
|
||||
|
||||
u32 StapipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
u32 StaPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
const bool& isLightingEnabled,
|
||||
const bool& isTextureEnabled) {
|
||||
return qbufferRenderer
|
||||
@@ -49,7 +49,7 @@ u32 StapipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
|
||||
}
|
||||
|
||||
void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
||||
if (bag->count <= 0) return;
|
||||
|
||||
TYRA_ASSERT(bag->vertices != nullptr,
|
||||
@@ -71,7 +71,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
!bag->texture || (bag->texture->texture && bag->texture->coordinates),
|
||||
"If you want texture, please provide texture and coordinates!");
|
||||
|
||||
StapipBagPackagesBBox* renderBbox;
|
||||
StaPipBagPackagesBBox* renderBbox;
|
||||
|
||||
u32 maxVertCount = getMaxVertCountByBag(bag);
|
||||
|
||||
@@ -79,7 +79,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
|
||||
if (!bbox)
|
||||
renderBbox =
|
||||
new StapipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
|
||||
new StaPipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
|
||||
else
|
||||
renderBbox = bbox;
|
||||
|
||||
@@ -141,7 +141,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
Verbose("Render finished");
|
||||
}
|
||||
|
||||
void StapipelineCore::renderPkgs(StapipBagPackage* packages, u16 count) {
|
||||
void StaPipelineCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
if (packages[i].isInFrustum == IN_FRUSTUM) {
|
||||
Verbose(i, " - package in frustum -> cull");
|
||||
@@ -161,7 +161,7 @@ void StapipelineCore::renderPkgs(StapipBagPackage* packages, u16 count) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipelineCore::renderSubpkgs(StapipBagPackage* subpkgs, u16 count) {
|
||||
void StaPipelineCore::renderSubpkgs(StaPipBagPackage* subpkgs, u16 count) {
|
||||
std::vector<u16> doneIndexes;
|
||||
std::vector<u16> loadedIndexes;
|
||||
|
||||
@@ -218,7 +218,7 @@ void StapipelineCore::renderSubpkgs(StapipBagPackage* subpkgs, u16 count) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipelineCore::setMaxVertCount(const u32& count) {
|
||||
void StaPipelineCore::setMaxVertCount(const u32& count) {
|
||||
maxVertCount = count;
|
||||
packager.setMaxVertCount(count);
|
||||
qbufferRenderer.setMaxVertCount(count);
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
Stapipeline::Stapipeline() { colorsCache = new Vec4[4]; }
|
||||
StaticPipeline::StaticPipeline() { colorsCache = new Vec4[4]; }
|
||||
|
||||
Stapipeline::~Stapipeline() { delete[] colorsCache; }
|
||||
StaticPipeline::~StaticPipeline() { delete[] colorsCache; }
|
||||
|
||||
void Stapipeline::init(RendererCore* t_core) {
|
||||
void StaticPipeline::init(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
core.init(t_core);
|
||||
}
|
||||
|
||||
void Stapipeline::onUse() { core.reinitStandardVU1Programs(); }
|
||||
void StaticPipeline::onUse() { core.reinitStandardVU1Programs(); }
|
||||
|
||||
void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) {
|
||||
auto model = mesh->getModelMatrix();
|
||||
|
||||
MeshFrame* frameFrom = mesh->getFramesCount() > 0
|
||||
@@ -49,7 +49,7 @@ void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
// material->isSingleColorActivated(), material->getNormalFaces(),
|
||||
// material->getTextureCoordFaces());
|
||||
|
||||
StapipBag bag;
|
||||
StaPipBag bag;
|
||||
addVertices(mesh, material, &bag, frameFrom, frameTo);
|
||||
bag.info = infoBag;
|
||||
bag.color = getColorBag(mesh, material, frameFrom, frameTo);
|
||||
@@ -65,9 +65,9 @@ void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
delete infoBag;
|
||||
}
|
||||
|
||||
void Stapipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StapipBag* bag, MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
void StaticPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StaPipBag* bag, MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
bag->count = material->getFacesCount();
|
||||
bag->vertices = new Vec4[bag->count];
|
||||
|
||||
@@ -83,10 +83,10 @@ void Stapipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
}
|
||||
}
|
||||
|
||||
StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
const StapipOptions* options,
|
||||
M4x4* model) const {
|
||||
auto* result = new StapipInfoBag();
|
||||
StaPipInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh,
|
||||
const StaPipOptions* options,
|
||||
M4x4* model) const {
|
||||
auto* result = new StaPipInfoBag();
|
||||
|
||||
if (options) {
|
||||
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
||||
@@ -96,7 +96,7 @@ StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
} else {
|
||||
result->antiAliasingEnabled = false;
|
||||
result->blendingEnabled = true;
|
||||
result->shadingType = StapipShadingFlat;
|
||||
result->shadingType = StaPipShadingFlat;
|
||||
result->noClipChecks = true;
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipColorBag* Stapipeline::getColorBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
auto* result = new StapipColorBag();
|
||||
StaPipColorBag* StaticPipeline::getColorBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
auto* result = new StaPipColorBag();
|
||||
|
||||
if (material->isSingleColorActivated()) {
|
||||
result->single = &material->singleColor;
|
||||
@@ -133,13 +133,13 @@ StapipColorBag* Stapipeline::getColorBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipTextureBag* Stapipeline::getTextureBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) {
|
||||
StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) {
|
||||
if (!material->getTextureCoordFaces()) return nullptr;
|
||||
|
||||
auto* result = new StapipTextureBag();
|
||||
auto* result = new StaPipTextureBag();
|
||||
|
||||
result->texture =
|
||||
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
||||
@@ -163,15 +163,15 @@ StapipTextureBag* Stapipeline::getTextureBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipLightingBag* Stapipeline::getLightingBag(
|
||||
StaPipLightingBag* StaticPipeline::getLightingBag(
|
||||
DynamicMesh* mesh, MeshMaterial* material, M4x4* model,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo,
|
||||
const StapipOptions* options) const {
|
||||
const StaPipOptions* options) const {
|
||||
if (!material->getNormalFaces() || options == nullptr ||
|
||||
options->lighting == nullptr)
|
||||
return nullptr;
|
||||
|
||||
auto* result = new StapipLightingBag(true);
|
||||
auto* result = new StaPipLightingBag(true);
|
||||
result->lightMatrix = model;
|
||||
|
||||
result->setLightsManually(colorsCache,
|
||||
@@ -193,8 +193,8 @@ StapipLightingBag* Stapipeline::getLightingBag(
|
||||
return result;
|
||||
}
|
||||
|
||||
void Stapipeline::setLightingColorsCache(
|
||||
StapipLightingOptions* lightingOptions) {
|
||||
void StaticPipeline::setLightingColorsCache(
|
||||
StaPipLightingOptions* lightingOptions) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
colorsCache[i] =
|
||||
reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]);
|
||||
@@ -202,8 +202,8 @@ void Stapipeline::setLightingColorsCache(
|
||||
colorsCache[3] = reinterpret_cast<Vec4&>(*lightingOptions->ambientColor);
|
||||
}
|
||||
|
||||
void Stapipeline::deallocDrawBags(StapipBag* bag,
|
||||
MeshMaterial* material) const {
|
||||
void StaticPipeline::deallocDrawBags(StaPipBag* bag,
|
||||
MeshMaterial* material) const {
|
||||
if (bag->color->many) {
|
||||
delete[] bag->color->many;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user