Commit 65198117 authored by Jacob Durrant's avatar Jacob Durrant

Fixed multiview and surface bug.

parent c4f8bd2f
CHANGES
=======
1.0.2
-----
* Removed support for the WebGL Multiview extension in VR mode. This
optimization has the potential to speed render times, but it appears to be
broken on the latest version of FireFox (Windows). Future versions of
ProteinVR may revisit the Multiview extension.
* Fixed a bug that caused an error when rendering large molecular surfaces.
1.0.1
-----
......
# ProteinVR 1.0.1 #
# ProteinVR 1.0.2 #
## Introduction ##
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -91,6 +91,6 @@
<script src="js/jsfile.4.babylonjs.materials.min.js"></script>
<script src="js/jsfile.5.babylon.gui.min.js"></script>
<script src="js/peer.min.js" async></script>
<script type="text/javascript" src="runtime.b245b6ae0f20097bad1e.js"></script><script type="text/javascript" src="vendors.b245b6ae0f20097bad1e.js"></script><script type="text/javascript" src="app.b245b6ae0f20097bad1e.js"></script></body>
<script type="text/javascript" src="runtime.5c8bd8707af4b48a404f.js"></script><script type="text/javascript" src="vendors.5c8bd8707af4b48a404f.js"></script><script type="text/javascript" src="app.5c8bd8707af4b48a404f.js"></script></body>
</html>
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");importScripts("precache-manifest.3f6c6b4a97deac8f48db843e8cf8d229.js");workbox.core.skipWaiting();workbox.core.clientsClaim();self.__precacheManifest=[].concat(self.__precacheManifest||[]);workbox.precaching.precacheAndRoute(self.__precacheManifest,{});workbox.routing.registerRoute(/\./,new workbox.strategies.NetworkFirst,"GET");
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");importScripts("precache-manifest.500951af334619a1fa80f7f83d13c6a5.js");workbox.core.skipWaiting();workbox.core.clientsClaim();self.__precacheManifest=[].concat(self.__precacheManifest||[]);workbox.precaching.precacheAndRoute(self.__precacheManifest,{});workbox.routing.registerRoute(/\./,new workbox.strategies.NetworkFirst,"GET");
(function(){'use strict';(function(x){function k(c){if(q[c])return q[c].a;var g=q[c]={m:c,f:!1,a:{}};x[c].call(g.a,g,g.a,k);g.f=!0;return g.a}var q={};k.l=x;k.g=q;k.d=function(c,g,r){k.c(c,g)||Object.defineProperty(c,g,{enumerable:!0,get:r})};k.r=function(c){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"});Object.defineProperty(c,"__esModule",{value:!0})};k.j=function(c,g){g&1&&(c=k(c));if(g&8)return c;if(g&4&&"object"===typeof c&&c&&c.b)return c;var r=
Object.create(null);k.r(r);Object.defineProperty(r,"default",{enumerable:!0,value:c});if(g&2&&"string"!=typeof c)for(var v in c)k.d(r,v,function(t){return c[t]}.bind(null,v));return r};k.h=function(c){var g=c&&c.b?function(){return c["default"]}:function(){return c};k.d(g,"a",g);return g};k.c=function(c,g){return Object.prototype.hasOwnProperty.call(c,g)};k.i="";return k(k.o=0)})([function(x,k,q){function c(a,d){void 0===d&&(d=!1);var e=[],b=a.split("geometry IndexedFaceSet {").splice(1),l=b.length;
for(a=0;a<l;a++){var f=b[a];var m=t("point [","]",f).match(y);for(var n=m.length,p=new Float32Array(n),h=0;h<n;h+=3)p[h]=+m[h+2],p[h+1]=+m[h+1],p[h+2]=+m[h];m=p;d&&(m=g(m));e.push({colors:r(t("color [","]",f)),coors:m,trisIdxs:v(t("coordIndex [","]",f))})}void 0===z&&(z=C(e));a=z;d=e.length;for(b=0;b<d;b++)for(l=e[b].coors.length,f=0;f<l;f+=3)e[b].coors[f]-=a[0],e[b].coors[f+1]-=a[1],e[b].coors[f+2]-=a[2];if(A){w=[];d=["colors","coors","trisIdxs"];b=d.length;l=e.length;for(f=0;f<l;f++)for(a=0;a<b;a++){m=
d[a];n=e[f][m];p=[];h=0;for(var u=n.length;h<u;)p.push(n.slice(h,h+=1E7));n=p;p=n.length;for(h=0;h<p;h++)w.push([f,m,n[h]])}return[]}return e}function g(a){for(var d=a[0],e=a[1],b=a[2],l=a.length,f=0;f<l;f+=3){var m=f+1,n=f+2;0===a[f]&&0===a[m]&&0===a[n]&&(a[f]=d,a[m]=e,a[n]=b)}return a}function r(a){a=a.match(y);for(var d=new Float32Array(4*a.length/3),e=d.length,b=0;b<e;b+=4){var l=3*b/4;d[b]=+a[l];d[b+1]=+a[l+1];d[b+2]=+a[l+2];d[b+3]=1}return d}function v(a){a=a.match(y);for(var d=3*a.length/4,
e=new Uint32Array(d),b=0;b<d;b+=3){var l=4*b/3;e[b]=+a[l];e[b+1]=+a[l+1];e[b+2]=+a[l+2]}return e}function t(a,d,e){a=e.split(a,2);if(1>=a.length)return"";a=a[1].split(d,2);return a[0]}function C(a){if(0===a.length)return new Float32Array([0,0,0]);var d=a.map(function(u){return u.coors.length}).reduce(function(u,D){return u+D});if(0===d)return new Float32Array([0,0,0]);for(var e=0,b=0,l=0,f=a.length,m=0;m<f;m++)for(var n=a[m].coors,p=n.length,h=0;h<p;h+=3)e+=n[h],b+=n[h+1],l+=n[h+2];a=d/3;return new Float32Array([e/
a,b/a,l/a])}q.r(k);q.d(k,"loadValsFromVRML",function(){return c});q.d(k,"removeStrayPoints",function(){return g});var B=self,w=[],y=/(^|-| )[0-9.]{1,8}/g,z=void 0,A=!1;"undefined"!==typeof WorkerGlobalScope&&B instanceof WorkerGlobalScope&&(A=!0);A&&(B.onmessage=function(a){var d=a.data.cmd,e=a.data.data;a=a.data.removeExtraPts;"start"===d&&(c(e,a),d="sendDataChunk");"sendDataChunk"===d&&(d=w.shift(),e=0===w.length?"done":"more",void 0===d&&(e="done"),B.postMessage({chunk:d,status:e}))})}]);}).call(this || window)
Object.create(null);k.r(r);Object.defineProperty(r,"default",{enumerable:!0,value:c});if(g&2&&"string"!=typeof c)for(var v in c)k.d(r,v,function(t){return c[t]}.bind(null,v));return r};k.h=function(c){var g=c&&c.b?function(){return c["default"]}:function(){return c};k.d(g,"a",g);return g};k.c=function(c,g){return Object.prototype.hasOwnProperty.call(c,g)};k.i="";return k(k.o=0)})([function(x,k,q){function c(a,d){void 0===d&&(d=!1);var e=[],b=a.split("geometry IndexedFaceSet {").splice(1),m=b.length;
for(a=0;a<m;a++){var f=b[a];var l=t("point [","]",f).match(y);if(null===l)l=new Float32Array(0);else{for(var n=l.length,p=new Float32Array(n),h=0;h<n;h+=3)p[h]=+l[h+2],p[h+1]=+l[h+1],p[h+2]=+l[h];l=p}d&&(l=g(l));e.push({colors:r(t("color [","]",f)),coors:l,trisIdxs:v(t("coordIndex [","]",f))})}void 0===z&&(z=C(e));a=z;d=e.length;for(b=0;b<d;b++)for(m=e[b].coors.length,f=0;f<m;f+=3)e[b].coors[f]-=a[0],e[b].coors[f+1]-=a[1],e[b].coors[f+2]-=a[2];if(A){w=[];d=["colors","coors","trisIdxs"];b=d.length;
m=e.length;for(f=0;f<m;f++)for(a=0;a<b;a++){l=d[a];n=e[f][l];p=[];h=0;for(var u=n.length;h<u;)p.push(n.slice(h,h+=1E7));n=p;p=n.length;for(h=0;h<p;h++)w.push([f,l,n[h]])}return[]}return e}function g(a){for(var d=a[0],e=a[1],b=a[2],m=a.length,f=0;f<m;f+=3){var l=f+1,n=f+2;0===a[f]&&0===a[l]&&0===a[n]&&(a[f]=d,a[l]=e,a[n]=b)}return a}function r(a){a=a.match(y);if(null===a)return new Float32Array(0);for(var d=new Float32Array(4*a.length/3),e=d.length,b=0;b<e;b+=4){var m=3*b/4;d[b]=+a[m];d[b+1]=+a[m+
1];d[b+2]=+a[m+2];d[b+3]=1}return d}function v(a){a=a.match(y);if(null===a)return new Float32Array(0);for(var d=3*a.length/4,e=new Uint32Array(d),b=0;b<d;b+=3){var m=4*b/3;e[b]=+a[m];e[b+1]=+a[m+1];e[b+2]=+a[m+2]}return e}function t(a,d,e){a=e.split(a,2);if(1>=a.length)return"";a=a[1].split(d,2);return a[0]}function C(a){if(0===a.length)return new Float32Array([0,0,0]);var d=a.map(function(u){return u.coors.length}).reduce(function(u,D){return u+D});if(0===d)return new Float32Array([0,0,0]);for(var e=
0,b=0,m=0,f=a.length,l=0;l<f;l++)for(var n=a[l].coors,p=n.length,h=0;h<p;h+=3)e+=n[h],b+=n[h+1],m+=n[h+2];a=d/3;return new Float32Array([e/a,b/a,m/a])}q.r(k);q.d(k,"loadValsFromVRML",function(){return c});q.d(k,"removeStrayPoints",function(){return g});var B=self,w=[],y=/(^|-| )[0-9.]{1,8}/g,z=void 0,A=!1;"undefined"!==typeof WorkerGlobalScope&&B instanceof WorkerGlobalScope&&(A=!0);A&&(B.onmessage=function(a){var d=a.data.cmd,e=a.data.data;a=a.data.removeExtraPts;"start"===d&&(c(e,a),d="sendDataChunk");
"sendDataChunk"===d&&(d=w.shift(),e=0===w.length?"done":"more",void 0===d&&(e="done"),B.postMessage({chunk:d,status:e}))})}]);}).call(this || window)
{
"name": "protein-vr",
"version": "1.0.1",
"version": "1.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "protein-vr",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"private": true,
"scripts": {
......
No preview for this file type
......@@ -270,7 +270,8 @@ function loadValsFromVRML(repName: string, callBack: any): void {
const vals = chunk[2];
if (modelData.length === modelIdx) {
while (modelData.length <= modelIdx) {
// if (modelData.length === modelIdx) {
modelData.push({
"coors": new Float32Array(0),
"colors": new Float32Array(0),
......
......@@ -81,6 +81,7 @@ export function loadValsFromVRML(vrmlStr: string, removeExtraPts = false): any[]
const vrmlChunksLen = vrmlChunks.length;
for (let i = 0; i < vrmlChunksLen; i++) {
const vrmlChunk = vrmlChunks[i];
// Extract the coordinates from the vrml text
let coors = strToCoors(betweenbookends("point [", "]", vrmlChunk));
......@@ -192,6 +193,12 @@ function chunk(arr: any[]): any[] {
function strToCoors(str: string): any {
// Convert coordinates in string form to arrays.
const coorStrs = str.match(numRegex);
if (coorStrs === null) {
// Sometimes there are no matches, e.g., 2HU4 surface.
return new Float32Array(0);
}
const coorLen = coorStrs.length;
const coors = new Float32Array(coorLen);
......@@ -217,6 +224,12 @@ function strToCoors(str: string): any {
function strToColors(str: string): any {
// Convert coordinates in string form to arrays.
const colorStrs = str.match(numRegex);
if (colorStrs === null) {
// Sometimes there are no matches, e.g., 2HU4 surface.
return new Float32Array(0);
}
const colorStrsLen = colorStrs.length;
const colors = new Float32Array(4 * colorStrsLen / 3);
const colorLen = colors.length;
......@@ -242,6 +255,12 @@ function strToColors(str: string): any {
function strToTris(str: string): any {
// Convert coordinates in string form to arrays.
const indexStrs = str.match(numRegex);
if (indexStrs === null) {
// Sometimes there are no matches, e.g., 2HU4 surface.
return new Float32Array(0);
}
const indexStrsLen = indexStrs.length;
const indexLen = 3 * indexStrsLen / 4;
const indexes = new Uint32Array(indexLen);
......
......@@ -22,7 +22,7 @@ export interface IVRSetup {
menuActive?: boolean;
}
export const VERSION = "1.0.1";
export const VERSION = "1.0.2";
export let canvas: any;
export let engine: any;
......@@ -169,12 +169,15 @@ export function setupVR(initParams: IVRSetup): void {
"createDeviceOrientationCamera": true,
"useMultiview": false
};
if (scene.getEngine().getCaps().multiview) {
// TODO: No multiview for now because causes errors on latest FireFox.
// Good to revist this in the future as WebVR progresses.
// if (scene.getEngine().getCaps().multiview) {
// Much faster according to
// https://doc.babylonjs.com/how_to/multiview, but not supported in
// all browsers.
params["useMultiview"] = true;
}
// params["useMultiview"] = true;
// }
vrHelper = scene.createDefaultVRExperience(params);
// Hide the vrHelper icon initially.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment