Skip to content

Commit

Permalink
firefox safari perf fix. plus miscellaneous
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpeiris committed Apr 7, 2018
1 parent 6665cb0 commit c29b804
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
rules: {
"prettier/prettier": "error",
"prefer-const": "error",
"no-use-before-define": "error",
"no-var": "error",
"no-throw-literal": "error",
// Light console usage is useful but remove debug logs before merging to master.
Expand Down
4 changes: 2 additions & 2 deletions src/components/super-cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ AFRAME.registerComponent("super-cursor", {
_handleMouseDown: function() {
if (this.isInteractable) {
const lookControls = this.data.camera.components["look-controls"];
lookControls.pause();
if (lookControls) lookControls.pause();
}
this.data.cursor.emit("action_grab", {});
},
Expand All @@ -117,7 +117,7 @@ AFRAME.registerComponent("super-cursor", {

_handleMouseUp: function() {
const lookControls = this.data.camera.components["look-controls"];
lookControls.play();
if (lookControls) lookControls.play();
this.data.cursor.emit("action_release", {});
},

Expand Down
2 changes: 1 addition & 1 deletion src/hub.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</head>

<body data-html-prefix="<%= HTML_PREFIX %>">
<script>(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})()</script>
<audio id="test-tone" src="./assets/sfx/tone.ogg"></audio>

<a-scene
Expand Down Expand Up @@ -187,7 +188,6 @@
camera
position="0 1.6 0"
personal-space-bubble="radius: 0.4"
look-controls
></a-entity>

<a-entity
Expand Down
15 changes: 7 additions & 8 deletions src/hub.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./assets/stylesheets/hub.scss";
import queryString from "query-string";
import { debounce } from "lodash";

import { patchWebGLRenderingContext } from "./utils/webgl";
patchWebGLRenderingContext();
Expand Down Expand Up @@ -126,6 +127,7 @@ async function enterScene(mediaStream, enterInVR, janusRoomId) {
const scene = document.querySelector("a-scene");
const playerRig = document.querySelector("#player-rig");
document.querySelector("a-scene canvas").classList.remove("blurred");
scene.render();

if (enterInVR) {
scene.enterVR();
Expand Down Expand Up @@ -179,11 +181,7 @@ async function enterScene(mediaStream, enterInVR, janusRoomId) {
screenEntity.setAttribute("visible", sharingScreen);
});

if (qsTruthy("offline")) {
onConnect();
} else {
document.body.addEventListener("connected", onConnect);

if (!qsTruthy("offline")) {
scene.components["networked-scene"].connect();

if (mediaStream) {
Expand All @@ -207,8 +205,6 @@ async function enterScene(mediaStream, enterInVR, janusRoomId) {
}
}

function onConnect() {}

function mountUI(scene) {
const disableAutoExitOnConcurrentLoad = qsTruthy("allow_multi");
const forcedVREntryType = qs.vr_entry_type || null;
Expand Down Expand Up @@ -255,7 +251,10 @@ const onReady = async () => {
const environmentRoot = document.querySelector("#environment-root");

const initialEnvironmentEl = document.createElement("a-entity");
initialEnvironmentEl.addEventListener("bundleloaded", () => uiRoot.setState({ initialEnvironmentLoaded: true }));
initialEnvironmentEl.addEventListener("bundleloaded", () => {
uiRoot.setState({ initialEnvironmentLoaded: true });
setTimeout(() => scene.renderer.animate(null), 100);
});
environmentRoot.appendChild(initialEnvironmentEl);

if (qs.room) {
Expand Down
2 changes: 1 addition & 1 deletion src/react-components/ui-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class UIRoot extends Component {
enableScreenSharing: PropTypes.bool,
store: PropTypes.object,
scene: PropTypes.object,
htmlPrefix: PropTypes.object
htmlPrefix: PropTypes.string
};

state = {
Expand Down
8 changes: 4 additions & 4 deletions src/vendor/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THREE.GLTFLoader = ( function () {

try {

scope.parse( data, path, onLoad, onError );
scope.parse( url, data, path, onLoad, onError );

} catch ( e ) {

Expand Down Expand Up @@ -80,7 +80,7 @@ THREE.GLTFLoader = ( function () {

},

parse: function ( data, path, onLoad, onError ) {
parse: function ( url, data, path, onLoad, onError ) {

var content;
var extensions = {};
Expand Down Expand Up @@ -159,7 +159,7 @@ THREE.GLTFLoader = ( function () {

}

console.time( 'GLTFLoader' );
console.time( `GLTFLoader - ${url}` );

var parser = new GLTFParser( json, extensions, {

Expand All @@ -171,7 +171,7 @@ THREE.GLTFLoader = ( function () {

parser.parse( function ( scene, scenes, cameras, animations, asset ) {

console.timeEnd( 'GLTFLoader' );
console.timeEnd( `GLTFLoader - ${url}` );

var glTF = {
scene: scene,
Expand Down

0 comments on commit c29b804

Please sign in to comment.