Skip to content

Commit

Permalink
life is pain
Browse files Browse the repository at this point in the history
  • Loading branch information
Mute124 committed Jan 11, 2024
1 parent af942d6 commit a229718
Show file tree
Hide file tree
Showing 145 changed files with 1,023 additions and 10,672 deletions.
24 changes: 21 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ FetchContent_Declare(
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(tomlplusplus)

# Include RRes
FetchContent_Declare(
RRes
GIT_REPOSITORY "https://github.com/raysan5/rres"
GIT_TAG "1.2.0"
)
FetchContent_MakeAvailable(RRes)

# Include RayGui
FetchContent_Declare(
RayGui
GIT_REPOSITORY "https://github.com/raysan5/raygui"
GIT_TAG "4.0"
)
FetchContent_MakeAvailable(RayGui)

# Our Project
# The configurations we support
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution")
Expand All @@ -42,7 +59,7 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution")
set(DOUBLE_PRECISION OFF)

# When turning this option on, the library will be compiled with debug symbols
set(GENERATE_DEBUG_SYMBOLS ON)
set(GENERATE_DEBUG_SYMBOLS OFF)

# When turning this option on, the library will be compiled in such a way to attempt to keep the simulation deterministic across platforms
set(CROSS_PLATFORM_DETERMINISTIC OFF)
Expand Down Expand Up @@ -80,7 +97,6 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(JoltPhysics)


# Set linker flags
set(CMAKE_EXE_LINKER_FLAGS_DISTRIBUTION "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")

Expand All @@ -92,8 +108,10 @@ SET_INTERPROCEDURAL_OPTIMIZATION()
add_executable(${PROJECT_NAME} main.cpp)
#set(raylib_VERBOSE 1)
target_link_libraries(${PROJECT_NAME} raylib)
target_include_directories(${PROJECT_NAME} PUBLIC ${JoltPhysics_SOURCE_DIR}/..)

target_link_libraries(${PROJECT_NAME} Jolt)
target_include_directories(${PROJECT_NAME} PUBLIC ${JoltPhysics_SOURCE_DIR}/..)


include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/resources)

Expand Down
6 changes: 5 additions & 1 deletion Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#pragma once
#include "../build/_deps/raylib-src/src/raylib.h"
#include "../build/_deps/raylib-src/src/raymath.h"

#include "../build/_deps/raylib-src/src/rlgl.h"
#include "../build/_deps/raylib-src/src/rcamera.h"
#include "../build/_deps/raygui-src/src/raygui.h"
// End of raylib Libraries


// C++ Libraries
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -45,4 +48,5 @@

// End of External Libraries


// End of Common.h
1 change: 0 additions & 1 deletion Engine/Classes/ConfigMan/ConfigRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <map>
#include <vector>
#include "../Logging/Logman.h"
#include "../../../lib/raylib.h"

// Components
#include "ConfigFile.h"
Expand Down
90 changes: 90 additions & 0 deletions Engine/Classes/Env/Light/Light.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#pragma once
#include "../../../../common.h"

#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 120
#endif

#define MAX_LIGHTS 4 // Max dynamic lights supported by shader

// Light type
typedef enum
{
LIGHT_DIRECTIONAL = 0,
LIGHT_POINT,
LIGHT_SPOT
} LightType;

// Light data
typedef struct {
int type;
int enabled;
Vector3 position;
Vector3 target;
float color[4];
float intensity;

// Shader light parameters locations
int typeLoc;
int enabledLoc;
int positionLoc;
int targetLoc;
int colorLoc;
int intensityLoc;
} Light;

static int lightsCount;

// Send light properties to shader
// NOTE: Light shader locations should be available
static void UpdateLight(Shader shader, Light light)
{
SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);

// Send to shader light position values
float position[3] = { light.position.x, light.position.y, light.position.z };
SetShaderValue(shader, light.positionLoc, position, SHADER_UNIFORM_VEC3);

// Send to shader light target position values
float target[3] = { light.target.x, light.target.y, light.target.z };
SetShaderValue(shader, light.targetLoc, target, SHADER_UNIFORM_VEC3);
SetShaderValue(shader, light.colorLoc, light.color, SHADER_UNIFORM_VEC4);
SetShaderValue(shader, light.intensityLoc, &light.intensity, SHADER_UNIFORM_FLOAT);
}
// Create light with provided data
// NOTE: It updated the global lightCount and it's limited to MAX_LIGHTS
static Light CreateLight(int type, Vector3 position, Vector3 target, Color color, float intensity, Shader shader)
{
Light light = { 0 };

if (lightsCount < MAX_LIGHTS)
{
light.enabled = 1;
light.type = type;
light.position = position;
light.target = target;
light.color[0] = (float)color.r/255.0f;
light.color[1] = (float)color.g/255.0f;
light.color[2] = (float)color.b/255.0f;
light.color[3] = (float)color.a/255.0f;
light.intensity = intensity;

// NOTE: Shader parameters names for lights must match the requested ones
light.enabledLoc = GetShaderLocation(shader, TextFormat("lights[%i].enabled", lightsCount));
light.typeLoc = GetShaderLocation(shader, TextFormat("lights[%i].type", lightsCount));
light.positionLoc = GetShaderLocation(shader, TextFormat("lights[%i].position", lightsCount));
light.targetLoc = GetShaderLocation(shader, TextFormat("lights[%i].target", lightsCount));
light.colorLoc = GetShaderLocation(shader, TextFormat("lights[%i].color", lightsCount));
light.intensityLoc = GetShaderLocation(shader, TextFormat("lights[%i].intensity", lightsCount));

UpdateLight(shader, light);

lightsCount++;
}

return light;
}

29 changes: 0 additions & 29 deletions Engine/Classes/Env/Light/LightObject.h

This file was deleted.

2 changes: 1 addition & 1 deletion Engine/Classes/GUIs/Console/Console.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../../../../lib/raylib.h"

#include "../../Logging/Logman.h"

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion Engine/Classes/GUIs/Core/MenuCamera.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../../../../lib/raylib.h"
#include "../../../../common.h"
#include "../../GameObject/Gameobject.h"

#pragma
Expand Down
7 changes: 4 additions & 3 deletions Engine/Classes/GameObject/Gameobject.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once
#include "../../../lib/raylib.h"
#include "../../../common.h"
#include "../../DataSets/Globals.h"
#include "../Logging/Logman.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <thread>
#include <mutex>

typedef enum type
{
BLOCK = 0, // Game object is a block
Expand Down Expand Up @@ -183,7 +184,7 @@ class GameObject
*/
static inline void Update()
{
Render();
RenderObjects();
for (auto &GameObject : GameObjects)
{

Expand All @@ -203,7 +204,7 @@ class GameObject
GameObjects.push_back(_obj);
}

static inline void Render()
static inline void RenderObjects()
{

for (auto &obj : GameObjects)
Expand Down
66 changes: 31 additions & 35 deletions Engine/Classes/GameObject/Object.h
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
#pragma once
#include "Gameobject.h"
#include "ObjectTransform.h"
#include "../Physics/RigidBody.h"
#include "../Project/Game/Game.h"

#include "../../../lib/rlgl.h"
#include "../../../lib/raymath.h"
class Object : public GameObject {
public:
typedef struct
{
MaterialMap albedo;
MaterialMap normal;
MaterialMap emissive;
MaterialMap metallic;
MaterialMap roughness;
MaterialMap ao;

MaterialMap MRAO;
} MaterialMapList;

class Object : public GameObject
{
public:
Object(Model model, MaterialMapList materialMapList)
{

Object(Model model, ObjectTransform transform) {

this->model = model;
this->transform = new ObjectTransform(transform);

};
};

void Destroy() {
this->~Object();
}

void onUpdate() override {

}
void Destroy()
{
this->~Object();
}

void Draw() override {
DrawModel(this->model, this->position, this->scale, )
}
void onUpdate() override
{
}

Vector3 position;
float scale;
void Draw() override
{
}


Model model;
Vector3 position;
float scale;
Model model;

private:
~Object() {
delete this;
}

void GenCubemap(float roughness) {

}

MaterialMapList materialMapList;
};

2 changes: 1 addition & 1 deletion Engine/Classes/Logging/Logman.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdlib.h>
#include <time.h>

#include "../../../lib/raylib.h"
#include "../../../../build/_deps/raylib-src/src/raylib.h"

// handles logging
class Logman {
Expand Down
2 changes: 1 addition & 1 deletion Engine/Classes/Player/CameraComp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../../../lib/raylib.h"

#include "CameraData.h"
#include <vector>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion Engine/Classes/Player/CameraData.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../../../lib/raylib.h"
#include "../../../common.h"


class CameraData
Expand Down
Loading

0 comments on commit a229718

Please sign in to comment.