work for today, hopefully tomorrow i will finish ambient occlusion
This commit is contained in:
parent
5a0691c155
commit
0b7eb66703
4 changed files with 10 additions and 21 deletions
2
raylib
2
raylib
|
|
@ -1 +1 @@
|
|||
Subproject commit 9cf901cdc6c4c6d4e399fa663f49bb969a5cff81
|
||||
Subproject commit 77e626060d3c5419c539edfa4fe4f268f9015ade
|
||||
|
|
@ -33,20 +33,11 @@ void main()
|
|||
|
||||
ivec2 floorFragTileTexCoord = ivec2(fragTileTexCoord);
|
||||
|
||||
//if(fragTileTexCoord.x < 1 && (int(occlusionSides.x >> floorFragTileTexCoord.x) & 1) == 1) {
|
||||
//if(fragTileTexCoord.x < 1 && (occlusionSides.x & uint(0x20000000)) > uint(0)) {
|
||||
//if(fragTileTexCoord.x < 1 && (occlusionSides.x & uint(0x40000000)) > uint(0)) {
|
||||
//if(fragTileTexCoord.x < 1 && (occlusionSides.x & uint(0x10000000)) > uint(0)) {
|
||||
|
||||
//if ((fragTileTexCoord.x < 1) && (occlusionSides.x > uint(0))) {
|
||||
|
||||
if(fragTileTexCoord.x < 1 && ((occlusionSides.x >> floorFragTileTexCoord.x) & uint(1)) == uint(1)) {
|
||||
if(floorFragTileTexCoord.x < 1 && ((occlusionSides.x >> floorFragTileTexCoord.x) & uint(1)) == uint(1)) {
|
||||
outColor *= 0.5 + fakeArcsin(fragTileTexCoord.x);
|
||||
}
|
||||
|
||||
outColor.a = 1;
|
||||
outColor.r = occlusionSides.x > uint(0) ? 1.0 : 0.0;
|
||||
//outColor.g = ((occlusionSides.x & uint(0x01000000)) > uint(0)) ? 1.0 : 0.0;
|
||||
|
||||
uint bit = uint(fragTileTexCoord * 32);
|
||||
outColor.g = (((occlusionSides.x >> bit) & uint(1)) == uint(1)) ?
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ pub fn main() !void {
|
|||
var chunk = try chunks.Chunk.init(a7r);
|
||||
defer chunk.deinit();
|
||||
|
||||
const height_generator = znoise.FnlGenerator{ .seed = 413445 };
|
||||
// const height_generator = znoise.FnlGenerator{ .seed = 413445 };
|
||||
const tile_type_generator = znoise.FnlGenerator{ .seed = 4435, .frequency = 0.1 };
|
||||
for (0..32) |raw_x| for (0..32) |raw_y| for (0..32) |raw_z| {
|
||||
const x: u5 = @intCast(raw_x);
|
||||
|
|
@ -83,9 +83,10 @@ pub fn main() !void {
|
|||
const xf: f32 = @floatFromInt(raw_x);
|
||||
const yf: f32 = @floatFromInt(raw_y);
|
||||
const zf: f32 = @floatFromInt(raw_z);
|
||||
const height: f32 = (height_generator.noise2(xf, zf) + 1) * 16 + @as(f32, if(x > 24) 4.0 else 0.0) + @as(f32, if(z < 8) 4.0 else 0.0);
|
||||
const tile_type: u32 = if (tile_type_generator.noise3(xf, yf, zf) > 0) 1 else 2;
|
||||
if (height >= yf) chunk.setTile(x, y, z, tile_type);
|
||||
// const height: f32 = (height_generator.noise2(xf, zf) + 1) * 16 + @as(f32, if(x > 24) 4.0 else 0.0) + @as(f32, if(z < 8) 4.0 else 0.0);
|
||||
// if (height >= yf) chunk.setTile(x, y, z, tile_type);
|
||||
if((xf-16)*(xf-16)+(yf-16)*(yf-16)+(zf-16)*(zf-16) < 16*16) chunk.setTile(x, y, z, tile_type);
|
||||
};
|
||||
|
||||
if (benchmark_chunk_meshing) {
|
||||
|
|
|
|||
|
|
@ -117,9 +117,6 @@ pub const Chunk = struct {
|
|||
const zleft: f32 = if (sign == 1) zmin else zmax;
|
||||
const zright: f32 = if (sign == 1) zmax else zmin;
|
||||
|
||||
_ = y_minus_obscuring_pattern;
|
||||
_ = y_plus_obscuring_pattern;
|
||||
_ = z_plus_obscuring_pattern;
|
||||
if(dimention == 0 and z_minus_obscuring_pattern == 0b10000){
|
||||
std.debug.print("z_minus_obscuring_pattern {b}\n", .{z_minus_obscuring_pattern});
|
||||
std.debug.print("dimension {}\n", .{dimention});
|
||||
|
|
@ -141,10 +138,10 @@ pub const Chunk = struct {
|
|||
.width = zmax - zmin,
|
||||
.height = ymax - ymin,
|
||||
|
||||
.top_obscuring_pattern = 0, //z_plus_obscuring_pattern,
|
||||
.left_obscuring_pattern = if(z_minus_obscuring_pattern == 0b10000) 0x80 else 0,
|
||||
.right_obscuring_pattern = 0, //y_plus_obscuring_pattern,
|
||||
.bottom_obscuring_pattern = 0, //y_minus_obscuring_pattern,
|
||||
.top_obscuring_pattern = z_plus_obscuring_pattern,
|
||||
.left_obscuring_pattern = z_minus_obscuring_pattern,
|
||||
.right_obscuring_pattern = y_plus_obscuring_pattern,
|
||||
.bottom_obscuring_pattern = y_minus_obscuring_pattern,
|
||||
.top_left_obscured = false,
|
||||
.top_right_obscured = false,
|
||||
.bottom_right_obscured = false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue