[CORE][ADD] Renderable add API

- getters
  - position
  - rotation
  - scaleVal
- normal
  - disposeLight
This commit is contained in:
Linloir 2022-12-19 17:09:12 +08:00
parent cad41559b1
commit c1d8d8ed42
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
2 changed files with 12 additions and 0 deletions

View File

@ -59,6 +59,13 @@ void Renderable::makeLight() {
_light = new ScopedLight(glm::vec3(0.0f));
}
void Renderable::disposeLight() {
if (_light != nullptr) {
delete _light;
_light = nullptr;
}
}
void Renderable::render(ShaderProgram shader) {
// Check if initialized
if (_model == nullptr) {

View File

@ -32,6 +32,10 @@ public:
~Renderable();
public:
glm::vec3 position() const { return _position; }
glm::mat4 rotation() const { return _rotation; }
glm::vec3 scaleVal() const { return _scale; }
void setModel(Model* model);
void move(glm::vec3 deltaVec);
void setPosition(glm::vec3 position);
@ -44,6 +48,7 @@ public:
ScopedLight* originalLight() const; // pass out the light object to scene manager to set light attributes
bool hasLight() const { return _light != nullptr; }
void makeLight(); // create a light source in the object
void disposeLight(); // remove the light source in the object
const Boundary& boundary() const { return _boundary; }