2 Commits

Author SHA256 Message Date
4002030de8 fixed ordering problem, but have a wier flicker in non editor mode 2026-05-03 22:09:08 +02:00
4fce05a927 README.md aktualisiert 2026-04-11 07:53:19 +00:00
8 changed files with 394 additions and 419 deletions

View File

@@ -1,2 +1,5 @@
# TSE
packages needed for building under linux:
build-essential llvm cmake ninja-build clang mesa-common-dev gdb

View File

@@ -186,36 +186,14 @@ TSE::Matrix4x4 BuildView_Zplus_RH(const TSE::Matrix4x4& world)
void TSE::Camera::PreDraw(IShader *shader)
{
rt->Bind();
// shader->SetUniform("prMatrix", projectionMatrix);
shader->SetUniform("prMatrix", projectionMatrix);
// auto worlmatrix = baseObject->GetGlobalMatrix();
auto worlmatrix = baseObject->GetGlobalMatrix();
// viewMatrix = BuildView_Zplus_RH(worlmatrix);
viewMatrix = BuildView_Zplus_RH(worlmatrix);
// shader->SetUniform("camMatrix", &viewMatrix);
// helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
Vector3 pos = baseObject->GetGlobalPosition();
Vector3 right = baseObject->LocalToGlobalPosition(Vector3::right) - pos;
Vector3 up = baseObject->LocalToGlobalPosition(Vector3::up) - pos;
Vector3 forward = baseObject->LocalToGlobalPosition(Vector3::forward) - pos;
forward.Normalize();
shader->SetUniform("CamPos", &pos);
shader->SetUniform("CamRight", &right);
shader->SetUniform("CamUp", &up);
shader->SetUniform("CamForward", &forward);
float x = lastRtSize.x / RenderScale;
float y = lastRtSize.y / RenderScale;
float mx = -x;
float my = -y;
shader->SetUniform("OrthoLeft", mx);
shader->SetUniform("OrthoRight", x);
shader->SetUniform("OrthoBottom", my);
shader->SetUniform("OrthoTop", y);
shader->SetUniform("NearPlane", nearClippingPlane);
shader->SetUniform("FarPlane", farClippingPlane);
shader->SetUniform("camMatrix", &viewMatrix);
helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
}
void TSE::Camera::PostDraw()

View File

@@ -1,6 +1,7 @@
#include "OrdererSpriteSet.hpp"
#include <algorithm>
#include <tuple>
#include <cmath>
#include "Debug.hpp"
TSE::OrdererSpriteSetChunk::OrdererSpriteSetChunk(int _chunksize, const Vector2 &_pos, SortingOrder _order)
@@ -210,14 +211,6 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
}
dirty = false;
string poses = "[";
for(auto pos : orderedChunks)
{
poses += pos.ToString() + ",";
}
poses.erase(poses.end() - 1);
poses += "]";
TSE_LOG("orderedPositions: " + poses);
}
return &orderedChunks;
}
@@ -245,7 +238,7 @@ void TSE::OrdererSpriteSet::DirtyAll()
TSE::Vector2 TSE::OrdererSpriteSet::LocalToChunkPos(const Vector2 &v)
{
Vector2 p = Vector2((int)v.x % chunkSize, (int)v.y % chunkSize);
Vector2 p = Vector2(std::fmod(v.x, chunkSize), std::fmod(v.y, chunkSize));
if(p.x < 0) p.x += chunkSize;
if(p.y < 0) p.y += chunkSize;
return p;

View File

@@ -50,7 +50,7 @@ namespace TSE
Rect bounds = Rect(0,0,0,0);
public:
int chunkSize = 16;
float chunkSize = 16;
SortingOrder order = TopRight;
TileSet* set;
std::unordered_map<Vector2, OrdererSpriteSetChunk> chunks;

View File

@@ -8,13 +8,14 @@
#include "BehaviourScripts/PhysicsObject.hpp"
#include "BehaviourScripts/basicEditorCamera.hpp"
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
TSE::EDITOR::EditorSubsystem::EditorSubsystem(ConsolView* cvp) : sv(nullptr), editorLayer("")
{
rt = IRenderTexture::factory->CreateTextureHeap({100,100}, 5);
sv = SceneView(rt);
cv = cvp;
controller.AddGuiElement("Scene", &sv);
controller.AddGuiElement("Consol", &cv);
controller.AddGuiElement("Consol", cv);
controller.AddGuiElement("Hirearchie", &hv);
controller.AddGuiElement("Properties", &pv);
controller.AddGuiElement("Debug", &dv);

View File

@@ -15,7 +15,7 @@ namespace TSE::EDITOR
{
public:
ViewportController controller;
ConsolView cv;
ConsolView* cv = nullptr;
DebugView dv;
HirearchieView hv = HirearchieView(nullptr);
PropertiesView pv;
@@ -24,6 +24,6 @@ namespace TSE::EDITOR
SceneView sv;
Layer editorLayer;
EditorSubsystem();
EditorSubsystem(ConsolView* cvp);
};
} // namespace TSE::EDITOR

View File

@@ -934,7 +934,7 @@ namespace TSE::EDITOR
}
ImGui::BeginDisabled();
ImGui::DragInt("Chunk Size", &element->chunkSize, 1.0f);
ImGui::DragFloat("Chunk Size", &element->chunkSize, 1.0f);
ImGui::EndDisabled();
if (debug)

View File

@@ -105,7 +105,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
{
if(tex->bpp() == 32)
{
internal = GL_R16;
internal = GL_RGBA;
input = GL_BGRA;
size = GL_UNSIGNED_BYTE;
}
@@ -136,7 +136,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
);
}
//glGenerateMipmap(GL_TEXTURE_3D);
glGenerateMipmap(GL_TEXTURE_3D);
glBindTexture(GL_TEXTURE_3D, 0);
}