From 8322690897a71a23b4349c3d24633dbd410e29b1 Mon Sep 17 00:00:00 2001 From: Joud Kandeel Date: Fri, 22 May 2026 23:00:15 +0200 Subject: [PATCH] testing the RmlUI --- Minecraft-Community-Edition/Minecraft.cpp | 9 +- Minecraft-Community-Edition/Startup.hpp | 8 +- Minecraft-Community-Edition/shader2vfs.py | 88 +++++++++++++++++++ .../shadercomp-debug.bat | 15 ++++ 4 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 Minecraft-Community-Edition/shader2vfs.py diff --git a/Minecraft-Community-Edition/Minecraft.cpp b/Minecraft-Community-Edition/Minecraft.cpp index 4608ad5..f1cbfef 100644 --- a/Minecraft-Community-Edition/Minecraft.cpp +++ b/Minecraft-Community-Edition/Minecraft.cpp @@ -66,7 +66,7 @@ namespace mce { } eastl::vector mem; - vfs.getFile("assets.images.aya", mem); + vfs.getFile("assets.images.who", mem); renderState.texture = factory.createTexture(mem); @@ -75,7 +75,7 @@ namespace mce { cube.setTexture(renderState.texture); torus.create(qBus, factory, 10, 5, 128, 128, gfx::Color::Black); - + //torus.createPlane(qBus, factory, 100, 100, 20, 20, gfx::Color::Black); torus.setTexture(renderState.texture); } @@ -133,10 +133,11 @@ namespace mce { torus.position.z = 20.0f; //torus.rotation.x = 310 * (3.14 / 180); - torus.rotation.y += 0.00045f; - torus.rotation.x += 0.00015f; + torus.rotation.y += 10 * (3.14 / 180); + torus.rotation.x += 10 * (3.14 / 180); //torus.rotation.z += 0.0035f; //renderer.render(cube); renderer.render(torus); } } +//-config ../data/launcher/launcher.xml --renderer d3d11 \ No newline at end of file diff --git a/Minecraft-Community-Edition/Startup.hpp b/Minecraft-Community-Edition/Startup.hpp index bee1ec3..4a8cc75 100644 --- a/Minecraft-Community-Edition/Startup.hpp +++ b/Minecraft-Community-Edition/Startup.hpp @@ -53,9 +53,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, \ #define MCE_STARTUP(_Startup) \ int main(int argc, char* argv[]) { \ - _Startup app(argc, argv); \ - int nExitCode = app.run(); \ - TerminateProcess(GetCurrentProcess(), nExitCode); \ + int nExitCode = 0x00; { \ + _Startup app(argc, argv); \ + nExitCode = app.run();\ + }\ + ExitProcess(nExitCode);\ } #endif diff --git a/Minecraft-Community-Edition/shader2vfs.py b/Minecraft-Community-Edition/shader2vfs.py new file mode 100644 index 0000000..841fe1d --- /dev/null +++ b/Minecraft-Community-Edition/shader2vfs.py @@ -0,0 +1,88 @@ +import json +from pathlib import Path + +# ------------------------------------------------------------ +# CONFIG +# ------------------------------------------------------------ + +MANIFEST_PATH = "assets.json" +SHADER_FOLDER = "./assets/shaders" +OUTPUT_JSON = "assets.json" + +# ------------------------------------------------------------ +# LOAD EXISTING MANIFEST +# ------------------------------------------------------------ + +manifest = {} + +manifest_file = Path(MANIFEST_PATH) + +if manifest_file.exists(): + with open(manifest_file, "r", encoding="utf-8") as f: + manifest = json.load(f) + +print(f"Loaded {len(manifest)} existing entries") + +# ------------------------------------------------------------ +# FILE TAG GENERATION +# ------------------------------------------------------------ + + +def generate_filetag(shader_path: Path) -> str: + """ + Converts: + + assets/shaders/main.fs.d3d11_windows.bin + + Into: + + assets.shaders.main.fs.d3d11_windows + """ + + # Remove extension (.bin) + no_ext = shader_path.with_suffix("") + + # Convert path separators to dots + parts = no_ext.parts + + return ".".join(parts) + + +# ------------------------------------------------------------ +# SCAN SHADER DIRECTORY +# ------------------------------------------------------------ + +shader_root = Path(SHADER_FOLDER) + +if not shader_root.exists(): + raise RuntimeError(f"Shader folder does not exist: {SHADER_FOLDER}") + +added_count = 0 + +for shader_file in shader_root.rglob("*.bin"): + + # Generate tag + filetag = generate_filetag(shader_file) + + # Convert to windows-style relative path + relative_path = ".\\" + str(shader_file).replace("/", "\\") + + # Add only if missing + if filetag not in manifest: + manifest[filetag] = relative_path + added_count += 1 + + print(f"Added: {filetag}") + print(f" -> {relative_path}") + +# ------------------------------------------------------------ +# SAVE JSON +# ------------------------------------------------------------ + +with open(OUTPUT_JSON, "w", encoding="utf-8") as f: + json.dump(manifest, f, indent=4) + +print() +print(f"Added {added_count} new shaders") +print(f"Total shaders: {len(manifest)}") +print(f"Saved manifest to: {OUTPUT_JSON}") \ No newline at end of file diff --git a/Minecraft-Community-Edition/shadercomp-debug.bat b/Minecraft-Community-Edition/shadercomp-debug.bat index 22eecb2..4a7aeec 100644 --- a/Minecraft-Community-Edition/shadercomp-debug.bat +++ b/Minecraft-Community-Edition/shadercomp-debug.bat @@ -7,6 +7,7 @@ REM Right now the only way to get the shader compiler is to build it from src fr set SC=D:\Void\bgfx\bin\shadercRelease set INCLUDE=%ROOT%\libs\bgfx\ set SHADERS=%ROOT%\Graphics\Shaders +set RMLSHADERS=%ROOT%\UI\Backend\shaders set OUT=%ROOT%\assets\shaders goto :gen @@ -17,9 +18,23 @@ REM %3 = profile :compile echo Compiling %2 for %1... +REM Graphics default shader %SC% -f %SHADERS%\main.vs -o %OUT%\main.vs.%2_%1.bin --type v --platform %1 -p %3 -i %INCLUDE% %SC% -f %SHADERS%\main.fs -o %OUT%\main.fs.%2_%1.bin --type f --platform %1 -p %3 -i %INCLUDE% +REM RmlUI shaders +%SC% -f %RMLSHADERS%\rmlui.vs -o %OUT%\rmlui.vs.%2_%1.bin --type v --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_passthrough.vs -o %OUT%\rmlui_passthrough.vs.%2_%1.bin --type v --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_blendmask.fs -o %OUT%\rmlui_blendmask.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_blur.fs -o %OUT%\rmlui_blur.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_color.fs -o %OUT%\rmlui_color.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_colormatrix.fs -o %OUT%\rmlui_colormatrix.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_creation.fs -o %OUT%\rmlui_creation.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_dropshadow.fs -o %OUT%\rmlui_dropshadow.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_gradient.fs -o %OUT%\rmlui_gradient.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_passthrough.fs -o %OUT%\rmlui_passthrough.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% +%SC% -f %RMLSHADERS%\rmlui_texture.fs -o %OUT%\rmlui_texture.fs.%2_%1.bin --type f --platform %1 -p %3 %INCLUDE% + goto :eof :gen