made a lot of changes, to get the render pipeline working
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "DefaultRendererOpenGL.hpp"
|
||||
#include "BehaviourScripts/Camera.hpp"
|
||||
#include "BehaviourScripts/Renderable.hpp"
|
||||
#include "Debug.hpp"
|
||||
|
||||
#define RENDERER_MAX_SPRITES 20000
|
||||
#define RENDERER_MAX_INDECIES 60000
|
||||
@@ -77,6 +78,8 @@ void TSE::GLFW::DefaultRendererOpenGL::Flush()
|
||||
|
||||
camerasToRenderWith[i]->PostDraw();
|
||||
}
|
||||
|
||||
lastShader->PostDraw();
|
||||
|
||||
if(ibobound)
|
||||
{
|
||||
|
||||
@@ -96,6 +96,8 @@ void TSE::GLFW::FrameBuffer::LoadFBTexture()
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, depthRboID);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
|
||||
@@ -39,6 +39,11 @@ void TSE::GLFW::Shader::DrawCall(int indexCount)
|
||||
OnDrawCall(indexCount);
|
||||
}
|
||||
|
||||
void TSE::GLFW::Shader::PostDraw()
|
||||
{
|
||||
OnPostDraw();
|
||||
}
|
||||
|
||||
void TSE::GLFW::Shader::Submit(const Transformable &t, float *&target, TransformationStack &stack, void (*restartDrawcall)(IRenderer &), IRenderer &rnd)
|
||||
{
|
||||
OnSubmit(t, target, stack, restartDrawcall, rnd);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace TSE::GLFW
|
||||
virtual void OnDisable() const {};
|
||||
virtual void OnFlush() {};
|
||||
virtual void OnDrawCall(int indexCount) {};
|
||||
virtual void OnPostDraw() {};
|
||||
virtual void OnSubmit(const Transformable& t, float*& target, TransformationStack& stack, void (*restartDrawcall)(IRenderer&), IRenderer& rnd) {};
|
||||
|
||||
public:
|
||||
@@ -33,6 +34,7 @@ namespace TSE::GLFW
|
||||
void Disable(bool notify = false) const;
|
||||
void Flush();
|
||||
void DrawCall(int indexCount);
|
||||
void PostDraw();
|
||||
void Submit(const Transformable& t, float*& target, TransformationStack& stack, void (*restartDrawcall)(IRenderer&), IRenderer& rnd);
|
||||
bool IsEnabled() const;
|
||||
int packageSize();
|
||||
|
||||
@@ -171,9 +171,7 @@ void TSE::GLFW::BasicTileMapShader::OnSubmit(const Transformable &t, float *&tar
|
||||
SpriteCount = tileSet->GetCount();
|
||||
SpriteScale = tm->SpriteScale;
|
||||
|
||||
const int chunkcount = tm->GetChunkCount();
|
||||
Vector2 orderedChunks[chunkcount];
|
||||
tm->GetChunkPositionsInOrder(orderedChunks);
|
||||
const std::vector<Vector2> orderedChunks = *tm->GetChunkPositionsInOrder();
|
||||
|
||||
Matrix4x4 matr = t.GetLocalMatrix();
|
||||
|
||||
@@ -183,10 +181,8 @@ void TSE::GLFW::BasicTileMapShader::OnSubmit(const Transformable &t, float *&tar
|
||||
{
|
||||
auto chunk = tm->GetChunk(chunkPos);
|
||||
const int spriteCount = chunk->GetSpriteCount();
|
||||
Vector2 spritePositions[spriteCount];
|
||||
int spriteIds[spriteCount];
|
||||
chunk->GetOrderedPositions(spritePositions);
|
||||
chunk->GetOrderedSpriteIds(spriteIds);
|
||||
const std::vector<Vector2> spritePositions = *chunk->GetOrderedPositions();
|
||||
const std::vector<Vector2i> spriteIds = *chunk->GetOrderedSpriteIds();
|
||||
int chunkSize = chunk->GetChunksize();
|
||||
|
||||
for (int i = 0; i < spriteCount; i++)
|
||||
@@ -198,7 +194,7 @@ void TSE::GLFW::BasicTileMapShader::OnSubmit(const Transformable &t, float *&tar
|
||||
*target++ = pos.x;
|
||||
*target++ = pos.y;
|
||||
*target++ = pos.z;
|
||||
*target++ = spriteIds[i];
|
||||
*target++ = spriteIds[i].x;
|
||||
|
||||
++instanceCount;
|
||||
stack.Pop();
|
||||
|
||||
Reference in New Issue
Block a user