stuff-from-scratch/src/visual_elements/SceneItem.h

57 lines
860 B
C
Raw Normal View History

2022-11-16 15:06:08 +00:00
#pragma once
#include "Color.h"
#include "Transform.h"
2022-11-16 17:00:55 +00:00
#include <string>
2022-11-16 15:06:08 +00:00
class SceneItem
{
public:
enum class Type
{
2022-11-16 17:00:55 +00:00
UNSET,
2022-11-16 15:06:08 +00:00
MODEL,
TEXT
};
SceneItem();
virtual ~SceneItem() = default;
const Color& getColor() const;
const Transform& getTransform() const;
virtual Type getType() const = 0;
bool isVisible() const;
void setIsVisible(bool isVisible);
void updateUniformColor(const Color& color);
void updateTransform(const Transform& transform);
2022-11-16 17:00:55 +00:00
void setName(const std::string& name)
{
mName = name;
}
const std::string& getName() const
{
return mName;
}
2022-11-16 15:06:08 +00:00
protected:
Transform mTransform;
Color mUniformColor;
bool mColorIsDirty{true};
bool mTransformIsDirty{true};
bool mIsVisible{true};
2022-11-16 17:00:55 +00:00
std::string mName;
2022-11-16 15:06:08 +00:00
};