diff --git a/README.md b/README.md index 4f143523..64c7dda4 100644 --- a/README.md +++ b/README.md @@ -29,17 +29,15 @@ Sorry, the zig version isn't there yet. You can test the old java version or ask Otherwise you can ### Compile Cubyz from source -1. Install git and zig (latest master release) +1. Install git 2. Clone this repository `git clone https://github.com/pixelguys/Cubyz` -3. Go into the folder `cd Cubyz` -4. Run zig `zig build run` -5. If it's too slow, run it in release: `zig build run -Doptimize=ReleaseFast` +3. Run `run.sh` (Linux) or `run.bat` (Windows) +4. If the game is too slow, run it in release: `run.sh -Doptimize=ReleaseFast` (Linux) or `run.bar -Doptimize=ReleaseFast` (Windows) #### Note for Linux Users: I also had to install a few `-dev` packages for the compilation to work: ``` sudo apt install libgl-dev libasound2-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxext-dev libxi-dev ``` -For Linux there is also a handy `run.sh` file that automatically downloads the correct zig version # Contributing ### Code diff --git a/run.bat b/run.bat new file mode 100644 index 00000000..32d47433 --- /dev/null +++ b/run.bat @@ -0,0 +1,24 @@ +@echo off + +set version=zig-windows-x86_64-0.12.0-dev.706+62a0fbdae + +if not exist "./compiler" mkdir "./compiler" +if not exist "./compiler/zig" mkdir "./compiler/zig" +if not exist "./compiler/version.txt" copy NUL "./compiler/version.txt" + +set /p curVersion=<"./compiler/version.txt" + +if not "%version%" == "%curVersion%" ( + echo "Deleting old zig installation..." + rmdir /s /q "./compiler/zig" + mkdir "./compiler/zig" + echo "Downloading %version%..." + powershell -Command "Invoke-WebRequest -uri https://ziglang.org/builds/%version%.zip -OutFile ./compiler/archive.zip" + echo "Extracting zip file..." + powershell Expand-Archive ".\compiler\archive.zip" -DestinationPath ".\compiler\zig" + echo "Done." + del ./compiler/archive.zip + echo %version%> "./compiler/version.txt" +) + +./compiler/zig/zig build run %* \ No newline at end of file diff --git a/run.sh b/run.sh index 61e44914..2415fdcf 100755 --- a/run.sh +++ b/run.sh @@ -5,17 +5,17 @@ version=zig-linux-x86_64-0.12.0-dev.706+62a0fbdae mkdir -p compiler/zig touch compiler/version.txt if [[ $(< compiler/version.txt) != "$version" ]]; then - echo "Deleting old zig installation..." - rm -r compiler/zig - mkdir compiler/zig - echo "Downloading zig version $version..." - wget -O compiler/archive.tar.xz https://ziglang.org/builds/$version.tar.xz - echo "Extracting tar file..." - tar --xz -xf compiler/archive.tar.xz --directory compiler/zig --strip-components 1 - echo "Done." - rm compiler/archive.tar.xz - rm compiler/version.txt - printf "$version" >> compiler/version.txt + echo "Deleting old zig installation..." + rm -r compiler/zig + mkdir compiler/zig + echo "Downloading $version..." + wget -O compiler/archive.tar.xz https://ziglang.org/builds/$version.tar.xz + echo "Extracting tar file..." + tar --xz -xf compiler/archive.tar.xz --directory compiler/zig --strip-components 1 + echo "Done." + rm compiler/archive.tar.xz + rm compiler/version.txt + printf "$version" >> compiler/version.txt fi ./compiler/zig/zig build run $@ \ No newline at end of file diff --git a/src/renderer.zig b/src/renderer.zig index 6e698633..ab5982f4 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -160,7 +160,6 @@ pub fn render(playerPosition: Vec3d) !void { } pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPos: Vec3d) !void { - _ = world; worldFrameBuffer.bind(); gpu_performance_measuring.startQuery(.clear); worldFrameBuffer.clear(Vec4f{skyColor[0], skyColor[1], skyColor[2], 1}); @@ -192,7 +191,7 @@ pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPo chunk.meshing.quadsDrawn = 0; chunk.meshing.transparentQuadsDrawn = 0; - const meshes = try RenderStructure.updateAndGetRenderChunks(game.world.?.conn, playerPos, settings.renderDistance, settings.LODFactor); + const meshes = try RenderStructure.updateAndGetRenderChunks(world.conn, playerPos, settings.renderDistance, settings.LODFactor); // for (ChunkMesh mesh : Cubyz.chunkTree.getRenderChunks(frustumInt, x0, y0, z0)) { // if (mesh instanceof NormalChunkMesh) {