Skip to content

Commit

Permalink
Add documentation, trigger testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Vergenz committed Jan 27, 2018
1 parent d5b89e7 commit c99c75d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/aframe/native-gltf.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
<html>
<head>
<title>Native glTF</title>
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<script src="https://aframe.io/releases/0.7.0/aframe.min.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 debug>
<a-entity id='model' n-gltf='url: resources/glTF/Corset.gltf; scene-index: 0'></a-entity>
<a-entity id='model' detect-click n-gltf='url: resources/glTF/Corset.gltf'></a-entity>
<a-box width='.3' height='.3' depth='.3' position='0 -1 0'></a-box>
</a-scene>
</body>
</html>
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 c99c75d

Please sign in to comment.