Compare commits
1 Commits
main
...
51a6ea1328
| Author | SHA256 | Date | |
|---|---|---|---|
| 51a6ea1328 |
@@ -1,5 +1,2 @@
|
|||||||
# TSE
|
# TSE
|
||||||
|
|
||||||
packages needed for building under linux:
|
|
||||||
|
|
||||||
build-essential llvm cmake ninja-build clang mesa-common-dev gdb
|
|
||||||
@@ -186,14 +186,36 @@ TSE::Matrix4x4 BuildView_Zplus_RH(const TSE::Matrix4x4& world)
|
|||||||
void TSE::Camera::PreDraw(IShader *shader)
|
void TSE::Camera::PreDraw(IShader *shader)
|
||||||
{
|
{
|
||||||
rt->Bind();
|
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);
|
// shader->SetUniform("camMatrix", &viewMatrix);
|
||||||
helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSE::Camera::PostDraw()
|
void TSE::Camera::PostDraw()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "OrdererSpriteSet.hpp"
|
#include "OrdererSpriteSet.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include "Debug.hpp"
|
|
||||||
|
|
||||||
TSE::OrdererSpriteSetChunk::OrdererSpriteSetChunk(int _chunksize, const Vector2 &_pos, SortingOrder _order)
|
TSE::OrdererSpriteSetChunk::OrdererSpriteSetChunk(int _chunksize, const Vector2 &_pos, SortingOrder _order)
|
||||||
{
|
{
|
||||||
@@ -145,8 +144,6 @@ void TSE::OrdererSpriteSet::SetSprite(Vector2 p, Vector2 Spriteindex, float heig
|
|||||||
{
|
{
|
||||||
Vector2 chunkInnerPos = LocalToChunkPos(p);
|
Vector2 chunkInnerPos = LocalToChunkPos(p);
|
||||||
Vector2 chunkIndex = p - chunkInnerPos;
|
Vector2 chunkIndex = p - chunkInnerPos;
|
||||||
// Vector2 p2 = Vector2((int)p.x % chunkSize, (int)p.y % chunkSize);
|
|
||||||
// Vector2 chunkIndex = p - p2;
|
|
||||||
if(!chunks.contains(chunkIndex))
|
if(!chunks.contains(chunkIndex))
|
||||||
{
|
{
|
||||||
dirty = true;
|
dirty = true;
|
||||||
@@ -178,9 +175,7 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
|
|||||||
case TopLeft:
|
case TopLeft:
|
||||||
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
|
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
|
||||||
{
|
{
|
||||||
if (a.y != b.y)
|
return std::tie(a.y, a.x) > std::tie(b.y, b.x);
|
||||||
return a.y > b.y;
|
|
||||||
return a.x < b.x;
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case TopRight:
|
case TopRight:
|
||||||
@@ -194,9 +189,7 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
|
|||||||
case BottomLeft:
|
case BottomLeft:
|
||||||
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
|
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
|
||||||
{
|
{
|
||||||
if (a.y != b.y)
|
return std::tie(a.y, a.x) < std::tie(b.y, b.x);
|
||||||
return a.y < b.y;
|
|
||||||
return a.x < b.x;
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case BottomRight:
|
case BottomRight:
|
||||||
@@ -210,14 +203,6 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
string poses = "[";
|
|
||||||
for(auto pos : orderedChunks)
|
|
||||||
{
|
|
||||||
poses += pos.ToString() + ",";
|
|
||||||
}
|
|
||||||
poses.erase(poses.end() - 1);
|
|
||||||
poses += "]";
|
|
||||||
TSE_LOG("orderedPositions: " + poses);
|
|
||||||
}
|
}
|
||||||
return &orderedChunks;
|
return &orderedChunks;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
#include "BehaviourScriptRegistry.hpp"
|
#include "BehaviourScriptRegistry.hpp"
|
||||||
#include "BehaviourScripts/AudioListener.hpp"
|
#include "BehaviourScripts/AudioListener.hpp"
|
||||||
#include "BehaviourScripts/AudioSource.hpp"
|
#include "BehaviourScripts/AudioSource.hpp"
|
||||||
#include "BehaviourScripts/TileMap.hpp"
|
|
||||||
#include "BehaviourScripts/OrdererSpriteSet.hpp"
|
|
||||||
#include "BehaviourScripts/PhysicsObject.hpp"
|
|
||||||
#include "BehaviourScripts/basicEditorCamera.hpp"
|
#include "BehaviourScripts/basicEditorCamera.hpp"
|
||||||
|
|
||||||
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
|
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
|
||||||
@@ -29,9 +26,6 @@ TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
|
|||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Camera", []() -> BehaviourScript* {return new Camera();});
|
BehaviourScriptRegistry::RegisterBehaviourScript("Camera", []() -> BehaviourScript* {return new Camera();});
|
||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Listener", []() -> BehaviourScript* {return new AudioListener();});
|
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Listener", []() -> BehaviourScript* {return new AudioListener();});
|
||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Source", []() -> BehaviourScript* {return new AudioSource();});
|
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Source", []() -> BehaviourScript* {return new AudioSource();});
|
||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Tile Map", []() -> BehaviourScript* {return new TileMap();});
|
|
||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Orderer Sprite Set", []() -> BehaviourScript* {return new OrdererSpriteSet();});
|
|
||||||
BehaviourScriptRegistry::RegisterBehaviourScript("Physics Object", []() -> BehaviourScript* { return new PhysicsObject(BodyType::Dynamic, ColliderShape::Box, 1.0f, 0.3f, Vector3(1, 1, 0)); });
|
|
||||||
|
|
||||||
#pragma region camerastuff
|
#pragma region camerastuff
|
||||||
|
|
||||||
|
|||||||
@@ -208,10 +208,6 @@ namespace TSE::EDITOR
|
|||||||
{
|
{
|
||||||
Draw((TileMap*)element, debug);
|
Draw((TileMap*)element, debug);
|
||||||
}
|
}
|
||||||
else if (name == "Orderer Sprite Set")
|
|
||||||
{
|
|
||||||
Draw((OrdererSpriteSet*)element, debug);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
element->CustomDraw(debug);
|
element->CustomDraw(debug);
|
||||||
@@ -919,30 +915,6 @@ namespace TSE::EDITOR
|
|||||||
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
|
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ElementDrawer::Draw(OrdererSpriteSet *element, const bool &debug)
|
|
||||||
{
|
|
||||||
int orderIndex = static_cast<int>(element->order);
|
|
||||||
const char* orderItems[] = { "TopRight", "TopLeft", "BottomRight", "BottomLeft" };
|
|
||||||
if (ImGui::Combo("Order", &orderIndex, orderItems, IM_ARRAYSIZE(orderItems)))
|
|
||||||
{
|
|
||||||
element->order = static_cast<SortingOrder>(orderIndex);
|
|
||||||
for (auto& [_, chunk] : element->chunks)
|
|
||||||
{
|
|
||||||
chunk.SetOrdering(element->order);
|
|
||||||
}
|
|
||||||
element->DirtyAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::BeginDisabled();
|
|
||||||
ImGui::DragInt("Chunk Size", &element->chunkSize, 1.0f);
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ElementDrawer::DrawAudioClipCompact(AudioClip *element, const bool &debug, const std::string &label)
|
void ElementDrawer::DrawAudioClipCompact(AudioClip *element, const bool &debug, const std::string &label)
|
||||||
{
|
{
|
||||||
float item_spacing = ImGui::GetStyle().ItemSpacing.x;
|
float item_spacing = ImGui::GetStyle().ItemSpacing.x;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "BehaviourScripts/AudioListener.hpp"
|
#include "BehaviourScripts/AudioListener.hpp"
|
||||||
#include "BehaviourScripts/AudioSource.hpp"
|
#include "BehaviourScripts/AudioSource.hpp"
|
||||||
#include "BehaviourScripts/TileMap.hpp"
|
#include "BehaviourScripts/TileMap.hpp"
|
||||||
#include "BehaviourScripts/OrdererSpriteSet.hpp"
|
|
||||||
|
|
||||||
namespace TSE::EDITOR
|
namespace TSE::EDITOR
|
||||||
{
|
{
|
||||||
@@ -82,7 +81,6 @@ namespace TSE::EDITOR
|
|||||||
static void Draw(Camera* element, const bool& debug);
|
static void Draw(Camera* element, const bool& debug);
|
||||||
static void Draw(ParticleSystem* element, const bool& debug);
|
static void Draw(ParticleSystem* element, const bool& debug);
|
||||||
static void Draw(TileMap* element, const bool& debug);
|
static void Draw(TileMap* element, const bool& debug);
|
||||||
static void Draw(OrdererSpriteSet* element, const bool& debug);
|
|
||||||
|
|
||||||
static void DrawAudioClipCompact(AudioClip* element, const bool& debug, const std::string& label);
|
static void DrawAudioClipCompact(AudioClip* element, const bool& debug, const std::string& label);
|
||||||
static void DrawAudioClipNormal(AudioClip* element, const bool& debug, const std::string& label);
|
static void DrawAudioClipNormal(AudioClip* element, const bool& debug, const std::string& label);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
|
|||||||
{
|
{
|
||||||
if(tex->bpp() == 32)
|
if(tex->bpp() == 32)
|
||||||
{
|
{
|
||||||
internal = GL_RGBA;
|
internal = GL_R16;
|
||||||
input = GL_BGRA;
|
input = GL_BGRA;
|
||||||
size = GL_UNSIGNED_BYTE;
|
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);
|
glBindTexture(GL_TEXTURE_3D, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user