Skip to content

Commit

Permalink
Add gltf example to index
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvergenz committed Feb 1, 2018
2 parents 5f484fb + c99c75d commit 209b979
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dist/altspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,14 @@ var NLayoutBrowser = (function (NativeComponent$$1) {
return NLayoutBrowser;
}(NativeComponent));

/**
* @name module:altspace/components.n-gltf
* @class
* @extends module:altspace/components.NativeComponent
* @classdesc Load a 3D model as a native asset, and attach it to this node.
* As a native asset, the model will be inaccessible from javascript, but
* will have better performance, materials, and colliders than normal SDK objects. @aframe
*/
var NGLTF = (function (NativeComponent$$1) {
function NGLTF() {NativeComponent$$1.call(this, 'n-gltf'); }

Expand All @@ -2926,7 +2934,20 @@ var NGLTF = (function (NativeComponent$$1) {
var prototypeAccessors = { schema: {} };
prototypeAccessors.schema.get = function () {
return {
/**
* The URL of the glTF model.
* @instance
* @member {vec3} url
* @memberof module:altspace/components.n-gltf
*/
url: { type: 'string' },

/**
* If the model file describes multiple scenes, load this one instead of the default.
* @instance
* @member {vec3} sceneIndex
* @memberof module:altspace/components.n-gltf
*/
sceneIndex: { type: 'int' }
};
};
Expand Down
10 changes: 10 additions & 0 deletions examples/aframe/native-gltf.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
<title>Native glTF</title>
<script src="https://aframe.io/releases/0.7.1/aframe.js"></script>
<script src='../../dist/altspace.js'></script>
<script>
AFRAME.registerComponent('detect-click', {
init: function(){
var self = this;
this.el.addEventListener('click', function(){
self.el.nextElementSibling.setAttribute('color', '#0f0');
});
}
});
</script>
</head>
<body>
<a-scene altspace>
Expand Down
21 changes: 21 additions & 0 deletions src/components/NGLTF.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import NativeComponent from './NativeComponent';
import Url from 'urllib';

/**
* @name module:altspace/components.n-gltf
* @class
* @extends module:altspace/components.NativeComponent
* @classdesc Load a 3D model as a native asset, and attach it to this node.
* As a native asset, the model will be inaccessible from javascript, but
* will have better performance, materials, and colliders than normal SDK objects. @aframe
*/
export default class NGLTF extends NativeComponent {
constructor() {super('n-gltf'); }
get schema() {
return {
/**
* The URL of the glTF model.
* @instance
* @member {vec3} url
* @memberof module:altspace/components.n-gltf
*/
url: { type: 'string' },

/**
* If the model file describes multiple scenes, load this one instead of the default.
* @instance
* @member {vec3} sceneIndex
* @memberof module:altspace/components.n-gltf
*/
sceneIndex: { type: 'int' }
};
}
Expand Down

0 comments on commit 209b979

Please sign in to comment.