Răsfoiți Sursa

update default world and ar

Nikolay Suslov 6 ani în urmă
părinte
comite
b6ddce5036

+ 6 - 4
public/app.js

@@ -1696,7 +1696,7 @@ class App {
 
     Object.keys(myWorlds).filter(el => el!=='_').forEach(w=>{
 
-      db.get('documents').get(w).once().map().once((res, datI)=>{
+      db.get('documents').get(w).map((res, datI)=>{
         var doc = {};
 
          if (datI.includes('_info_vwf_json')){
@@ -1784,8 +1784,8 @@ class App {
         db = _LCSDB.user();
     }
 
-    db.get('worlds').once().map().once((val, index)=>{
-      db.get('worlds').get(index).get('info_json').load(res=>{
+    db.get('worlds').map((val, index)=>{
+     db.get('worlds').get(index).get('info_json').load(res=>{
         
        var doc = {};
 
@@ -1963,6 +1963,7 @@ class App {
             let worldDesc = JSON.parse(res.file);
             let root = Object.keys(worldDesc)[0];
             var appInfo = worldDesc[root]['en'];
+            let settings = worldDesc[root].settings;
 
             let langID = localStorage.getItem('krestianstvo_locale');
             if (langID) {
@@ -1975,7 +1976,8 @@ class App {
               'modified': res.modified,
               'type': 'proto',
               'userAlias': user,
-              'info': appInfo
+              'info': appInfo,
+              'settings': settings
             }
 
           }

+ 13 - 0
public/defaults/worlds/aframe-ar/index.vwf.yaml

@@ -6,6 +6,18 @@ properties:
   transparent: true
   assets: "assets.json"
 children:
+  light1:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "ambient"
+      color: "#BBB"
+  light2:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "directional"
+      color: "#FFF"
+      intensity: 0.6
+      position: "-0.5 1 1"
   arcamera:    
     extends: http://vwf.example.com/aframe/abox.vwf
     properties:
@@ -18,6 +30,7 @@ children:
     children:
       camera:
         extends: http://vwf.example.com/aframe/acamera.vwf
+        type: "ar"
         properties:
           look-controls-enabled: false
           wasd-controls-enabled: false

+ 5 - 2
public/defaults/worlds/aframe-ar/info.json

@@ -2,13 +2,16 @@
         "info": {
             "en": {
                 "title": "Simple AR app",
-                "imgUrl": "/defaults/worlds/aframe/webimg.jpg",
+                "imgUrl": "/defaults/worlds/aframe-ar/webimg.jpg",
                 "text": "Example application showing Virtual World Framework & A-Frame integration in AR"
             },
             "ru": {
                 "title": "Мир VWF & A-Frame в AR",
-                "imgUrl": "/defaults/worlds/aframe/webimg.jpg",
+                "imgUrl": "/defaults/worlds/aframe-ar/webimg.jpg",
                 "text": "Пример распределенного приложения, показывающего возможности интеграции Virtual World Framework & A-Frame в дополненной реальности"
+            },
+            "settings":{
+                "ar": true
             }
         }
 }

BIN
public/defaults/worlds/aframe-ar/webimg.jpg


+ 12 - 0
public/defaults/worlds/aframe/index.vwf.yaml

@@ -23,6 +23,18 @@ children:
           color: "#ECECEC"
           side: "back"
           fog: false
+  light1:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "ambient"
+      color: "#BBB"
+  light2:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "directional"
+      color: "#FFF"
+      intensity: 0.6
+      position: "-0.5 1 1"
   spaceText:
     extends: http://vwf.example.com/aframe/atext.vwf
     properties:

+ 12 - 0
public/defaults/worlds/ohmlang-calc/index.vwf.yaml

@@ -11,6 +11,18 @@ methods:
       console.log(calc);
       vwf_view.kernel.callMethod(calc, "calcMe");
 children:
+  light1:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "ambient"
+      color: "#BBB"
+  light2:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "directional"
+      color: "#FFF"
+      intensity: 0.6
+      position: "-0.5 1 1"
   groundPlane:
     extends: http://vwf.example.com/aframe/aplane.vwf
     properties:

+ 12 - 0
public/defaults/worlds/ohmlang-lsys/index.vwf.yaml

@@ -5,6 +5,18 @@ extends: http://vwf.example.com/aframe/ascene.vwf
 properties:
     assets: "assets.json"
 children:
+    light1:
+        extends: http://vwf.example.com/aframe/alight.vwf
+        properties:
+        type: "ambient"
+        color: "#BBB"
+    light2:
+        extends: http://vwf.example.com/aframe/alight.vwf
+        properties:
+        type: "directional"
+        color: "#FFF"
+        intensity: 0.6
+        position: "-0.5 1 1"
     skySun:
         extends: http://vwf.example.com/aframe/aentity.vwf
         children:

+ 1 - 0
public/vwf/model/aframe.js

@@ -1334,6 +1334,7 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
             let assetsElement = document.createElement('a-assets');
             aframeObj.appendChild(assetsElement);
             aframeObj.setAttribute('scene-utils', "");
+            aframeObj.setAttribute('light', 'defaultLightsEnabled', false);
             //aframeObj.setAttribute('embedded', {});
             //aframeObj.setAttribute('loading-screen', "backgroundColor: black");
             self.state.scenes[node.ID] = aframeObj;

+ 32 - 5
public/vwf/view/aframe-ar-driver.js

@@ -47,7 +47,8 @@ define(["module", "vwf/view", "vwf/view/arjs/signals/signals", "vwf/view/arjs/af
 			}
 
 			if (self.viewDriver.state.nodes[childID].extendsID == "http://vwf.example.com/aframe/acamera.vwf") {
-				if(!childID.includes('avatar')){
+				//if(!childID.includes('avatar')){
+				if(node.type == 'ar'){
 					console.log(childID);
 					vwf_view.kernel.callMethod(childID, "setCameraToActive", [vwf.moniker_]);
 				}
@@ -59,6 +60,16 @@ define(["module", "vwf/view", "vwf/view/arjs/signals/signals", "vwf/view/arjs/af
 
 		firedEvent: function (nodeID, eventName, eventParameters) {
 
+			// var node = self.viewDriver.state.nodes[nodeID];
+            // if (!node) {
+            //     return;
+			// }
+
+			// if (eventName == "createAvatar") {
+			// 	let avatarName = 'avatar-' + self.kernel.moniker();
+			// 	vwf_view.kernel.callMethod(avatarName, "showHideAvatar", false);
+            // }
+
 		},
 
 
@@ -66,12 +77,28 @@ define(["module", "vwf/view", "vwf/view/arjs/signals/signals", "vwf/view/arjs/af
 		 * Receives incoming messages
 		 */
 		calledMethod: function( nodeID, methodName, methodParameters, methodValue ) {
-	
-        }
+			
+			var node = self.viewDriver.state.nodes[nodeID];
+            if (!node) {
+                return;
+			}
 
-		
-	})
 
+			if (methodName == "createAvatarBody") {
+				let avatarName = 'avatar-' + self.kernel.moniker();
+				if (nodeID == avatarName) {
+					vwf_view.kernel.callMethod(nodeID, "showHideAvatar", [false]);
+				}
+
+
+        		}
+
+			
+			}
 
 
+
+
+	})
+
 });

+ 2 - 2
public/web/index-app.js

@@ -1016,8 +1016,8 @@ class IndexApp {
                           
                             let el = document.querySelector('#runWorldGUI');
                             if (el) {
-                                if (el._settingsSwitch.checked){
-                                    console.log("NEED TO LOAD MANUAL SETTINGS!!");
+                                if (el._arSwitch.checked){
+                                    console.log("NEED TO LOAD IN AR MODE!!");
 
                                 let arSettings = {
                                     model:{

+ 35 - 23
public/web/world-app.js

@@ -130,34 +130,46 @@ class WorldApp {
             worldStatesGUI.push(worldStates);
         }
 
+        var runWorldGUI = {};
+        let settings = worldCardGUI._worldInfo.settings;
+        if(settings){
+            if (settings.ar){
 
-        let runWorldGUI = {
-            id: "runWorldGUI",
-            $type: "div",
-            _settingsSwitch: null,
-            $components: [
-                {
+                runWorldGUI = {
+                    id: "runWorldGUI",
                     $type: "div",
-                    $text: "Settings for start:"
-                },
-                _cellWidgets.switch({
-                    'id': 'arjsView',
-                    'init': function () {
-                      this._switch = new mdc.switchControl.MDCSwitch(this);
-                      this._switch.checked = false;
-                      this._settingsSwitch = this._switch;
-                    }
-                  }
-                  ),
-                  {
-                    $type: 'label',
-                    for: 'input-forceReplace',
-                    $text: 'AR'
-                  }
-            ]
+                    $init: function(){
+                        console.log(worldCardGUI);
+                    },
+                    _arSwitch: null,
+                    $components: [
+                        {
+                            $type: "div",
+                            $text: "Settings for start:"
+                        },
+                        _cellWidgets.switch({
+                            'id': 'arjsView',
+                            'init': function () {
+                              this._switch = new mdc.switchControl.MDCSwitch(this);
+                              this._switch.checked = false;
+                              this._arSwitch = this._switch;
+                            }
+                          }
+                          ),
+                          {
+                            $type: 'label',
+                            for: 'input-forceReplace',
+                            $text: 'AR'
+                          }
+                    ]
+        
+                }
+            } 
 
         }
 
+        
+
         let actionsGUI = {
             $cell: true,
             id: "worldActionsGUI",