core renderer refactor finish
This commit is contained in:
@@ -52,10 +52,10 @@ class DynamicPipeline : public Renderer3DPipeline {
|
||||
static const u32 halfBuffersCount;
|
||||
|
||||
void setBuffer(DynPipBag* buffers, DynPipBag* buffer, u16* bufferIndex,
|
||||
const DynPipFrustumCulling& frustumCulling);
|
||||
const PipelineFrustumCulling& frustumCulling);
|
||||
|
||||
void sendRestOfBuffers(DynPipBag* buffers, u16* bufferIndex,
|
||||
const DynPipFrustumCulling& frustumCulling);
|
||||
const PipelineFrustumCulling& frustumCulling);
|
||||
|
||||
void addVertices(MeshMaterialFrame* materialFrameFrom,
|
||||
MeshMaterialFrame* materialFrameTo, DynPipBag* bag,
|
||||
|
||||
@@ -14,19 +14,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum DynPipFrustumCulling {
|
||||
DynPipFrustumCulling_None = 0,
|
||||
DynPipFrustumCulling_Simple = 1,
|
||||
DynPipFrustumCulling_Precise = 2,
|
||||
};
|
||||
|
||||
class DynPipOptions : public PipelineOptions {
|
||||
public:
|
||||
DynPipOptions() {}
|
||||
~DynPipOptions() {}
|
||||
|
||||
/** Default: Simple */
|
||||
DynPipFrustumCulling frustumCulling;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Tyra {
|
||||
* Pipeline specialized in fast rendering of voxels
|
||||
* Supports:
|
||||
* - Full "against each plane" clipping
|
||||
* - Frustum culling (on noFullClipChecks = false)
|
||||
* - Frustum culling (on fullClipChecks = true)
|
||||
*/
|
||||
class MinecraftPipeline : public Renderer3DPipeline {
|
||||
public:
|
||||
@@ -40,11 +40,11 @@ class MinecraftPipeline : public Renderer3DPipeline {
|
||||
* @param count number of blocks to render
|
||||
* @param t_tex texture to use
|
||||
* @param isMulti is this a 6 texture voxel?
|
||||
* @param noFullClipChecks true = faster, simple PS2 clipping. False = slower
|
||||
* @param fullClipChecks false = faster, simple PS2 clipping. True = slower
|
||||
* "against each plane" clipping.
|
||||
*/
|
||||
void render(McpipBlock* blocks, const u32& count, Texture* t_tex,
|
||||
const bool& isMulti = false, const bool& noFullClipChecks = true);
|
||||
const bool& isMulti = false, const bool& fullClipChecks = false);
|
||||
|
||||
inline const float& getTextureOffset() const {
|
||||
return manager.getTextureOffset();
|
||||
@@ -58,12 +58,17 @@ class MinecraftPipeline : public Renderer3DPipeline {
|
||||
RenderBBox* bbox;
|
||||
McpipProgramName latestMode;
|
||||
|
||||
McpipBlock*** spamBuffers;
|
||||
u32* spamCounts;
|
||||
u32 spamBuffersCount;
|
||||
u32 spammerIndex;
|
||||
|
||||
void initBBox();
|
||||
|
||||
void changeMode(const McpipProgramName& requestedMode, const u8& force);
|
||||
|
||||
void cull(McpipBlock* blocks, const std::vector<u32>& indexes,
|
||||
RendererCoreTextureBuffers* texBuffers,
|
||||
RendererCoreTextureBuffers* texBuffers, const bool& isCullOnly,
|
||||
const bool& isMulti = false);
|
||||
|
||||
void clip(McpipBlock* blocks, const std::vector<u32>& indexes,
|
||||
@@ -71,6 +76,12 @@ class MinecraftPipeline : public Renderer3DPipeline {
|
||||
const bool& isMulti = false);
|
||||
|
||||
Tyra::CoreBBoxFrustum isInFrustum(const McpipBlock& block) const;
|
||||
|
||||
void addToSpammer(McpipBlock** blockPointerArray, const u32& count,
|
||||
RendererCoreTextureBuffers* texBuffers,
|
||||
const bool& isMulti);
|
||||
void flushSpammer(RendererCoreTextureBuffers* texBuffers,
|
||||
const bool& isMulti);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -42,6 +42,10 @@ class BlockizerProgramsManager {
|
||||
|
||||
void clearLastProgram() { lastProgramName = UndefinedMcpipProgram; }
|
||||
|
||||
void cullSpam(McpipBlock*** blockPointerArrays, u32* blockPointerArrayCounts,
|
||||
u32 blockPointerArraysCount,
|
||||
RendererCoreTextureBuffers* texBuffers, const bool& isMulti);
|
||||
|
||||
void cull(McpipBlock** blockPointerArray, u32 blockPointerArrayCount,
|
||||
RendererCoreTextureBuffers* texBuffers, const bool& isMulti);
|
||||
|
||||
@@ -69,6 +73,7 @@ class BlockizerProgramsManager {
|
||||
|
||||
void setProgramsCache();
|
||||
void uploadBlock(bool isMulti);
|
||||
void addProgram(McpipProgram* program);
|
||||
void sendPacket(McpipProgram* program);
|
||||
};
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ class PipelineInfoBag {
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/**
|
||||
* @brief True -> disables "clip against each plane" algorithm.
|
||||
* Default: false.
|
||||
* @brief 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 noFullClipChecks;
|
||||
bool fullClipChecks;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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 PipelineFrustumCulling {
|
||||
/** No frustum culling */
|
||||
PipelineFrustumCulling_None = 0,
|
||||
/** Frustum culling of whole object */
|
||||
PipelineFrustumCulling_Simple = 1,
|
||||
/** Frustum culling of parts of an object */
|
||||
PipelineFrustumCulling_Precise = 2,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
|
||||
#include "../shared/pipeline_lighting_options.hpp"
|
||||
#include "./pipeline_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -20,6 +21,7 @@ class PipelineOptions {
|
||||
PipelineOptions() { lighting = nullptr; }
|
||||
~PipelineOptions() {}
|
||||
|
||||
PipelineFrustumCulling frustumCulling;
|
||||
PipelineShadingType shadingType;
|
||||
bool blendingEnabled;
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "./bag/packaging/stapip_bag_package.hpp"
|
||||
#include "./bag/packaging/stapip_bag_packager.hpp"
|
||||
#include "./stapip_qbuffer_renderer.hpp"
|
||||
#include "renderer/3d/pipeline/shared/pipeline_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -27,7 +28,8 @@ class StaPipCore {
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
/** Render 3D via "bags" */
|
||||
void render(StaPipBag* bag, StaPipBagPackagesBBox* bbox = nullptr);
|
||||
void render(StaPipBag* bag, const bool& frustumCull,
|
||||
StaPipBagPackagesBBox* bbox = nullptr);
|
||||
|
||||
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
||||
u32 getMaxVertCountByParams(const bool& isSingleColor,
|
||||
@@ -52,7 +54,7 @@ class StaPipCore {
|
||||
void setMaxVertCount(const u32& count);
|
||||
StaPipBagPackager packager;
|
||||
StaPipQBufferRenderer qbufferRenderer;
|
||||
void renderPkgs(StaPipBagPackage* packages, u16 count);
|
||||
void renderPkgs(StaPipBagPackage* packages, const bool& doClip, u16 count);
|
||||
void renderSubpkgs(StaPipBagPackage* packages, u16 count);
|
||||
};
|
||||
|
||||
|
||||
@@ -16,18 +16,18 @@ namespace Tyra {
|
||||
|
||||
class StaPipOptions : public PipelineOptions {
|
||||
public:
|
||||
StaPipOptions() {}
|
||||
StaPipOptions() { fullClipChecks = false; }
|
||||
~StaPipOptions() {}
|
||||
|
||||
/**
|
||||
* @brief True -> disables "clip against each plane" algorithm.
|
||||
* Mandatory, default: false.
|
||||
* @brief False -> disables "clip against each plane" algorithm.
|
||||
* Mandatory, 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)
|
||||
*/
|
||||
bool noFullClipChecks;
|
||||
bool fullClipChecks;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Tyra {
|
||||
* Pipeline for static models (StaticMesh).
|
||||
* Supports:
|
||||
* - Full "against each plane" clipping and simple PS2 clipping
|
||||
* (noFullClipChecks),
|
||||
* (fullClipChecks),
|
||||
* - Force enabled precise frustum culling (checks parts of given mesh)
|
||||
* - Modes: color(s), texture+color(s), dir lights, texture + dir lights
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user