This commit is contained in:
monsterkodi 2016-08-20 22:30:36 +02:00
parent 109fa0185a
commit 6dcab21574
4 changed files with 393 additions and 107 deletions

View File

@ -14,14 +14,15 @@ Geom = require './geom'
class Gear extends Valve
constructor: (@face) ->
super @face
@updateMesh()
createMesh: ->
@mesh = new THREE.Mesh Geom.gear(), Cage.cageMat
@mesh.add new THREE.Mesh Geom.valve(), Cage.rasterMat
@mesh.receiveShadow = true
super @face
@updateMesh()
getNeighborDirections: (face) ->
neighbors = [
[[0,1,0], [0,-1,0], [0,0,1], [0,0,-1]]

View File

@ -5,6 +5,8 @@
# 0000000 00000000 000 000 00000000 000 000 000 000 000 0000000 000 000
Gear = require './gear'
Geom = require './geom'
Cage = require './cage'
Wire = require './wire'
class Generator extends Gear
@ -12,6 +14,11 @@ class Generator extends Gear
constructor: (face) ->
super face
createMesh: ->
@mesh = new THREE.Mesh Geom.gear(), Cage.cageMat
@mesh.add new THREE.Mesh Geom.generator(), Cage.rasterMat
@mesh.receiveShadow = true
activateWires: ->
wires = world.getObjectsOfTypeAtPos Wire, @getPos()

View File

@ -10,8 +10,33 @@ Vector = require './lib/vector'
class Geom
@generator: ->
quads = 12+4*8+8*4
triangles = quads*2
positions = new Float32Array triangles*9
normals = new Float32Array triangles*9
pi = -1
pi = @quadList positions, normals, pi, @generatorQuads
pi = @quadStrip positions, normals, pi, @generatorQuadStrip1
pi = @quadStrip positions, normals, pi, @generatorQuadStrip2
pi = @quadStrip positions, normals, pi, @generatorQuadStrip3
pi = @quadStrip positions, normals, pi, @generatorQuadStrip4
pi = @quadStrip positions, normals, pi, @generatorQuadStrip5
pi = @quadStrip positions, normals, pi, @generatorQuadStrip6
pi = @quadStrip positions, normals, pi, @generatorQuadStrip7
pi = @quadStrip positions, normals, pi, @generatorQuadStrip8
pi = @quadStrip positions, normals, pi, @generatorQuadStrip9
pi = @quadStrip positions, normals, pi, @generatorQuadStrip10
pi = @quadStrip positions, normals, pi, @generatorQuadStrip11
pi = @quadStrip positions, normals, pi, @generatorQuadStrip12
geom = new THREE.BufferGeometry
geom.addAttribute 'position', new THREE.BufferAttribute positions, 3
geom.addAttribute 'normal', new THREE.BufferAttribute normals, 3
geom
@valve: ->
quads = 6+5*8 # valve
quads = 6+5*8
triangles = quads*2
positions = new Float32Array triangles*9
normals = new Float32Array triangles*9
@ -25,11 +50,11 @@ class Geom
geom = new THREE.BufferGeometry
geom.addAttribute 'position', new THREE.BufferAttribute positions, 3
geom.addAttribute 'normal', new THREE.BufferAttribute normals, 3
geom.addAttribute 'normal', new THREE.BufferAttribute normals, 3
geom
@gear: ->
quads = 48+16*3 # gear
quads = 48+16*3
triangles = quads*2
positions = new Float32Array triangles*9
normals = new Float32Array triangles*9
@ -41,7 +66,7 @@ class Geom
geom = new THREE.BufferGeometry
geom.addAttribute 'position', new THREE.BufferAttribute positions, 3
geom.addAttribute 'normal', new THREE.BufferAttribute normals, 3
geom.addAttribute 'normal', new THREE.BufferAttribute normals, 3
geom.translate 0,0,0.4
geom
@ -57,7 +82,8 @@ class Geom
pi
@quadStrip: (positions, normals, pi, strip) ->
numQuads = strip.length/12-2
numQuads = strip.length/12-1
log numQuads
for q in [0...numQuads]
qi = q * 12
for j in [0,1,2,2,1,3]
@ -66,144 +92,395 @@ class Geom
positions[pi+=1] = strip[qi+jj+i+3]
normals[pi] = strip[qi+jj+i]
pi
# 0000000 00000000 000 000 00000000 00000000 0000000 000000000 0000000 00000000
# 000 000 0000 000 000 000 000 000 000 000 000 000 000 000
# 000 0000 0000000 000 0 000 0000000 0000000 000000000 000 000 000 0000000
# 000 000 000 000 0000 000 000 000 000 000 000 000 000 000 000
# 0000000 00000000 000 000 00000000 000 000 000 000 000 0000000 000 000
@generatorQuads = [
0.924, 0.383, 0, 0.383, 0.330, 0.155,
0.924, 0.383, 0, 0.500, 0.047, 0.155,
0.924, 0.383, 0, 0.500, 0.047, -0.153,
0.924, 0.383, 0, 0.383, 0.330, -0.153,
-0.924, -0.383, 0,-0.387, -0.321, 0.155,
-0.924, -0.383, 0,-0.504, -0.038, 0.155,
-0.924, -0.383, 0,-0.504, -0.038, -0.153,
-0.924, -0.383, 0,-0.387, -0.321, -0.153,
0.924, -0.383, 0, 0.500, -0.038, 0.155,
0.924, -0.383, 0, 0.383, -0.321, 0.155,
0.924, -0.383, 0, 0.383, -0.321, -0.153,
0.924, -0.383, 0, 0.500, -0.038, -0.153,
-0.383, 0.924, 0,-0.327, 0.389, 0.155,
-0.383, 0.924, 0,-0.044, 0.506, 0.155,
-0.383, 0.924, 0,-0.044, 0.506, -0.153,
-0.383, 0.924, 0,-0.327, 0.389, -0.153,
0.383, -0.924, 0, 0.323, -0.380, 0.155,
0.383, -0.924, 0, 0.040, -0.498, 0.155,
0.383, -0.924, 0, 0.040, -0.498, -0.153,
0.383, -0.924, 0, 0.323, -0.380, -0.153,
0.383, 0.924, 0, 0.040, 0.506, 0.155,
0.383, 0.924, 0, 0.323, 0.389, 0.155,
0.383, 0.924, 0, 0.323, 0.389, -0.153,
0.383, 0.924, 0, 0.040, 0.506, -0.153,
-0.924, 0.383, 0,-0.504, 0.047, 0.155,
-0.924, 0.383, 0,-0.387, 0.330, 0.155,
-0.924, 0.383, 0,-0.387, 0.330, -0.153,
-0.924, 0.383, 0,-0.504, 0.047, -0.153,
-0.383, -0.924, 0,-0.044, -0.498, 0.155,
-0.383, -0.924, 0,-0.327, -0.380, 0.155,
-0.383, -0.924, 0,-0.327, -0.380, -0.153,
-0.383, -0.924, 0,-0.044, -0.498, -0.153,
0, 0, 1, 0.100, 0, 0.500,
0, 0, 1, 0.071, 0.071, 0.500,
0, 0, 1, 0, 0.100, 0.500,
0, 0, 1, 0.071, -0.071, 0.500,
0, 0, 1,-0.100, 0, 0.500,
0, 0, 1,-0.071, -0.071, 0.500,
0, 0, 1, 0, -0.100, 0.500,
0, 0, 1,-0.071, 0.071, 0.500,
0, 0, 1, 0.071, -0.071, 0.500,
0, 0, 1, 0, 0.100, 0.500,
0, 0, 1,-0.071, 0.071, 0.500,
0, 0, 1, 0, -0.100, 0.500,
0, 0, -1, 0.100, 0, -0.500,
0, 0, -1, 0.071, -0.071, -0.500,
0, 0, -1, 0, -0.100, -0.500,
0, 0, -1, 0.071, 0.071, -0.500,
0, 0, -1,-0.100, 0, -0.500,
0, 0, -1,-0.071, 0.071, -0.500,
0, 0, -1, 0, 0.100, -0.500,
0, 0, -1,-0.071, -0.071, -0.500,
0, 0, -1, 0.071, 0.071, -0.500,
0, 0, -1, 0, -0.100, -0.500,
0, 0, -1,-0.071, -0.071, -0.500,
0, 0, -1, 0, 0.100, -0.500,
]
@generatorQuadStrip1 = [
0.707, 0.707, 0, 0.141, 0.141, -0.076,
0.707, 0.707, 0, 0.141, 0.141, 0.078,
1, 0, 0, 0.200, 0, -0.076,
1, 0, 0, 0.200, 0, 0.078,
0.707, -0.707, 0, 0.141, -0.141, -0.076,
0.707, -0.707, 0, 0.141, -0.141, 0.078,
0, -1, 0, 0, -0.200, -0.076,
0, -1, 0, 0, -0.200, 0.078,
-0.707, -0.707, 0, -0.141, -0.141, -0.076,
-0.707, -0.707, 0, -0.141, -0.141, 0.078,
-1, 0, 0, -0.200, 0, -0.076,
-1, 0, 0, -0.200, 0, 0.078,
-0.707, 0.707, 0, -0.141, 0.141, -0.076,
-0.707, 0.707, 0, -0.141, 0.141, 0.078,
0, 1, 0, 0, 0.200, -0.076,
0, 1, 0, 0, 0.200, 0.078,
0.707, 0.707, 0, 0.141, 0.141, -0.076,
0.707, 0.707, 0, 0.141, 0.141, 0.078,
1, 0, 0, 0.200, 0, -0.076,
1, 0, 0, 0.200, 0, 0.078
]
@generatorQuadStrip2 = [
0, 0.710, 0.704, 0, 0.200, 0.078,
0, 0.710, 0.704, 0, 0.059, 0.220,
0.502, 0.502, 0.704, 0.141, 0.141, 0.078,
0.502, 0.502, 0.704, 0.042, 0.042, 0.220,
0.710, 0, 0.704, 0.200, 0, 0.078,
0.710, 0, 0.704, 0.059, 0, 0.220,
0.502, -0.502, 0.704, 0.141, -0.141, 0.078,
0.502, -0.502, 0.704, 0.042, -0.042, 0.220,
0, -0.710, 0.704, 0, -0.200, 0.078,
0, -0.710, 0.704, 0, -0.059, 0.220,
-0.502, -0.502, 0.704, -0.141, -0.141, 0.078,
-0.502, -0.502, 0.704, -0.042, -0.042, 0.220,
-0.710, 0, 0.704, -0.200, 0, 0.078,
-0.710, 0, 0.704, -0.059, 0, 0.220,
-0.502, 0.502, 0.704, -0.141, 0.141, 0.078,
-0.502, 0.502, 0.704, -0.042, 0.042, 0.220,
0, 0.710, 0.704, 0, 0.200, 0.078,
0, 0.710, 0.704, 0, 0.059, 0.220,
0.502, 0.502, 0.704, 0.141, 0.141, 0.078,
0.502, 0.502, 0.704, 0.042, 0.042, 0.220
]
@generatorQuadStrip3 = [
0, 1, 0, 0, 0.100, 0.354,
0, 1, 0, 0, 0.100, 0.500,
0.707, 0.707, 0, 0.071, 0.071, 0.354,
0.707, 0.707, 0, 0.071, 0.071, 0.500,
1, 0, 0, 0.100, 0, 0.354,
1, 0, 0, 0.100, 0, 0.500,
0.707, -0.707, 0, 0.071, -0.071, 0.354,
0.707, -0.707, 0, 0.071, -0.071, 0.500,
0, -1, 0, 0, -0.100, 0.354,
0, -1, 0, 0, -0.100, 0.500,
-0.707, -0.707, 0, -0.071, -0.071, 0.354,
-0.707, -0.707, 0, -0.071, -0.071, 0.500,
-1, 0, 0, -0.100, 0, 0.354,
-1, 0, 0, -0.100, 0, 0.500,
-0.707, 0.707, 0, -0.071, 0.071, 0.354,
-0.707, 0.707, 0, -0.071, 0.071, 0.500,
0, 1, 0, 0, 0.100, 0.354,
0, 1, 0, 0, 0.100, 0.500,
0.707, 0.707, 0, 0.071, 0.071, 0.354,
0.707, 0.707, 0, 0.071, 0.071, 0.500
]
@generatorQuadStrip4 = [
0.676, 0.676, -0.291, 0.042, 0.042, 0.220,
0.676, 0.676, -0.291, 0.071, 0.071, 0.354,
0.957, 0, -0.291, 0.059, 0, 0.220,
0.957, 0, -0.291, 0.100, 0, 0.354,
0.676, -0.676, -0.291, 0.042, -0.042, 0.220,
0.676, -0.676, -0.291, 0.071, -0.071, 0.354,
0, -0.957, -0.291, 0, -0.059, 0.220,
0, -0.957, -0.291, 0, -0.100, 0.354,
-0.676, -0.676, -0.291, -0.042, -0.042, 0.220,
-0.676, -0.676, -0.291, -0.071, -0.071, 0.354,
-0.957, 0, -0.291, -0.059, 0, 0.220,
-0.957, 0, -0.291, -0.100, 0, 0.354,
-0.676, 0.676, -0.291, -0.042, 0.042, 0.220,
-0.676, 0.676, -0.291, -0.071, 0.071, 0.354,
0, 0.957, -0.291, 0, 0.059, 0.220,
0, 0.957, -0.291, 0, 0.100, 0.354,
0.676, 0.676, -0.291, 0.042, 0.042, 0.220,
0.676, 0.676, -0.291, 0.071, 0.071, 0.354,
0.957, 0, -0.291, 0.059, 0, 0.220,
0.957, 0, -0.291, 0.100, 0, 0.354
]
@generatorQuadStrip5 = [
0.756, 0.295, 0.585, -0.044, -0.498, 0.155,
0.756, 0.295, 0.585, -0.054, -0.321, 0.078,
-0.326, 0.743, 0.585, -0.327, -0.380, 0.155,
-0.326, 0.743, 0.585, -0.195, -0.262, 0.078,
-0.326, 0.743, -0.585, -0.327, -0.380, -0.153,
-0.326, 0.743, -0.585, -0.195, -0.262, -0.076,
0.756, 0.295, -0.585, -0.044, -0.498, -0.153,
0.756, 0.295, -0.585, -0.054, -0.321, -0.076,
0.756, 0.295, 0.585, -0.044, -0.498, 0.155,
0.756, 0.295, 0.585, -0.054, -0.321, 0.078,
]
@generatorQuadStrip6 = [
0.295, -0.756, 0.585, -0.504, 0.047, 0.155,
0.295, -0.756, 0.585, -0.327, 0.056, 0.078,
0.743, 0.326, 0.585, -0.387, 0.330, 0.155,
0.743, 0.326, 0.585, -0.268, 0.198, 0.078,
0.743, 0.326, -0.585, -0.387, 0.330, -0.153,
0.743, 0.326, -0.585, -0.268, 0.198, -0.076,
0.295, -0.756, -0.585, -0.504, 0.047, -0.153,
0.295, -0.756, -0.585, -0.327, 0.056, -0.076,
0.295, -0.756, 0.585, -0.504, 0.047, 0.155,
0.295, -0.756, 0.585, -0.327, 0.056, 0.078,
]
@generatorQuadStrip7 = [
-0.756, -0.295, 0.585, 0.040, 0.506, 0.155,
-0.756, -0.295, 0.585, 0.050, 0.329, 0.078,
0.326, -0.743, 0.585, 0.323, 0.389, 0.155,
0.326, -0.743, 0.585, 0.191, 0.271, 0.078,
0.326, -0.743, -0.585, 0.323, 0.389, -0.153,
0.326, -0.743, -0.585, 0.191, 0.271, -0.076,
-0.756, -0.295, -0.585, 0.040, 0.506, -0.153,
-0.756, -0.295, -0.585, 0.050, 0.329, -0.076,
-0.756, -0.295, 0.585, 0.040, 0.506, 0.155,
-0.756, -0.295, 0.585, 0.050, 0.329, 0.078,
]
@generatorQuadStrip8 = [
0.326, 0.743, 0.585, 0.323, -0.380, 0.155,
0.326, 0.743, 0.585, 0.191, -0.262, 0.078,
-0.756, 0.295, 0.585, 0.040, -0.498, 0.155,
-0.756, 0.295, 0.585, 0.050, -0.321, 0.078,
-0.756, 0.295, -0.585, 0.040, -0.498, -0.153,
-0.756, 0.295, -0.585, 0.050, -0.321, -0.076,
0.326, 0.743, -0.585, 0.323, -0.380, -0.153,
0.326, 0.743, -0.585, 0.191, -0.262, -0.076,
0.326, 0.743, 0.585, 0.323, -0.380, 0.155,
0.326, 0.743, 0.585, 0.191, -0.262, 0.078,
]
@generatorQuadStrip9 = [
-0.326, -0.743, 0.585, -0.327, 0.389, 0.155,
-0.326, -0.743, 0.585, -0.195, 0.271, 0.078,
0.756, -0.295, 0.585, -0.044, 0.506, 0.155,
0.756, -0.295, 0.585, -0.054, 0.329, 0.078,
0.756, -0.295, -0.585, -0.044, 0.506, -0.153,
0.756, -0.295, -0.585, -0.054, 0.329, -0.076,
-0.326, -0.743, -0.585, -0.327, 0.389, -0.153,
-0.326, -0.743, -0.585, -0.195, 0.271, -0.076,
-0.326, -0.743, 0.585, -0.327, 0.389, 0.155,
-0.326, -0.743, 0.585, -0.195, 0.271, 0.078,
]
@generatorQuadStrip10 = [
-0.295, 0.756, 0.585, 0.500, -0.038, 0.155,
-0.295, 0.756, 0.585, 0.323, -0.047, 0.078,
-0.743, -0.326, 0.585, 0.383, -0.321, 0.155,
-0.743, -0.326, 0.585, 0.265, -0.189, 0.078,
-0.743, -0.326, -0.585, 0.383, -0.321, -0.153,
-0.743, -0.326, -0.585, 0.265, -0.189, -0.076,
-0.295, 0.756, -0.585, 0.500, -0.038, -0.153,
-0.295, 0.756, -0.585, 0.323, -0.047, -0.076,
-0.295, 0.756, 0.585, 0.500, -0.038, 0.155,
-0.295, 0.756, 0.585, 0.323, -0.047, 0.078,
]
@generatorQuadStrip11 = [
0.743, -0.326, 0.585, -0.387, -0.321, 0.155,
0.743, -0.326, 0.585, -0.268, -0.189, 0.078,
0.295, 0.756, 0.585, -0.504, -0.038, 0.155,
0.295, 0.756, 0.585, -0.327, -0.047, 0.078,
0.295, 0.756, -0.585, -0.504, -0.038, -0.153,
0.295, 0.756, -0.585, -0.327, -0.047, -0.076,
0.743, -0.326, -0.585, -0.387, -0.321, -0.153,
0.743, -0.326, -0.585, -0.268, -0.189, -0.076,
0.743, -0.326, 0.585, -0.387, -0.321, 0.155,
0.743, -0.326, 0.585, -0.268, -0.189, 0.078,
]
@generatorQuadStrip12 = [
-0.743, 0.326, 0.585, 0.383, 0.330, 0.155,
-0.743, 0.326, 0.585, 0.265, 0.198, 0.078,
-0.295, -0.756, 0.585, 0.500, 0.047, 0.155,
-0.295, -0.756, 0.585, 0.323, 0.056, 0.078,
-0.295, -0.756, -0.585, 0.500, 0.047, -0.153,
-0.295, -0.756, -0.585, 0.323, 0.056, -0.076,
-0.743, 0.326, -0.585, 0.383, 0.330, -0.153,
-0.743, 0.326, -0.585, 0.265, 0.198, -0.076,
-0.743, 0.326, 0.585, 0.383, 0.330, 0.155,
-0.743, 0.326, 0.585, 0.265, 0.198, 0.078,
]
# 000 000 0000000 000 000 000 00000000
# 000 000 000 000 000 000 000 000
# 000 000 000000000 000 000 000 0000000
# 000 000 000 000 000 000
# 0 000 000 0000000 0 00000000
@valveQuads = [
0, 0, 1, 0.100, 0, 0.500,
0, 0, 1, 0.071, 0.071, 0.500,
0, 0, 1, 0, 0.100, 0.500,
0, 0, 1, 0.071, -0.071, 0.500,
0, 0, 1,-0.100, 0, 0.500,
0, 0, 1,-0.071, -0.071, 0.500,
0, 0, 1, 0, -0.100, 0.500,
0, 0, 1,-0.071, 0.071, 0.500,
0, 0, 1, 0.071, -0.071, 0.500,
0, 0, 1, 0, 0.100, 0.500,
0, 0, 1,-0.071, 0.071, 0.500,
0, 0, 1, 0, -0.100, 0.500,
0, 0, -1, 0.100, 0, -0.500,
0, 0, -1, 0.071, -0.071, -0.500,
0, 0, -1, 0, -0.100, -0.500,
0, 0, -1, 0.071, 0.071, -0.500,
0, 0, -1,-0.100, 0, -0.500,
0, 0, -1,-0.071, 0.071, -0.500,
0, 0, -1, 0, 0.100, -0.500,
0, 0, -1,-0.071, -0.071, -0.500,
0, 0, -1, 0.071, 0.071, -0.500,
0, 0, -1, 0, -0.100, -0.500,
0, 0, -1,-0.071, -0.071, -0.500,
0, 0, -1, 0, 0.100, -0.500,
]
@valveQuadStrip1 = [
0.673, 0.673, 0.308, 0.071, 0.071, -0.346,
0.673, 0.673, 0.308, 0.042, 0.042, -0.220,
0.951, -0.000, 0.308, 0.100, 0.000, -0.346,
0.951, -0.000, 0.308, 0.059, 0.000, -0.220,
0.951, 0, 0.308, 0.100, 0, -0.346,
0.951, 0, 0.308, 0.059, 0, -0.220,
0.673, -0.673, 0.308, 0.071, -0.071, -0.346,
0.673, -0.673, 0.308, 0.042, -0.042, -0.220,
-0.000, -0.951, 0.308, 0.000, -0.100, -0.346,
-0.000, -0.951, 0.308, 0.000, -0.059, -0.220,
0, -0.951, 0.308, 0, -0.100, -0.346,
0, -0.951, 0.308, 0, -0.059, -0.220,
-0.673, -0.673, 0.308, -0.071, -0.071, -0.346,
-0.673, -0.673, 0.308, -0.042, -0.042, -0.220,
-0.951, -0.000, 0.308, -0.100, 0.000, -0.346,
-0.951, -0.000, 0.308, -0.059, 0.000, -0.220,
-0.951, 0, 0.308, -0.100, 0, -0.346,
-0.951, 0, 0.308, -0.059, 0, -0.220,
-0.673, 0.673, 0.308, -0.071, 0.071, -0.346,
-0.673, 0.673, 0.308, -0.042, 0.042, -0.220,
-0.000, 0.951, 0.308, -0.000, 0.100, -0.346,
-0.000, 0.951, 0.308, -0.000, 0.059, -0.220,
0, 0.951, 0.308, 0, 0.100, -0.346,
0, 0.951, 0.308, 0, 0.059, -0.220,
0.673, 0.673, 0.308, 0.071, 0.071, -0.346,
0.673, 0.673, 0.308, 0.042, 0.042, -0.220,
0.951, -0.000, 0.308, 0.100, 0.000, -0.346,
0.951, -0.000, 0.308, 0.059, 0.000, -0.220]
0.673, 0.673, 0.308, 0.042, 0.042, -0.220
]
@valveQuadStrip2 = [
0.707, 0.707, 0.000, 0.042, 0.042, -0.220,
0.707, 0.707, 0.000, 0.042, 0.042, 0.220,
1.000, 0.000, 0.000, 0.059, 0.000, -0.220,
1.000, 0.000, 0.000, 0.059, -0.000, 0.220,
0.707, -0.707, -0.000, 0.042, -0.042, -0.220,
0.707, -0.707, -0.000, 0.042, -0.042, 0.220,
0.000, -1.000, -0.000, 0.000, -0.059, -0.220,
0.000, -1.000, -0.000, 0.000, -0.059, 0.220,
-0.707, -0.707, -0.000, -0.042, -0.042, -0.220,
-0.707, -0.707, -0.000, -0.042, -0.042, 0.220,
-1.000, -0.000, 0.000, -0.059, 0.000, -0.220,
-1.000, -0.000, 0.000, -0.059, -0.000, 0.220,
-0.707, 0.707, 0.000, -0.042, 0.042, -0.220,
-0.707, 0.707, 0.000, -0.042, 0.042, 0.220,
-0.000, 1.000, 0.000, -0.000, 0.059, -0.220,
-0.000, 1.000, 0.000, -0.000, 0.059, 0.220,
0.707, 0.707, 0.000, 0.042, 0.042, -0.220,
0.707, 0.707, 0.000, 0.042, 0.042, 0.220,
1.000, 0.000, 0.000, 0.059, 0.000, -0.220,
1.000, 0.000, 0.000, 0.059, -0.000, 0.220]
0.707, 0.707, 0, 0.042, 0.042, -0.220,
0.707, 0.707, 0, 0.042, 0.042, 0.220,
1, 0, 0, 0.059, 0, -0.220,
1, 0, 0, 0.059, 0, 0.220,
0.707, -0.707, 0, 0.042, -0.042, -0.220,
0.707, -0.707, 0, 0.042, -0.042, 0.220,
0, -1, 0, 0, -0.059, -0.220,
0, -1, 0, 0, -0.059, 0.220,
-0.707, -0.707, 0, -0.042, -0.042, -0.220,
-0.707, -0.707, 0, -0.042, -0.042, 0.220,
-1, 0, 0, -0.059, 0, -0.220,
-1, 0, 0, -0.059, 0, 0.220,
-0.707, 0.707, 0, -0.042, 0.042, -0.220,
-0.707, 0.707, 0, -0.042, 0.042, 0.220,
0, 1, 0, 0, 0.059, -0.220,
0, 1, 0, 0, 0.059, 0.220,
0.707, 0.707, 0, 0.042, 0.042, -0.220,
0.707, 0.707, 0, 0.042, 0.042, 0.220
]
@valveQuadStrip3 = [
0.707, 0.707, 0.000, 0.071, 0.071, -0.500,
0.707, 0.707, 0.000, 0.071, 0.071, -0.346,
1.000, -0.000, 0.000, 0.100, 0.000, -0.500,
1.000, -0.000, 0.000, 0.100, 0.000, -0.346,
0.707, -0.707, -0.000, 0.071, -0.071, -0.500,
0.707, -0.707, -0.000, 0.071, -0.071, -0.346,
0.000, -1.000, -0.000, 0.000, -0.100, -0.500,
0.000, -1.000, -0.000, 0.000, -0.100, -0.346,
-0.707, -0.707, -0.000, -0.071, -0.071, -0.500,
-0.707, -0.707, -0.000, -0.071, -0.071, -0.346,
-1.000, -0.000, -0.000, -0.100, 0.000, -0.500,
-1.000, -0.000, -0.000, -0.100, 0.000, -0.346,
-0.707, 0.707, 0.000, -0.071, 0.071, -0.500,
-0.707, 0.707, 0.000, -0.071, 0.071, -0.346,
-0.000, 1.000, 0.000, -0.000, 0.100, -0.500,
-0.000, 1.000, 0.000, -0.000, 0.100, -0.346,
0.707, 0.707, 0.000, 0.071, 0.071, -0.500,
0.707, 0.707, 0.000, 0.071, 0.071, -0.346,
1.000, -0.000, 0.000, 0.100, 0.000, -0.500,
1.000, -0.000, 0.000, 0.100, 0.000, -0.346]
0.707, 0.707, 0, 0.071, 0.071, -0.500,
0.707, 0.707, 0, 0.071, 0.071, -0.346,
1, 0, 0, 0.100, 0, -0.500,
1, 0, 0, 0.100, 0, -0.346,
0.707, -0.707, 0, 0.071, -0.071, -0.500,
0.707, -0.707, 0, 0.071, -0.071, -0.346,
0, -1, 0, 0, -0.100, -0.500,
0, -1, 0, 0, -0.100, -0.346,
-0.707, -0.707, 0, -0.071, -0.071, -0.500,
-0.707, -0.707, 0, -0.071, -0.071, -0.346,
-1, 0, 0, -0.100, 0, -0.500,
-1, 0, 0, -0.100, 0, -0.346,
-0.707, 0.707, 0, -0.071, 0.071, -0.500,
-0.707, 0.707, 0, -0.071, 0.071, -0.346,
0, 1, 0, 0, 0.100, -0.500,
0, 1, 0, 0, 0.100, -0.346,
0.707, 0.707, 0, 0.071, 0.071, -0.500,
0.707, 0.707, 0, 0.071, 0.071, -0.346,
]
@valveQuadStrip4 = [
-0.000, 1.000, 0.000, -0.000, 0.100, 0.354,
-0.000, 1.000, 0.000, -0.000, 0.100, 0.500,
0.707, 0.707, 0.000, 0.071, 0.071, 0.354,
0.707, 0.707, 0.000, 0.071, 0.071, 0.500,
1.000, 0.000, -0.000, 0.100, -0.000, 0.354,
1.000, 0.000, -0.000, 0.100, -0.000, 0.500,
0.707, -0.707, -0.000, 0.071, -0.071, 0.354,
0.707, -0.707, -0.000, 0.071, -0.071, 0.500,
0.000, -1.000, -0.000, 0.000, -0.100, 0.354,
0.000, -1.000, -0.000, 0.000, -0.100, 0.500,
-0.707, -0.707, -0.000, -0.071, -0.071, 0.354,
-0.707, -0.707, -0.000, -0.071, -0.071, 0.500,
-1.000, -0.000, 0.000, -0.100, -0.000, 0.354,
-1.000, -0.000, 0.000, -0.100, -0.000, 0.500,
-0.707, 0.707, 0.000, -0.071, 0.071, 0.354,
-0.707, 0.707, 0.000, -0.071, 0.071, 0.500,
-0.000, 1.000, 0.000, -0.000, 0.100, 0.354,
-0.000, 1.000, 0.000, -0.000, 0.100, 0.500,
0.707, 0.707, 0.000, 0.071, 0.071, 0.354,
0.707, 0.707, 0.000, 0.071, 0.071, 0.500]
0, 1, 0, 0, 0.100, 0.354,
0, 1, 0, 0, 0.100, 0.500,
0.707, 0.707, 0, 0.071, 0.071, 0.354,
0.707, 0.707, 0, 0.071, 0.071, 0.500,
1, 0, 0, 0.100, 0, 0.354,
1, 0, 0, 0.100, 0, 0.500,
0.707, -0.707, 0, 0.071, -0.071, 0.354,
0.707, -0.707, 0, 0.071, -0.071, 0.500,
0, -1, 0, 0, -0.100, 0.354,
0, -1, 0, 0, -0.100, 0.500,
-0.707, -0.707, 0, -0.071, -0.071, 0.354,
-0.707, -0.707, 0, -0.071, -0.071, 0.500,
-1, 0, 0, -0.100, 0, 0.354,
-1, 0, 0, -0.100, 0, 0.500,
-0.707, 0.707, 0, -0.071, 0.071, 0.354,
-0.707, 0.707, 0, -0.071, 0.071, 0.500,
0, 1, 0, 0, 0.100, 0.354,
0, 1, 0, 0, 0.100, 0.500,
]
@valveQuadStrip5 = [
0.676, 0.676, -0.291, 0.042, 0.042, 0.220,
0.676, 0.676, -0.291, 0.071, 0.071, 0.354,
0.957, 0.000, -0.291, 0.059, -0.000, 0.220,
0.957, 0.000, -0.291, 0.100, -0.000, 0.354,
0.957, 0, -0.291, 0.059, 0, 0.220,
0.957, 0, -0.291, 0.100, 0, 0.354,
0.676, -0.676, -0.291, 0.042, -0.042, 0.220,
0.676, -0.676, -0.291, 0.071, -0.071, 0.354,
0.000, -0.957, -0.291, 0.000, -0.059, 0.220,
0.000, -0.957, -0.291, 0.000, -0.100, 0.354,
0, -0.957, -0.291, 0, -0.059, 0.220,
0, -0.957, -0.291, 0, -0.100, 0.354,
-0.676, -0.676, -0.291, -0.042, -0.042, 0.220,
-0.676, -0.676, -0.291, -0.071, -0.071, 0.354,
-0.957, 0.000, -0.291, -0.059, -0.000, 0.220,
-0.957, 0.000, -0.291, -0.100, -0.000, 0.354,
-0.957, 0, -0.291, -0.059, 0, 0.220,
-0.957, 0, -0.291, -0.100, 0, 0.354,
-0.676, 0.676, -0.291, -0.042, 0.042, 0.220,
-0.676, 0.676, -0.291, -0.071, 0.071, 0.354,
0.000, 0.957, -0.291, -0.000, 0.059, 0.220,
0.000, 0.957, -0.291, -0.000, 0.100, 0.354,
0, 0.957, -0.291, 0, 0.059, 0.220,
0, 0.957, -0.291, 0, 0.100, 0.354,
0.676, 0.676, -0.291, 0.042, 0.042, 0.220,
0.676, 0.676, -0.291, 0.071, 0.071, 0.354,
0.957, 0.000, -0.291, 0.059, -0.000, 0.220,
0.957, 0.000, -0.291, 0.100, -0.000, 0.354]
]
# 0000000 00000000 0000000 00000000
# 000 000 000 000 000 000
# 000 0000 0000000 000000000 0000000
# 000 000 000 000 000 000 000
# 0000000 00000000 000 000 000 000
@gearQuadStrip1 = [
0.120, -0.050, 0.991, 0.208, -0.086, 0.111,
@ -240,8 +517,7 @@ class Geom
0.097, -0.114, 0.989, 0.287, -0.287, 0.087,
0.120, -0.050, 0.991, 0.208, -0.086, 0.111,
0.143, -0.046, 0.989, 0.375, -0.155, 0.087,
0.130, 0, 0.991, 0.226, 0, 0.111,
0.149, -0.012, 0.989, 0.406, 0, 0.087]
]
@gearQuadStrip2 = [
-1, 0, 0, 0.226, 0, -0.111,
@ -278,8 +554,7 @@ class Geom
-0.924, 0.383, 0, 0.208, -0.086, 0.111,
-1, 0, 0, 0.226, 0, -0.111,
-1, 0, 0, 0.226, 0, 0.111,
-0.924, -0.383, 0, 0.208, 0.086, -0.111,
-0.924, -0.383, 0, 0.208, 0.086, 0.111]
]
@gearQuadStrip3 = [
0.149, -0.012, -0.989, 0.406, 0, -0.087,
@ -316,8 +591,7 @@ class Geom
0.120, -0.050, -0.991, 0.208, -0.086, -0.111,
0.149, -0.012, -0.989, 0.406, 0, -0.087,
0.130, 0, -0.991, 0.226, 0, -0.111,
0.133, 0.069, -0.989, 0.375, 0.155, -0.087,
0.120, 0.050, -0.991, 0.208, 0.086, -0.111]
]
@gearQuads = [
0.981, 0.195, 0, 0.375, 0.155, 0.087,
@ -511,6 +785,7 @@ class Geom
0.159, 0.106, 0.982, 0.490, 0.266, 0.056,
0.159, 0.106, 0.982, 0.433, 0.351, 0.056,
0.114, 0.097, 0.989, 0.287, 0.287, 0.087,
0.133, 0.069, 0.989, 0.375, 0.155, 0.087]
0.133, 0.069, 0.989, 0.375, 0.155, 0.087
]
module.exports = Geom

View File

@ -9,7 +9,7 @@ module.exports =
name: "test"
size: [11,11,11]
player:
coordinates: [5,5,0]
coordinates: [5,5,1]
exits: [
name: "exit"
active: 0
@ -19,8 +19,11 @@ module.exports =
s = world.size
{Gear,Generator,MotorCylinder,MotorGear,Face} = require '../items'
world.addObjectAtPos new Gear(Face.Z), 6, 5, 0
# world.addObjectAtPos new Generator(Face.NZ), 5, 5, 0
# world.addObjectAtPos new Generator(Face.NZ), 5, 5, 10
world.addObjectAtPos new Gear(Face.NZ), 6, 5, 0
world.addObjectAtPos new Gear(Face.Z), 4, 5, 0
return
world.addObjectAtPos new Gear(Face.Z), 4, 5, 0
world.addObjectAtPos new Gear(Face.Z), 5, 6, 0
world.addObjectAtPos new Gear(Face.Z), 5, 4, 0