Compare commits

..

1 Commits

Author SHA1 Message Date
Avery b8bc03b2f2
Reduce unsafe blocks, make clippy happy
4 months ago

@ -1,61 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1743315132,
"narHash": "sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om+D4UnDhlDW9BE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "52faf482a3889b7619003c0daec593a1912fddc1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -1,33 +0,0 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
lib = nixpkgs.lib;
in {
devShells.default = pkgs.mkShell {
VULKAN_SDK = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
# LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${pkgs.SDL2}/lib/";
LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [SDL2 vulkan-loader]);
buildInputs = with pkgs; [
SDL2
SDL2.dev
vulkan-headers
vulkan-loader
vulkan-validation-layers # maybe?
# glm and whatnot …
];
};
});
}

Binary file not shown.

@ -1,7 +1,4 @@
#version 450 #version 450
// vim: ft=c
//
layout(binding = 1) uniform samplerCube combined_image;
layout(location = 0) out vec4 outColor; layout(location = 0) out vec4 outColor;
@ -13,8 +10,7 @@ layout(push_constant, std430) uniform pc {
}; };
void main() { void main() {
outColor = texture(combined_image, vec3(pos_pre)); outColor = vec4(data.rgb*(1.0+dot(normal.xyz, normalize(vec3(-0.7, -0.5, -0.1))))/2.0, 1.0);
// outColor = vec4(data.rgb*(1.0+dot(normal.xyz, normalize(vec3(-0.7, -0.5, -0.1))))/2.0, 1.0);
//if(pos_post.z <= 0.0) { //if(pos_post.z <= 0.0) {
// outColor = vec4(1.0); // outColor = vec4(1.0);
//} //}

Binary file not shown.

Binary file not shown.

@ -1,13 +1,8 @@
#version 450 #version 450
// vim: ft=c // vim: ft=c
struct PosNorm {
vec4 pos;
vec4 norm;
};
layout(std430, set = 0, binding = 0) buffer positions_buffer { layout(std430, set = 0, binding = 0) buffer positions_buffer {
PosNorm posnrm[]; mat2x4 posnrm[];
} pos; } pos;
layout(push_constant, std430) uniform pc { layout(push_constant, std430) uniform pc {
@ -25,22 +20,16 @@ const float TAU = PI*2.0;
void main() { void main() {
// assign outs // assign outs
normal = pos.posnrm[gl_VertexIndex].norm; normal = pos.posnrm[gl_VertexIndex][1];
pos_pre = pos.posnrm[gl_VertexIndex].pos; pos_pre = pos.posnrm[gl_VertexIndex][0];
// define constants // define constants
const float zFar = 100.0; const float zFar = 100.0;
const float zNear = 0.1; const float zNear = 0.1;
// assign the transformee // assign the transformee
gl_Position = pos.posnrm[gl_VertexIndex].pos; gl_Position = pos.posnrm[gl_VertexIndex][0];
mat4 fix_coordinates = mat4(
-1.0, 0.0, 0.0, 0.0,
0.0, -1.0, 0.0, 0.0,
0.0, 0.0, -1.0, 0.0,
0.0, 0.0, 0.0, 1.0
);
mat4 view_orig = mat4( mat4 view_orig = mat4(
1.0, 0.0, 0.0, cam_orig.x, 1.0, 0.0, 0.0, cam_orig.x,
0.0, 1.0, 0.0, cam_orig.y, 0.0, 1.0, 0.0, cam_orig.y,
@ -84,14 +73,9 @@ void main() {
0.0, 0.0, 0.0, 1.0 0.0, 0.0, 0.0, 1.0
); );
// vulkan has inverted screen coordinates
// but we want regular mesh coordinates
// gl_Position.xyz *= -1.0
gl_Position *= fix_coordinates;
// apply view's origin transformation // apply view's origin transformation
//gl_Position.xyz += cam_orig.xyz; //gl_Position.xyz += cam_orig.xyz;
// gl_Position *= view_orig; gl_Position *= view_orig;
// apply view's xz rotation // apply view's xz rotation
//mat2 xz_rot; //mat2 xz_rot;
@ -123,5 +107,4 @@ void main() {
// z normalization // z normalization
//gl_Position.z /= zFar; //gl_Position.z /= zFar;
gl_Position *= project_normal; gl_Position *= project_normal;
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save