This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@group(0) @binding(0) var<storage, read_write> WORLD_DATA: array<vec2u>; | |
struct TEMPLATE_DATA_STRUCT { | |
segment_1: u32, | |
segment_2: u32, | |
segment_3: array<u32,12>, | |
segment_4: array<u32,3> | |
} | |
@group(0) @binding(1) var<storage, read_write> TEMPLATE_DATA: array<TEMPLATE_DATA_STRUCT>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE!: vec3u is padded to by 4 bytes | |
@group(0) @binding(0) var<storage, read_write> worldData: array<vec2u>; | |
@group(0) @binding(1) var<uniform> processingOptions: vec3<f32>; | |
fn generate_column(column_position: vec3<f32>) { | |
//put code here | |
let minY: f32 = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from "http"; | |
import fs from "fs/promises"; | |
const host = "localhost"; | |
const port = 8000; | |
const getFile = async (path: string) => { | |
try { | |
return await fs.readFile(`./public/${path}`); | |
} catch (e) { | |
return new Uint8Array(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Based on this article: | |
https://dmauro.com/post/77011214305/a-hashing-function-for-x-y-z-coordinates | |
*/ | |
const mask = (n) => { | |
if (n >= 0) { | |
return 2 * n; | |
} else { | |
return -2 * n - 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chunk : number[][][] = []; | |
const blockBytes : number[] = []; | |
for(const x of chunk.keys()) { | |
for(const z of chunk[x].keys()) { | |
for(const y of chunk[x][z].keys()) { | |
const block = chunk[x][z][y]; | |
if(!block)continue; | |
let blockByte = 0; | |
if(!chunk[x][z][y + 1]) { | |
blockByte = setBit(blockByte,0,1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBit(number : number, index: number): 0 | 1 { | |
if (index > 7 || index < 0) { | |
throw new Error("Index is out of range. Acceptable range is 0 - 7"); | |
} | |
const value = (number >>> index) & 1; | |
return <0 | 1>value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setBit(number : number,index: number, value: 0 | 1) { | |
if (index > 7 || index < 0) { | |
throw new Error("Index is out of range. Acceptable range is 0 - 7"); | |
} | |
if (value < 0 || value > 1) { | |
throw new Error("Value is not in range. Acceptable range is 0 - 1"); | |
} | |
const setValue = 1 << index; | |
if (!value) { | |
number = number & ~setValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type BinaryNums = 0 | 1; | |
type BinraryArray = BinaryNums[]; | |
export class InfoByte { | |
constructor(private byteValue: number = 0) {} | |
getNumberValue() { | |
return this.byteValue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dsCom: DSCommander = require("dscom"); | |
(async () => { | |
let mode = ""; | |
dsCom.addParam({ | |
flag : "m", | |
desc : "Program Mode", | |
name : "mode", | |
type : "string" | |
}); | |
await dsCom.initProgramInput(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dsCom: DSCommander = require("dscom"); | |
(async () => { | |
dsCom | |
.ask("What is the first number?", "num1", "number") | |
.ask("What is the second number", "num2", "number"); | |
await dsCom.startPrompt(); | |
const num1 = parseInt(<string>dsCom.getInput("num1")); | |
const num2 = parseInt(<string>dsCom.getInput("num2")); | |
const total = num1 + num2; | |
dsCom.BR.C.logSleep([`${num1} + ${num2}`]).CLEAR.BR.G.logSleep([total]); |
NewerOlder