forked from aframevr/aframe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
90 lines (78 loc) · 3.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Polyfill `Promise`.
window.Promise = window.Promise || require('promise-polyfill');
// Check before the polyfill runs
window.hasNativeWebVRImplementation = !!navigator.getVRDisplays || !!navigator.getVRDevices;
window.WebVRConfig = window.WebVRConfig || {
BUFFER_SCALE: 1,
CARDBOARD_UI_DISABLED: true,
ROTATE_INSTRUCTIONS_DISABLED: true,
TOUCH_PANNER_DISABLED: true,
MOUSE_KEYBOARD_CONTROLS_DISABLED: true
};
// Workaround for iOS Safari canvas sizing issues in stereo (webvr-polyfill/issues/102).
// Should be fixed in iOS 10.
if (/(iphone|ipod|ipad).*os.*(7|8|9)/i.test(navigator.userAgent)) {
window.WebVRConfig.BUFFER_SCALE = 1 / window.devicePixelRatio;
}
// WebVR polyfill
require('webvr-polyfill');
require('present'); // Polyfill `performance.now()`.
// CSS.
require('./style/aframe.css');
require('./style/rStats.css');
// Required before `AEntity` so that all components are registered.
var AScene = require('./core/scene/a-scene');
var components = require('./core/component').components;
var registerComponent = require('./core/component').registerComponent;
var registerGeometry = require('./core/geometry').registerGeometry;
var registerPrimitive = require('./extras/primitives/primitives').registerPrimitive;
var registerShader = require('./core/shader').registerShader;
var registerSystem = require('./core/system').registerSystem;
var shaders = require('./core/shader').shaders;
var systems = require('./core/system').systems;
// Exports THREE to window so three.js can be used without alteration.
var THREE = window.THREE = require('./lib/three');
var TWEEN = window.TWEEN = require('tween.js');
var pkg = require('../package');
var utils = require('./utils/');
require('./components/index'); // Register standard components.
require('./geometries/index'); // Register standard geometries.
require('./shaders/index'); // Register standard shaders.
require('./systems/index'); // Register standard systems.
var ANode = require('./core/a-node');
var AEntity = require('./core/a-entity'); // Depends on ANode and core components.
require('./core/a-animation');
require('./core/a-assets');
require('./core/a-cubemap');
require('./core/a-mixin');
// Extras.
require('./extras/components/');
require('./extras/declarative-events/');
require('./extras/primitives/');
console.log('A-Frame Version:', pkg.version);
console.log('three Version:', pkg.dependencies['three']);
console.log('WebVR Polyfill Version:', pkg.dependencies['webvr-polyfill']);
module.exports = window.AFRAME = {
AEntity: AEntity,
ANode: ANode,
AScene: AScene,
components: components,
geometries: require('./core/geometry').geometries,
registerComponent: registerComponent,
registerElement: require('./core/a-register-element').registerElement,
registerGeometry: registerGeometry,
registerPrimitive: registerPrimitive,
registerShader: registerShader,
registerSystem: registerSystem,
primitives: {
getMeshMixin: require('./extras/primitives/getMeshMixin'),
primitives: require('./extras/primitives/primitives').primitives
},
schema: require('./core/schema'),
shaders: shaders,
systems: systems,
THREE: THREE,
TWEEN: TWEEN,
utils: utils,
version: pkg.version
};