finish of renderer refactor
This commit is contained in:
@@ -25,7 +25,7 @@ class DynPipCore {
|
||||
|
||||
DynPipProgramsRepository repository;
|
||||
|
||||
void init(RendererCore* t_core, const u32& t_packetSize);
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
/** Force starting VU1 program instead of continueing */
|
||||
void clear() { qbufferRenderer.clearLastProgramName(); }
|
||||
@@ -52,6 +52,11 @@ class DynPipCore {
|
||||
*/
|
||||
void reinitVU1Programs();
|
||||
|
||||
void allocateOnUse(const u32& t_packetSize) {
|
||||
qbufferRenderer.allocateOnUse(t_packetSize);
|
||||
}
|
||||
void deallocateOnUse() { qbufferRenderer.deallocateOnUse(); }
|
||||
|
||||
private:
|
||||
M4x4 mvp;
|
||||
RendererCore* rendererCore;
|
||||
|
||||
@@ -21,8 +21,7 @@ class DynPipRenderer {
|
||||
DynPipRenderer();
|
||||
~DynPipRenderer();
|
||||
|
||||
void init(RendererCore* t_core, DynPipProgramsRepository* t_programRepo,
|
||||
const u32& t_packetSize);
|
||||
void init(RendererCore* t_core, DynPipProgramsRepository* t_programRepo);
|
||||
|
||||
void reinitVU1();
|
||||
|
||||
@@ -35,6 +34,9 @@ class DynPipRenderer {
|
||||
|
||||
const u16& getBufferSize() { return bufferSize; }
|
||||
|
||||
void allocateOnUse(const u32& t_packetSize);
|
||||
void deallocateOnUse();
|
||||
|
||||
private:
|
||||
void sendStaticData() const;
|
||||
void setProgramsCache();
|
||||
|
||||
@@ -35,10 +35,12 @@ class DynamicPipeline : public Renderer3DPipeline {
|
||||
|
||||
DynPipCore core;
|
||||
|
||||
void init(RendererCore* core);
|
||||
void setRenderer(RendererCore* core);
|
||||
|
||||
void onUse();
|
||||
|
||||
void onUseEnd();
|
||||
|
||||
/**
|
||||
* Render dynamic model.
|
||||
* This render() method is a bridge to core.render() method.
|
||||
|
||||
@@ -29,9 +29,10 @@ class MinecraftPipeline : public Renderer3DPipeline {
|
||||
MinecraftPipeline();
|
||||
~MinecraftPipeline();
|
||||
|
||||
void init(RendererCore* core);
|
||||
void setRenderer(RendererCore* core);
|
||||
|
||||
void onUse();
|
||||
void onUseEnd();
|
||||
|
||||
/**
|
||||
* @brief Render voxels
|
||||
|
||||
@@ -58,6 +58,9 @@ class BlockizerProgramsManager {
|
||||
|
||||
const McpipBlockData& getBlockData() const { return singleTexBlockData; }
|
||||
|
||||
void allocateOnUse();
|
||||
void deallocateOnUse();
|
||||
|
||||
private:
|
||||
McpipProgramsRepository repo;
|
||||
Renderer* renderer;
|
||||
|
||||
@@ -19,8 +19,9 @@ class Renderer3DPipeline {
|
||||
Renderer3DPipeline() {}
|
||||
~Renderer3DPipeline() {}
|
||||
|
||||
virtual void init(RendererCore* core) = 0;
|
||||
virtual void setRenderer(RendererCore* core) = 0;
|
||||
virtual void onUse() = 0;
|
||||
virtual void onUseEnd() = 0;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -47,6 +47,9 @@ class StaPipCore {
|
||||
*/
|
||||
void reinitVU1Programs();
|
||||
|
||||
void allocateOnUse() { qbufferRenderer.allocateOnUse(); }
|
||||
void deallocateOnUse() { qbufferRenderer.deallocateOnUse(); }
|
||||
|
||||
private:
|
||||
u32 maxVertCount;
|
||||
RendererCore* rendererCore;
|
||||
|
||||
@@ -65,6 +65,9 @@ class StaPipQBufferRenderer {
|
||||
|
||||
const u16& getBufferSize() { return bufferSize; }
|
||||
|
||||
void allocateOnUse();
|
||||
void deallocateOnUse();
|
||||
|
||||
private:
|
||||
bool is1stDBufferFlushTime();
|
||||
bool is2ndDBufferFlushTime();
|
||||
@@ -74,6 +77,7 @@ class StaPipQBufferRenderer {
|
||||
void uploadPrograms();
|
||||
void setDoubleBuffer();
|
||||
u16 getQBufferIndex(StaPipQBuffer* buffer);
|
||||
u16 qbuffersPacketSize;
|
||||
|
||||
static const u16 buffersCount;
|
||||
|
||||
@@ -88,7 +92,7 @@ class StaPipQBufferRenderer {
|
||||
packet2_t* programsPacket;
|
||||
|
||||
packet2_t** packets;
|
||||
StaPipVU1Program** programs; // dbuffer
|
||||
StaPipVU1Program** dBufferPrograms;
|
||||
StaPipQBuffer** buffers;
|
||||
packet2_t* currentPacket;
|
||||
packet2_t* staticDataPacket;
|
||||
|
||||
@@ -35,10 +35,12 @@ class StaticPipeline : public Renderer3DPipeline {
|
||||
|
||||
StaPipCore core;
|
||||
|
||||
void init(RendererCore* core);
|
||||
void setRenderer(RendererCore* core);
|
||||
|
||||
void onUse();
|
||||
|
||||
void onUseEnd();
|
||||
|
||||
/**
|
||||
* Render static model
|
||||
* This render() method is a bridge to core.render() method.
|
||||
|
||||
@@ -95,19 +95,19 @@ class TextureRepository {
|
||||
* Remove texture from repository.
|
||||
* Texture is NOT destructed.
|
||||
*/
|
||||
void removeByIndex(const u32& t_index) {
|
||||
textures.erase(textures.begin() + t_index);
|
||||
}
|
||||
void removeByIndex(const u32& t_index);
|
||||
|
||||
/**
|
||||
* Remove texture from repository.
|
||||
* Texture is NOT destructed.
|
||||
*/
|
||||
const void removeById(const u32& t_texId) {
|
||||
s32 index = getIndexOf(t_texId);
|
||||
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
|
||||
removeByIndex(index);
|
||||
}
|
||||
void removeById(const u32& t_texId);
|
||||
|
||||
/**
|
||||
* Remove texture from repository.
|
||||
* Texture IS destructed.
|
||||
*/
|
||||
void free(const u32& t_texId);
|
||||
|
||||
private:
|
||||
std::vector<Texture*> textures;
|
||||
|
||||
Reference in New Issue
Block a user