initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#ifndef DELTA_ENTITY
|
||||
#define DELTA_ENTITY
|
||||
|
||||
#include "renderer/camera.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
class DeltaEntity {
|
||||
public:
|
||||
DeltaVector3 pos;
|
||||
DeltaVector2 angle;
|
||||
|
||||
DeltaEntity(float x, float y, float z);
|
||||
void draw(DeltaCamera camera);
|
||||
void update(float deltaTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DELTA_GLOBALS
|
||||
#define DELTA_GLOBALS
|
||||
|
||||
const int SIMULATED_WIDTH = 1200;
|
||||
const int SIMULATED_HEIGHT = 800;
|
||||
const int FOCAL = 200;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef DELTA_MATH
|
||||
#define DELTA_MATH
|
||||
|
||||
class DeltaVector2 {
|
||||
public:
|
||||
float x, y;
|
||||
DeltaVector2(float xval, float yval);
|
||||
DeltaVector2();
|
||||
DeltaVector2 operator+(const DeltaVector2& other) const;
|
||||
DeltaVector2 operator-(const DeltaVector2& other) const;
|
||||
DeltaVector2 operator*(float a) const;
|
||||
DeltaVector2& operator+=(const DeltaVector2& other);
|
||||
DeltaVector2& operator-=(const DeltaVector2& other);
|
||||
float distanceToVector(const DeltaVector2& vec) const;
|
||||
float distanceToPos(float x, float y) const;
|
||||
float dotProduct(const DeltaVector2& vec) const;
|
||||
float angleTo(const DeltaVector2& vec) const;
|
||||
float length() const;
|
||||
};
|
||||
|
||||
class DeltaVector3 {
|
||||
public:
|
||||
float x, y, z;
|
||||
DeltaVector3(float xval, float yval, float zval);
|
||||
DeltaVector3();
|
||||
float distanceToVector(const DeltaVector3 &vec) const;
|
||||
float distanceToPos(float x, float y) const;
|
||||
float dotProduct(const DeltaVector3 &vec) const;
|
||||
float angleTo(const DeltaVector3 &vec) const;
|
||||
float length() const;
|
||||
};
|
||||
|
||||
float getDeterminant(const DeltaVector2 &pointA, const DeltaVector2 &pointB, const DeltaVector2 &candidate);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef DELTA_RENDERCALLS
|
||||
#define DELTA_RENDERCALLS
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "math.hpp"
|
||||
|
||||
void rasterizeTriangle(SDL_Renderer *renderer, const DeltaVector2 &a, const DeltaVector2 &b, const DeltaVector2 &c);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef DELTA_CAMERA
|
||||
#define DELTA_CAMERA
|
||||
|
||||
#include "math.hpp"
|
||||
|
||||
class DeltaCamera {
|
||||
public:
|
||||
DeltaVector3 pos;
|
||||
DeltaVector2 angle;
|
||||
|
||||
DeltaCamera(float x, float y, float z);
|
||||
DeltaVector2 projectPointVec(const DeltaVector3 &worldPos);
|
||||
DeltaVector2 projectPoint(float worldX, float worldY, float worldZ);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user