Compare commits

..

4 Commits

Author SHA1 Message Date
itycodes 6f04e54627 Skybox rendering
10 months ago
itycodes a5bbd536ca Fix mistakes in movement code
10 months ago
Avery d7615e5658
New movement controller
10 months ago
Avery a50b95de09
Fixed movement controller, nix flake
11 months ago

@ -0,0 +1,61 @@
{
"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
}

@ -0,0 +1,33 @@
{
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,4 +1,7 @@
#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;
@ -10,7 +13,8 @@ layout(push_constant, std430) uniform pc {
}; };
void main() { void main() {
outColor = vec4(data.rgb*(1.0+dot(normal.xyz, normalize(vec3(-0.7, -0.5, -0.1))))/2.0, 1.0); 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);
//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,8 +1,13 @@
#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 {
mat2x4 posnrm[]; PosNorm posnrm[];
} pos; } pos;
layout(push_constant, std430) uniform pc { layout(push_constant, std430) uniform pc {
@ -20,16 +25,22 @@ const float TAU = PI*2.0;
void main() { void main() {
// assign outs // assign outs
normal = pos.posnrm[gl_VertexIndex][1]; normal = pos.posnrm[gl_VertexIndex].norm;
pos_pre = pos.posnrm[gl_VertexIndex][0]; pos_pre = pos.posnrm[gl_VertexIndex].pos;
// 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][0]; gl_Position = pos.posnrm[gl_VertexIndex].pos;
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,
@ -73,9 +84,14 @@ 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;
@ -107,4 +123,5 @@ 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