Add code
This commit is contained in:
38 files changed
+2150
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Mat44.hpp"
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
|
||||
struct Camera
|
||||
{
|
||||
Mat44 projectionTransform;
|
||||
|
||||
|
||||
static Mat44 MakeProjectionTransform(float fov, float nearClip, float farClip, unsigned int viewWidth, unsigned int viewHeight)
|
||||
{
|
||||
float zClipBias0 =
|
||||
(farClip + nearClip)
|
||||
/ (farClip - nearClip);
|
||||
|
||||
float zClipBias1 =
|
||||
(2.0f * farClip * nearClip)
|
||||
/ (farClip - nearClip);
|
||||
|
||||
float zoomX = 1.0f / tanf((fov / 2.0f) * (M_PI / 180.0f));
|
||||
float zoomY = (zoomX * static_cast<float>(viewWidth)) / static_cast<float>(viewHeight);
|
||||
|
||||
Mat44 transform;
|
||||
transform.m[0][0] = zoomX;
|
||||
transform.m[1][1] = zoomY;
|
||||
transform.m[2][2] = -zClipBias0;
|
||||
transform.m[3][2] = -1;
|
||||
transform.m[2][3] = -zClipBias1;
|
||||
|
||||
return transform;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vec3.hpp"
|
||||
|
||||
|
||||
struct Gravity
|
||||
{
|
||||
Vec3 force;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
struct Player
|
||||
{
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vec3.hpp"
|
||||
|
||||
struct Renderable
|
||||
{
|
||||
Vec3 color;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vec3.hpp"
|
||||
|
||||
|
||||
struct RigidBody
|
||||
{
|
||||
Vec3 velocity;
|
||||
Vec3 acceleration;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vec3.hpp"
|
||||
|
||||
|
||||
struct Thrust
|
||||
{
|
||||
Vec3 force;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vec3.hpp"
|
||||
|
||||
|
||||
struct Transform
|
||||
{
|
||||
Vec3 position;
|
||||
Vec3 rotation;
|
||||
Vec3 scale;
|
||||
};
|
||||
Reference in new issue
Block a user