Jelajahi Sumber

DAE from url create support

Nikolay Suslov 7 tahun lalu
induk
melakukan
61467fefa4

+ 164 - 37
support/client/lib/vwf/view/editor-new.js

@@ -195,7 +195,7 @@ define([
                             {
                                 $cell: true,
                                 $type: "h3",
-                                class: "mdc-typography--subheading2",
+                                class: "mdc-typography--title",
                                 $text:"Primitives"
                             },
                             {
@@ -211,12 +211,12 @@ define([
                                     }
                                 ]
                             },
-                            widgets.divider,
+                            //widgets.divider,
                             {
                                 $cell: true,
                                 $type: "h3",
                                 $text:"Lights",
-                                class: "mdc-typography--subheading2"
+                                class: "mdc-typography--title"
                             },
                             {
                                 $cell: true,
@@ -231,44 +231,171 @@ define([
                                     }
                                 ]
                             },
-                            // widgets.divider,
-                            // {
-                            //     $cell: true,
-                            //     $type: "h3",
-                            //     class: "mdc-typography--subheading2",
-                            //     $text:"Objects"
-                            // },
-                            // {
-                            //     $cell: true,
-                            //     $type: "div",
-                            //     class: "mdc-grid-list",
-                            //     $components: [
-                            //         {
-                            //             $cell: true,
-                            //             $type: "ul",
-                            //             class: "mdc-grid-list__tiles",
-                            //             $components: [  
-                            //                 self.widgets.gridListItem({
-                            //                     imgSrc: "vwf/view/lib/images/ui/icons/floor.png",
-                            //                     title: 'Floor',
-                            //                     styleClass: "createListItem",
-                            //                     onclickfunc: function(){
-                            //                         //let cubeName = self.GUID();
-                            //                        // vwf_view.kernel.callMethod(vwf.application(), "createFloor")
-                            //                     }
-                            //                 })
+                            //widgets.divider,
+                            {
+                                $cell: true,
+                                $type: "h3",
+                                class: "mdc-typography--title",
+                                $text:"Objects"
+                            },
+                            {
+                                $cell: true,
+                                $type: "div",
+                                class: "mdc-grid-list",
+                                $components: [
+                                    {
+                                        $cell: true,
+                                        $type: "ul",
+                                        class: "mdc-grid-list__tiles",
+                                        $components: [  
+                                            self.widgets.gridListItem({
+                                                imgSrc: "vwf/view/lib/images/ui/icons/camera.png",
+                                                title: 'Camera',
+                                                styleClass: "createListItem",
+                                                onclickfunc: function(){
+                                                    //let cubeName = self.GUID();
+                                                   // vwf_view.kernel.callMethod(vwf.application(), "createFloor")
+                                                }
+                                            }),
+                                            self.widgets.gridListItem({
+                                                imgSrc: "vwf/view/lib/images/ui/icons/camera_offset.png",
+                                                title: 'Camera with view offset',
+                                                styleClass: "createListItem",
+                                                onclickfunc: function(){
+                                                    //let cubeName = self.GUID();
+                                                   // vwf_view.kernel.callMethod(vwf.application(), "createFloor")
+                                                }
+                                            })
                                         
                                         
-                            //             ]
-                            //         }
-                            //     ]
-                            // }, 
-                            widgets.divider,
+                                        ]
+                                    }
+                                ]
+                            }, 
+                            //widgets.divider,
+                            {
+                                $cell: true,
+                                $type: "h3",
+                                class: "mdc-typography--title",
+                                $text:"3D Assets" 
+                             
+                            },
+                            widgets.textField({
+                                id:"asset3dsrc",
+                                value:"URL to asset source",
+                                funconchange: function(e){
+                                    console.log(this.value)
+                                }
+                            }),
+                            {
+                                $cell: true,
+                                $type: "div",
+                                class: "mdc-grid-list",
+                                $components: [
+                                    {
+                                        $cell: true,
+                                        $type: "ul",
+                                        class: "mdc-grid-list__tiles",
+                                        $components: [
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "GLTF",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            ),
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "DAE",
+                                                    onclick: function(e){
+                                                        let srcEl = document.querySelector('#asset3dsrc');
+                                                        let avatarID = 'avatar-' + vwf.moniker_;
+                                                        if(srcEl.value.includes('.dae'))
+                                                        vwf_view.kernel.callMethod(vwf.application(), "createModelDAE", [srcEl.value, avatarID])
+
+                                                    }
+                                                }
+                                            ),
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "OBJ",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            ),
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "MTL",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            ),
+                                        
+                                        ]
+                                    }
+                                ]
+                            }, 
+                            //widgets.divider,
+                            {
+                                $cell: true,
+                                $type: "h3",
+                                class: "mdc-typography--title",
+                                $text:"2D Assets / Sound" 
+                             
+                            },
+                            widgets.textField({
+                                id:"asset2dsrc",
+                                value:"URL to asset source",
+                                funconchange: function(e){
+                                    console.log(this.value)
+                                }
+                            }),
+                            {
+                                $cell: true,
+                                $type: "div",
+                                class: "mdc-grid-list",
+                                $components: [
+                                    {
+                                        $cell: true,
+                                        $type: "ul",
+                                        class: "mdc-grid-list__tiles",
+                                        $components: [
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "Image",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            ),
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "Sound",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            ),
+                                            widgets.buttonStroked(
+                                                {
+                                                    label: "Video",
+                                                    onclick: function(e){
+                                                    }
+                                                }
+                                            )
+                                           
+                                        
+                                        ]
+                                    }
+                                ]
+                            },
+                            {
+                                $type:"div"
+                            },
+                             //widgets.divider,
                             {
                                 $cell: true,
                                 $type: "h3",
-                                class: "mdc-typography--subheading2",
-                                $text:"Assets" 
+                                class: "mdc-typography--title",
+                                $text:"Resources" 
                              
                             },
                             {
@@ -283,7 +410,7 @@ define([
                                         $components: [
                                             self.widgets.gridListItem({
                                                 imgSrc: "vwf/view/lib/images/ui/icons/3ditem.png",
-                                                title: '3D Model',
+                                                title: 'Asset item',
                                                 styleClass: "createListItem"
                                             }),
                                             self.widgets.gridListItem({

TEMPAT SAMPAH
support/client/lib/vwf/view/lib/images/ui/icons/camera.png


TEMPAT SAMPAH
support/client/lib/vwf/view/lib/images/ui/icons/camera_offset.png


+ 21 - 0
support/client/lib/vwf/view/widgets.js

@@ -315,6 +315,27 @@ define(function () {
             }
         }
 
+        textField(obj) {
+            return {
+                class: "mdc-text-field",
+                style: "width: 100%",
+                $cell: true,
+                $type: "div",
+                $components: [
+                    {
+                        class: "mdc-text-field__input prop-text-field-input",
+                        id: obj.id,
+                        $cell: true,
+                        $type: "input",
+                        type: "text",
+                        value: obj.value,
+                        onchange: obj.funconchange
+                    }
+
+                ]
+            }
+        }
+
         icontoggle(obj) {
             return {
                 $cell: true,

+ 44 - 4
support/proxy/vwf.example.com/aframe/ascene.js

@@ -332,6 +332,47 @@ this.planeProto = function () {
     return node
 }
 
+this.createModelDAE = function (daeSrc, avatar) {
+
+    var self = this;
+
+    let daeTagName = 'DAE-ASSET-'+this.GUID();
+    let daeTagNode = {
+        "extends": "http://vwf.example.com/aframe/a-asset-item.vwf",
+        "properties": {
+            "itemID": daeTagName,
+            "itemSrc": daeSrc,
+        },
+    }
+
+    this.children.create(daeTagName, daeTagNode, function( child ) {
+        let daeNodeName = 'DAE-MODEL-'+self.GUID();
+
+        var position = "0 0 0";
+        let myAvatar = self.children[avatar];
+        let cursorNode = myAvatar.avatarNode.myHead.myCursor.vis;
+    
+        if (cursorNode) {
+             position = cursorNode.worldPosition;
+            //console.log(position);
+        }
+
+        let daeNode = {
+            "extends": "http://vwf.example.com/aframe/acolladamodel.vwf",
+            "properties": {
+                "src": '#' + child.itemID,
+                "position": position
+            }
+        }
+
+        self.children.create(daeNodeName, daeNode, function( child ) {
+            if (avatar) child.lookAt(self.children[avatar].worldPosition)
+           });
+
+       });
+}
+
+
 this.createPrimitive = function (type, avatar, params, name, node) {
 
     var position = "0 0 0";
@@ -392,9 +433,7 @@ this.createPrimitive = function (type, avatar, params, name, node) {
     if (newNode) {
         newNode.properties.position = position;
         this.children.create(nodeName, newNode, function( child ) {
-           // self.select( self.clickedID );
-           child.lookAt(this.children[avatar].worldPosition)
-           //console.log(avatar);
+           child.lookAt(self.children[avatar].worldPosition)
           });
     }
 
@@ -456,4 +495,5 @@ this.deleteNode = function(nodeName){
       let node = this.children[nodeName];
     if (node) this.children.delete(node);
 
-}
+}
+

+ 4 - 0
support/proxy/vwf.example.com/aframe/ascene.vwf.yaml

@@ -25,6 +25,10 @@ methods:
   lightProto:
      parameters:
       - lightType
+  createModelDAE:
+    parameters:
+      - src
+      - avatar
   deleteNode:
     parameters:
       - nodeName