made a lot of changes, to get the render pipeline working
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "Layer.hpp"
|
||||
#include "BehaviourScripts/Renderable.hpp"
|
||||
#include "elements/BehaviourScript.hpp"
|
||||
#include "IdGenerator.hpp"
|
||||
|
||||
void HandleObject(TSE::Transformable* trans, TSE::TransformationStack& stack, TSE::IRenderer& rnd)
|
||||
{
|
||||
@@ -24,6 +25,7 @@ void HandleObject(TSE::Transformable* trans, TSE::TransformationStack& stack, TS
|
||||
|
||||
TSE::Layer::Layer(const string &n)
|
||||
{
|
||||
ID = GenerateRandomUUID();
|
||||
name = n;
|
||||
}
|
||||
|
||||
@@ -94,3 +96,13 @@ void TSE::Layer::Update()
|
||||
trans->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void TSE::Layer::SetNonVisual(bool v)
|
||||
{
|
||||
nonVisual = v;
|
||||
}
|
||||
|
||||
bool TSE::Layer::IsVisual()
|
||||
{
|
||||
return !nonVisual;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
#include "Types.hpp"
|
||||
#include "interfaces/IRenderer.hpp"
|
||||
#include <vector>
|
||||
#include "interfaces/IIdentifyable.hpp"
|
||||
|
||||
namespace TSE
|
||||
{
|
||||
class Layer
|
||||
class Layer : public IIdentifyable
|
||||
{
|
||||
private:
|
||||
string name;
|
||||
std::vector<Transformable*> objectsToRender;
|
||||
bool nonVisual = false;
|
||||
|
||||
public:
|
||||
Layer(const string& name);
|
||||
@@ -27,5 +29,7 @@ namespace TSE
|
||||
void SetName(const string& name);
|
||||
std::vector<Transformable*>& GetAllObjects();
|
||||
void Update();
|
||||
void SetNonVisual(bool v);
|
||||
bool IsVisual();
|
||||
};
|
||||
} // namespace TSE
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace TSE
|
||||
}
|
||||
|
||||
template void Material::SetValue<int>(const string&, const int&);
|
||||
template void Material::SetValue<uint>(const string&, const uint&);
|
||||
template void Material::SetValue<float>(const string&, const float&);
|
||||
template void Material::SetValue<Vector2>(const string&, const Vector2&);
|
||||
template void Material::SetValue<Vector3>(const string&, const Vector3&);
|
||||
@@ -70,6 +71,7 @@ namespace TSE
|
||||
template void Material::SetValue<ITexture>(const string&, const ITexture*);
|
||||
|
||||
template int Material::GetValue<int>(const string&) const;
|
||||
template uint Material::GetValue<uint>(const string&) const;
|
||||
template float Material::GetValue<float>(const string&) const;
|
||||
template Vector2 Material::GetValue<Vector2>(const string&) const;
|
||||
template Vector3 Material::GetValue<Vector3>(const string&) const;
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
#include "Scene.hpp"
|
||||
#include "BehaviourScripts/Camera.hpp"
|
||||
#include <algorithm>
|
||||
#include "Debug.hpp"
|
||||
|
||||
void TSE::Scene::Render(IRenderer &rnd, const IWindow &wnd)
|
||||
{
|
||||
auto camerasBackup = std::vector<Camera*>(IRenderer::camerasToRenderWith);
|
||||
int counter = 1;
|
||||
for(auto l : layers)
|
||||
{
|
||||
IRenderer::camerasToRenderWith.clear();
|
||||
if(!l.second->IsVisual()) continue;
|
||||
for(auto camera : camerasBackup)
|
||||
{
|
||||
auto it = std::find(camera->layersNotToRender.begin(), camera->layersNotToRender.end(), l.second->GetID());
|
||||
if(it == camera->layersNotToRender.end())
|
||||
{
|
||||
IRenderer::camerasToRenderWith.push_back(camera);
|
||||
}
|
||||
}
|
||||
|
||||
l.second->Render(rnd);
|
||||
if(counter++ != layers.size())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user