work on object system

This commit is contained in:
2026-02-17 14:09:20 -06:00
parent e9f1f49416
commit da1292d9e5
8 changed files with 173 additions and 77 deletions

View File

@@ -0,0 +1,30 @@
#ifndef BODY_H
#define BODY_H
#include "pch.hpp"
#include "extratools.h"
#include "Object.h"
namespace Archimedes {
class Body : public Object {
public:
Body(RenderTarget rt, glm::mat4 t = glm::mat4(1.0f)) : mesh(rt), Object(t) {};
Body(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s, glm::mat4 t = glm::mat4(1.0f))
: mesh(vb, ia, vl, s), Object(t) {}
Body() {}
~Body() {};
private:
RenderTarget mesh;
};
}
#endif

View File

@@ -0,0 +1,25 @@
#ifndef CAMERA_H
#define CAMERA_H
#include "pch.hpp"
#include "extratools.h"
#include "Object.h"
namespace Archimedes {
class Camera : public Object {
public:
Camera() {}
Camera(glm::mat4 t)
: Object(t) {}
~Camera() {};
};
}
#endif

View File

@@ -12,24 +12,25 @@ namespace Archimedes {
class Object {
public:
Object(RenderTarget rt) : mesh(rt) {};
Object(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s, glm::mat4 t)
: mesh(vb, ia, vl, s), worldTransform(t) {}
Object() {};
Object() {}
Object(glm::mat4 t)
: worldTransform(t) {}
~Object() {};
///scales an object absolutely
void scaleTo() {}
void scaleRel() {}
//void scaleTo() {}
void scaleRel(float scale) { worldTransform = glm::scale(worldTransform, glm::vec3(scale)); }
void moveTo() {}
void moveRel() {}
//void moveTo(glm::vec3 pos) { worldTransform = glm::translate(worldTransform, pos); }
void moveRel(glm::vec3 pos) { worldTransform = glm::translate(worldTransform, pos); }
void rotateTo() {}
void rotateRel() {}
//void rotateTo() {}
void rotateRel(float radians, glm::vec3 axis) { worldTransform = glm::rotate(worldTransform, radians, axis); }
const glm::mat4& getTransform() { return worldTransform; }
private:
@@ -38,8 +39,6 @@ namespace Archimedes {
glm::mat4 worldTransform = glm::mat4(1.0f);
RenderTarget mesh;
};
}