init of dynpip bag

This commit is contained in:
h4570
2022-07-19 13:16:18 +02:00
parent 7fd2926d1d
commit 4e0785754e
18 changed files with 406 additions and 49 deletions
@@ -10,12 +10,41 @@
#pragma once #pragma once
#include "./bag/dynpip_bag.hpp"
namespace Tyra { namespace Tyra {
class DynPipQBuffer { class DynPipQBuffer {
public: public:
DynPipQBuffer(); DynPipQBuffer();
~DynPipQBuffer(); ~DynPipQBuffer();
void setMaxVertCount(const u32& count);
DynPipBag* bag;
Vec4* verticesFrom;
Vec4* verticesTo;
Vec4* stsFrom;
Vec4* stsTo;
Vec4* colorsFrom;
Vec4* colorsTo;
Vec4* normalsFrom;
Vec4* normalsTo;
/** Size per frame */
u32 size;
void print() const;
void print(const char* name) const;
void print(const std::string& name) const { print(name.c_str()); }
std::string getPrint(const char* name = nullptr) const;
private:
u32 maxVertCount;
}; };
} // namespace Tyra } // namespace Tyra
@@ -21,4 +21,4 @@
// #define VU1_LAST_ITEM_ADDR 18 // #define VU1_LAST_ITEM_ADDR 18
// Buffer data (xtop) // Buffer data (xtop)
// #define VU1_VERT_DATA_ADDR 2 #define VU1_VERT_DATA_ADDR 2
@@ -12,7 +12,7 @@
#include <tamtypes.h> #include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp" #include "../renderer_3d_pipeline.hpp"
#include "./core/dynpip_options.hpp" #include "./dynpip_options.hpp"
#include "./core/dynpip_core.hpp" #include "./core/dynpip_core.hpp"
#include "renderer/core/renderer_core.hpp" #include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp" #include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
@@ -35,6 +35,26 @@ class DynamicPipeline : public Renderer3DPipeline {
* This render() method is a bridge to core.render() method. * This render() method is a bridge to core.render() method.
*/ */
void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr); void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr);
private:
RendererCore* rendererCore;
Vec4* colorsCache;
void addVertices(DynamicMesh* mesh, MeshMaterial* material, DynPipBag* bag,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const DynPipOptions* options,
M4x4* model) const;
DynPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
DynPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo);
DynPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
M4x4* model, MeshFrame* frameFrom,
MeshFrame* frameTo,
const DynPipOptions* options) const;
void deallocDrawBags(DynPipBag* bag, MeshMaterial* material) const;
void setLightingColorsCache(PipelineLightingOptions* lightingOptions);
}; };
} // namespace Tyra } // namespace Tyra
@@ -10,12 +10,22 @@
#pragma once #pragma once
#include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
#include "../shared/pipeline_lighting_options.hpp"
namespace Tyra { namespace Tyra {
class DynPipOptions { class DynPipOptions {
public: public:
DynPipOptions() {} DynPipOptions() {}
~DynPipOptions() {} ~DynPipOptions() {}
PipelineShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
/** Optional */
PipelineLightingOptions* lighting;
}; };
} // namespace Tyra } // namespace Tyra
@@ -13,7 +13,7 @@
#include <draw.h> #include <draw.h>
#include "math/m4x4.hpp" #include "math/m4x4.hpp"
#include "math/vec4.hpp" #include "math/vec4.hpp"
#include "./pipeline_shading_type.hpp" #include "../pipeline_shading_type.hpp"
namespace Tyra { namespace Tyra {
@@ -36,6 +36,7 @@ class PipelineInfoBag {
* Full clip checks are slow, but they are * Full clip checks are slow, but they are
* preventing visual artifacts, which can happen * preventing visual artifacts, which can happen
* for big 3D objects (or objects near camera eyes) * for big 3D objects (or objects near camera eyes)
* Force enabled in dynamic pipe, because of efficiency.
*/ */
bool noFullClipChecks; bool noFullClipChecks;
}; };
@@ -15,10 +15,10 @@
namespace Tyra { namespace Tyra {
class StaPipLightingOptions { class PipelineLightingOptions {
public: public:
StaPipLightingOptions() {} PipelineLightingOptions() {}
~StaPipLightingOptions() {} ~PipelineLightingOptions() {}
/** /**
* Mandatory. * Mandatory.
@@ -13,8 +13,8 @@
namespace Tyra { namespace Tyra {
enum PipelineShadingType { enum PipelineShadingType {
StaPipShadingFlat, TyraShadingFlat,
StaPipShadingGouraud, TyraShadingGouraud,
}; };
} // namespace Tyra } // namespace Tyra
@@ -10,8 +10,8 @@
#pragma once #pragma once
#include "renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp" #include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
#include "./stapip_lighting_options.hpp" #include "../shared/pipeline_lighting_options.hpp"
namespace Tyra { namespace Tyra {
@@ -35,7 +35,7 @@ class StaPipOptions {
bool noFullClipChecks; bool noFullClipChecks;
/** Optional */ /** Optional */
StaPipLightingOptions* lighting; PipelineLightingOptions* lighting;
}; };
} // namespace Tyra } // namespace Tyra
@@ -12,10 +12,11 @@
#include <tamtypes.h> #include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp" #include "../renderer_3d_pipeline.hpp"
#include "./stapip_options.hpp" #include "../shared/pipeline_lighting_options.hpp"
#include "renderer/core/renderer_core.hpp" #include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp" #include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
#include "./core/stapip_core.hpp" #include "./core/stapip_core.hpp"
#include "./stapip_options.hpp"
namespace Tyra { namespace Tyra {
@@ -54,7 +55,7 @@ class StaticPipeline : public Renderer3DPipeline {
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(PipelineLightingOptions* lightingOptions);
}; };
} // namespace Tyra } // namespace Tyra
@@ -18,4 +18,76 @@ DynPipQBuffer::DynPipQBuffer() {}
DynPipQBuffer::~DynPipQBuffer() {} DynPipQBuffer::~DynPipQBuffer() {}
void DynPipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
void DynPipQBuffer::print() const {
auto text = getPrint(nullptr);
printf("%s\n", text.c_str());
}
void DynPipQBuffer::print(const char* name) const {
auto text = getPrint(name);
printf("%s\n", text.c_str());
}
std::string DynPipQBuffer::getPrint(const char* name) const {
std::stringstream res;
if (name) {
res << name << "(";
} else {
res << "DynPipQBuffer(";
}
res << std::fixed << std::setprecision(2);
res << std::endl;
res << "Size: " << static_cast<int>(size) << std::endl;
res << "Vertices from: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << verticesFrom[i].getPrint() << std::endl;
res << "Vertices to: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << verticesTo[i].getPrint() << std::endl;
if (bag->texture != nullptr) {
res << "STs from: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << stsFrom[i].getPrint() << std::endl;
res << "STs to: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << stsTo[i].getPrint() << std::endl;
}
if (bag->color->manyFrom != nullptr) {
res << "Colors from: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << colorsFrom[i].getPrint() << std::endl;
}
if (bag->color->manyTo != nullptr) {
res << "Colors to: " << std::endl;
for (u32 i = 0; i < size; i++)
res << i << ": " << colorsTo[i].getPrint() << std::endl;
}
if (bag->lighting != nullptr) {
res << "Normals from: " << std::endl;
for (u32 i = 0; i < size; i++) {
res << i << ": " << normalsFrom[i].getPrint() << std::endl;
}
res << "Normals to: " << std::endl;
for (u32 i = 0; i < size; i++) {
res << i << ": " << normalsTo[i].getPrint();
if (i < size - 1) {
res << std::endl;
}
}
}
res << ")";
return res.str();
}
} // namespace Tyra } // namespace Tyra
@@ -31,28 +31,39 @@ std::string DynPipTDVU1Program::getStringName() const {
void DynPipTDVU1Program::addProgramQBufferDataToPacket( void DynPipTDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, DynPipQBuffer* qbuffer) const { packet2_t* packet, DynPipQBuffer* qbuffer) const {
// u32 addr = VU1_VERT_DATA_ADDR; u32 addr = VU1_VERT_DATA_ADDR;
// // Add vertices // Add vertices
// packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices, packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->verticesFrom,
// qbuffer->size, true); qbuffer->size, true);
// addr += qbuffer->size; addr += qbuffer->size;
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->verticesTo,
qbuffer->size, true);
addr += qbuffer->size;
// // Add sts // Add sts
// packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->sts, qbuffer->size, packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->stsFrom,
// true); qbuffer->size, true);
// addr += qbuffer->size; addr += qbuffer->size;
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->stsTo, qbuffer->size,
true);
addr += qbuffer->size;
// // Add normal // Add normal
// packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->normals, packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->normalsFrom,
// qbuffer->size, true); qbuffer->size, true);
addr += qbuffer->size;
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->normalsTo,
qbuffer->size, true);
addr += qbuffer->size;
// // Add colors // Add colors
// if (qbuffer->bag->color->single == nullptr) { if (qbuffer->bag->color->singleFrom == nullptr) {
// addr += qbuffer->size; packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->colorsFrom,
// packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->colors, qbuffer->size, true);
// qbuffer->size, true); packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->colorsTo,
// } qbuffer->size, true);
}
} }
} // namespace Tyra } // namespace Tyra
@@ -20,6 +20,213 @@ void DynamicPipeline::init(RendererCore* t_core) {}
void DynamicPipeline::onUse() {} void DynamicPipeline::onUse() {}
void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) {} void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) {
auto model = mesh->getModelMatrix();
MeshFrame* frameFrom = mesh->getFramesCount() > 0
? mesh->getFrame(mesh->getCurrentAnimationFrame())
: mesh->getFrame(0);
MeshFrame* frameTo = mesh->getFramesCount() > 0
? mesh->getFrame(mesh->getNextAnimationFrame())
: nullptr;
// auto* infoBag = getInfoBag(mesh, options, &model);
if (options && options->lighting) setLightingColorsCache(options->lighting);
for (u32 i = 0; i < mesh->getMaterialsCount(); i++) {
auto* material = mesh->getMaterial(i);
// 2x bufory[maxVertCount*2] -> pętla po mniejszych częściach i czestsze
// rendery
// TODO: Double buffering in future
// auto maxVertCount = core->renderer3D.getMaxVertCountByParams(
// material->isSingleColorActivated(), material->getNormalFaces(),
// material->getTextureCoordFaces());
DynPipBag bag;
addVertices(mesh, material, &bag, frameFrom, frameTo);
// bag.info = infoBag;
// bag.color = getColorBag(mesh, material, frameFrom, frameTo);
// bag.texture = getTextureBag(mesh, material, frameFrom, frameTo);
// bag.lighting =
// getLightingBag(mesh, material, &model, frameFrom, frameTo, options);
core.render(&bag);
// deallocDrawBags(&bag, material);
}
// delete infoBag; // TODO
}
void DynamicPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
DynPipBag* bag, MeshFrame* frameFrom,
MeshFrame* frameTo) const {
// bag->count = material->getFacesCount();
// bag->vertices = new Vec4[bag->count];
// for (u32 i = 0; i < bag->count; i++) {
// auto& face = material->getVertexFaces()[i];
// if (frameTo == nullptr) {
// bag->vertices[i] = frameFrom->getVertices()[face];
// } else {
// Vec4::setLerp(&bag->vertices[i], frameFrom->getVertices()[face],
// frameTo->getVertices()[face],
// mesh->getAnimState().interpolation);
// }
// }
}
PipelineInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh,
const DynPipOptions* options,
M4x4* model) const {
auto* result = new PipelineInfoBag();
if (options) {
result->antiAliasingEnabled = options->antiAliasingEnabled;
result->blendingEnabled = options->blendingEnabled;
result->shadingType = options->shadingType;
} else {
result->antiAliasingEnabled = false;
result->blendingEnabled = true;
result->shadingType = TyraShadingFlat;
}
result->model = model;
return result;
}
DynPipColorBag* DynamicPipeline::getColorBag(DynamicMesh* mesh,
MeshMaterial* material,
MeshFrame* frameFrom,
MeshFrame* frameTo) const {
// auto* result = new DynPipColorBag();
// if (material->isSingleColorActivated()) {
// result->single = &material->singleColor;
// } else {
// result->many = new Color[material->getFacesCount()];
// for (u32 i = 0; i < material->getFacesCount(); i++) {
// auto& face = material->getColorFaces()[i];
// if (frameTo == nullptr) {
// result->many[i] = frameFrom->getColors()[face];
// } else {
// Vec4::setLerp(
// reinterpret_cast<Vec4*>(&result->many[i]),
// reinterpret_cast<const Vec4&>(frameFrom->getColors()[face]),
// reinterpret_cast<const Vec4&>(frameTo->getColors()[face]),
// mesh->getAnimState().interpolation);
// }
// }
// }
// return result;
return nullptr; // TODO
}
DynPipTextureBag* DynamicPipeline::getTextureBag(DynamicMesh* mesh,
MeshMaterial* material,
MeshFrame* frameFrom,
MeshFrame* frameTo) {
// if (!material->getTextureCoordFaces()) return nullptr;
// auto* result = new DynPipTextureBag();
// result->texture =
// rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
// TYRA_ASSERT(result->texture, "Texture for material id: ",
// material->getId(),
// " was not found in texture repository!");
// result->coordinates = new Vec4[material->getFacesCount()];
// for (u32 i = 0; i < material->getFacesCount(); i++) {
// auto& face = material->getTextureCoordFaces()[i];
// if (frameTo == nullptr) {
// result->coordinates[i] = frameFrom->getTextureCoords()[face];
// } else {
// Vec4::setLerp(&result->coordinates[i],
// frameFrom->getTextureCoords()[face],
// frameTo->getTextureCoords()[face],
// mesh->getAnimState().interpolation);
// }
// }
// return result;
return nullptr; // TODO
}
DynPipLightingBag* DynamicPipeline::getLightingBag(
DynamicMesh* mesh, MeshMaterial* material, M4x4* model,
MeshFrame* frameFrom, MeshFrame* frameTo,
const DynPipOptions* options) const {
// if (!material->getNormalFaces() || options == nullptr ||
// options->lighting == nullptr)
// return nullptr;
// auto* result = new DynPipLightingBag();
// auto* dirLightsBag = new PipelineDirLightsBag(true);
// result->dirLights = dirLightsBag;
// result->lightMatrix = model;
// result->dirLights->setLightsManually(
// colorsCache, options->lighting->directionalDirections);
// result->normals = new Vec4[material->getFacesCount()];
// for (u32 i = 0; i < material->getFacesCount(); i++) {
// auto& face = material->getNormalFaces()[i];
// if (frameTo == nullptr) {
// result->normals[i] = frameFrom->getNormals()[face];
// } else {
// Vec4::setLerp(&result->normals[i], frameFrom->getNormals()[face],
// frameTo->getNormals()[face],
// mesh->getAnimState().interpolation);
// }
// }
// return result;
return nullptr; // TODO
}
void DynamicPipeline::setLightingColorsCache(
PipelineLightingOptions* lightingOptions) {
for (int i = 0; i < 3; i++) {
colorsCache[i] =
reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]);
}
colorsCache[3] = reinterpret_cast<Vec4&>(*lightingOptions->ambientColor);
}
void DynamicPipeline::deallocDrawBags(DynPipBag* bag,
MeshMaterial* material) const {
if (bag->color->manyFrom) {
delete[] bag->color->manyFrom;
delete[] bag->color->manyTo;
}
if (bag->texture) {
delete[] bag->texture->coordinatesFrom;
delete[] bag->texture->coordinatesTo;
delete bag->texture;
}
if (bag->lighting) {
delete[] bag->lighting->normalsFrom;
delete[] bag->lighting->normalsTo;
delete bag->lighting->dirLights;
delete bag->lighting;
}
delete[] bag->verticesFrom;
delete[] bag->verticesTo;
delete bag->color;
}
} // namespace Tyra } // namespace Tyra
@@ -13,7 +13,7 @@
namespace Tyra { namespace Tyra {
PipelineInfoBag::PipelineInfoBag() { PipelineInfoBag::PipelineInfoBag() {
shadingType = StaPipShadingFlat; shadingType = TyraShadingFlat;
blendingEnabled = true; blendingEnabled = true;
antiAliasingEnabled = false; antiAliasingEnabled = false;
model = nullptr; model = nullptr;
@@ -228,13 +228,13 @@ std::string StaPipQBuffer::getPrint(const char* name) const {
if (name) { if (name) {
res << name << "("; res << name << "(";
} else { } else {
res << "Path1Buffer("; res << "StaPipQBuffer(";
} }
res << std::fixed << std::setprecision(2); res << std::fixed << std::setprecision(2);
res << std::endl; res << std::endl;
res << "Size: " << static_cast<int>(size) << std::endl; res << "Size: " << static_cast<int>(size) << std::endl;
res << "Vectors: " << std::endl; res << "Vertices: " << std::endl;
for (u32 i = 0; i < size; i++) for (u32 i = 0; i < size; i++)
res << i << ": " << vertices[i].getPrint() << std::endl; res << i << ": " << vertices[i].getPrint() << std::endl;
@@ -36,7 +36,7 @@ void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) {
auto* infoBag = getInfoBag(mesh, options, &model); auto* infoBag = getInfoBag(mesh, options, &model);
if (options->lighting) setLightingColorsCache(options->lighting); if (options && options->lighting) setLightingColorsCache(options->lighting);
for (u32 i = 0; i < mesh->getMaterialsCount(); i++) { for (u32 i = 0; i < mesh->getMaterialsCount(); i++) {
auto* material = mesh->getMaterial(i); auto* material = mesh->getMaterial(i);
@@ -96,7 +96,7 @@ PipelineInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh,
} else { } else {
result->antiAliasingEnabled = false; result->antiAliasingEnabled = false;
result->blendingEnabled = true; result->blendingEnabled = true;
result->shadingType = StaPipShadingFlat; result->shadingType = TyraShadingFlat;
result->noFullClipChecks = false; result->noFullClipChecks = false;
} }
@@ -197,7 +197,7 @@ StaPipLightingBag* StaticPipeline::getLightingBag(
} }
void StaticPipeline::setLightingColorsCache( void StaticPipeline::setLightingColorsCache(
StaPipLightingOptions* lightingOptions) { PipelineLightingOptions* lightingOptions) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
colorsCache[i] = colorsCache[i] =
reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]); reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]);
+2
View File
@@ -14,6 +14,7 @@
#include <game.hpp> #include <game.hpp>
#include "renderer/3d/pipeline/minecraft/minecraft_pipeline.hpp" #include "renderer/3d/pipeline/minecraft/minecraft_pipeline.hpp"
#include "renderer/3d/pipeline/static/static_pipeline.hpp" #include "renderer/3d/pipeline/static/static_pipeline.hpp"
#include "renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp"
namespace Tyra { namespace Tyra {
@@ -39,6 +40,7 @@ class H4570 : public Game {
Vec4 cameraPosition, cameraLookAt; Vec4 cameraPosition, cameraLookAt;
MinecraftPipeline mcPip; MinecraftPipeline mcPip;
DynamicPipeline dynpip;
StaticPipeline stapip; StaticPipeline stapip;
StaPipOptions* renderOptions; StaPipOptions* renderOptions;
Texture* blocksTex; Texture* blocksTex;
+13 -9
View File
@@ -65,6 +65,7 @@ void H4570::init() {
FileUtils::fromCwd("blocks.png")); FileUtils::fromCwd("blocks.png"));
mcPip.init(&engine->renderer.core); mcPip.init(&engine->renderer.core);
dynpip.init(&engine->renderer.core);
stapip.init(&engine->renderer.core); stapip.init(&engine->renderer.core);
picture = get2DPicture(&engine->renderer); picture = get2DPicture(&engine->renderer);
@@ -137,13 +138,16 @@ void H4570::loop() {
// engine->renderer.renderer2D.render(picture); // engine->renderer.renderer2D.render(picture);
engine->renderer.renderer3D.usePipeline(&stapip); // engine->renderer.renderer3D.usePipeline(&stapip);
{ // {
stapip.render(warrior, renderOptions); // stapip.render(warrior, renderOptions);
// stapip.render(warrior2, renderOptions); // // stapip.render(warrior2, renderOptions);
// stapip.render(warrior3, renderOptions); // // stapip.render(warrior3, renderOptions);
// stapip.render(warrior4, renderOptions); // // stapip.render(warrior4, renderOptions);
} // }
engine->renderer.renderer3D.usePipeline(&dynpip);
{ dynpip.render(warrior); }
engine->renderer.renderer3D.usePipeline(&mcPip); engine->renderer.renderer3D.usePipeline(&mcPip);
{ mcPip.render(blocks, blocksCount, blocksTex, false); } { mcPip.render(blocks, blocksCount, blocksTex, false); }
@@ -189,12 +193,12 @@ StaPipOptions* getRenderingOptions() {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F); directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
auto* lightingOptions = new StaPipLightingOptions(); // Memory leak! auto* lightingOptions = new PipelineLightingOptions(); // Memory leak!
lightingOptions->ambientColor = ambientColor; lightingOptions->ambientColor = ambientColor;
lightingOptions->directionalColors = directionalColors; lightingOptions->directionalColors = directionalColors;
lightingOptions->directionalDirections = directionalDirections; lightingOptions->directionalDirections = directionalDirections;
options->shadingType = Tyra::StaPipShadingGouraud; options->shadingType = Tyra::TyraShadingGouraud;
options->blendingEnabled = true; options->blendingEnabled = true;
options->antiAliasingEnabled = false; options->antiAliasingEnabled = false;
options->lighting = lightingOptions; options->lighting = lightingOptions;
+2 -2
View File
@@ -160,12 +160,12 @@ StaPipOptions* getRenderingOptions() {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F); directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
auto* lightingOptions = new StaPipLightingOptions(); // Memory leak! auto* lightingOptions = new PipelineLightingOptions(); // Memory leak!
lightingOptions->ambientColor = ambientColor; lightingOptions->ambientColor = ambientColor;
lightingOptions->directionalColors = directionalColors; lightingOptions->directionalColors = directionalColors;
lightingOptions->directionalDirections = directionalDirections; lightingOptions->directionalDirections = directionalDirections;
options->shadingType = Tyra::StaPipShadingGouraud; options->shadingType = Tyra::TyraShadingGouraud;
options->blendingEnabled = true; options->blendingEnabled = true;
options->antiAliasingEnabled = false; options->antiAliasingEnabled = false;
options->lighting = lightingOptions; options->lighting = lightingOptions;