Skip to content

Commit

Permalink
VEGA v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Aermoss committed Feb 24, 2024
1 parent 5d91fb2 commit bbb5194
Show file tree
Hide file tree
Showing 130 changed files with 175,238 additions and 27,598 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Yusuf Rençber
Copyright (c) 2024 Yusuf Rençber

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 24 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
cc = g++
cflags = -lopengl32 -lglfw3 -lgdi32 -static -static-libgcc -static-libstdc++
src_files = src/*.cpp src/stb/*.cpp src/glad/*.c
include_dirs = -Iinclude
lib_dirs = -Llib -Llib/GLFW
output_file = bin/main

default:
xcopy shaders bin\shaders /E /H /C /I /Y
xcopy res bin\res /E /H /C /I /Y
$(cc) -o $(output_file) $(src_files) $(include_dirs) $(lib_dirs) $(cflags)
$(output_file)
binaryDir := ./bin
objectDir := ./bin/obj
sourceDir := ./src
includeDirs := ./include ./include/imgui
libDirs := ./lib
executable := $(binaryDir)/main.exe
vendors := $(patsubst $(sourceDir)/vendor/%,%,$(wildcard $(sourceDir)/vendor/*))
sources := $(wildcard $(sourceDir)/*.cpp) $(foreach vendor,$(vendors),$(wildcard $(sourceDir)/vendor/$(vendor)/*.cpp))
objects := $(patsubst $(sourceDir)/%.cpp,$(objectDir)/%.o,$(sources)) $(foreach vendor,$(vendors),$(wildcard $(objectDir)/vendor/$(vendor)/*.o))
flags = -lopengl32 -lglfw3 -lgdi32 -static -static-libgcc -static-libstdc++

all: $(objectDir) $(executable) run

$(executable): $(objects) | $(binaryDir)
$(cc) $^ -o $@ $(foreach dir,$(includeDirs),-I$(dir)) $(foreach dir,$(libDirs),-L$(dir)) $(flags)

$(objectDir)/%.o: $(sourceDir)/%.cpp | $(objectDir)
$(cc) -c $< -o $@ $(foreach dir,$(includeDirs),-I$(dir))

$(objectDir):
mkdir bin && cd bin && mkdir obj && cd obj && mkdir vendor && cd vendor && $(foreach dir,$(vendors),mkdir $(dir) &&) cd ../../..

run: $(executable)
$<
56 changes: 47 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,58 @@
A simple 3D game engine written in C++ using OpenGL.

# Examples
## Creating a window
## Creating a window.
```c++
#include "vega.hpp"
#include <vega/vega.hpp>

int main(int argc, const char* argv[]) {
vega::VEGAWindow window(1200, 600, "VEGA Window", "res/icon/icon.png", vega::VEGAColor(0.0f, 0.0f, 0.0f), false, false, true, true);
vega::VEGAWindow window(1200, 600, "VEGA Window");

while (!window.should_close()) {
window.handle_events();
window.clear_color();
window.check_errors();
window.swap_buffers();
while (!window.shouldClose()) {
window.pollEvents();
window.clear();
window.checkErrors();
window.swapBuffers();
}


window.destroy();
return 0;
}
```
## Rendering a model.
```c++
#include <vega/vega.hpp>
int main(int argc, const char* argv[]) {
vega::VEGAWindow window(1200, 600, "VEGA Window");
vega::VEGAShader shader(
vega::VEGAReadFile("shaders/default.vert"),
vega::VEGAReadFile("shaders/default.frag")
);
vega::VEGACamera camera(&window, 45.0f, 0.1f, 1000.0f);
vega::VEGAModel model("res/models/crow/scene.gltf");
shader.use();
glUniform4fv(shader.getUniformLocation("lightColor"), 1, (float*) glm::value_ptr(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)));
glUniform3fv(shader.getUniformLocation("lightPosition"), 1, (float*) glm::value_ptr(glm::vec3(0.5f, 0.5f, 0.5f)));
glUniform1f(shader.getUniformLocation("ambient"), ambient);
shader.unuse();
while (!window.shouldClose()) {
window.pollEvents();
camera.processInputs();
window.clear();
model.render(&shader, &camera);
window.checkErrors();
window.swapBuffers();
}
model.destroy();
shader.destroy();
window.destroy();
return 0;
}
```
Binary file modified bin/main.exe
Binary file not shown.
Binary file added bin/obj/camera.o
Binary file not shown.
Binary file added bin/obj/file.o
Binary file not shown.
Binary file added bin/obj/indexBuffer.o
Binary file not shown.
Binary file added bin/obj/input.o
Binary file not shown.
Binary file added bin/obj/main.o
Binary file not shown.
Binary file added bin/obj/mesh.o
Binary file not shown.
Binary file added bin/obj/model.o
Binary file not shown.
Binary file added bin/obj/shader.o
Binary file not shown.
Binary file added bin/obj/texture.o
Binary file not shown.
Binary file added bin/obj/transform.o
Binary file not shown.
Binary file added bin/obj/vendor/glad/glad.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_demo.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_draw.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_impl_glfw.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_impl_opengl3.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_tables.o
Binary file not shown.
Binary file added bin/obj/vendor/imgui/imgui_widgets.o
Binary file not shown.
Binary file added bin/obj/vendor/stb/stb.o
Binary file not shown.
Binary file added bin/obj/vertexArray.o
Binary file not shown.
Binary file added bin/obj/vertexBuffer.o
Binary file not shown.
Binary file added bin/obj/window.o
Binary file not shown.
Binary file removed bin/res/icon/icon.png
Binary file not shown.
Binary file removed bin/res/models/bunny/baseColor.png
Binary file not shown.
Binary file removed bin/res/models/bunny/metallicRoughness.png
Binary file not shown.
Binary file removed bin/res/models/bunny/scene.bin
Binary file not shown.
147 changes: 0 additions & 147 deletions bin/res/models/bunny/scene.gltf

This file was deleted.

Binary file removed bin/res/models/crow/diffuse.png
Binary file not shown.
Binary file removed bin/res/models/crow/scene.bin
Binary file not shown.
Loading

0 comments on commit bbb5194

Please sign in to comment.