renderer cleanup, demo changes
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "math/vec4.hpp"
|
||||
|
||||
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||
#include "./dynpip_info_bag.hpp"
|
||||
#include "./dynpip_color_bag.hpp"
|
||||
#include "./dynpip_lighting_bag.hpp"
|
||||
#include "./dynpip_texture_bag.hpp"
|
||||
@@ -31,7 +31,7 @@ class DynPipBag {
|
||||
~DynPipBag();
|
||||
|
||||
/** Mandatory. Object info. */
|
||||
PipelineInfoBag* info;
|
||||
DynPipInfoBag* info;
|
||||
|
||||
/** Mandatory. Object color(s). */
|
||||
DynPipColorBag* color;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipInfoBag : public PipelineInfoBag {
|
||||
public:
|
||||
DynPipInfoBag() {}
|
||||
~DynPipInfoBag() {}
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -28,18 +28,16 @@ class DynPipCore {
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
/** Force starting VU1 program instead of continueing */
|
||||
void clear() { qbufferRenderer.clearLastProgramName(); }
|
||||
void updatePrimLod(PipelineInfoBag* bag);
|
||||
void begin(PipelineInfoBag* bag);
|
||||
|
||||
/**
|
||||
* Send model matrix, lighting data and other
|
||||
* repetitve stuff to VU1
|
||||
*/
|
||||
void initParts(DynPipBag* data);
|
||||
void sendObjectDataToVU1(DynPipBag* data);
|
||||
|
||||
/** Render 3D via "bags" */
|
||||
void renderPart(DynPipBag** bags, const u32& count,
|
||||
const bool& frustumCull = true);
|
||||
void render(DynPipBag** bags, const u32& count);
|
||||
|
||||
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
||||
u32 getMaxVertCountByParams(const bool& isLightingEnabled,
|
||||
|
||||
@@ -53,18 +53,16 @@ class DynamicPipeline : public Renderer3DPipeline {
|
||||
DynPipBag* buffers;
|
||||
static const u32 halfBuffersCount;
|
||||
|
||||
void setBuffer(DynPipBag* buffers, DynPipBag* buffer, u16* bufferIndex,
|
||||
const PipelineFrustumCulling& frustumCulling);
|
||||
void setBuffer(DynPipBag* buffers, DynPipBag* buffer, u16* bufferIndex);
|
||||
|
||||
void sendRestOfBuffers(DynPipBag* buffers, u16* bufferIndex,
|
||||
const PipelineFrustumCulling& frustumCulling);
|
||||
void sendRestOfBuffers(DynPipBag* buffers, u16* bufferIndex);
|
||||
|
||||
void addVertices(MeshMaterialFrame* materialFrameFrom,
|
||||
MeshMaterialFrame* materialFrameTo, DynPipBag* bag,
|
||||
const u32& startIndex) const;
|
||||
|
||||
PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const DynPipOptions* options,
|
||||
M4x4* model) const;
|
||||
DynPipInfoBag* getInfoBag(DynamicMesh* mesh, const DynPipOptions* options,
|
||||
M4x4* model) const;
|
||||
|
||||
DynPipColorBag* getColorBag(MeshMaterial* material) const;
|
||||
|
||||
@@ -82,7 +80,7 @@ class DynamicPipeline : public Renderer3DPipeline {
|
||||
void setLightingColorsCache(PipelineLightingOptions* lightingOptions);
|
||||
void freeBuffer(DynPipBag* bag);
|
||||
void setBuffersDefaultVars(DynPipBag* buffers, DynamicMesh* mesh,
|
||||
PipelineInfoBag* infoBag);
|
||||
DynPipInfoBag* infoBag);
|
||||
void setBuffersColorBag(DynPipBag* buffers, DynPipColorBag* colorBag);
|
||||
};
|
||||
|
||||
|
||||
@@ -16,33 +16,43 @@
|
||||
#include "../pipeline_shading_type.hpp"
|
||||
#include "../pipeline_texture_mapping_type.hpp"
|
||||
#include "../pipeline_transformation_type.hpp"
|
||||
#include "./pipeline_info_bag_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class PipelineInfoBag {
|
||||
public:
|
||||
PipelineInfoBag();
|
||||
~PipelineInfoBag();
|
||||
PipelineInfoBag() {
|
||||
shadingType = TyraShadingFlat;
|
||||
transformationType = TyraMVP;
|
||||
textureMappingType = TyraLinear;
|
||||
blendingEnabled = true;
|
||||
antiAliasingEnabled = false;
|
||||
model = nullptr;
|
||||
frustumCulling = PipelineInfoBagFrustumCulling_None;
|
||||
}
|
||||
~PipelineInfoBag() {}
|
||||
|
||||
/** Mandatory. Model matrix */
|
||||
M4x4* model;
|
||||
|
||||
/** Flat or gouraud */
|
||||
PipelineShadingType shadingType;
|
||||
|
||||
/** Linear or nearest */
|
||||
PipelineTextureMappingType textureMappingType;
|
||||
|
||||
/** Multiply by model matrix by view-projection or projection matrix */
|
||||
PipelineTransformationType transformationType;
|
||||
|
||||
/** Blending texture with color */
|
||||
bool blendingEnabled;
|
||||
|
||||
/** Anti-aliasing */
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/**
|
||||
* @brief Experimental! False -> disables "clip against each plane" algorithm.
|
||||
* Default: True.
|
||||
*
|
||||
* 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 fullClipChecks;
|
||||
/** Type of frustum culling */
|
||||
PipelineInfoBagFrustumCulling frustumCulling;
|
||||
};
|
||||
|
||||
} // 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>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum PipelineInfoBagFrustumCulling {
|
||||
/** No frustum culling */
|
||||
PipelineInfoBagFrustumCulling_None = 0,
|
||||
/** Frustum culling of parts of an object */
|
||||
PipelineInfoBagFrustumCulling_Precise = 2,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class PipelineOptions {
|
||||
/** Anti-aliasing */
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/** Multiply by model matrix by MVP or MP */
|
||||
/** Multiply by model matrix by view-projection or projection matrix */
|
||||
PipelineTransformationType transformationType;
|
||||
|
||||
/** Optional */
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "math/vec4.hpp"
|
||||
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||
#include "./stapip_info_bag.hpp"
|
||||
#include "./stapip_color_bag.hpp"
|
||||
#include "./stapip_lighting_bag.hpp"
|
||||
#include "./stapip_texture_bag.hpp"
|
||||
@@ -31,7 +31,7 @@ class StaPipBag {
|
||||
~StaPipBag();
|
||||
|
||||
/** Mandatory. Object info. */
|
||||
PipelineInfoBag* info;
|
||||
StaPipInfoBag* info;
|
||||
|
||||
/** Mandatory. Object color(s). */
|
||||
StaPipColorBag* color;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||
#include "renderer/3d/pipeline/static/stapip_ztest.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StaPipInfoBag : public PipelineInfoBag {
|
||||
public:
|
||||
StaPipInfoBag() {
|
||||
fullClipChecks = false;
|
||||
zTestType = StaPipZTest_Standard;
|
||||
}
|
||||
~StaPipInfoBag() {}
|
||||
|
||||
/**
|
||||
* @brief Experimental! False -> disables "clip against each plane" algorithm.
|
||||
* Default: True.
|
||||
*
|
||||
* 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 fullClipChecks;
|
||||
|
||||
/** @brief Type of z buffer testing. */
|
||||
StaPipZTest zTestType;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -29,8 +29,7 @@ class StaPipCore {
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
/** Render 3D via "bags" */
|
||||
void render(StaPipBag* bag, const bool& frustumCull, const StaPipZTest& zTest,
|
||||
StaPipBagPackagesBBox* bbox = nullptr);
|
||||
void render(StaPipBag* bag, StaPipBagPackagesBBox* bbox = nullptr);
|
||||
|
||||
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
||||
u32 getMaxVertCountByParams(const bool& isSingleColor,
|
||||
|
||||
@@ -53,7 +53,7 @@ class StaticPipeline : public Renderer3DPipeline {
|
||||
|
||||
void addVertices(MeshMaterialFrame* materialFrame, StaPipBag* bag) const;
|
||||
|
||||
PipelineInfoBag* getInfoBag(StaticMesh* mesh, const StaPipOptions* options,
|
||||
StaPipInfoBag* getInfoBag(StaticMesh* mesh, const StaPipOptions* options,
|
||||
M4x4* model) const;
|
||||
|
||||
StaPipColorBag* getColorBag(MeshMaterial* material,
|
||||
|
||||
Reference in New Issue
Block a user