fixed some small bugs and updated version to 0.1.3
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "interfaces/IRenderer.hpp"
|
||||
|
||||
TSE::Camera* TSE::Camera::mainCamera = nullptr;
|
||||
TSE::ICameraHelper* TSE::Camera::helper = nullptr;
|
||||
|
||||
float TSE::Camera::GetRenderScale() const
|
||||
{
|
||||
@@ -182,6 +183,7 @@ void TSE::Camera::PreDraw(IShader *shader)
|
||||
viewMatrix = BuildView_Zplus_RH(worlmatrix);
|
||||
|
||||
shader->SetUniform("camMatrix", &viewMatrix);
|
||||
helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
|
||||
}
|
||||
|
||||
void TSE::Camera::PostDraw()
|
||||
|
||||
@@ -17,6 +17,12 @@ namespace TSE
|
||||
Perspective = 2,
|
||||
};
|
||||
|
||||
class ICameraHelper
|
||||
{
|
||||
public:
|
||||
inline virtual void OnRenderTargetChanged(float width, float height) {};
|
||||
};
|
||||
|
||||
class Camera : public IResizeNotifiable, public BehaviourScript
|
||||
{
|
||||
private:
|
||||
@@ -35,6 +41,7 @@ namespace TSE
|
||||
Vector2 lastRtSize = {0, 0};
|
||||
|
||||
public:
|
||||
static ICameraHelper* helper;
|
||||
static Camera* mainCamera;
|
||||
|
||||
// Getter
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace TSE
|
||||
objectEntries[id] = this;
|
||||
}
|
||||
|
||||
Transformable::Transformable(uuids::uuid id)
|
||||
: id(id), position(0, 0, 0), scale(1, 1, 1), rotation(), name("")
|
||||
Transformable::Transformable(uuids::uuid _id)
|
||||
: id(_id), position(0, 0, 0), scale(1, 1, 1), rotation(), name("")
|
||||
{
|
||||
objectEntries[id] = this;
|
||||
objectEntries[_id] = this;
|
||||
}
|
||||
|
||||
Transformable::Transformable(const string &name)
|
||||
@@ -28,10 +28,10 @@ namespace TSE
|
||||
objectEntries[id] = this;
|
||||
}
|
||||
|
||||
Transformable::Transformable(const string &name, uuids::uuid id)
|
||||
: id(id), position(0, 0, 0), scale(1, 1, 1), rotation(), name(name)
|
||||
Transformable::Transformable(const string &name, uuids::uuid _id)
|
||||
: id(_id), position(0, 0, 0), scale(1, 1, 1), rotation(), name(name)
|
||||
{
|
||||
objectEntries[id] = this;
|
||||
objectEntries[_id] = this;
|
||||
}
|
||||
|
||||
Transformable::~Transformable()
|
||||
@@ -370,10 +370,13 @@ namespace TSE
|
||||
{
|
||||
//deleting children
|
||||
if(!onlyThis)
|
||||
{
|
||||
for(auto child : t->children)
|
||||
{
|
||||
HardDelete(child, onlyThis);
|
||||
}
|
||||
t->children.clear();
|
||||
}
|
||||
|
||||
//deleting atteched scripts
|
||||
for (auto& [_, script] : t->components)
|
||||
@@ -449,6 +452,19 @@ namespace TSE
|
||||
return objectEntries.size();
|
||||
}
|
||||
|
||||
Transformable *Transformable::GetTansformableAt(int i)
|
||||
{
|
||||
int x = 0;
|
||||
for(auto obj : objectEntries)
|
||||
{
|
||||
if(i == x++)
|
||||
{
|
||||
return obj.second;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Transformable *Transformable::Find(string name)
|
||||
{
|
||||
for(auto obj : objectEntries)
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace TSE
|
||||
public:
|
||||
|
||||
static int GetTansformableCount();
|
||||
static Transformable* GetTansformableAt(int i);
|
||||
static Transformable* Find(string name);
|
||||
static Transformable* Find(uuids::uuid id);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user