Explorar el Código

paint app fix

Nikolay Suslov hace 4 años
padre
commit
b6d5b90f09

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

@@ -556,6 +556,26 @@ this.createAssetResource = function(resType, resSrc){
 
 }
 
+this.createDrawNode = function(node, name, color, width, pos) {
+    let newNode = {
+        extends: "http://vwf.example.com/aframe/aentity.vwf",
+        properties: {
+            position: pos
+        },
+        children: {
+            linepath: {
+                extends: "http://vwf.example.com/aframe/linepath.vwf",
+                properties: {
+                    color: color,
+                    path: [],
+                    width: width
+                }
+            }
+        }
+    }
+
+    node.children.create(name, newNode);
+} 
 
 this.createPrimitive = function (type, params, name, node, avatar) {
 

+ 7 - 0
public/defaults/proxy/vwf.example.com/aframe/ascene.vwf.yaml

@@ -95,5 +95,12 @@ methods:
   getDefaultXRCostume:
   enterVR:
   exitVR:
+  createDrawNode:
+    parameters:
+      - node
+      - name
+      - color
+      - width
+      - pos
 scripts:
 - source: "http://vwf.example.com/aframe/ascene.js"

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

@@ -24,7 +24,7 @@ this.createController = function (modelSrc) {
     var newNode = {
         "extends": "http://vwf.example.com/aframe/aentity.vwf",
         "properties": {
-            "position": [0, 0, -0.4]
+            "position": [0, 0, -0.1]
         },
         children: {}
     }

+ 6 - 2
public/defaults/worlds/paint/controller.js

@@ -1,6 +1,9 @@
 this.triggerdown = function(){
+    let scene = this.getScene();
     this.pointer.material.color = "black";
     this.penDown = true;
+    this.penName = 'drawNode-' + scene.GUID();
+    scene.createDrawNode(scene.drawBox, this.penName, "#f9f9f9", 0.007, "0 0 0");
 }
 
 this.triggerup = function(){
@@ -11,10 +14,11 @@ this.triggerup = function(){
 this.onMove = function(){
     if(this.penDown){
         let scene = this.getScene();
+        let pen = scene.drawBox.children[this.penName];
         let pos = this.pointer.worldPosition();
-        let path = scene.drawNode.linepath.path.slice();
+        let path = pen.linepath.path.slice();
         path.push(pos);
-        scene.drawNode.linepath.path = path;
+        pen.linepath.path = path;
     }
     
 }

+ 7 - 13
public/defaults/worlds/paint/index.vwf.yaml

@@ -63,17 +63,10 @@ children:
         extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
         properties:
           color: "#3c7249"
-  drawNode:
+  drawBox:
     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:
@@ -81,8 +74,9 @@ children:
       position: "0 0 0"
       height: 0.01
       width: 0.01
-      depth: 1
+      depth: 0.3
       penDown: false
+      penName: "drawNode"
     children:
       material:
         extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
@@ -92,10 +86,10 @@ children:
       pointer:
         extends: http://vwf.example.com/aframe/abox.vwf
         properties:
-          position: "0 0 -0.7"
-          height: 0.1
-          width: 0.1
-          depth: 0.1
+          position: "0 0 -0.25"
+          height: 0.05
+          width: 0.05
+          depth: 0.05
         children:
           material:
             extends: http://vwf.example.com/aframe/aMaterialComponent.vwf