Skip to content
Snippets Groups Projects
Commit 7199bafd authored by Brian Peiris's avatar Brian Peiris
Browse files

workaround for skinned mesh bug on galaxy s6 devices

parent 526f3460
No related branches found
No related tags found
No related merge requests found
{
"printWidth": 120
}
import { angleTo4Direction, angleTo8Direction } from "../utils";
import { angleTo4Direction, angleTo8Direction } from "../utils/dpad";
// @TODO specify 4 or 8 direction
function oculus_touch_joystick_dpad4(el, outputPrefix) {
......
import { angleTo4Direction, angleTo8Direction } from "../utils";
import { angleTo4Direction, angleTo8Direction } from "../utils/dpad";
function vive_trackpad_dpad4(el, outputPrefix) {
this.outputPrefix = outputPrefix;
......
import queryString from "query-string";
import { patchWebGLRenderingContext } from "./utils/webgl";
patchWebGLRenderingContext();
import "aframe";
import "./vendor/GLTFLoader";
import "networked-aframe";
......@@ -36,7 +39,7 @@ import "./components/layers";
import "./components/spawn-controller";
import "./systems/personal-space-bubble";
import { promptForName, getCookie, parseJwt } from "./utils";
import { promptForName, getCookie, parseJwt } from "./utils/identity";
import registerNetworkSchemas from "./network-schemas";
import { inGameActions, config } from "./input-mappings";
import registerTelemetry from "./telemetry";
......
export function angleTo4Direction(angle) {
angle = (angle * THREE.Math.RAD2DEG + 180 + 45) % 360;
if (angle > 0 && angle < 90) {
return "north";
} else if (angle >= 90 && angle < 180) {
return "west";
} else if (angle >= 180 && angle < 270) {
return "south";
} else {
return "east";
}
}
export function angleTo8Direction(angle) {
angle = (angle * THREE.Math.RAD2DEG + 180 + 45) % 360;
var direction = "";
if ((angle >= 0 && angle < 120) || angle >= 330) {
direction += "north";
}
if (angle >= 150 && angle < 300) {
direction += "south";
}
if (angle >= 60 && angle < 210) {
direction += "west";
}
if ((angle >= 240 && angle < 360) || angle < 30) {
direction += "east";
}
return direction;
}
......@@ -190,34 +190,3 @@ export function parseJwt(token) {
var base64 = base64Url.replace("-", "+").replace("_", "/");
return JSON.parse(window.atob(base64));
}
export function angleTo4Direction(angle) {
angle = (angle * THREE.Math.RAD2DEG + 180 + 45) % 360;
if (angle > 0 && angle < 90) {
return "north";
} else if (angle >= 90 && angle < 180) {
return "west";
} else if (angle >= 180 && angle < 270) {
return "south";
} else {
return "east";
}
}
export function angleTo8Direction(angle) {
angle = (angle * THREE.Math.RAD2DEG + 180 + 45) % 360;
var direction = "";
if ((angle >= 0 && angle < 120) || angle >= 330) {
direction += "north";
}
if (angle >= 150 && angle < 300) {
direction += "south";
}
if (angle >= 60 && angle < 210) {
direction += "west";
}
if ((angle >= 240 && angle < 360) || angle < 30) {
direction += "east";
}
return direction;
}
import AFRAME from "aframe";
const THREE = AFRAME.THREE;
function checkFloatTextureSupport() {
const renderer = new THREE.WebGLRenderer();
const scene = new THREE.Scene();
const dataTexture = new THREE.DataTexture(new Float32Array(2 * 2 * 4), 2, 2, THREE.RGBAFormat, THREE.FloatType);
const box = new THREE.Mesh(new THREE.PlaneBufferGeometry(1, 1), new THREE.MeshBasicMaterial({ map: dataTexture }));
box.material.map.needsUpdate = true;
scene.add(box);
renderer.render(scene, new THREE.Camera());
return renderer.context.getError() === 0;
}
let supportsFloatTextures = checkFloatTextureSupport();
export function patchWebGLRenderingContext() {
const originalGetExtension = WebGLRenderingContext.prototype.getExtension;
WebGLRenderingContext.prototype.getExtension = function patchedGetExtension(name) {
// It appears that Galaxy S6 devices falsely report that they support OES_texture_float in Firefox.
// This workaround disables float textures for those devices.
// See https://github.com/mozilla/mr-social-client/issues/32 and https://bugzilla.mozilla.org/show_bug.cgi?id=1338656
if (name === "OES_texture_float" && /Android.+Firefox/.test(navigator.userAgent)) {
if (supportsFloatTextures === undefined) {
supportsFloatTextures = checkFloatTextureSupport();
}
if (!supportsFloatTextures) {
return null;
}
}
return originalGetExtension.call(this, name);
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment