-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: janusweb
action: commit
revision:
path_from:
revision_from: 46c3852e310c5deb90fd2fb026a2cb71cc3e9a31:
path_to:
revision_to:

git.thebackupbox.net

janusweb

git://git.thebackupbox.net/janusweb

commit 46c3852e310c5deb90fd2fb026a2cb71cc3e9a31
Author: James Baicoianu <james_github@baicoianu.com>
Date:   Sat Jan 14 18:56:39 2017 -0800

    Only update image material once per frame max

diff --git a/scripts/image.js b/scripts/image.js

index 215c79002e29b9b1d65fd22fe24db44a28f6d21c..

index ..575d4197b33f4709c156b78fe7493c011d39ab8a 100644

--- a/scripts/image.js
+++ b/scripts/image.js
@@ -41,10 +41,10 @@ elation.require(['janusweb.janusbase'], function() {
     this.postinit = function() {
       elation.engine.things.janusimage.extendclass.postinit.call(this);
       this.defineProperties({
-        image_id: { type: 'string', set: this.updateMaterial },
-        sbs3d: { type: 'boolean', default: false, set: this.updateMaterial },
-        ou3d: { type: 'boolean', default: false, set: this.updateMaterial },
-        reverse3d: { type: 'boolean', default: false, set: this.updateMaterial },
+        image_id: { type: 'string', set: this.setMaterialDirty },
+        sbs3d: { type: 'boolean', default: false, set: this.setMaterialDirty },
+        ou3d: { type: 'boolean', default: false, set: this.setMaterialDirty },
+        reverse3d: { type: 'boolean', default: false, set: this.setMaterialDirty },
       });
     }
     this.createObject3D = function() {
@@ -104,8 +104,18 @@ elation.require(['janusweb.janusbase'], function() {
       this.sidematerial = sidemat;
       return facemat;
     }
+    this.setMaterialDirty = function() {
+      this.materialNeedsUpdate = true;
+    }
+    this.handleFrameUpdates = function() {
+      elation.engine.things.janusobject.extendclass.handleFrameUpdates.call(this);
+      if (this.materialNeedsUpdate) {
+        this.updateMaterial();
+      }
+    }
     this.updateMaterial = function() {
       this.asset = this.getAsset('image', this.image_id);
+      this.materialNeedsUpdate = false;
       var newtexture = false;
       if (this.asset) {
         newtexture = this.asset.getInstance();

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 14:48:53 2024