implement world generator, frustum culling and rebuild queue
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
window.EnumWorldBlockLayer = class {
|
||||
static SOLID = 0;
|
||||
static CUTOUT = 0;
|
||||
}
|
||||
@@ -8,4 +8,12 @@ window.MathHelper = class {
|
||||
return value < i ? i - 1 : i;
|
||||
}
|
||||
|
||||
static toDegrees(angle) {
|
||||
return angle * (180 / Math.PI);
|
||||
}
|
||||
|
||||
static toRadians(degree) {
|
||||
return degree * (Math.PI / 180);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
window.Random = class {
|
||||
|
||||
constructor(seed) {
|
||||
this.mask = 0xffffffff;
|
||||
this.m_w = (123456789 + seed) & this.mask;
|
||||
this.m_z = (987654321 - seed) & this.mask;
|
||||
}
|
||||
|
||||
nextBoolean() {
|
||||
return this.nextFloat() > 0.5;
|
||||
}
|
||||
|
||||
nextInt(max) {
|
||||
return Math.floor(this.nextFloat() * (max + 1));
|
||||
}
|
||||
|
||||
nextFloat() {
|
||||
this.m_z = (36969 * (this.m_z & 65535) + (this.m_z >>> 16)) & this.mask;
|
||||
this.m_w = (18000 * (this.m_w & 65535) + (this.m_w >>> 16)) & this.mask;
|
||||
|
||||
let result = ((this.m_z << 16) + (this.m_w & 65535)) >>> 0;
|
||||
result /= 4294967296;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user