FINALLY i have the fucking ball
This commit is contained in:
parent
a79ba6f606
commit
37fb3b1868
@ -21,9 +21,6 @@ class CubeFace {
|
||||
|
||||
this.position = pos
|
||||
|
||||
this.transform = mat4.create()
|
||||
mat4.fromTranslation(this.transform, this.position)
|
||||
|
||||
// Center the face
|
||||
this.position = subv3(this.position, mulv3(this.left, this.radius / 2))
|
||||
this.position = subv3(this.position, mulv3(this.forward, this.radius / 2))
|
||||
@ -35,7 +32,7 @@ class CubeFace {
|
||||
if (this.generated) return
|
||||
|
||||
let VERTICES = this.resolution
|
||||
let count = (VERTICES - 1) * (VERTICES - 1)
|
||||
let count = VERTICES * VERTICES
|
||||
let vertices = new Array(count * 3)
|
||||
// let normals = new Array(count * 3)
|
||||
let textureCoords = new Array(count * 2)
|
||||
@ -103,6 +100,9 @@ class CubePlanet {
|
||||
this.resolution = resolution
|
||||
this.radius = radius
|
||||
|
||||
this.transform = mat4.create()
|
||||
mat4.fromTranslation(this.transform, origin)
|
||||
|
||||
let hs = radius / 2
|
||||
|
||||
this.faces = [
|
||||
@ -115,6 +115,10 @@ class CubePlanet {
|
||||
new CubeFace(this, 0, [0, hs, 0], [0, 1, 0], resolution, radius, generator), // top
|
||||
new CubeFace(this, 0, [0, -hs, 0], [0, -1, 0], resolution, radius, generator) // bottom
|
||||
]
|
||||
|
||||
for (let i in this.faces) {
|
||||
this.faces[i].transform = this.transform
|
||||
}
|
||||
}
|
||||
|
||||
draw (gl, shader) {
|
||||
|
@ -38,7 +38,7 @@ async function pipeline () {
|
||||
cam.updateProjection(game.gl)
|
||||
|
||||
// Planet test
|
||||
let planet = new CubePlanet([0.0, 0.0, 0.0], 16, 36)
|
||||
let planet = new CubePlanet([0.0, 0.0, 0.0], 16, 128)
|
||||
|
||||
// Update function for camera
|
||||
game.addUpdateFunction(function (dt) {
|
||||
|
Loading…
Reference in New Issue
Block a user