Skip to content

Commit

Permalink
???
Browse files Browse the repository at this point in the history
  • Loading branch information
Pannoniae committed Sep 12, 2024
1 parent 2e1765f commit 57e42dc
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 8 deletions.
1 change: 1 addition & 0 deletions BlockGame.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollectionsMarshal_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F333c45fb859b4b8879aa166857cffe8a8bbd12ec22c6bb7144c01c4fadbd44_003FCollectionsMarshal_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollectionsMarshal_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F6381eca44c5bf27e971899bd4745e3a717acc851947313c2a767a43e18c21357_003FCollectionsMarshal_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollisionHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cfec35914b54ad8b5a9e578d6e61749ad800_003F47_003Ffdd13684_003FCollisionHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColor4D_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cfec35914b54ad8b5a9e578d6e61749ad800_003F43_003F0d56f3f0_003FColor4D_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColor4_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cfec35914b54ad8b5a9e578d6e61749ad800_003Fd1_003F0cfe4c99_003FColor4_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cfec35914b54ad8b5a9e578d6e61749ad800_003F86_003Fcea27348_003FColor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F0ae181a25dcbad0d6ba7bc6ad41d3f4a6ee366953ff464a3d6e115b5587819_003FColor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
Expand Down
9 changes: 9 additions & 0 deletions src/GL/BlockVAO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ public BlockVertexTinted(float x, float y, float z, float u, float v, byte r, by
this.a = a;
}

public BlockVertexTinted(float x, float y, float z, float u, float v, Color c) {
this.x = x;
this.y = y;
this.z = z;
this.u = (Half)u;
this.v = (Half)v;
this.c = c;
}

public BlockVertexTinted(float x, float y, float z, Half u, Half v, Color c) {
this.x = x;
this.y = y;
Expand Down
59 changes: 58 additions & 1 deletion src/render/model/Cube.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
using BlockGame.util;
using Molten;
using Molten.DoublePrecision;

namespace BlockGame.model;

/// <summary>
/// A cube has 6 faces and 24 verts overall.
/// It has a position, and vertices can are added to it.
/// </summary>
public class Cube {

public readonly BlockVertexTinted[] vertices = new BlockVertexTinted[24];

/// <summary>
/// The position of the cube.
/// </summary>
public Vector3D position;


/// <summary>
/// The the relative position of the cube (from the base position)
/// </summary>
public Vector3D cubePos;

/// <summary>
/// The rotation of the cube (from the base position)
/// </summary>
public Vector3D rotation;

/// <summary>
/// The extents of the cube.
/// </summary>
public Vector3D ext;

public Cube(Vector3D cubePos, Vector3D ext, double expand, UVPair[] uvs) {
this.cubePos = cubePos - expand;
this.ext = ext + expand * 2;

if (uvs == null || uvs.Length != 6) {
throw new ArgumentException("UVs must be of length 6");
}

var colour = Color.White;
// generate vertices
// west

}

public Cube pos(Vector3D pos) {
position = pos;
return this;
}

public Cube rot(Vector3D rot) {
rotation = rot;
return this;
}

public void render(double scale) {

}
}
14 changes: 7 additions & 7 deletions src/util/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public readonly record struct Direction {
public static readonly Vector3I UP = new(0, 1, 0);
public static readonly Vector3I SELF = new(0, 0, 0);

public static Vector3I[] directions = [WEST, EAST, SOUTH, NORTH, DOWN, UP];
public static Vector3I[] directionsLight = [DOWN, UP, WEST, EAST, SOUTH, NORTH];
public static Vector3I[] directionsWaterSpread = [WEST, EAST, SOUTH, NORTH, DOWN];
public static Vector3I[] directionsHorizontal = [WEST, EAST, SOUTH, NORTH];
public static Vector3I[] directionsDiag = [WEST, EAST, SOUTH, NORTH, DOWN, UP, WEST + SOUTH, WEST + NORTH, EAST + SOUTH, EAST + NORTH];
public static Vector3I[] directionsAll = new Vector3I[27];
public static Vector3I[] directionsSelf = [WEST, EAST, SOUTH, NORTH, DOWN, UP, SELF];
public static readonly Vector3I[] directions = [WEST, EAST, SOUTH, NORTH, DOWN, UP];
public static readonly Vector3I[] directionsLight = [DOWN, UP, WEST, EAST, SOUTH, NORTH];
public static readonly Vector3I[] directionsWaterSpread = [WEST, EAST, SOUTH, NORTH, DOWN];
public static readonly Vector3I[] directionsHorizontal = [WEST, EAST, SOUTH, NORTH];
public static readonly Vector3I[] directionsDiag = [WEST, EAST, SOUTH, NORTH, DOWN, UP, WEST + SOUTH, WEST + NORTH, EAST + SOUTH, EAST + NORTH];
public static readonly Vector3I[] directionsAll = new Vector3I[27];
public static readonly Vector3I[] directionsSelf = [WEST, EAST, SOUTH, NORTH, DOWN, UP, SELF];

static Direction() {
// construct 27-box of all directions
Expand Down

0 comments on commit 57e42dc

Please sign in to comment.