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
#include "./bag/dynpip_bag.hpp"
namespace Tyra {
class DynPipQBuffer {
public:
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
@@ -21,4 +21,4 @@
// #define VU1_LAST_ITEM_ADDR 18
// Buffer data (xtop)
// #define VU1_VERT_DATA_ADDR 2
#define VU1_VERT_DATA_ADDR 2
@@ -12,7 +12,7 @@
#include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp"
#include "./core/dynpip_options.hpp"
#include "./dynpip_options.hpp"
#include "./core/dynpip_core.hpp"
#include "renderer/core/renderer_core.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.
*/
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
@@ -10,12 +10,22 @@
#pragma once
#include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
#include "../shared/pipeline_lighting_options.hpp"
namespace Tyra {
class DynPipOptions {
public:
DynPipOptions() {}
~DynPipOptions() {}
PipelineShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
/** Optional */
PipelineLightingOptions* lighting;
};
} // namespace Tyra
@@ -13,7 +13,7 @@
#include <draw.h>
#include "math/m4x4.hpp"
#include "math/vec4.hpp"
#include "./pipeline_shading_type.hpp"
#include "../pipeline_shading_type.hpp"
namespace Tyra {
@@ -36,6 +36,7 @@ class PipelineInfoBag {
* Full clip checks are slow, but they are
* preventing visual artifacts, which can happen
* for big 3D objects (or objects near camera eyes)
* Force enabled in dynamic pipe, because of efficiency.
*/
bool noFullClipChecks;
};
@@ -15,10 +15,10 @@
namespace Tyra {
class StaPipLightingOptions {
class PipelineLightingOptions {
public:
StaPipLightingOptions() {}
~StaPipLightingOptions() {}
PipelineLightingOptions() {}
~PipelineLightingOptions() {}
/**
* Mandatory.
@@ -13,8 +13,8 @@
namespace Tyra {
enum PipelineShadingType {
StaPipShadingFlat,
StaPipShadingGouraud,
TyraShadingFlat,
TyraShadingGouraud,
};
} // namespace Tyra
@@ -10,8 +10,8 @@
#pragma once
#include "renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp"
#include "./stapip_lighting_options.hpp"
#include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
#include "../shared/pipeline_lighting_options.hpp"
namespace Tyra {
@@ -35,7 +35,7 @@ class StaPipOptions {
bool noFullClipChecks;
/** Optional */
StaPipLightingOptions* lighting;
PipelineLightingOptions* lighting;
};
} // namespace Tyra
@@ -12,10 +12,11 @@
#include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp"
#include "./stapip_options.hpp"
#include "../shared/pipeline_lighting_options.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
#include "./core/stapip_core.hpp"
#include "./stapip_options.hpp"
namespace Tyra {
@@ -54,7 +55,7 @@ class StaticPipeline : public Renderer3DPipeline {
const StaPipOptions* options) const;
void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const;
void setLightingColorsCache(StaPipLightingOptions* lightingOptions);
void setLightingColorsCache(PipelineLightingOptions* lightingOptions);
};
} // namespace Tyra