This commit is contained in:
monsterkodi 2016-08-21 03:11:24 +02:00
parent 8605b93909
commit e20381d55d
6 changed files with 441 additions and 1100 deletions

View File

@ -4,28 +4,15 @@
# 000 000 000 000 000 000
# 0000000 000 000 0000000 00000000
log = require '/Users/kodi/s/ko/js/tools/log'
log = require '/Users/kodi/s/ko/js/tools/log'
Material = require './material'
class Cage
@cageMat = new THREE.MeshPhongMaterial
color: 0x880000
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 10
emissive: 0x880000
emissiveIntensity: 0.02
@rasterMat = new THREE.MeshPhongMaterial
color: 0x880000
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 20
constructor: (@size, gap) ->
Cage.gap = gap
geom = Cage.wallTiles @size, 'inside', 0
@raster = new THREE.Mesh geom, Cage.rasterMat
@raster = new THREE.Mesh geom, Material.raster
@raster.translateX -0.5
@raster.translateY -0.5
@raster.translateZ -0.5
@ -33,7 +20,7 @@ class Cage
world.scene.add @raster
geom = Cage.wallTiles @size, 'inside', Cage.gap
@cage = new THREE.Mesh geom, Cage.cageMat
@cage = new THREE.Mesh geom, Material.plate
@cage.translateX -0.5
@cage.translateY -0.5
@cage.translateZ -0.5

View File

@ -4,10 +4,10 @@
# 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
Gear = require './gear'
Geom = require './geom'
Cage = require './cage'
Wire = require './wire'
Gear = require './gear'
Geom = require './geom'
Wire = require './wire'
Material = require './material'
class Generator extends Gear
@ -15,8 +15,8 @@ class Generator extends Gear
super face
createMesh: ->
@mesh = new THREE.Mesh Geom.generator(), Cage.cageMat
@mesh.add new THREE.Mesh Geom.gear(), Cage.rasterMat
@mesh = new THREE.Mesh Geom.generator(), Material.plate
@mesh.add new THREE.Mesh Geom.gear(), Material.gear
@mesh.receiveShadow = true
activateWires: ->

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,11 @@ module.exports =
create: ->
s = world.size
{Gear,Generator,MotorCylinder,MotorGear,Face} = require '../items'
# world.addObjectAtPos new Generator(Face.Z), 5, 5, 0
{Gear,Generator,MotorCylinder,MotorGear,Face,Wall} = require '../items'
world.addObjectAtPos new Generator(Face.Z), 5, 7, 0
world.addObjectAtPos new Wall(), 6, 7, 0
world.addObjectAtPos new Wall(), 6, 7, 1
world.addObjectAtPos new Wall(), 6, 7, 2
world.addObjectAtPos new MotorCylinder(Face.Z), 4, 5, 1
world.addObjectAtPos new MotorGear(Face.Z), 4, 5, 0

View File

@ -18,7 +18,13 @@ module.exports =
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 20
wall: new THREE.MeshPhongMaterial
color: 0x770000
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 10
plate: new THREE.MeshPhongMaterial
color: 0x880000
side: THREE.FrontSide

View File

@ -5,37 +5,30 @@
# 000 000 000 000 000 000
# 00 00 000 000 0000000 0000000
Pos = require './lib/pos'
Item = require './item'
Cage = require './cage'
Pos = require './lib/pos'
Item = require './item'
Cage = require './cage'
Material = require './material'
class Wall extends Item
@rasterMat = new THREE.MeshPhongMaterial
color: 0x770000
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 10
isSpaceEgoistic: -> true
constructor: ->
geom = Cage.wallTiles new Pos(1,1,1), 'outside', 0
geom.translate -0.5, -0.5, -0.5
@raster = new THREE.Mesh geom, Wall.rasterMat
constructor: -> super
createMesh: ->
geom = new THREE.BoxGeometry 1,1,1
@raster = new THREE.Mesh geom, Material.wall
@raster.receiveShadow = true
@raster.castShadow = true
geom = Cage.wallTiles new Pos(1,1,1), 'outside', Cage.gap
geom.translate -0.5, -0.5, -0.5
@plates = new THREE.Mesh geom, Cage.cageMat
@plates = new THREE.Mesh geom, Material.plate
@plates.receiveShadow = true
@mesh = new THREE.Object3D
@mesh.add @raster
@mesh.add @plates
super
module.exports = Wall