misc
This commit is contained in:
parent
8ec96ec4f0
commit
a2cd885c7f
|
@ -5,7 +5,6 @@
|
||||||
# 000 000 000 000
|
# 000 000 000 000
|
||||||
# 000 0000000 0000000
|
# 000 0000000 0000000
|
||||||
|
|
||||||
log = require '/Users/kodi/s/ko/js/tools/log'
|
|
||||||
Vector = require './vector'
|
Vector = require './vector'
|
||||||
|
|
||||||
class Pos
|
class Pos
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Pushable extends Item
|
||||||
pushAction = @getActionWithId Action.PUSH
|
pushAction = @getActionWithId Action.PUSH
|
||||||
@pusher = object
|
@pusher = object
|
||||||
@move_action = pushAction
|
@move_action = pushAction
|
||||||
@direction = dir
|
@direction = new Vector dir
|
||||||
pushAction.duration = world.unmapMsTime duration
|
pushAction.duration = world.unmapMsTime duration
|
||||||
Timer.addAction pushAction
|
Timer.addAction pushAction
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Wall extends Item
|
||||||
|
|
||||||
geom = Cage.wallTiles new Pos(1,1,1), 'outside', Cage.gap
|
geom = Cage.wallTiles new Pos(1,1,1), 'outside', Cage.gap
|
||||||
geom.translate -0.5, -0.5, -0.5
|
geom.translate -0.5, -0.5, -0.5
|
||||||
@plates = new THREE.Mesh geom, Material.plate
|
@plates = new THREE.Mesh geom, Material.plate.clone()
|
||||||
@plates.receiveShadow = true
|
@plates.receiveShadow = true
|
||||||
|
|
||||||
@mesh = new THREE.Object3D
|
@mesh = new THREE.Object3D
|
||||||
|
|
|
@ -37,6 +37,7 @@ Pos = require './lib/pos'
|
||||||
_ = require 'lodash'
|
_ = require 'lodash'
|
||||||
now = require 'performance-now'
|
now = require 'performance-now'
|
||||||
{
|
{
|
||||||
|
Wall,
|
||||||
Wire,
|
Wire,
|
||||||
Gear,
|
Gear,
|
||||||
Stone,
|
Stone,
|
||||||
|
@ -685,13 +686,22 @@ class World extends Actor
|
||||||
for o in @objects
|
for o in @objects
|
||||||
if o instanceof Stone
|
if o instanceof Stone
|
||||||
stones.push o
|
stones.push o
|
||||||
stones.sort (a,b) => b.getPos().minus(@player.camera.getPosition()).length() - a.getPos().minus(@player.camera.getPosition()).length()
|
stones.sort (a,b) => b.position.minus(@player.camera.getPosition()).length() - a.position.minus(@player.camera.getPosition()).length()
|
||||||
|
|
||||||
order = 100
|
order = 100
|
||||||
for stone in stones
|
for stone in stones
|
||||||
stone.mesh.renderOrder = order
|
stone.mesh.renderOrder = order
|
||||||
order += 1
|
order += 1
|
||||||
|
|
||||||
|
d = stone.position.minus(@player.camera.getPosition()).length()
|
||||||
|
if d < 1.0
|
||||||
|
console.log 'd', d
|
||||||
|
stone.mesh.material.orig_opacity = stone.mesh.material.opacity if not stone.mesh.material.orig_opacity?
|
||||||
|
stone.mesh.material.opacity = 0.2 + d * 0.5
|
||||||
|
else if stone.mesh.material.orig_opacity?
|
||||||
|
stone.mesh.material.opacity = stone.mesh.material.orig_opacity
|
||||||
|
delete stone.mesh.material.orig_opacity
|
||||||
|
|
||||||
@sun.position.copy camera.position
|
@sun.position.copy camera.position
|
||||||
@renderer.autoClearColor = false
|
@renderer.autoClearColor = false
|
||||||
@renderer.render @scene, camera
|
@renderer.render @scene, camera
|
||||||
|
|
Loading…
Reference in New Issue
Block a user