summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-04-03 16:54:51 -0400
committerJules Laplace <jules@okfoc.us>2015-04-03 16:54:51 -0400
commit66e10f749fcc35e779e2492521b8dd98a8770820 (patch)
tree98a1097b7b39b5f56060f8820518daa7d177d620
parent3986bd98b0c0a4674310aa6425c75dba5962f2c7 (diff)
billboard mode
-rw-r--r--public/assets/javascripts/rectangles/_env.js1
-rw-r--r--public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js9
-rw-r--r--public/assets/javascripts/rectangles/engine/sculpture/types/image.js3
3 files changed, 13 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/_env.js b/public/assets/javascripts/rectangles/_env.js
index 3221bac..14f73e3 100644
--- a/public/assets/javascripts/rectangles/_env.js
+++ b/public/assets/javascripts/rectangles/_env.js
@@ -20,6 +20,7 @@ environment.init = function(){
Rooms.init()
Walls.init()
Scenery.init()
+ Sculpture.init()
scene.update()
environment.update()
diff --git a/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js b/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js
index c8c90d3..1543def 100644
--- a/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js
+++ b/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js
@@ -8,6 +8,15 @@ var Sculpture = new function(){
base.mouse = new mouse ({ use_offset: false, mousedownUsesCapture: true })
base.init = function(){
+ app.on("move", base.updateBillboards)
+ }
+
+ base.updateBillboards = function(){
+ base.forEach(function(sculpture){
+ if (sculpture.billboard) {
+ sculpture.mx.rotationY = cam.rotationY
+ }
+ })
}
base.add = function(opt){
diff --git a/public/assets/javascripts/rectangles/engine/sculpture/types/image.js b/public/assets/javascripts/rectangles/engine/sculpture/types/image.js
index 914abdf..9399097 100644
--- a/public/assets/javascripts/rectangles/engine/sculpture/types/image.js
+++ b/public/assets/javascripts/rectangles/engine/sculpture/types/image.js
@@ -28,6 +28,7 @@ Sculpture.types.image = Sculpture.types.base.extend(function(base){
if (opt.position) {
opt.position.y = opt.position.y || this.scale * this.media.height/2 + 5
opt.position.rotationY = opt.position.rotationY || scene.camera.rotationY
+ this.billboard = true
}
scene.add( this.mx )
@@ -35,6 +36,7 @@ Sculpture.types.image = Sculpture.types.base.extend(function(base){
serialize: function(){
var data = base.serialize.call(this)
+ data.billboard = this.billboard
return data
},
@@ -42,6 +44,7 @@ Sculpture.types.image = Sculpture.types.base.extend(function(base){
this.mx.move(data.position)
this.mx.ops.width = data.dimensions.a
this.mx.ops.height = data.dimensions.b
+ this.billboard = data.billboard
this.dimensions.deserialize(data.dimensions)
},
}