Implementing basic scene tree

This commit is contained in:
Dynamitos
2020-04-15 02:04:42 +02:00
parent 576747c369
commit 3ef8342247
34 changed files with 722 additions and 54 deletions
+69
View File
@@ -0,0 +1,69 @@
#include "Actor.h"
#include "Component.h"
using namespace Seele;
Actor::Actor()
{
}
Actor::~Actor()
{
}
void Actor::setParent(PActor newParent)
{
parent = newParent;
}
void Actor::addChild(PActor child)
{
children.add(child);
}
void Actor::detachChild(PActor child)
{
children.remove(children.find(child), false);
}
void Actor::setWorldLocation(Vector location)
{
rootComponent->setWorldLocation(location);
}
void Actor::setWorldRotation(Vector4 rotation)
{
rootComponent->setWorldRotation(rotation);
}
void Actor::setWorldScale(Vector scale)
{
rootComponent->setWorldScale(scale);
}
void Actor::setRelativeLocation(Vector location)
{
rootComponent->setRelativeLocation(location);
}
void Actor::setRelativeRotation(Vector4 rotation)
{
rootComponent->setRelativeRotation(rotation);
}
void Actor::setRelativeScale(Vector scale)
{
rootComponent->setRelativeScale(scale);
}
void Actor::addWorldTranslation(Vector translation)
{
rootComponent->addWorldTranslation(translation);
}
void Actor::addWorldRotation(Vector4 rotation)
{
rootComponent->addWorldRotation(rotation);
}
void Actor::addWorldScale(Vector scale)
{
rootComponent->addWorldScale(scale);
}
PComponent Actor::getRootComponent()
{
return rootComponent;
}
void Actor::setRootComponent(PComponent newRoot)
{
rootComponent = newRoot;
}
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "MinimalEngine.h"
#include "Transform.h"
namespace Seele
{
DECLARE_REF(Actor);
DECLARE_REF(Component);
class Actor
{
public:
Actor();
virtual ~Actor();
void setParent(PActor parent);
PActor getParent();
void addChild(PActor child);
void detachChild(PActor child);
Array<PActor> getChildren();
void setWorldLocation(Vector location);
void setWorldRotation(Vector4 rotation);
void setWorldScale(Vector scale);
void setRelativeLocation(Vector location);
void setRelativeRotation(Vector4 rotation);
void setRelativeScale(Vector scale);
void addWorldTranslation(Vector translation);
void addWorldRotation(Vector4 rotation);
void addWorldScale(Vector scale);
PComponent getRootComponent();
void setRootComponent(PComponent newRoot);
private:
PActor parent;
Array<PActor> children;
PComponent rootComponent;
Transform transform;
};
DEFINE_REF(Actor);
}
+4
View File
@@ -0,0 +1,4 @@
target_sources(SeeleEngine
PRIVATE
Actor.cpp
Actor.h)