Maybe doxy will pick them up now????
This commit is contained in:
@@ -8,9 +8,9 @@ using J3ML::Geometry::Frustum;
|
||||
using J3ML::Geometry::Sphere;
|
||||
|
||||
namespace Collision {
|
||||
AABB genMinimallyEnclosingAABB(const VertexArray* vA); //Creates an AABB around a Vertex Array. *SLOW*
|
||||
AABB genMinimallyEnclosingAABB(const VertexArray* vA, const Vector3& rotation); //Creates an AABB around a Vertex Array using the OBB. *FAST*
|
||||
Sphere genMinimallyEnclosingSphere(const VertexArray* vA); //Creates a minimally enclosing sphere around a VertexArray using the cached OBB *FAST*
|
||||
OBB genMinimallyEnclosingOBB(const VertexArray* vA, const Vector3& rotation); //Creates an OBB around a VertexArray. Should ideally only be used when loading. *SLOW*
|
||||
VertexArray getDrawable(const Shape& collider); //Returns a renderable version of the collider for debug reasons.
|
||||
AABB genMinimallyEnclosingAABB(const VertexArray* vA); ///Creates an AABB around a Vertex Array. *SLOW*
|
||||
AABB genMinimallyEnclosingAABB(const VertexArray* vA, const Vector3& rotation); ///Creates an AABB around a Vertex Array using the OBB. *FAST*
|
||||
Sphere genMinimallyEnclosingSphere(const VertexArray* vA); ///Creates a minimally enclosing sphere around a VertexArray using the cached OBB *FAST*
|
||||
OBB genMinimallyEnclosingOBB(const VertexArray* vA, const Vector3& rotation); ///Creates an OBB around a VertexArray. Should ideally only be used when loading. *SLOW*
|
||||
VertexArray getDrawable(const Shape& collider); ///Returns a renderable version of the collider for debug reasons.
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ using namespace J3ML;
|
||||
|
||||
using J3ML::LinearAlgebra::Vector3;
|
||||
|
||||
Vector3 calcAngle(Vector3 sP, Vector3 eP) { //Calculates the angle between two points in 3D space.
|
||||
Vector3 calcAngle(Vector3 sP, Vector3 eP) { ///Calculates the angle between two points in 3D space.
|
||||
return {static_cast<float>((-(asinf((eP.y - sP.y) / Vector3::Distance(sP, eP)) * 180.0f / Math::Pi))),static_cast<float>(-(atan2f(eP.x - sP.x,eP.z - sP.z) / Math::Pi * 180.0f)),0};
|
||||
}
|
@@ -2,6 +2,6 @@
|
||||
#include <typeinfo>
|
||||
|
||||
template <typename Source, typename Target>
|
||||
bool instanceOf(Source* source, Target* target) { //Returns true if target is the exact same class type as source.
|
||||
bool instanceOf(Source* source, Target* target) { ///Returns true if target is the exact same class type as source.
|
||||
return typeid(*source) == typeid(*target);
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
using J3ML::LinearAlgebra::Vector3;
|
||||
using J3ML::LinearAlgebra::Vector2;
|
||||
|
||||
class Camera; //Forward declaration of Camera.
|
||||
class Camera; ///Forward declaration of Camera.
|
||||
|
||||
// TODO: Move data to Entity / or rename to DataModelEntry
|
||||
struct ByteArray {
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
Vector3 globalLightColor = {0, 0, 0};
|
||||
Vector4 globalFogColor = {0, 0, 0, 0};
|
||||
Vector2 globalFogRange = {0, 0};
|
||||
GLenum globalFogMode = NULL; //There's Linear, GL_EXP, GL_EXP2.
|
||||
GLenum globalFogMode = NULL; ///There's Linear, GL_EXP, GL_EXP2.
|
||||
GLfloat globalFogDensity = 0.0f;
|
||||
|
||||
public:
|
||||
|
@@ -7,11 +7,11 @@
|
||||
using J3ML::LinearAlgebra::Matrix4x4;
|
||||
using J3ML::Geometry::Frustum;
|
||||
|
||||
class Camera : public Moby {//The base camera class. Entirely stationary.
|
||||
class Camera : public Moby {///The base camera class. Entirely stationary.
|
||||
public:
|
||||
Matrix4x4 GetViewMatrix(); //Returns the current ViewMatrix.
|
||||
Matrix4x4 GetViewMatrix(); ///Returns the current ViewMatrix.
|
||||
bool raycast(Entity* entity);
|
||||
Frustum getFrustum(); //Returns the view frustum of the camera.
|
||||
Frustum getFrustum(); ///Returns the view frustum of the camera.
|
||||
void Rotate(float amt, Vector3 axis) { }
|
||||
void Translate(Vector3 dir) { }
|
||||
void pre_render() override {};
|
||||
|
@@ -11,16 +11,16 @@ using J3ML::LinearAlgebra::Matrix4x4;
|
||||
using J3ML::LinearAlgebra::Vector3;
|
||||
|
||||
|
||||
class Entity { //Base entity type.
|
||||
class Entity { ///Base entity type.
|
||||
private:
|
||||
virtual void loadTexture(); //Loads the texture for the entity.
|
||||
void loadGeometry(); //Loads the geometry for it.
|
||||
GLfloat scale = 1.0f; //The scale it should be rendered at.
|
||||
virtual void loadTexture(); ///Loads the texture for the entity.
|
||||
void loadGeometry(); ///Loads the geometry for it.
|
||||
GLfloat scale = 1.0f; ///The scale it should be rendered at.
|
||||
protected:
|
||||
std::string modelPath;
|
||||
std::string texturePath;
|
||||
Entity* parent; //If the entity has a parent entity, It's here.
|
||||
std::vector<Entity*> children; //Entity list of child entities.
|
||||
Entity* parent; ///If the entity has a parent entity, It's here.
|
||||
std::vector<Entity*> children; ///Entity list of child entities.
|
||||
public:
|
||||
std::string name; //Entity name. TODO remove this.
|
||||
bool alive;
|
||||
@@ -41,16 +41,16 @@ public:
|
||||
archive & GetEntityUUIDList();
|
||||
}
|
||||
|
||||
Vector3 angle = {0,0,0}; //Pitch Yaw Roll, The orientation of the entity in the world,
|
||||
bool collidable = true; //Whether an entity is solid. Entities are solid by default.
|
||||
Vector3 angle = {0,0,0}; ///Pitch Yaw Roll, The orientation of the entity in the world,
|
||||
bool collidable = true; ///Whether an entity is solid. Entities are solid by default.
|
||||
|
||||
virtual Texture* getTexture(); //Returns the texture for the entity. Loads it if it's not in the list.
|
||||
virtual VertexArray* getGeometry(); //Returns the geometry for the entity. Loads it if it's not in the list.
|
||||
AABB getAABB(); //Returns the AABB for the entity.
|
||||
Sphere getSphere(); //Returns the minimal enclosing sphere for the entity.
|
||||
OBB getOBB(); //Returns the OBB of the entity.
|
||||
std::vector<Entity*> GetChildren(); //Returns the entity list of the entities children.
|
||||
virtual void SetParent(Entity* parent); //Sets a given entity as this entities parent.
|
||||
virtual Texture* getTexture(); ///Returns the texture for the entity. Loads it if it's not in the list.
|
||||
virtual VertexArray* getGeometry(); ///Returns the geometry for the entity. Loads it if it's not in the list.
|
||||
AABB getAABB(); ///Returns the AABB for the entity.
|
||||
Sphere getSphere(); ///Returns the minimal enclosing sphere for the entity.
|
||||
OBB getOBB(); ///Returns the OBB of the entity.
|
||||
std::vector<Entity*> GetChildren(); ///Returns the entity list of the entities children.
|
||||
virtual void SetParent(Entity* parent); ///Sets a given entity as this entities parent.
|
||||
bool IsDescendantOf(Entity* ancestor);
|
||||
bool IsAncestorOf(Entity* descendant);
|
||||
std::vector<Entity*> GetDescendants();
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
|
||||
protected:
|
||||
Matrix4x4 coordinates;
|
||||
J3ML::LinearAlgebra::Position position; // X Y Z
|
||||
J3ML::LinearAlgebra::Position position; /// X Y Z
|
||||
public:
|
||||
std::string uuid;
|
||||
u32 ticksAlive; //At 64tps it'd take 776 days to overflow.
|
||||
@@ -91,13 +91,13 @@ public:
|
||||
void SetPos(const Vector3& rhs);
|
||||
Matrix4x4 GetMatrix() const;
|
||||
void SetMatrix(const Matrix4x4& rhs);
|
||||
void erase(); //Removes an entity from the list, Checks if the assets are being used by any other entity. Removes them from their lists & deletes. Then deletes the entity.
|
||||
void erase(); ///Removes an entity from the list, Checks if the assets are being used by any other entity. Removes them from their lists & deletes. Then deletes the entity.
|
||||
bool draw = true;
|
||||
bool occluded();
|
||||
bool isCollidingWith(Entity* entity);
|
||||
virtual void pre_render() {}
|
||||
virtual void post_render() {}
|
||||
virtual void render(); //The default rendering routine. Works for 99% of cases.
|
||||
virtual void render(); ///The default rendering routine. Works for 99% of cases.
|
||||
virtual void update(float elapsed) {}
|
||||
virtual void ticc(int tics)
|
||||
{
|
||||
@@ -106,8 +106,8 @@ public:
|
||||
|
||||
Entity();
|
||||
|
||||
Entity(const Entity& rhs) = default; // Boilerplate: Copy Constructor
|
||||
Entity(Entity&& rhs) = default; // Boilerplate: Move Constructor
|
||||
Entity(const Entity& rhs) = default; /// Boilerplate: Copy Constructor
|
||||
Entity(Entity&& rhs) = default; /// Boilerplate: Move Constructor
|
||||
~Entity() = default;
|
||||
};
|
||||
|
||||
|
@@ -2,23 +2,23 @@
|
||||
|
||||
#include <types/entity/entity.h>
|
||||
|
||||
class Moby : public Entity { //A "Movable Object". Things that will move often are derived from this.
|
||||
class Moby : public Entity { ///A "Movable Object". Things that will move often are derived from this.
|
||||
public:
|
||||
Moby(): Entity(), velAngle({0,0,0})
|
||||
{
|
||||
|
||||
}
|
||||
Vector3 velAngle = {0,0,0}; //The angle of velocity.
|
||||
float hVelocity; //Horizontal speed.
|
||||
float vVelocity; //Vertical speed.
|
||||
Vector3 velAngle = {0,0,0}; ///The angle of velocity.
|
||||
float hVelocity; ///Horizontal speed.
|
||||
float vVelocity; ///Vertical speed.
|
||||
Vector3 upVector = {0.0f,1.0f,0.0f};
|
||||
virtual void hMove(Vector3 a, float vel);
|
||||
void vMove(float vel);
|
||||
Vector3 simulateHMove(Vector3 a, float speed);
|
||||
Vector3 simulateVMove(Vector3 position, float speed);
|
||||
Vector3 fAngle(); // forward angle
|
||||
Vector3 bAngle(); // back angle
|
||||
Vector3 lAngle(); // left angle
|
||||
Vector3 rAngle(); // right angle
|
||||
Vector3 fAngle(); /// forward angle
|
||||
Vector3 bAngle(); /// back angle
|
||||
Vector3 lAngle(); /// left angle
|
||||
Vector3 rAngle(); /// right angle
|
||||
};
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <types/vertex.h>
|
||||
#include <types/entity/moby.h>
|
||||
|
||||
class Skybox : public Moby { //Simple skybox, A sphere with a texture on it where the center of the sphere is always the camera.
|
||||
class Skybox : public Moby { ///Simple skybox, A sphere with a texture on it where the center of the sphere is always the camera.
|
||||
public:
|
||||
void pre_render() override;
|
||||
Skybox();
|
||||
|
@@ -7,10 +7,10 @@ class Shader {
|
||||
public:
|
||||
std::string name;
|
||||
|
||||
//The shader program
|
||||
///The shader program
|
||||
GLuint id = NULL;
|
||||
|
||||
//The individual shaders
|
||||
///The individual shaders
|
||||
GLuint vertex = NULL;
|
||||
GLuint fragment = NULL;
|
||||
|
||||
|
@@ -9,19 +9,19 @@ class Entity;
|
||||
|
||||
class Texture {
|
||||
public:
|
||||
std::vector<Entity*> usedBy; //Reference counter.
|
||||
GLuint id = 0; //The id OpenGL uses to keep track of where the texture is in vram.
|
||||
void load(Entity* entity, const std::string& file, bool storeOnTextureList); //Loads a texture for a given entity type from a file you specify.
|
||||
virtual void erase(); //removes texture from texture list and deletes it.
|
||||
std::vector<Entity*> usedBy; ///Reference counter.
|
||||
GLuint id = 0; ///The id OpenGL uses to keep track of where the texture is in vram.
|
||||
void load(Entity* entity, const std::string& file, bool storeOnTextureList); ///Loads a texture for a given entity type from a file you specify.
|
||||
virtual void erase(); ///removes texture from texture list and deletes it.
|
||||
void erase(Texture* texture) const;
|
||||
Texture(Entity* entity, const char *filePath, bool storeOnTextureList); //Constructor. Calls load.
|
||||
Texture(Entity* entity, const char *filePath, bool storeOnTextureList); ///Constructor. Calls load.
|
||||
Texture() = default;
|
||||
};
|
||||
|
||||
class MultiTexture : public Texture {
|
||||
public:
|
||||
void erase() override;
|
||||
std::vector<Texture> multi; //Every texture other than the base texture.
|
||||
MultiTexture(Entity* entity, const char* pathContainingTextures, bool storeOnTextureList); //Loads a multi-texture from a given directory. One must be called "default.png"
|
||||
std::vector<Texture> multi; ///Every texture other than the base texture.
|
||||
MultiTexture(Entity* entity, const char* pathContainingTextures, bool storeOnTextureList); ///Loads a multi-texture from a given directory. One must be called "default.png"
|
||||
//TODO load multi-texture from array of std::string of file names.
|
||||
};
|
@@ -9,15 +9,15 @@
|
||||
#include <glad/glad.h>
|
||||
#include <J3ML/Geometry/OBB.h>
|
||||
|
||||
//Forward declaration of entity.
|
||||
///Forward declaration of entity.
|
||||
class Entity;
|
||||
|
||||
using J3ML::LinearAlgebra::Vector3;
|
||||
using J3ML::LinearAlgebra::Vector2;
|
||||
using J3ML::Geometry::OBB;
|
||||
|
||||
typedef Vector3 Vertex; //A point which makes up a model in 3D space.
|
||||
typedef Vector2 TextureCoordinate; //Determines how your texture is wrapped around the model.
|
||||
typedef Vector3 Vertex; ///A point which makes up a model in 3D space.
|
||||
typedef Vector2 TextureCoordinate; ///Determines how your texture is wrapped around the model.
|
||||
|
||||
class VertexArray {
|
||||
private:
|
||||
@@ -25,21 +25,21 @@ private:
|
||||
*It's faster to create an OBB when loading and then apply the rotation of the entity at the time, then create the other collider you want */
|
||||
OBB cachedOBB;
|
||||
public:
|
||||
std::vector<Vertex> vertices; //A list of points in 3d space that make up the model.
|
||||
std::vector<unsigned int> indices; //A list specifying how to connect the vertices together to make triangular faces.
|
||||
std::vector<Vertex> vertices; ///A list of points in 3d space that make up the model.
|
||||
std::vector<unsigned int> indices; ///A list specifying how to connect the vertices together to make triangular faces.
|
||||
std::vector<TextureCoordinate> texCoords;
|
||||
std::vector<Entity*> usedBy; //Reference counter
|
||||
GLuint vbo = 0; //Id OpenGL uses to keep track of where the vertices are in vram.
|
||||
GLuint ebo = 0; //Id OpenGL uses to keep track of where the indices are in vram.
|
||||
GLuint tbo = 0; //Id OpenGL uses to keep track of where the texture coordinates are in vram.
|
||||
std::vector<Entity*> usedBy; ///Reference counter
|
||||
GLuint vbo = 0; ///Id OpenGL uses to keep track of where the vertices are in vram.
|
||||
GLuint ebo = 0; ///Id OpenGL uses to keep track of where the indices are in vram.
|
||||
GLuint tbo = 0; ///Id OpenGL uses to keep track of where the texture coordinates are in vram.
|
||||
|
||||
void load(const std::string& filename); //Loads a model of a given filename.
|
||||
void load(const std::string& filename); ///Loads a model of a given filename.
|
||||
[[nodiscard]] OBB getCachedOBB(const Matrix3x3& rotation) const;
|
||||
[[nodiscard]] OBB getCachedOBB(const Vector3& rotation) const; //Returns the OBB given the rotation of the entity.
|
||||
[[nodiscard]] OBB getCachedOBB(const Vector3& rotation) const; ///Returns the OBB given the rotation of the entity.
|
||||
[[nodiscard]] OBB getCachedOBB(const EulerAngle& rotation) const;
|
||||
virtual void draw(); //Renders the model in the way you'd expect.
|
||||
void drawWireframe(); //Renders a wireframe of the model with no texture.
|
||||
explicit VertexArray(Entity* entity, const std::string& filename, bool storeOnGeometryList); //Constructor, calls load.
|
||||
virtual void draw(); ///Renders the model in the way you'd expect.
|
||||
void drawWireframe(); ///Renders a wireframe of the model with no texture.
|
||||
explicit VertexArray(Entity* entity, const std::string& filename, bool storeOnGeometryList); ///Constructor, calls load.
|
||||
VertexArray() = default;
|
||||
void erase() const; //Removes Vertex Array from geometry list and deletes it.
|
||||
void erase() const; ///Removes Vertex Array from geometry list and deletes it.
|
||||
};
|
||||
|
Reference in New Issue
Block a user