Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pannoniae committed Aug 29, 2024
1 parent 0d857b1 commit 23a0fd4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .run/BlockGame.run.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BlockGame" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/bin/Release/net9.0/BlockGame.exe" />
<option name="EXE_PATH" value="$PROJECT_DIR$/bin/Debug/net9.0/BlockGame" />
<option name="PROGRAM_PARAMETERS" value="--dev" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/bin/Release/net9.0" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/bin/Debug/net9.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<envs>
<env name="DOTNET_EnableWriteXorExecute" value="0" />
<env name="DOTNET_LegacyExceptionHandling" value="1" />
<env name="MALLOC_ARENA_MAX" value="2" />
</envs>
<option name="USE_EXTERNAL_CONSOLE" value="0" />
Expand Down
2 changes: 2 additions & 0 deletions BlockGame.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AKeys_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F406fff25b4a94b8b9f0197cde0774ec514da0_003F8d_003Fe4fdc38f_003FKeys_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AKey_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fea488c63231b42228efc7f0ed3b60217a1a0_003F76_003F81592fa7_003FKey_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3712a13b205a97fe0e8afddc0cf36f285106f97dd7e3f21a120e9f6bbdd124_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMarshal_002EUnix_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe0e2d11fbc86b08695afc212293771a75639ab76f2937689cb3b8dbe31cd6b_003FMarshal_002EUnix_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMathF_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fc7e8693bcd2b99ff1026be64bbccf25616a97d935ce156de9eca6e0523313a3_003FMathF_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMatrix4F_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cfec35914b54ad8b5a9e578d6e61749ad800_003F39_003F7ad60054_003FMatrix4F_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMatrix4X4_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe445a7db98e64ffc9f5bfeafad0d34d7501a0_003F2a_003F625192c8_003FMatrix4X4_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
Expand All @@ -49,6 +50,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANVViewportSwizzle_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F674dc3a0100b4afd94644b6d0863aad6877a0_003Fdc_003Ff865c0ef_003FNVViewportSwizzle_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANvxProgressFence_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Faa30fcfea0c14feba53a2fd179063fcc11da0_003Fbf_003F6c59f69c_003FNvxProgressFence_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANV_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F674dc3a0100b4afd94644b6d0863aad6877a0_003F07_003Ff0b31747_003FNV_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOSPlatform_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F9e988c941e6515999ebab7336243c87df16e340b8faeb57b5f562d2b8a7c2c_003FOSPlatform_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APlane_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F56d711421813f9c55c53b36da631f65ea41a4e70816a87b292db1115ca4c0_003FPlane_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APlane_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fd3dcccdc63aac1732584c75613ee3fe953c5cf50c7c3f96a1d999a7e76c4c_003FPlane_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APlane_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe445a7db98e64ffc9f5bfeafad0d34d7501a0_003F18_003Fe6ee8535_003FPlane_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
Expand Down
3 changes: 3 additions & 0 deletions src/main/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using TrippyGL;
using DebugSeverity = Silk.NET.OpenGL.DebugSeverity;
using DebugSource = Silk.NET.OpenGL.DebugSource;
using DebugType = Silk.NET.OpenGL.DebugType;
using DepthFunction = TrippyGL.DepthFunction;
using Image = SixLabors.ImageSharp.Image;
using IWindow = Silk.NET.Windowing.IWindow;
Expand Down
8 changes: 6 additions & 2 deletions src/render/WorldRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Numerics;
using System.Runtime.InteropServices;
using BlockGame.ui;
using BlockGame.util;
Expand Down Expand Up @@ -69,6 +70,8 @@ public WorldRenderer(World world) {
Game.dummyShader = dummyShader;
waterShader = new Shader(GL, "shaders/waterShader.vert", "shaders/waterShader.frag");
Game.waterShader = waterShader;

shader.use();
blockTexture = shader.getUniformLocation("blockTexture");
lightTexture = shader.getUniformLocation("lightTexture");
uMVP = shader.getUniformLocation(nameof(uMVP));
Expand All @@ -80,6 +83,7 @@ public WorldRenderer(World world) {
skyColour = shader.getUniformLocation(nameof(skyColour));
//drawDistance = shader.getUniformLocation(nameof(drawDistance));

waterShader.use();
waterBlockTexture = waterShader.getUniformLocation("blockTexture");
waterLightTexture = waterShader.getUniformLocation("lightTexture");
wateruMVP = waterShader.getUniformLocation(nameof(uMVP));
Expand Down Expand Up @@ -176,7 +180,7 @@ public void render(double interp) {
shader.use();
var cameraPos = world.player.camera.renderPosition(interp);
shader.setUniform(uMVP, viewProj);
shader.setUniform(uCameraPos, 0);
shader.setUniform(uCameraPos, new Vector3(0));
foreach (var chunk in chunkList) {
if (!chunk.isRendered) {
continue;
Expand Down Expand Up @@ -213,7 +217,7 @@ public void render(double interp) {
// TRANSLUCENT PASS
waterShader.use();
waterShader.setUniform(wateruMVP, viewProj);
waterShader.setUniform(wateruCameraPos, 0);
waterShader.setUniform(wateruCameraPos, new Vector3(0));
GL.ColorMask(true, true, true, true);
GL.DepthMask(false);
GL.DepthFunc(DepthFunction.Lequal);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/menu/IngameMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void updateDebugTextMethod() {
debugStrG.Clear();
if (Game.devMode) {
debugStr.AppendFormat("{0:0.000}, {1:0.000}, {2:0.000}\n", p.position.X, p.position.Y, p.position.Z);
debugStr.AppendFormat("vx:{0:0.000}, vy:{1:0.000}, vz:{2:0.000}, vl:{3:0.000}\n", p.velocity.X, p.velocity.Y, p.velocity.Z, p.velocity.Length);
debugStr.AppendFormat("vx:{0:0.000}, vy:{1:0.000}, vz:{2:0.000}, vl:{3:0.000}\n", p.velocity.X, p.velocity.Y, p.velocity.Z, p.velocity.Length());
debugStr.AppendFormat("ax:{0:0.000}, ay:{1:0.000}, az:{2:0.000}\n", p.accel.X, p.accel.Y, p.accel.Z);
debugStr.AppendFormat("cf:{0:0.000}, {1:0.000}, {2:0.000}\n", c.forward.X, c.forward.Y, c.forward.Z);
debugStr.AppendFormat("sl:{0}, bl:{1}\n", sl, bl);
Expand Down
8 changes: 4 additions & 4 deletions src/world/PlayerRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PlayerRenderer {
public double lower;

private int uMVP;
private int blockTexture;
private int tex;

public Shader heldBlockShader;

Expand All @@ -30,9 +30,9 @@ public PlayerRenderer(Player player) {
vao = new StreamingVAO<BlockVertexTinted>();
vao.bind();
vao.setSize(Face.MAX_FACES * 4);
heldBlockShader = new Shader(Game.GL, "shaders/simpleBlock.vert", "shaders/simpleBlock.frag");
heldBlockShader = new Shader(Game.GL, "shaders/instantVertex.vert", "shaders/instantVertex.frag");
uMVP = heldBlockShader.getUniformLocation("uMVP");
blockTexture = heldBlockShader.getUniformLocation("blockTexture");
tex = heldBlockShader.getUniformLocation("tex");
}

public double getLower(double dt) {
Expand Down Expand Up @@ -73,7 +73,7 @@ public void render(double dt, double interp) {
Matrix4x4.CreateTranslation((float)(sinSwingSqrt * -0.7f), (float)(circleishThing * 0.35f), (float)(sinSwing * 0.6f));
heldBlockShader.use();
heldBlockShader.setUniform(uMVP, mat * player.camera.getHandViewMatrix(interp) * player.camera.getFixedProjectionMatrix());
heldBlockShader.setUniform(blockTexture, 0);
heldBlockShader.setUniform(tex, 0);
vao.render();
}

Expand Down
2 changes: 1 addition & 1 deletion src/world/chunk/ArrayBlockData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public sealed class ArrayBlockData : BlockData, IDisposable {
}

/// <summary>
/// Your reponsibility to update the counts after a batch of changes.
/// Your responsibility to update the counts after a batch of changes.
/// </summary>
public void fastSet(int x, int y, int z, ushort value) {
if (!inited && value != 0) {
Expand Down

0 comments on commit 23a0fd4

Please sign in to comment.