Browse Source

add paint app proto with xr

Nikolay Suslov 4 years ago
parent
commit
765b9967d9

+ 4 - 0
public/defaults/proxy/vwf.example.com/aframe/ascene.js

@@ -1179,6 +1179,10 @@ this.getDefaultXRCostume = function(){
             triggerup:{
                 body:'\/\/do on trigger up \n this.pointer.material.color = "green"',
                 type: "application/javascript"
+            },
+            onMove:{
+                body:'\/\/do on move',
+                type: "application/javascript"
             }
         },
         children: {

+ 7 - 0
public/defaults/proxy/vwf.example.com/aframe/xrcontroller.js

@@ -49,6 +49,13 @@ this.createController = function (modelSrc) {
 
 }
 
+this.moveVRController = function(){
+
+    let controller = this.xrnode.controller;
+    if(controller){
+        controller.onMove();
+    }
+}
 
 this.updateVRControl = function(position, rotation){
 

+ 1 - 0
public/defaults/proxy/vwf.example.com/aframe/xrcontroller.vwf.yaml

@@ -25,5 +25,6 @@ methods:
         parameters:
             - modelSrc
     saveToScene:
+    moveVRController:
 scripts:
 - source: "http://vwf.example.com/aframe/xrcontroller.js"

+ 6 - 0
public/defaults/worlds/paint/appui.js

@@ -0,0 +1,6 @@
+//-----App ui-----
+
+// function createApp() {
+    
+//     }
+    

+ 10 - 0
public/defaults/worlds/paint/assets.json

@@ -0,0 +1,10 @@
+{
+    "sky":{
+        "tag": "img",
+        "src": "/defaults/assets/skyes/sky3.jpg"
+    },
+     "bg2":{
+        "tag": "img",
+        "src": "/defaults/assets/checker.jpg"
+    }
+}

+ 20 - 0
public/defaults/worlds/paint/controller.js

@@ -0,0 +1,20 @@
+this.triggerdown = function(){
+    this.pointer.material.color = "black";
+    this.penDown = true;
+}
+
+this.triggerup = function(){
+    this.pointer.material.color = "white";
+    this.penDown = false;
+}
+
+this.onMove = function(){
+    if(this.penDown){
+        let scene = this.getScene();
+        let pos = this.pointer.worldPosition();
+        let path = scene.drawNode.linepath.path.slice();
+        path.push(pos);
+        scene.drawNode.linepath.path = path;
+    }
+    
+}

+ 8 - 0
public/defaults/worlds/paint/index.vwf.config.yaml

@@ -0,0 +1,8 @@
+---
+info:
+  title: "Paint App"
+model:
+  vwf/model/aframe:
+view:
+  vwf/view/aframe:
+  vwf/view/editor-new:

+ 110 - 0
public/defaults/worlds/paint/index.vwf.yaml

@@ -0,0 +1,110 @@
+# A-Frame & VWF simple scene
+# Copyright 2017 Krestianstvo.org project
+---
+extends: http://vwf.example.com/aframe/ascene.vwf
+properties:
+  assets: "assets.json"
+children:
+  fog:
+    extends: http://vwf.example.com/aframe/aSceneFogComponent.vwf
+    type: "component"
+    properties:
+      fogType: "linear"
+      fogColor: "#ECECEC"
+      far: 20
+      near: 0
+  groundPlane:
+    extends: http://vwf.example.com/aframe/aplane.vwf
+    properties:
+      height: 50
+      width: 50
+      rotation: "-90 0 0"
+    children:
+      material:
+        extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
+        properties:
+          wireframe: false
+          src: "#bg2"
+          repeat: "10 10"
+  myLight:
+    extends: http://vwf.example.com/aframe/alight.vwf
+    properties:
+      type: "point"
+      color: "white"
+      position: "0 3 0"
+      rotation: "0 0 0"
+  sky:
+    extends: http://vwf.example.com/aframe/asky.vwf
+    properties:
+    children:
+      material:
+        extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
+        properties:
+          color: "#ECECEC"
+          src: "#sky"
+          fog: false
+          side: "back"
+  spaceText:
+    extends: http://vwf.example.com/aframe/atext.vwf
+    properties:
+      value: "Paint App"
+      color: "white"
+      position: "-2 2.5 -2"
+  box:
+    extends: http://vwf.example.com/aframe/abox.vwf
+    properties:
+      position: "0 0 -3"
+      rotation: "0 0 0"
+      depth: 3
+      height: 0.2
+      width: 3
+    children:
+      material:
+        extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
+        properties:
+          color: "#3c7249"
+  drawNode:
+    extends: http://vwf.example.com/aframe/aentity.vwf
+    properties:
+      position: "0 0 0"
+    children:
+      linepath:
+        extends: http://vwf.example.com/aframe/linepath.vwf
+        properties:
+          color: "#14f7b2"
+          path: []
+          width: 0.007
+  defaultXRCostume:
+    extends: http://vwf.example.com/aframe/abox.vwf
+    properties:
+      displayName: "defaultXRCostume"
+      position: "0 0 0"
+      height: 0.01
+      width: 0.01
+      depth: 1
+      penDown: false
+    children:
+      material:
+        extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
+        type: "component"
+        properties:
+          color: "#3c7249"
+      pointer:
+        extends: http://vwf.example.com/aframe/abox.vwf
+        properties:
+          position: "0 0 -0.7"
+          height: 0.1
+          width: 0.1
+          depth: 0.1
+        children:
+          material:
+            extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
+            type: "component"
+            properties:
+              color: "green"
+    methods:
+      triggerdown:
+      triggerup:
+      onMove:
+    scripts:
+      - source: "controller.js"

+ 14 - 0
public/defaults/worlds/paint/info.json

@@ -0,0 +1,14 @@
+{
+    "info": {
+        "en": {
+            "title": "Paint app in XR",
+            "imgUrl": "/defaults/worlds/webrtc/webimg.jpg",
+            "text": "Audio and video streaming for Avatars"
+        },
+        "ru": {
+            "title": "Paint app in XR",
+            "imgUrl": "/defaults/worlds/webrtc/webimg.jpg",
+            "text": "Пример приложения с использованием WebRTC потокового аудио и видео"
+        }
+    }
+}

BIN
public/defaults/worlds/paint/webimg.jpg


+ 2 - 0
public/vwf/view/aframe.js

@@ -738,6 +738,7 @@ define(["module", "vwf/view"], function (module, view) {
                 {
                     console.log("position not equal");
                     self.kernel.setProperty(avatarName, "position", position);
+                    self.kernel.callMethod(avatarName, "moveVRController",[]);
                 }
             }
 
@@ -748,6 +749,7 @@ define(["module", "vwf/view"], function (module, view) {
                 {
                     console.log("rotation not equal");
                     self.kernel.setProperty(avatarName, "rotation", rotation);
+                    self.kernel.callMethod(avatarName, "moveVRController",[]);
                 }
             }