Minor fixes and refactors
This commit is contained in:
2
castle
2
castle
Submodule castle updated: af5f035830...99b8cf1d8e
@@ -123,13 +123,13 @@ pub fn refresh(self: *Chunk, blocks: *const Blocks, neighbors: Neighbors) !void
|
||||
if (wall.material != .empty and self.getOpposite(side, ix, iy, iz, blocks, neighbors) == .empty) {
|
||||
const matrix = getMatrix(side, origin);
|
||||
try uniforms.append(allocator_frame, .{
|
||||
.matrixOStoWS_i = matrix.getIVersor().dropW(),
|
||||
.matrixOStoWS_j = matrix.getJVersor().dropW(),
|
||||
.matrixOStoWS_k = matrix.getKVersor().dropW(),
|
||||
.matrixOStoWS_t = matrix.getTranslationVector().dropW(),
|
||||
|
||||
.matrixOStoWS = .{
|
||||
matrix.getIVersor().dropW(),
|
||||
matrix.getJVersor().dropW(),
|
||||
matrix.getKVersor().dropW(),
|
||||
matrix.getTranslationVector().dropW(),
|
||||
},
|
||||
.texCoordTransform = wall.transform.getMatrix(),
|
||||
|
||||
.material = wall.material,
|
||||
});
|
||||
}
|
||||
|
||||
17
src/Game.zig
17
src/Game.zig
@@ -86,9 +86,9 @@ pub fn init() !Game {
|
||||
.mag_filter = .linear,
|
||||
.min_filter = .linear,
|
||||
.mipmap_mode = .linear,
|
||||
.address_mode_u = .repeat,
|
||||
.address_mode_v = .repeat,
|
||||
.address_mode_w = .repeat,
|
||||
.address_mode_u = .clamp_to_edge,
|
||||
.address_mode_v = .clamp_to_edge,
|
||||
.address_mode_w = .clamp_to_edge,
|
||||
.mip_lod_bias = 0,
|
||||
.anisotropy_enable = .false,
|
||||
.max_anisotropy = 0,
|
||||
@@ -909,11 +909,12 @@ fn render(self: *Game) !void {
|
||||
const ambient_light = vm.Vector3.init(0.01, 0.01, 0.01);
|
||||
|
||||
self.global_uniforms_staging_ptr.* = .{
|
||||
.matrixWStoVS_i = matrix_ws_to_vs.getIVersor().dropW(),
|
||||
.matrixWStoVS_j = matrix_ws_to_vs.getJVersor().dropW(),
|
||||
.matrixWStoVS_k = matrix_ws_to_vs.getKVersor().dropW(),
|
||||
.matrixWStoVS_t = matrix_ws_to_vs.getTranslationVector().dropW(),
|
||||
|
||||
.matrixWStoVS = .{
|
||||
matrix_ws_to_vs.getIVersor().dropW(),
|
||||
matrix_ws_to_vs.getJVersor().dropW(),
|
||||
matrix_ws_to_vs.getKVersor().dropW(),
|
||||
matrix_ws_to_vs.getTranslationVector().dropW(),
|
||||
},
|
||||
.matrixVStoCS = matrix_vs_to_cs,
|
||||
.matrixSSPXtoCS = matrix_sspx_to_cs,
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ pub fn init() !*Gui {
|
||||
.mag_filter = .linear,
|
||||
.min_filter = .linear,
|
||||
.mipmap_mode = .linear,
|
||||
.address_mode_u = .repeat,
|
||||
.address_mode_v = .repeat,
|
||||
.address_mode_w = .repeat,
|
||||
.address_mode_u = .clamp_to_edge,
|
||||
.address_mode_v = .clamp_to_edge,
|
||||
.address_mode_w = .clamp_to_edge,
|
||||
.mip_lod_bias = 0,
|
||||
.anisotropy_enable = .false,
|
||||
.max_anisotropy = 0,
|
||||
|
||||
@@ -44,11 +44,7 @@ pub const Vertex = extern struct {
|
||||
pub const Index = u16;
|
||||
|
||||
pub const GlobalUniforms = extern struct {
|
||||
matrixWStoVS_i: vm.Vector3,
|
||||
matrixWStoVS_j: vm.Vector3,
|
||||
matrixWStoVS_k: vm.Vector3,
|
||||
matrixWStoVS_t: vm.Vector3,
|
||||
|
||||
matrixWStoVS: [4]vm.Vector3,
|
||||
matrixVStoCS: vm.Matrix4x4,
|
||||
matrixSSPXtoCS: vm.Matrix3x2,
|
||||
|
||||
@@ -98,13 +94,8 @@ pub const Material = extern struct {
|
||||
|
||||
pub const ObjectUniforms = extern struct {
|
||||
// Limited to a composition of translation and rotation
|
||||
matrixOStoWS_i: vm.Vector3,
|
||||
matrixOStoWS_j: vm.Vector3,
|
||||
matrixOStoWS_k: vm.Vector3,
|
||||
matrixOStoWS_t: vm.Vector3,
|
||||
|
||||
matrixOStoWS: [4]vm.Vector3,
|
||||
texCoordTransform: vm.Matrix3x2,
|
||||
|
||||
material: Materials.Id,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user