Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
54d9f91
Update README.md
4ipset111 May 8, 2026
94eb24a
Merge pull request #23 from Quark-Engine/main
valmme May 8, 2026
04dd443
subproject link
4ipset111 May 9, 2026
063b997
Update .gitmodules
4ipset111 May 9, 2026
31a55bd
fix
4ipset111 May 9, 2026
6de9415
Merge pull request #24 from Quark-Engine/main
4ipset111 May 9, 2026
1471ee4
Merge pull request #25 from Quark-Engine/main
4ipset111 May 9, 2026
a660d4d
Merge pull request #26 from Quark-Engine/main
4ipset111 May 9, 2026
038ce7e
fix
4ipset111 May 9, 2026
fab2184
replace raylib with QuarkCore in cmake
4ipset111 May 11, 2026
f348d76
Merge pull request #27 from Quark-Engine/main
4ipset111 May 11, 2026
87cf97e
USE_IMGUI QuarkCore
4ipset111 May 11, 2026
d3d1f08
start of rewriting
4ipset111 May 12, 2026
0da963d
Vector math update in main.cpp and lightning.cpp
4ipset111 May 12, 2026
cf6692f
Update QuarkCore
4ipset111 May 12, 2026
d157efd
fix
4ipset111 May 12, 2026
a45d003
Merge branch 'dev-opengl' into fimoz
4ipset111 May 12, 2026
54bc292
Merge pull request #29 from Quark-Engine/fimoz
4ipset111 May 12, 2026
0c00b87
Fix TraceLog and Vector errors
4ipset111 May 14, 2026
4ce049f
Update QuarkCore
4ipset111 May 14, 2026
300d47b
fix Scale function
4ipset111 May 14, 2026
9a3c1c0
Update QuarkCore
4ipset111 May 14, 2026
fc07afc
Update QuarkCore
4ipset111 May 17, 2026
9f7fbfc
remove shadows for future compatibility with QuarkCore
4ipset111 May 17, 2026
bc73fa7
rlights to QuarkLights
4ipset111 May 17, 2026
8206ab6
full rewrite
4ipset111 May 17, 2026
940434e
Update QuarkCore
4ipset111 May 17, 2026
8fa27f7
Merge pull request #33 from Quark-Engine/main
4ipset111 May 17, 2026
e4d9d26
Merge branch 'dev-opengl' into merge
4ipset111 May 17, 2026
917e508
Merge pull request #34 from Quark-Engine/merge
4ipset111 May 17, 2026
8559e06
fix
4ipset111 May 17, 2026
80e3ea1
fix access violation
4ipset111 May 17, 2026
337594e
imgui fix
4ipset111 May 19, 2026
39e3bbd
Update README.md
4ipset111 May 19, 2026
8576501
Update QuarkCore
4ipset111 May 24, 2026
e2808fb
fix build
4ipset111 May 24, 2026
51498c5
fix freetype dll
4ipset111 May 24, 2026
944cd6b
fix bugs
4ipset111 May 25, 2026
170bed3
Merge branch 'dev-opengl' into merge
4ipset111 May 25, 2026
ec12ef6
Merge pull request #36 from Quark-Engine/merge
4ipset111 May 25, 2026
e4b44ce
3d text
4ipset111 May 25, 2026
1335250
fps panel + camera fix
4ipset111 May 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "quark-libs/freetype"]
path = quark-libs/freetype
url = https://github.com/freetype/freetype.git
[submodule "quark-libs/QuarkCore"]
path = quark-libs/QuarkCore
url = https://github.com/Quark-Engine/QuarkCore
45 changes: 27 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
cmake_minimum_required(VERSION 3.10)
project(QuarkEngine)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(BUILD_ENGINE "Build Quark Engine" ON)
option(BUILD_PLUGIN "Build Plugin" OFF)

set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(QC_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
set(GLFW_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)

add_subdirectory(quark-libs/raylib)
add_subdirectory(quark-libs/freetype)

include_directories(
${CMAKE_SOURCE_DIR}/quark-libs/QuarkCore/include
${CMAKE_SOURCE_DIR}/quark-libs/imgui/include
${CMAKE_SOURCE_DIR}/imgui
${CMAKE_SOURCE_DIR}/src/headers
${CMAKE_SOURCE_DIR}/src/plugins
${CMAKE_SOURCE_DIR}/src
)

add_subdirectory(quark-libs/QuarkCore)

add_library(imgui SHARED
quark-libs/imgui/include/imgui.cpp
quark-libs/imgui/include/imgui_draw.cpp
quark-libs/imgui/include/imgui_widgets.cpp
quark-libs/imgui/include/imgui_tables.cpp
quark-libs/imgui/include/rlImGui.cpp
imgui/imgui_impl_sdl3.cpp
imgui/imgui_impl_opengl3.cpp
src/qcImGui.cpp
src/ImGuizmo.cpp
)

target_include_directories(imgui PUBLIC
${CMAKE_SOURCE_DIR}/quark-libs/imgui/include
${CMAKE_SOURCE_DIR}/imgui
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/headers
${CMAKE_SOURCE_DIR}/quark-libs/freetype/include
)

target_link_libraries(imgui PUBLIC
SDL3::SDL3
QuarkCore
)

if(WIN32)
target_compile_definitions(imgui
PRIVATE BUILD_LIBTYPE_SHARED
Expand All @@ -50,8 +58,6 @@ else()
)
endif()

target_link_libraries(imgui PRIVATE raylib freetype)

set_target_properties(imgui PROPERTIES
PREFIX ""
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
Expand Down Expand Up @@ -86,7 +92,6 @@ if(BUILD_ENGINE)
src/models.cpp
src/project.cpp
src/plugins/plugin_manager.cpp
src/rlights.cpp
src/scene.cpp
src/tex.cpp
src/text_mesh.cpp
Expand All @@ -110,7 +115,10 @@ if(BUILD_ENGINE)
)
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE raylib imgui freetype)
target_link_libraries(${PROJECT_NAME} PRIVATE
QuarkCore
imgui
)

if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE winmm gdi32 opengl32)
Expand Down Expand Up @@ -139,13 +147,14 @@ if(BUILD_ENGINE)

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:raylib>
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:QuarkCore>
$<TARGET_FILE:imgui>
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
$<TARGET_FILE:SDL3::SDL3>
$<TARGET_FILE:assimp::assimp>
$<TARGET_FILE:ZLIB::ZLIB>
$<TARGET_FILE:freetype>
"${VULKAN_RUNTIME_DLL}"
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug
)
endif()

Expand Down Expand Up @@ -182,4 +191,4 @@ if(BUILD_PLUGIN)
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/plugins
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/plugins
)
endif()
endif()
30 changes: 7 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Quark Engine
# Quark Engine QuarkCore rewrite branch

Quark Engine is a lightweight, world-class 3D game engine and editor built using **C++**, **Raylib**, and **Dear ImGui**. It is designed for rapid 3D scene prototyping, featuring a modern editor interface, a robust lighting system, and flexible asset management.
This is a branch for rewriting Quark Engine to QuarkCore, which is a raylib-style framework.

# Default README:

## Features

Expand All @@ -26,40 +28,22 @@ Quark Engine is a lightweight, world-class 3D game engine and editor built using
## Tech Stack

* **Core:** C++17
* **Rendering:** Raylib
* **UI:** Dear ImGui via rlImGui
* **Rendering:** QuarkCore
* **UI:** Dear ImGui via qcImGui
* **Gizmos:** ImGuizmo
* **Serialization:** nlohmann/json

## Getting Started

### Prerequisites
* A C++ compiler supporting C++17.
* Raylib development libraries installed.

### Directory Structure
Ensure your project folder contains an `assets` directory with the following resources:
* `Rubik-Regular.ttf` (Editor font)
* `lighting.vs` / `lighting.fs` (Shaders)
* `file.png`, `folder.png`, `full_folder.png` (Editor icons)

## Configuration

The engine stores all configuration in a single `config.json` file in the project root:

```json
{
"language": "en_us",
"projects": [
{
"name": "ProjectName",
"path": "path/to/project"
}
]
}
```

* **language:** Current UI language (`en_us`, `ru_ru`)
* **projects:** Array of registered projects for the Quark Hub

This file is automatically created on first run and manages both application settings and project registry.
Expand Down Expand Up @@ -107,4 +91,4 @@ cmake --build build

## License

This project is licensed under the MIT License - see the source headers for details.
This project is licensed under the MIT License - see the source headers for details.
74 changes: 28 additions & 46 deletions assets/lighting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ in vec3 fragNormal;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
uniform int useTexture;
uniform sampler2D shadowMap;
uniform mat4 lightVP;
uniform int shadowMapResolution;
uniform vec3 shadowLightDir;
uniform int shadowsEnabled;

out vec4 finalColor;

#define MAX_LIGHTS 4
#define LIGHT_POINT 0
#define LIGHT_DIRECTIONAL 1
#define LIGHT_DIRECTIONAL 0
#define LIGHT_POINT 1
#define LIGHT_SPOT 2
#define LIGHT_AREA 3

Expand All @@ -39,28 +34,6 @@ uniform vec3 viewPos;
uniform vec3 emissionColor;
uniform float emissionPower;

float ShadowCalc(vec3 fragPos, vec3 normal) {
if (shadowsEnabled != 1) return 0.0;

vec4 fragPosLS = lightVP * vec4(fragPos, 1.0);
vec3 proj = fragPosLS.xyz / fragPosLS.w;
proj = proj * 0.5 + 0.5;
if (proj.z > 1.0) return 0.0;
if (proj.x < 0.0 || proj.x > 1.0 || proj.y < 0.0 || proj.y > 1.0) return 0.0;

float bias = max(0.0002 * (1.0 - dot(normal, normalize(shadowLightDir))), 0.00002) + 0.00001;
int shadowCounter = 0;
vec2 texelSize = vec2(1.0 / float(shadowMapResolution));

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
float sampleDepth = texture(shadowMap, proj.xy + texelSize * vec2(x, y)).r;
if (proj.z - bias > sampleDepth) shadowCounter++;
}
}
return float(shadowCounter) / 9.0;
}

void main() {
vec4 texelColor = vec4(1.0);
if (useTexture == 1)
Expand All @@ -77,21 +50,27 @@ void main() {

vec3 lightDir;
float attenuation = 1.0;
float directLight = 0.0;
float lightEnergy = min(lights[i].intensity, 4.0);

if (lights[i].type == LIGHT_DIRECTIONAL) {
lightDir = normalize(lights[i].position - lights[i].target);
attenuation = 1.0;
}
else if (lights[i].type == LIGHT_POINT) {
lightDir = normalize(lights[i].position - fragPosition);
float dist = length(lights[i].position - fragPosition);
attenuation = clamp(1.0 - (dist / lights[i].range), 0.0, 1.0);
vec3 toLight = lights[i].position - fragPosition;
float dist = max(length(toLight), 0.35);
lightDir = toLight / dist;
float range = max(lights[i].range, 0.001);
attenuation = clamp(1.0 - (dist / range), 0.0, 1.0);
attenuation *= attenuation;
}
else if (lights[i].type == LIGHT_SPOT) {
lightDir = normalize(lights[i].position - fragPosition);
float dist = length(lights[i].position - fragPosition);
attenuation = clamp(1.0 - (dist / lights[i].range), 0.0, 1.0);
vec3 toLight = lights[i].position - fragPosition;
float dist = max(length(toLight), 0.35);
lightDir = toLight / dist;
float range = max(lights[i].range, 0.001);
attenuation = clamp(1.0 - (dist / range), 0.0, 1.0);
attenuation *= attenuation;

vec3 spotDir = normalize(lights[i].position - lights[i].target);
Expand All @@ -101,25 +80,28 @@ void main() {
else attenuation *= smoothstep(cutoff, cutoff + 0.05, theta);
}
else if (lights[i].type == LIGHT_AREA) {
lightDir = normalize(lights[i].position - fragPosition);
float dist = length(lights[i].position - fragPosition);
attenuation = clamp(1.0 - (dist / lights[i].range), 0.0, 1.0);
vec3 toLight = lights[i].position - fragPosition;
float dist = max(length(toLight), 0.35);
lightDir = toLight / dist;
float range = max(lights[i].range, 0.001);
attenuation = clamp(1.0 - (dist / range), 0.0, 1.0);
attenuation = sqrt(attenuation);
}

float NdotL = max(dot(normal, lightDir), 0.0);
lightAccum += lights[i].color.rgb * NdotL * attenuation * lights[i].intensity;
directLight = max(dot(normal, lightDir), 0.0);
float wrappedLight = clamp((dot(normal, lightDir) + 0.28) / 1.28, 0.0, 1.0);
float diffuse = max(directLight, wrappedLight * 0.25);
vec3 bounce = lights[i].color.rgb * attenuation * lightEnergy * 0.08;
lightAccum += lights[i].color.rgb * diffuse * attenuation * lightEnergy + bounce;

if (NdotL > 0.0) {
float spec = pow(max(dot(viewD, reflect(-lightDir, normal)), 0.0), 16.0);
specular += spec * attenuation * lights[i].intensity * lights[i].color.rgb;
if (directLight > 0.0) {
float spec = pow(max(dot(viewD, reflect(-lightDir, normal)), 0.0), 24.0);
specular += spec * attenuation * lightEnergy * 0.2 * lights[i].color.rgb;
}
}

float shadow = ShadowCalc(fragPosition, normal);
vec3 ambientLight = ambient.rgb;
vec3 color = texelColor.rgb * tint.rgb * (ambientLight + lightAccum * (1.0 - shadow * 0.8)) + specular * (1.0 - shadow);
color += texelColor.rgb * tint.rgb * (ambientLight / 10.0);
vec3 color = texelColor.rgb * tint.rgb * (ambientLight + lightAccum) + specular;
color += emissionColor * emissionPower;

finalColor = vec4(color, texelColor.a * tint.a);
Expand Down
37 changes: 13 additions & 24 deletions assets/lighting.vs
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
#version 330

// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec4 vertexColor;
layout(location = 0) in vec3 aPosition;
layout(location = 1) in vec3 aNormal;
layout(location = 2) in vec2 aTexCoord0;

// Input uniform values
uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;
uniform mat4 lightSpaceMatrix;
uniform mat4 view;
uniform mat4 projection;
uniform mat4 model;
uniform mat4 normalMatrix;

// Output vertex attributes (to fragment shader)
out vec3 fragPosition;
out vec2 fragTexCoord;
out vec4 fragColor;
out vec4 fragPosLightSpace;
out vec3 fragNormal;

// NOTE: Add your custom variables here

void main()
{
// Send vertex attributes to fragment shader
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));

// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
fragPosLightSpace = lightSpaceMatrix * vec4(fragPosition, 1.0);
}
fragPosition = vec3(model * vec4(aPosition, 1.0));
fragTexCoord = aTexCoord0;
fragColor = vec4(1.0);
fragNormal = normalize((normalMatrix * vec4(aNormal, 0.0)).xyz);
gl_Position = projection * view * vec4(fragPosition, 1.0);
}
8 changes: 0 additions & 8 deletions assets/shadowcaster.fs

This file was deleted.

10 changes: 0 additions & 10 deletions assets/shadowcaster.vs

This file was deleted.

Loading
Loading