Compare commits
No commits in common. "458891b609eb157ba5209a10cd2f2282b4de187b" and "4ba7e8f88813ed95f89f2a202837180839afef4b" have entirely different histories.
458891b609
...
4ba7e8f888
Binary file not shown.
18
build.log
18
build.log
@ -1,3 +1,15 @@
|
|||||||
[LINK] g++ src\build\src\Engine.o src\build\src\main.o src\build\src\Renderer.o src\build\src\Components\CameraComponent.o src\build\src\Components\LightComponent.o src\build\src\Components\SpriteComponent.o src\build\src\Entitys\Object.o src\build\src\utils\FileDialog.o src\build\src\utils\Logging.o src\build\src\utils\Shader.o src\build\src\utils\utils.o src\build\vendor\imgui\imgui.o src\build\vendor\imgui\imgui_demo.o src\build\vendor\imgui\imgui_draw.o src\build\vendor\imgui\imgui_impl_glfw.o src\build\vendor\imgui\imgui_impl_opengl3.o src\build\vendor\imgui\imgui_tables.o src\build\vendor\imgui\imgui_widgets.o -o src\build\app.exe -LC:\msys64\mingw64\lib -lglfw3 -lglew32 -lopengl32 -lgdi32 -lyaml-cpp -lcomdlg32 -lssl -lcrypto
|
[COMPILE] g++ -std=c++20 -Wall -Isrc/include -Isrc/vendor -Isrc/vendor/imgui -IC:/msys64/mingw64/include -MMD -MP -c src\src\Engine.cpp -o src\build\src\Engine.oIn file included from C:/msys64/mingw64/include/yaml-cpp/parser.h:13,
|
||||||
[ERROR] Runtime crash
|
from C:/msys64/mingw64/include/yaml-cpp/yaml.h:10,
|
||||||
Command 'src\build\app.exe' returned non-zero exit status 3221225477.
|
from src\src\Entitys/Object.h:7,
|
||||||
|
from src\src\Engine.cpp:2:
|
||||||
|
C:/msys64/mingw64/include/yaml-cpp/dll.h:22:65: note: '#pragma message: Defining YAML_CPP_API for DLL import'
|
||||||
|
22 | # pragma message( "Defining YAML_CPP_API for DLL import" )
|
||||||
|
| ^
|
||||||
|
src\src\Engine.cpp: In function 'void DrawInspectorUI(std::shared_ptr<Object>)':
|
||||||
|
src\src\Engine.cpp:219:13: warning: unused variable 'type' [-Wunused-variable]
|
||||||
|
219 | int type = light->GetType();
|
||||||
|
| ^~~~
|
||||||
|
|
||||||
|
[LINK] g++ src\build\src\Engine.o src\build\src\main.o src\build\src\Renderer.o src\build\src\Components\CameraComponent.o src\build\src\Components\LightComponent.o src\build\src\Components\SpriteComponent.o src\build\src\Entitys\Object.o src\build\src\utils\FileDialog.o src\build\src\utils\Logging.o src\build\src\utils\Shader.o src\build\src\utils\utils.o src\build\vendor\imgui\imgui.o src\build\vendor\imgui\imgui_demo.o src\build\vendor\imgui\imgui_draw.o src\build\vendor\imgui\imgui_impl_glfw.o src\build\vendor\imgui\imgui_impl_opengl3.o src\build\vendor\imgui\imgui_tables.o src\build\vendor\imgui\imgui_widgets.o -o src\build\app.exe -LC:/msys64/mingw64/lib -lglfw3 -lglew32 -lopengl32 -lgdi32 -lyaml-cpp -lcomdlg32 -lssl -lcrypto
|
||||||
|
|
||||||
|
[TIME] Build duration: 6.67s
|
||||||
|
@ -4,8 +4,47 @@ from pathlib import Path
|
|||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
from remake_config import *
|
# ========== CONFIG ==========
|
||||||
|
SRC_DIRS = ["src/src", "src/vendor"]
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE_DIRS = [
|
||||||
|
"src/include",
|
||||||
|
"src/vendor",
|
||||||
|
"src/vendor/imgui",
|
||||||
|
"C:/msys64/mingw64/include"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LIB_DIRS = ["C:/msys64/mingw64/lib"]
|
||||||
|
BUILD_DIR = Path("src/build")
|
||||||
|
TARGET = BUILD_DIR / "app.exe"
|
||||||
|
LOG_FILE = Path("build.log")
|
||||||
|
LIBS = ["glfw3", "glew32", "opengl32", "gdi32", "yaml-cpp", "comdlg32", "ssl", "crypto"]
|
||||||
|
|
||||||
|
|
||||||
|
CXX = "g++"
|
||||||
|
CXXFLAGS = ["-std=c++20", "-Wall"] + [f"-I{inc}" for inc in INCLUDE_DIRS]
|
||||||
|
LDFLAGS = [f"-L{lib}" for lib in LIB_DIRS] + [f"-l{lib}" for lib in LIBS]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ========== COLOR UTILS ==========
|
# ========== COLOR UTILS ==========
|
||||||
class Colors:
|
class Colors:
|
||||||
@ -29,80 +68,6 @@ def log(msg: str):
|
|||||||
with LOG_FILE.open("a", encoding="utf-8") as f:
|
with LOG_FILE.open("a", encoding="utf-8") as f:
|
||||||
f.write(msg + "\n")
|
f.write(msg + "\n")
|
||||||
|
|
||||||
# ========== CACHE ==========
|
|
||||||
def load_cache():
|
|
||||||
try:
|
|
||||||
if CACHE_FILE.exists():
|
|
||||||
return json.loads(CACHE_FILE.read_text())
|
|
||||||
except json.decoder.JSONDecodeError:
|
|
||||||
error("Failed to Read Cache File.")
|
|
||||||
return {}
|
|
||||||
|
|
||||||
def save_cache(data):
|
|
||||||
CACHE_FILE.write_text(json.dumps(data, indent=2))
|
|
||||||
|
|
||||||
# ========== PACKAGE DISCOVERY ==========
|
|
||||||
class AutoLib:
|
|
||||||
def __init__(self, name):
|
|
||||||
self.name = name
|
|
||||||
self.path = None
|
|
||||||
|
|
||||||
def find(self, search_paths, cache):
|
|
||||||
if self.name in cache:
|
|
||||||
self.path = Path(cache[self.name])
|
|
||||||
return self.path.exists()
|
|
||||||
|
|
||||||
for path in search_paths:
|
|
||||||
for root, _, files in os.walk(path):
|
|
||||||
for ext in [".lib", ".a"]:
|
|
||||||
fname = f"lib{self.name}{ext}"
|
|
||||||
if fname in files:
|
|
||||||
self.path = Path(root) / fname
|
|
||||||
cache[self.name] = str(self.path)
|
|
||||||
info(f"Found {self.name} at {self.path}")
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
class AutoInclude:
|
|
||||||
def __init__(self, name):
|
|
||||||
self.name = name
|
|
||||||
self.path = None
|
|
||||||
|
|
||||||
def find(self, search_paths, cache):
|
|
||||||
if self.name in cache:
|
|
||||||
self.path = Path(cache[self.name])
|
|
||||||
return self.path.exists()
|
|
||||||
|
|
||||||
for path in search_paths:
|
|
||||||
for root, _, files in os.walk(path):
|
|
||||||
if f"{self.name}.h" in files or Path(root).name == self.name:
|
|
||||||
self.path = Path(root)
|
|
||||||
cache[self.name] = str(self.path)
|
|
||||||
info(f"Found header {self.name} at {self.path}")
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def resolve_packages():
|
|
||||||
cache = load_cache()
|
|
||||||
extra_link_paths, resolved_libs, extra_includes = [], [], []
|
|
||||||
|
|
||||||
for name in AUTO_LIBS:
|
|
||||||
lib = AutoLib(name)
|
|
||||||
if lib.find(LIB_DIRS, cache):
|
|
||||||
extra_link_paths.append(str(lib.path.parent))
|
|
||||||
resolved_libs.append(f"-l{lib.name}")
|
|
||||||
else:
|
|
||||||
error(f"Library {lib.name} not found.")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
for name in AUTO_INCLUDES:
|
|
||||||
inc = AutoInclude(name)
|
|
||||||
if inc.find(INCLUDE_DIRS, cache):
|
|
||||||
extra_includes.append(str(inc.path))
|
|
||||||
|
|
||||||
save_cache(cache)
|
|
||||||
return list(set(extra_link_paths)), resolved_libs, list(set(extra_includes))
|
|
||||||
|
|
||||||
# ========== BUILD SYSTEM ==========
|
# ========== BUILD SYSTEM ==========
|
||||||
def find_cpp_files():
|
def find_cpp_files():
|
||||||
cpp_files = []
|
cpp_files = []
|
||||||
@ -115,7 +80,8 @@ def obj_path(source): return BUILD_DIR / source.relative_to("src").with_suffix("
|
|||||||
def dep_path(obj): return obj.with_suffix(".d")
|
def dep_path(obj): return obj.with_suffix(".d")
|
||||||
|
|
||||||
def parse_dep_file(dep_file):
|
def parse_dep_file(dep_file):
|
||||||
if not dep_file.exists(): return []
|
if not dep_file.exists():
|
||||||
|
return []
|
||||||
deps = []
|
deps = []
|
||||||
with dep_file.open() as f:
|
with dep_file.open() as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
@ -125,13 +91,13 @@ def parse_dep_file(dep_file):
|
|||||||
deps.extend(line.strip().split())
|
deps.extend(line.strip().split())
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
def compile_source(source, obj, includes):
|
def compile_source(source, obj):
|
||||||
obj.parent.mkdir(parents=True, exist_ok=True)
|
obj.parent.mkdir(parents=True, exist_ok=True)
|
||||||
cmd = [CXX, *CXXFLAGS, *[f"-I{inc}" for inc in includes], "-MMD", "-MP", "-c", str(source), "-o", str(obj)]
|
cmd = [CXX, *CXXFLAGS, "-MMD", "-MP", "-c", str(source), "-o", str(obj)]
|
||||||
try:
|
try:
|
||||||
print(f"{color('🔨 Compiling:', Colors.OKCYAN)} {source}")
|
print(f"{color('🔨 Compiling:', Colors.OKCYAN)} {source}")
|
||||||
subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
log(f"[COMPILE] {' '.join(cmd)}")
|
log(f"[COMPILE] {' '.join(cmd)}{result.stdout.decode()}{result.stderr.decode()}")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error(f"Failed to compile {source}")
|
error(f"Failed to compile {source}")
|
||||||
print("🔧 Command:", " ".join(cmd))
|
print("🔧 Command:", " ".join(cmd))
|
||||||
@ -139,12 +105,12 @@ def compile_source(source, obj, includes):
|
|||||||
log(f"[ERROR] {' '.join(cmd)}\n{e.stderr.decode()}")
|
log(f"[ERROR] {' '.join(cmd)}\n{e.stderr.decode()}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def link_objects(obj_files, link_dirs, libs):
|
def link_objects(obj_files):
|
||||||
cmd = [CXX, *map(str, obj_files), "-o", str(TARGET), *[f"-L{p}" for p in link_dirs], *libs]
|
cmd = [CXX, *map(str, obj_files), "-o", str(TARGET), *LDFLAGS]
|
||||||
try:
|
try:
|
||||||
print(f"{color('📦 Linking:', Colors.OKBLUE)} {TARGET}")
|
print(f"{color('📦 Linking:', Colors.OKBLUE)} {TARGET}")
|
||||||
subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
log(f"[LINK] {' '.join(cmd)}")
|
log(f"[LINK] {' '.join(cmd)}\n{result.stdout.decode()}{result.stderr.decode()}")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error("Linking failed.")
|
error("Linking failed.")
|
||||||
print("🔧 Command:", " ".join(cmd))
|
print("🔧 Command:", " ".join(cmd))
|
||||||
@ -152,21 +118,27 @@ def link_objects(obj_files, link_dirs, libs):
|
|||||||
log(f"[ERROR] {' '.join(cmd)}\n{e.stderr.decode()}")
|
log(f"[ERROR] {' '.join(cmd)}\n{e.stderr.decode()}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def build():
|
def build():
|
||||||
build_start = time.time()
|
build_start = time.time()
|
||||||
banner("🚀 Building Project")
|
banner("🚀 Building Project")
|
||||||
|
|
||||||
cpp_files = find_cpp_files()
|
cpp_files = find_cpp_files()
|
||||||
obj_files = []
|
obj_files = []
|
||||||
|
|
||||||
link_dirs, libs, extra_includes = resolve_packages()
|
|
||||||
all_includes = INCLUDE_DIRS + extra_includes
|
|
||||||
|
|
||||||
for source in cpp_files:
|
for source in cpp_files:
|
||||||
obj = obj_path(source)
|
obj = obj_path(source)
|
||||||
dep = dep_path(obj)
|
dep = dep_path(obj)
|
||||||
obj_mtime = obj.stat().st_mtime if obj.exists() else 0
|
|
||||||
needs_build = not obj.exists() or source.stat().st_mtime > obj_mtime
|
|
||||||
|
|
||||||
|
obj_mtime = obj.stat().st_mtime if obj.exists() else 0
|
||||||
|
needs_build = not obj.exists()
|
||||||
|
|
||||||
|
# If source is newer than object
|
||||||
|
if not needs_build and source.stat().st_mtime > obj_mtime:
|
||||||
|
needs_build = True
|
||||||
|
|
||||||
|
# If any dependencies are newer than object
|
||||||
if not needs_build and dep.exists():
|
if not needs_build and dep.exists():
|
||||||
for dep_file in parse_dep_file(dep):
|
for dep_file in parse_dep_file(dep):
|
||||||
try:
|
try:
|
||||||
@ -178,21 +150,27 @@ def build():
|
|||||||
break
|
break
|
||||||
|
|
||||||
if needs_build:
|
if needs_build:
|
||||||
compile_source(source, obj, all_includes)
|
compile_source(source, obj)
|
||||||
else:
|
else:
|
||||||
print(f"{color('👌 Up-to-date:', Colors.GRAY)} {source}")
|
print(f"{color('👌 Up-to-date:', Colors.GRAY)} {source}")
|
||||||
obj_files.append(obj)
|
obj_files.append(obj)
|
||||||
|
|
||||||
link_objects(obj_files, link_dirs, libs)
|
link_objects(obj_files)
|
||||||
banner("✅ Build Complete")
|
banner("✅ Build Complete")
|
||||||
print(color(f"⏱ Build time: {time.time() - build_start:.2f}s", Colors.OKCYAN))
|
build_end = time.time()
|
||||||
|
log(f"[TIME] Build duration: {build_end - build_start:.2f}s")
|
||||||
|
print(color(f"⏱ Build time: {build_end - build_start:.2f}s", Colors.OKCYAN))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
build()
|
build()
|
||||||
if TARGET.exists():
|
if TARGET.exists():
|
||||||
banner("🚀 Running")
|
banner("🚀 Running")
|
||||||
try:
|
try:
|
||||||
subprocess.run(str(TARGET), check=True)
|
result = subprocess.run(str(TARGET), check=True)
|
||||||
log("[RUN] Executed app.exe successfully.")
|
log("[RUN] Executed app.exe successfully.")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error("Program exited with error.")
|
error("Program exited with error.")
|
||||||
@ -200,22 +178,26 @@ def run():
|
|||||||
sys.exit(e.returncode)
|
sys.exit(e.returncode)
|
||||||
else:
|
else:
|
||||||
error("Executable not found.")
|
error("Executable not found.")
|
||||||
|
log("[ERROR] Executable not found.")
|
||||||
|
|
||||||
def clean():
|
def clean():
|
||||||
banner("🧹 Cleaning")
|
banner("🧹 Cleaning")
|
||||||
if BUILD_DIR.exists():
|
if BUILD_DIR.exists():
|
||||||
shutil.rmtree(BUILD_DIR)
|
shutil.rmtree(BUILD_DIR)
|
||||||
info("Build directory removed.")
|
info("Build directory removed.")
|
||||||
|
log("[CLEAN] Build directory removed.")
|
||||||
|
else:
|
||||||
|
warn("Nothing to clean.")
|
||||||
|
log("[CLEAN] No build directory found.")
|
||||||
if LOG_FILE.exists():
|
if LOG_FILE.exists():
|
||||||
LOG_FILE.unlink()
|
LOG_FILE.unlink()
|
||||||
info("Log file cleared.")
|
info("Log file cleared.")
|
||||||
if CACHE_FILE.exists():
|
|
||||||
CACHE_FILE.unlink()
|
|
||||||
info("Cache file cleared.")
|
|
||||||
|
|
||||||
# ========== ENTRY ==========
|
# ========== ENTRY ==========
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
start = time.time()
|
total_start = time.time()
|
||||||
|
|
||||||
|
# Clear old log
|
||||||
LOG_FILE.write_text("", encoding="utf-8")
|
LOG_FILE.write_text("", encoding="utf-8")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -227,7 +209,9 @@ if __name__ == "__main__":
|
|||||||
build()
|
build()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
error("Interrupted by user.")
|
error("Interrupted by user.")
|
||||||
log("[ERROR] Interrupted by user.")
|
log("[ERROR] Build interrupted by user.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print(color(f"\n⏱ Total time: {time.time() - start:.2f}s", Colors.BOLD + Colors.OKGREEN))
|
total_end = time.time()
|
||||||
|
print(color(f"\n⏱ Total time: {total_end - total_start:.2f}s", Colors.BOLD + Colors.OKGREEN))
|
||||||
|
log(f"[TIME] Total runtime: {total_end - total_start:.2f}s")
|
30
imgui.ini
30
imgui.ini
@ -10,24 +10,24 @@ Collapsed=1
|
|||||||
|
|
||||||
[Window][WindowOverViewport_11111111]
|
[Window][WindowOverViewport_11111111]
|
||||||
Pos=0,19
|
Pos=0,19
|
||||||
Size=1920,1158
|
Size=1280,701
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Inspector]
|
[Window][Inspector]
|
||||||
Pos=1408,19
|
Pos=873,19
|
||||||
Size=512,835
|
Size=407,505
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][Scene Tree]
|
[Window][Scene Tree]
|
||||||
Pos=0,19
|
Pos=0,19
|
||||||
Size=263,1158
|
Size=263,701
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000001,0
|
DockId=0x00000001,0
|
||||||
|
|
||||||
[Window][Viewport]
|
[Window][Viewport]
|
||||||
Pos=265,19
|
Pos=265,19
|
||||||
Size=1141,869
|
Size=606,412
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000007,0
|
DockId=0x00000007,0
|
||||||
|
|
||||||
@ -36,25 +36,25 @@ Size=1280,19
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Performance Info]
|
[Window][Performance Info]
|
||||||
Pos=1408,856
|
Pos=873,526
|
||||||
Size=512,321
|
Size=407,194
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
[Window][Console]
|
[Window][Console]
|
||||||
Pos=265,890
|
Pos=265,433
|
||||||
Size=1141,287
|
Size=606,287
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000008,0
|
DockId=0x00000008,0
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0x11111111 Window=0x1BBC0F80 Pos=0,19 Size=1920,1158 Split=X
|
DockSpace ID=0x11111111 Window=0x1BBC0F80 Pos=0,19 Size=1280,701 Split=X
|
||||||
DockNode ID=0x00000003 Parent=0x11111111 SizeRef=1406,1158 Split=X
|
DockNode ID=0x00000003 Parent=0x11111111 SizeRef=1511,1158 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=263,701 HiddenTabBar=1 Selected=0x12EF0F59
|
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=263,701 HiddenTabBar=1 Selected=0x12EF0F59
|
||||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1141,701 Split=Y Selected=0xC450F867
|
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1246,701 Split=Y Selected=0xC450F867
|
||||||
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=606,869 CentralNode=1 HiddenTabBar=1 Selected=0xC450F867
|
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=606,869 CentralNode=1 Selected=0xC450F867
|
||||||
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=606,287 HiddenTabBar=1 Selected=0xEA83D666
|
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=606,287 Selected=0xEA83D666
|
||||||
DockNode ID=0x00000004 Parent=0x11111111 SizeRef=512,1158 Split=Y Selected=0x36DC96AB
|
DockNode ID=0x00000004 Parent=0x11111111 SizeRef=407,1158 Split=Y Selected=0x36DC96AB
|
||||||
DockNode ID=0x00000005 Parent=0x00000004 SizeRef=407,835 HiddenTabBar=1 Selected=0x36DC96AB
|
DockNode ID=0x00000005 Parent=0x00000004 SizeRef=407,835 HiddenTabBar=1 Selected=0x36DC96AB
|
||||||
DockNode ID=0x00000006 Parent=0x00000004 SizeRef=407,321 HiddenTabBar=1 Selected=0x3FC1A724
|
DockNode ID=0x00000006 Parent=0x00000004 SizeRef=407,321 HiddenTabBar=1 Selected=0x3FC1A724
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"glfw3": "C:\\msys64\\mingw64\\lib\\libglfw3.a",
|
|
||||||
"glew32": "C:\\msys64\\mingw64\\lib\\libglew32.a",
|
|
||||||
"opengl32": "C:\\msys64\\mingw64\\lib\\libopengl32.a",
|
|
||||||
"gdi32": "C:\\msys64\\mingw64\\lib\\libgdi32.a",
|
|
||||||
"yaml-cpp": "C:\\msys64\\mingw64\\lib\\libyaml-cpp.a",
|
|
||||||
"comdlg32": "C:\\msys64\\mingw64\\lib\\libcomdlg32.a",
|
|
||||||
"ssl": "C:\\msys64\\mingw64\\lib\\libssl.a",
|
|
||||||
"crypto": "C:\\msys64\\mingw64\\lib\\libcrypto.a",
|
|
||||||
"imgui": "src\\vendor\\imgui"
|
|
||||||
}
|
|
Binary file not shown.
@ -1,34 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Source and header directories
|
|
||||||
SRC_DIRS = ["src/src", "src/vendor"]
|
|
||||||
INCLUDE_DIRS = [
|
|
||||||
"src/include",
|
|
||||||
"src/vendor",
|
|
||||||
"src/vendor/imgui",
|
|
||||||
"C:/msys64/mingw64/include"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Default library search paths
|
|
||||||
LIB_DIRS = [
|
|
||||||
"C:/msys64/mingw64/lib",
|
|
||||||
"C:/Program Files",
|
|
||||||
"C:/Program Files (x86)",
|
|
||||||
"C:/libs",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Compiler and build options
|
|
||||||
BUILD_DIR = Path("src/build")
|
|
||||||
TARGET = BUILD_DIR / "app.exe"
|
|
||||||
LOG_FILE = Path("build.log")
|
|
||||||
CACHE_FILE = Path("./remake/.remake_cache.json")
|
|
||||||
CXX = "g++"
|
|
||||||
CXXFLAGS = ["-std=c++20", "-Wall"] + [f"-I{inc}" for inc in INCLUDE_DIRS]
|
|
||||||
|
|
||||||
# Libraries and includes to auto-discover
|
|
||||||
AUTO_LIBS = [
|
|
||||||
"glfw3", "glew32", "opengl32", "gdi32",
|
|
||||||
"yaml-cpp", "comdlg32", "ssl", "crypto"
|
|
||||||
]
|
|
||||||
|
|
||||||
AUTO_INCLUDES = ["imgui", "yaml-cpp"]
|
|
@ -1,6 +1,6 @@
|
|||||||
engine_version: 0.1.0
|
engine_version: 0.1.0
|
||||||
scene_name: test
|
scene_name: test
|
||||||
scene_hash: b4b8f6fe7881b1b5183673450e9a2b43fff7f5d24e88fbedf920edf09cd63fd2
|
scene_hash: beb59668150f92192118ae530ea3d931789cec7c937e2620b25516e0f88ac8a7
|
||||||
format_version: 1
|
format_version: 1
|
||||||
objects:
|
objects:
|
||||||
- name: Sprite Object
|
- name: Sprite Object
|
||||||
@ -32,83 +32,24 @@ objects:
|
|||||||
texture: C:\Users\spenc\OneDrive\Pictures\49555.jpg
|
texture: C:\Users\spenc\OneDrive\Pictures\49555.jpg
|
||||||
normalMap: ""
|
normalMap: ""
|
||||||
children: []
|
children: []
|
||||||
- name: Bark
|
- name: NewObject
|
||||||
position: [1024, 0]
|
position: [0, 444]
|
||||||
layer: -1
|
layer: 0
|
||||||
components:
|
components:
|
||||||
- type: SpriteComponent
|
- type: SpriteComponent
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_diff_1k.png
|
texture: C:\Users\spenc\OneDrive\Pictures\49555.jpg
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_nor_gl_1k.png
|
normalMap: ""
|
||||||
children: []
|
children: []
|
||||||
- name: Sun
|
- name: Light
|
||||||
position: [-5000, -5000]
|
position: [-5000, -5000]
|
||||||
layer: 1
|
layer: 1
|
||||||
components:
|
components:
|
||||||
- type: LightComponent
|
- type: LightComponent
|
||||||
color:
|
color:
|
||||||
- 0.990196049
|
- 1
|
||||||
- 0.943370163
|
- 1
|
||||||
- 0.791186035
|
- 1
|
||||||
intensity: 2.0999999
|
intensity: 10
|
||||||
radius: 100000000
|
|
||||||
falloff: 0.100000001
|
|
||||||
type: 0
|
|
||||||
children: []
|
|
||||||
- name: Rocks
|
|
||||||
position: [0, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: World
|
|
||||||
position: [-436, 248]
|
|
||||||
layer: 0
|
|
||||||
components: []
|
|
||||||
children:
|
|
||||||
- name: Rocks
|
|
||||||
position: [0, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Bark
|
|
||||||
position: [1024, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Planks
|
|
||||||
position: [0, 1024]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\wood_floor_worn_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\wood_floor_worn_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Metal
|
|
||||||
position: [1024, 1024]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\metal_plate_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\metal_plate_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Sun
|
|
||||||
position: [-5000, -5000]
|
|
||||||
layer: 1
|
|
||||||
components:
|
|
||||||
- type: LightComponent
|
|
||||||
color:
|
|
||||||
- 0.990196049
|
|
||||||
- 0.943370163
|
|
||||||
- 0.791186035
|
|
||||||
intensity: 2.0999999
|
|
||||||
radius: 100000000
|
radius: 100000000
|
||||||
falloff: 0.100000001
|
falloff: 0.100000001
|
||||||
type: 0
|
type: 0
|
||||||
|
@ -1,123 +0,0 @@
|
|||||||
engine_version: 0.1.0
|
|
||||||
scene_name: Normal Map Test
|
|
||||||
scene_hash: 2aa0652450eaf2aa838b1a49c8c5e1ee27a0412c93b25e3c213d5b23f1d96e5a
|
|
||||||
format_version: 1
|
|
||||||
objects:
|
|
||||||
- name: Face1
|
|
||||||
position: [258, 0]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: CameraComponent
|
|
||||||
fov: 45
|
|
||||||
aspect: 1.76999998
|
|
||||||
zoom: 1
|
|
||||||
primary: true
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\49555.jpg
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\circuits_normal.jpg
|
|
||||||
children:
|
|
||||||
- name: Face2
|
|
||||||
position: [403, 189]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\49555.jpg
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\brick-normal.jpg
|
|
||||||
children: []
|
|
||||||
- name: Logo (+normal)
|
|
||||||
position: [1686, 929]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\blue_logo.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\circuits_normal.jpg
|
|
||||||
children:
|
|
||||||
- name: NewObject
|
|
||||||
position: [1080, 0]
|
|
||||||
layer: 0
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\blue_logo.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\images.jpg
|
|
||||||
children: []
|
|
||||||
- name: Bark
|
|
||||||
position: [1024, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Sun
|
|
||||||
position: [-5000, -5000]
|
|
||||||
layer: 1
|
|
||||||
components:
|
|
||||||
- type: LightComponent
|
|
||||||
color:
|
|
||||||
- 0.992156863
|
|
||||||
- 0.984313726
|
|
||||||
- 0.827450991
|
|
||||||
intensity: 1.25
|
|
||||||
radius: 100000000
|
|
||||||
falloff: 0.100000001
|
|
||||||
type: 0
|
|
||||||
children: []
|
|
||||||
- name: Rocks
|
|
||||||
position: [0, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: World
|
|
||||||
position: [-436, 248]
|
|
||||||
layer: 0
|
|
||||||
components: []
|
|
||||||
children:
|
|
||||||
- name: Rocks
|
|
||||||
position: [0, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\ganges_river_pebbles_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Bark
|
|
||||||
position: [1024, 0]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\bark_willow_02_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Planks
|
|
||||||
position: [0, 1024]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\wood_floor_worn_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\wood_floor_worn_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Metal
|
|
||||||
position: [1024, 1024]
|
|
||||||
layer: -1
|
|
||||||
components:
|
|
||||||
- type: SpriteComponent
|
|
||||||
texture: C:\Users\spenc\OneDrive\Pictures\textures\metal_plate_diff_1k.png
|
|
||||||
normalMap: C:\Users\spenc\OneDrive\Pictures\textures\metal_plate_nor_gl_1k.png
|
|
||||||
children: []
|
|
||||||
- name: Sun
|
|
||||||
position: [-5000, -5000]
|
|
||||||
layer: 1
|
|
||||||
components:
|
|
||||||
- type: LightComponent
|
|
||||||
color:
|
|
||||||
- 0.992156863
|
|
||||||
- 0.984313726
|
|
||||||
- 0.827450991
|
|
||||||
intensity: 1.25
|
|
||||||
radius: 100000000
|
|
||||||
falloff: 0.100000001
|
|
||||||
type: 0
|
|
||||||
children: []
|
|
@ -6,24 +6,22 @@
|
|||||||
#include "../utils/Logging.h"
|
#include "../utils/Logging.h"
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
|
|
||||||
|
|
||||||
SpriteComponent::SpriteComponent(Object* owner) : Component(owner) {}
|
SpriteComponent::SpriteComponent(Object* owner) : Component(owner) {}
|
||||||
|
|
||||||
|
unsigned int SpriteComponent::LoadTexture(const std::string& path) {
|
||||||
|
|
||||||
unsigned int SpriteComponent::LoadTexture(const std::string &path, bool updateSize)
|
|
||||||
{
|
|
||||||
int w, h, channels;
|
int w, h, channels;
|
||||||
std::string filename = GetFilenameFromPath(path);
|
std::string filename = GetFilenameFromPath(path);
|
||||||
stbi_set_flip_vertically_on_load(false);
|
stbi_set_flip_vertically_on_load(false);
|
||||||
|
|
||||||
unsigned char* data = stbi_load(path.c_str(), &w, &h, &channels, 4);
|
unsigned char* data = stbi_load(path.c_str(), &w, &h, &channels, 4);
|
||||||
if (!data)
|
if (!data) {
|
||||||
{
|
|
||||||
Logger::LogError("Failed to load asset: '%s': %s", filename.c_str(), stbi_failure_reason());
|
Logger::LogError("Failed to load asset: '%s': %s", filename.c_str(), stbi_failure_reason());
|
||||||
|
|
||||||
|
texture_loaded = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateSize)
|
|
||||||
size = glm::vec2(w, h);
|
size = glm::vec2(w, h);
|
||||||
|
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
@ -39,60 +37,48 @@ unsigned int SpriteComponent::LoadTexture(const std::string &path, bool updateSi
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
stbi_image_free(data);
|
stbi_image_free(data);
|
||||||
|
texture_loaded = true;
|
||||||
Logger::LogDebug("Loaded Asset: %s, %d", filename.c_str(), id);
|
Logger::LogDebug("Loaded Asset: %s, %d", filename.c_str(), id);
|
||||||
|
textureID = id;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SpriteComponent::HasTexture()
|
bool SpriteComponent::HasTexture()
|
||||||
{
|
{
|
||||||
return texture_loaded;
|
return texture_loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteComponent::SetTexture(const std::string &path)
|
|
||||||
{
|
void SpriteComponent::SetTexture(const std::string& path) {
|
||||||
if (path.empty())
|
if (path.empty()) return;
|
||||||
return;
|
|
||||||
texturePath = path;
|
texturePath = path;
|
||||||
textureID = LoadTexture(path, true);
|
LoadTexture(path);
|
||||||
if (textureID != 0)
|
|
||||||
{
|
|
||||||
texture_loaded = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteComponent::SetNormalMap(const std::string &path)
|
|
||||||
{
|
void SpriteComponent::SetNormalMap(const std::string& path) {
|
||||||
if (path.empty())
|
if (path.empty()) return;
|
||||||
return;
|
|
||||||
normalMapPath = path;
|
normalMapPath = path;
|
||||||
normalMapID = LoadTexture(path, false);
|
LoadTexture(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int SpriteComponent::GetTextureID() const
|
unsigned int SpriteComponent::GetTextureID() const {
|
||||||
{
|
|
||||||
return textureID;
|
return textureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int SpriteComponent::GetNormalMapID() const
|
unsigned int SpriteComponent::GetNormalMapID() const {
|
||||||
{
|
|
||||||
return normalMapID;
|
return normalMapID;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SpriteComponent::GetTexturePath() const
|
std::string SpriteComponent::GetTexturePath() const {
|
||||||
{
|
|
||||||
return texturePath;
|
return texturePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SpriteComponent::GetNormalMapPath() const
|
std::string SpriteComponent::GetNormalMapPath() const {
|
||||||
{
|
|
||||||
return normalMapPath;
|
return normalMapPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteComponent::Save(YAML::Emitter &out) const
|
void SpriteComponent::Save(YAML::Emitter& out) const {
|
||||||
{
|
|
||||||
out << YAML::BeginMap;
|
out << YAML::BeginMap;
|
||||||
out << YAML::Key << "type" << YAML::Value << "SpriteComponent";
|
out << YAML::Key << "type" << YAML::Value << "SpriteComponent";
|
||||||
out << YAML::Key << "texture" << YAML::Value << texturePath;
|
out << YAML::Key << "texture" << YAML::Value << texturePath;
|
||||||
@ -100,11 +86,11 @@ void SpriteComponent::Save(YAML::Emitter &out) const
|
|||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteComponent::Load(const YAML::Node &node)
|
void SpriteComponent::Load(const YAML::Node& node) {
|
||||||
{
|
|
||||||
if (node["texture"] && !node["texture"].as<std::string>().empty())
|
if (node["texture"] && !node["texture"].as<std::string>().empty())
|
||||||
SetTexture(node["texture"].as<std::string>());
|
SetTexture(node["texture"].as<std::string>());
|
||||||
|
|
||||||
if (node["normalMap"] && !node["normalMap"].as<std::string>().empty())
|
if (node["normalMap"] && !node["normalMap"].as<std::string>().empty())
|
||||||
SetNormalMap(node["normalMap"].as<std::string>());
|
SetNormalMap(node["normalMap"].as<std::string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,5 +38,5 @@ private:
|
|||||||
unsigned int textureID = 0;
|
unsigned int textureID = 0;
|
||||||
unsigned int normalMapID = 0;
|
unsigned int normalMapID = 0;
|
||||||
bool texture_loaded = false;
|
bool texture_loaded = false;
|
||||||
unsigned int LoadTexture(const std::string& path, bool updateSize);
|
unsigned int LoadTexture(const std::string& path);
|
||||||
};
|
};
|
||||||
|
@ -190,6 +190,7 @@ void DrawInspectorUI(std::shared_ptr<Object> selected)
|
|||||||
selected->RemoveComponent<SpriteComponent>();
|
selected->RemoveComponent<SpriteComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Camera UI...
|
||||||
if (auto cam = selected->GetComponent<CameraComponent>())
|
if (auto cam = selected->GetComponent<CameraComponent>())
|
||||||
{
|
{
|
||||||
ImGui::SeparatorText("Camera Component");
|
ImGui::SeparatorText("Camera Component");
|
||||||
|
@ -12,8 +12,6 @@ static Shader spriteShader;
|
|||||||
|
|
||||||
GLuint Renderer::fbo = 0;
|
GLuint Renderer::fbo = 0;
|
||||||
GLuint Renderer::textureColorBuffer = 0;
|
GLuint Renderer::textureColorBuffer = 0;
|
||||||
GLuint Renderer::defaultNormalMap = 0;
|
|
||||||
|
|
||||||
GLuint Renderer::rbo = 0;
|
GLuint Renderer::rbo = 0;
|
||||||
GLuint Renderer::quadVAO = 0;
|
GLuint Renderer::quadVAO = 0;
|
||||||
GLuint Renderer::quadVBO = 0;
|
GLuint Renderer::quadVBO = 0;
|
||||||
@ -26,7 +24,6 @@ std::vector<Light> Renderer::s_Lights;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Renderer::InitQuad() {
|
void Renderer::InitQuad() {
|
||||||
float vertices[] = {
|
float vertices[] = {
|
||||||
// pos // uv
|
// pos // uv
|
||||||
@ -76,14 +73,6 @@ void Renderer::Init() {
|
|||||||
|
|
||||||
spriteShader.LoadFromFile("src/assets/shaders/sprite.vert", "src/assets/shaders/sprite.frag");
|
spriteShader.LoadFromFile("src/assets/shaders/sprite.vert", "src/assets/shaders/sprite.frag");
|
||||||
|
|
||||||
// Create a 1x1 flat normal map (RGB: 128,128,255)
|
|
||||||
unsigned char flatNormal[3] = { 128, 128, 255 };
|
|
||||||
glGenTextures(1, &defaultNormalMap);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, defaultNormalMap);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, flatNormal);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
||||||
|
|
||||||
s_DrawCalls = 0;
|
s_DrawCalls = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,11 +161,9 @@ void Renderer::DrawSprite(SpriteComponent* sprite, const glm::vec2& pos, float z
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, sprite->GetTextureID());
|
glBindTexture(GL_TEXTURE_2D, sprite->GetTextureID());
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
if (sprite->GetNormalMapID()) {
|
if (sprite->GetNormalMapID()) {
|
||||||
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, sprite->GetNormalMapID());
|
glBindTexture(GL_TEXTURE_2D, sprite->GetNormalMapID());
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, defaultNormalMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(quadVAO);
|
glBindVertexArray(quadVAO);
|
||||||
@ -190,7 +177,6 @@ void Renderer::DrawSprite(SpriteComponent* sprite, const glm::vec2& pos, float z
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Renderer::GetDrawCallCount()
|
int Renderer::GetDrawCallCount()
|
||||||
{
|
{
|
||||||
return s_DrawCalls;
|
return s_DrawCalls;
|
||||||
|
@ -30,7 +30,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
static std::vector<Light> s_Lights;
|
static std::vector<Light> s_Lights;
|
||||||
static GLuint fbo, textureColorBuffer, rbo;
|
static GLuint fbo, textureColorBuffer, rbo;
|
||||||
static GLuint defaultNormalMap;
|
|
||||||
static int width, height;
|
static int width, height;
|
||||||
static int s_DrawCalls;
|
static int s_DrawCalls;
|
||||||
static GLuint shader, quadVAO, quadVBO;
|
static GLuint shader, quadVAO, quadVBO;
|
||||||
|
Loading…
Reference in New Issue
Block a user