viral-viewer-2 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +57 -57
- package/dist/components/mouse/viral-mouse.d.ts +13 -0
- package/dist/components/mouse/viral-mouse.js +78 -2
- package/dist/components/mouse/viral-mouse.js.map +1 -1
- package/dist/components/spinner/viral-spinner.js +159 -159
- package/dist/components/worker/test-worker.worker.d.ts +6 -0
- package/dist/components/worker/test-worker.worker.js +21 -0
- package/dist/components/worker/test-worker.worker.js.map +1 -0
- package/dist/components/worker/viral-viewer-3.worker.js +2 -0
- package/dist/components/worker/viral-viewer-3.worker.js.map +1 -1
- package/dist/components/worker-script/threejs.script.js +16 -0
- package/dist/components/worker-script/threejs.script.js.map +1 -0
- package/dist/components/worker-script/threejs.types.js +185 -185
- package/dist/types.d.ts +5 -0
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +29 -29
- package/dist/components/worker/load-model.d.ts +0 -126
- package/dist/components/worker/load-model.js +0 -1265
- package/dist/components/worker/load-model.js.map +0 -1
- package/dist/components/worker/test-worker-pool.d.ts +0 -6
- package/dist/components/worker/test-worker-pool.js +0 -21
- package/dist/components/worker/test-worker-pool.js.map +0 -1
- package/dist/components/worker-script/load-model-worker-3.script.d.ts +0 -0
- package/dist/components/worker-script/load-model-worker-3.script.js +0 -170
- package/dist/components/worker-script/load-model-worker-3.script.js.map +0 -1
- package/dist/components/worker-script/test-worker-pool.script.js +0 -12
- package/dist/components/worker-script/test-worker-pool.script.js.map +0 -1
- /package/dist/components/worker-script/{test-worker-pool.script.d.ts → threejs.script.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestWorker = void 0;
|
|
4
|
+
const worker_pool_1 = require("./base/worker-pool");
|
|
5
|
+
const threejs_script_1 = require("../worker-script/threejs.script");
|
|
6
|
+
class TestWorker {
|
|
7
|
+
constructor() {
|
|
8
|
+
// Create a new Blob containing the worker code
|
|
9
|
+
const blob = new Blob([`(${threejs_script_1.workerCode})()`]);
|
|
10
|
+
const workerPath = URL.createObjectURL(blob);
|
|
11
|
+
// Create a new Worker from the Blob
|
|
12
|
+
this.workerPool = new worker_pool_1.WorkerThreadPool(4, workerPath);
|
|
13
|
+
}
|
|
14
|
+
initial(callbackOnSuccess = () => { }) {
|
|
15
|
+
this.workerPool.Enqueue("test", (data) => {
|
|
16
|
+
callbackOnSuccess();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.TestWorker = TestWorker;
|
|
21
|
+
//# sourceMappingURL=test-worker.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker.worker.js","sourceRoot":"","sources":["../../../src/components/worker/test-worker.worker.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AACtD,oEAA6D;AAE7D,MAAa,UAAU;IAEnB;QAEI,+CAA+C;QAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,2BAAU,KAAK,CAAC,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC7C,oCAAoC;QACpC,IAAI,CAAC,UAAU,GAAG,IAAI,8BAAgB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEM,OAAO,CAAE,iBAAiB,GAAG,GAAG,EAAE,GAAG,CAAC;QACzC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAc,MAAM,EAAE,CAAC,IAAS,EAAE,EAAE;YACvD,iBAAiB,EAAE,CAAC;QACxB,CAAC,CAAC,CAAA;IAEN,CAAC;CACJ;AAjBD,gCAiBC"}
|
|
@@ -47,6 +47,7 @@ class ViralViewerWorker3 {
|
|
|
47
47
|
this.workerPool.Enqueue(inputData, (data) => {
|
|
48
48
|
let mesh = this.threejsLoader.parse(data);
|
|
49
49
|
mesh.material = this.threejsMaterials.get(model.MaterialIndex);
|
|
50
|
+
mesh.userData.type = "Revit Element";
|
|
50
51
|
if (this.mainModel)
|
|
51
52
|
this.mainModel.add(mesh);
|
|
52
53
|
this.viralViewerApi.viralRenderer.render();
|
|
@@ -57,6 +58,7 @@ class ViralViewerWorker3 {
|
|
|
57
58
|
this.workerPool.Enqueue(model, (data) => {
|
|
58
59
|
let mesh = this.threejsLoader.parse(data);
|
|
59
60
|
mesh.material = this.threejsMaterials.get(model.MaterialIndex);
|
|
61
|
+
mesh.userData.type = "Revit Element";
|
|
60
62
|
if (this.mainModel)
|
|
61
63
|
this.mainModel.add(mesh);
|
|
62
64
|
this.viralViewerApi.viralRenderer.render();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viral-viewer-3.worker.js","sourceRoot":"","sources":["../../../src/components/worker/viral-viewer-3.worker.ts"],"names":[],"mappings":";;;AACA,uCAA4K;AAC5K,iCAAsN;AACtN,4EAA4E;AAC5E,kEAA4D;AAC5D,oEAA2D;AAC3D,oDAAsD;AAGtD,MAAa,kBAAkB;IAQ3B,YAAmB,cAA8B,EAAE,YAAoB,gDAAgD;QAApG,mBAAc,GAAd,cAAc,CAAgB;QAN1C,cAAS,GAAqB,EAAE,CAAC;QACjC,cAAS,GAAgB,IAAI,CAAC;QAC9B,qBAAgB,GAA0C,IAAI,6BAAU,EAA6B,CAAC;QAC5F,wBAAmB,GAAG,IAAI,CAAC;QAC3B,sBAAiB,GAAG,IAAI,CAAC;QAClC,kBAAa,GAAG,IAAI,oBAAY,EAAE,CAAC;QAGvC,+CAA+C;QAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,0BAAU,KAAK,CAAC,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC7C,oCAAoC;QACpC,IAAI,CAAC,UAAU,GAAG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C;CACJ;AApED,gDAoEC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workerCode = void 0;
|
|
4
|
+
function workerFunction() {
|
|
5
|
+
function child() {
|
|
6
|
+
Promise.resolve().then(() => require('../../threejs-addon/simplify-modifier')).then((THREE) => {
|
|
7
|
+
let modifier = new THREE.SimplifyModifier();
|
|
8
|
+
console.log(modifier);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
self.addEventListener("message", (event) => {
|
|
12
|
+
child();
|
|
13
|
+
}, false);
|
|
14
|
+
}
|
|
15
|
+
exports.workerCode = workerFunction;
|
|
16
|
+
//# sourceMappingURL=threejs.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threejs.script.js","sourceRoot":"","sources":["../../../src/components/worker-script/threejs.script.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc;IAClB,SAAS,KAAK;QACX,qCAAO,uCAAuC,GAAE,IAAI,CAAC,CAAC,KAAU,EAAE,EAAE;YAChE,IAAI,QAAQ,GAAG,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IAEN,CAAC;IAGD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAwB,EAAE,EAAE;QAC1D,KAAK,EAAE,CAAC;IACZ,CAAC,EACG,KAAK,CACR,CAAC;AACN,CAAC;AACY,QAAA,UAAU,GAAQ,cAAc,CAAC"}
|
|
@@ -8485,42 +8485,42 @@ function workerFunction() {
|
|
|
8485
8485
|
uniforms: {
|
|
8486
8486
|
tEquirect: { value: null },
|
|
8487
8487
|
},
|
|
8488
|
-
vertexShader: /* glsl */ `
|
|
8489
|
-
|
|
8490
|
-
varying vec3 vWorldDirection;
|
|
8491
|
-
|
|
8492
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
8493
|
-
|
|
8494
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
8495
|
-
|
|
8496
|
-
}
|
|
8497
|
-
|
|
8498
|
-
void main() {
|
|
8499
|
-
|
|
8500
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
8501
|
-
|
|
8502
|
-
#include <begin_vertex>
|
|
8503
|
-
#include <project_vertex>
|
|
8504
|
-
|
|
8505
|
-
}
|
|
8488
|
+
vertexShader: /* glsl */ `
|
|
8489
|
+
|
|
8490
|
+
varying vec3 vWorldDirection;
|
|
8491
|
+
|
|
8492
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
8493
|
+
|
|
8494
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
8495
|
+
|
|
8496
|
+
}
|
|
8497
|
+
|
|
8498
|
+
void main() {
|
|
8499
|
+
|
|
8500
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
8501
|
+
|
|
8502
|
+
#include <begin_vertex>
|
|
8503
|
+
#include <project_vertex>
|
|
8504
|
+
|
|
8505
|
+
}
|
|
8506
8506
|
`,
|
|
8507
|
-
fragmentShader: /* glsl */ `
|
|
8508
|
-
|
|
8509
|
-
uniform sampler2D tEquirect;
|
|
8510
|
-
|
|
8511
|
-
varying vec3 vWorldDirection;
|
|
8512
|
-
|
|
8513
|
-
#include <common>
|
|
8514
|
-
|
|
8515
|
-
void main() {
|
|
8516
|
-
|
|
8517
|
-
vec3 direction = normalize( vWorldDirection );
|
|
8518
|
-
|
|
8519
|
-
vec2 sampleUV = equirectUv( direction );
|
|
8520
|
-
|
|
8521
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
8522
|
-
|
|
8523
|
-
}
|
|
8507
|
+
fragmentShader: /* glsl */ `
|
|
8508
|
+
|
|
8509
|
+
uniform sampler2D tEquirect;
|
|
8510
|
+
|
|
8511
|
+
varying vec3 vWorldDirection;
|
|
8512
|
+
|
|
8513
|
+
#include <common>
|
|
8514
|
+
|
|
8515
|
+
void main() {
|
|
8516
|
+
|
|
8517
|
+
vec3 direction = normalize( vWorldDirection );
|
|
8518
|
+
|
|
8519
|
+
vec2 sampleUV = equirectUv( direction );
|
|
8520
|
+
|
|
8521
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
8522
|
+
|
|
8523
|
+
}
|
|
8524
8524
|
`,
|
|
8525
8525
|
};
|
|
8526
8526
|
const geometry = new BoxGeometry(5, 5, 5);
|
|
@@ -11055,66 +11055,66 @@ function workerFunction() {
|
|
|
11055
11055
|
poleAxis: { value: poleAxis },
|
|
11056
11056
|
},
|
|
11057
11057
|
vertexShader: _getCommonVertexShader(),
|
|
11058
|
-
fragmentShader: /* glsl */ `
|
|
11059
|
-
|
|
11060
|
-
precision mediump float;
|
|
11061
|
-
precision mediump int;
|
|
11062
|
-
|
|
11063
|
-
varying vec3 vOutputDirection;
|
|
11064
|
-
|
|
11065
|
-
uniform sampler2D envMap;
|
|
11066
|
-
uniform int samples;
|
|
11067
|
-
uniform float weights[ n ];
|
|
11068
|
-
uniform bool latitudinal;
|
|
11069
|
-
uniform float dTheta;
|
|
11070
|
-
uniform float mipInt;
|
|
11071
|
-
uniform vec3 poleAxis;
|
|
11072
|
-
|
|
11073
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
11074
|
-
#include <cube_uv_reflection_fragment>
|
|
11075
|
-
|
|
11076
|
-
vec3 getSample( float theta, vec3 axis ) {
|
|
11077
|
-
|
|
11078
|
-
float cosTheta = cos( theta );
|
|
11079
|
-
// Rodrigues' axis-angle rotation
|
|
11080
|
-
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
11081
|
-
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
11082
|
-
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
11083
|
-
|
|
11084
|
-
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
11085
|
-
|
|
11086
|
-
}
|
|
11087
|
-
|
|
11088
|
-
void main() {
|
|
11089
|
-
|
|
11090
|
-
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
11091
|
-
|
|
11092
|
-
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
11093
|
-
|
|
11094
|
-
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
11095
|
-
|
|
11096
|
-
}
|
|
11097
|
-
|
|
11098
|
-
axis = normalize( axis );
|
|
11099
|
-
|
|
11100
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
11101
|
-
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
11102
|
-
|
|
11103
|
-
for ( int i = 1; i < n; i++ ) {
|
|
11104
|
-
|
|
11105
|
-
if ( i >= samples ) {
|
|
11106
|
-
|
|
11107
|
-
break;
|
|
11108
|
-
|
|
11109
|
-
}
|
|
11110
|
-
|
|
11111
|
-
float theta = dTheta * float( i );
|
|
11112
|
-
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
11113
|
-
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
11114
|
-
|
|
11115
|
-
}
|
|
11116
|
-
|
|
11117
|
-
}
|
|
11058
|
+
fragmentShader: /* glsl */ `
|
|
11059
|
+
|
|
11060
|
+
precision mediump float;
|
|
11061
|
+
precision mediump int;
|
|
11062
|
+
|
|
11063
|
+
varying vec3 vOutputDirection;
|
|
11064
|
+
|
|
11065
|
+
uniform sampler2D envMap;
|
|
11066
|
+
uniform int samples;
|
|
11067
|
+
uniform float weights[ n ];
|
|
11068
|
+
uniform bool latitudinal;
|
|
11069
|
+
uniform float dTheta;
|
|
11070
|
+
uniform float mipInt;
|
|
11071
|
+
uniform vec3 poleAxis;
|
|
11072
|
+
|
|
11073
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
11074
|
+
#include <cube_uv_reflection_fragment>
|
|
11075
|
+
|
|
11076
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
11077
|
+
|
|
11078
|
+
float cosTheta = cos( theta );
|
|
11079
|
+
// Rodrigues' axis-angle rotation
|
|
11080
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
11081
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
11082
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
11083
|
+
|
|
11084
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
11085
|
+
|
|
11086
|
+
}
|
|
11087
|
+
|
|
11088
|
+
void main() {
|
|
11089
|
+
|
|
11090
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
11091
|
+
|
|
11092
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
11093
|
+
|
|
11094
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
11095
|
+
|
|
11096
|
+
}
|
|
11097
|
+
|
|
11098
|
+
axis = normalize( axis );
|
|
11099
|
+
|
|
11100
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
11101
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
11102
|
+
|
|
11103
|
+
for ( int i = 1; i < n; i++ ) {
|
|
11104
|
+
|
|
11105
|
+
if ( i >= samples ) {
|
|
11106
|
+
|
|
11107
|
+
break;
|
|
11108
|
+
|
|
11109
|
+
}
|
|
11110
|
+
|
|
11111
|
+
float theta = dTheta * float( i );
|
|
11112
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
11113
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
11114
|
+
|
|
11115
|
+
}
|
|
11116
|
+
|
|
11117
|
+
}
|
|
11118
11118
|
`,
|
|
11119
11119
|
blending: NoBlending,
|
|
11120
11120
|
depthTest: false,
|
|
@@ -11129,25 +11129,25 @@ function workerFunction() {
|
|
|
11129
11129
|
envMap: { value: null },
|
|
11130
11130
|
},
|
|
11131
11131
|
vertexShader: _getCommonVertexShader(),
|
|
11132
|
-
fragmentShader: /* glsl */ `
|
|
11133
|
-
|
|
11134
|
-
precision mediump float;
|
|
11135
|
-
precision mediump int;
|
|
11136
|
-
|
|
11137
|
-
varying vec3 vOutputDirection;
|
|
11138
|
-
|
|
11139
|
-
uniform sampler2D envMap;
|
|
11140
|
-
|
|
11141
|
-
#include <common>
|
|
11142
|
-
|
|
11143
|
-
void main() {
|
|
11144
|
-
|
|
11145
|
-
vec3 outputDirection = normalize( vOutputDirection );
|
|
11146
|
-
vec2 uv = equirectUv( outputDirection );
|
|
11147
|
-
|
|
11148
|
-
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
11149
|
-
|
|
11150
|
-
}
|
|
11132
|
+
fragmentShader: /* glsl */ `
|
|
11133
|
+
|
|
11134
|
+
precision mediump float;
|
|
11135
|
+
precision mediump int;
|
|
11136
|
+
|
|
11137
|
+
varying vec3 vOutputDirection;
|
|
11138
|
+
|
|
11139
|
+
uniform sampler2D envMap;
|
|
11140
|
+
|
|
11141
|
+
#include <common>
|
|
11142
|
+
|
|
11143
|
+
void main() {
|
|
11144
|
+
|
|
11145
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
11146
|
+
vec2 uv = equirectUv( outputDirection );
|
|
11147
|
+
|
|
11148
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
11149
|
+
|
|
11150
|
+
}
|
|
11151
11151
|
`,
|
|
11152
11152
|
blending: NoBlending,
|
|
11153
11153
|
depthTest: false,
|
|
@@ -11162,22 +11162,22 @@ function workerFunction() {
|
|
|
11162
11162
|
flipEnvMap: { value: -1 },
|
|
11163
11163
|
},
|
|
11164
11164
|
vertexShader: _getCommonVertexShader(),
|
|
11165
|
-
fragmentShader: /* glsl */ `
|
|
11166
|
-
|
|
11167
|
-
precision mediump float;
|
|
11168
|
-
precision mediump int;
|
|
11169
|
-
|
|
11170
|
-
uniform float flipEnvMap;
|
|
11171
|
-
|
|
11172
|
-
varying vec3 vOutputDirection;
|
|
11173
|
-
|
|
11174
|
-
uniform samplerCube envMap;
|
|
11175
|
-
|
|
11176
|
-
void main() {
|
|
11177
|
-
|
|
11178
|
-
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
11179
|
-
|
|
11180
|
-
}
|
|
11165
|
+
fragmentShader: /* glsl */ `
|
|
11166
|
+
|
|
11167
|
+
precision mediump float;
|
|
11168
|
+
precision mediump int;
|
|
11169
|
+
|
|
11170
|
+
uniform float flipEnvMap;
|
|
11171
|
+
|
|
11172
|
+
varying vec3 vOutputDirection;
|
|
11173
|
+
|
|
11174
|
+
uniform samplerCube envMap;
|
|
11175
|
+
|
|
11176
|
+
void main() {
|
|
11177
|
+
|
|
11178
|
+
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
11179
|
+
|
|
11180
|
+
}
|
|
11181
11181
|
`,
|
|
11182
11182
|
blending: NoBlending,
|
|
11183
11183
|
depthTest: false,
|
|
@@ -11185,61 +11185,61 @@ function workerFunction() {
|
|
|
11185
11185
|
});
|
|
11186
11186
|
}
|
|
11187
11187
|
function _getCommonVertexShader() {
|
|
11188
|
-
return /* glsl */ `
|
|
11189
|
-
|
|
11190
|
-
precision mediump float;
|
|
11191
|
-
precision mediump int;
|
|
11192
|
-
|
|
11193
|
-
attribute float faceIndex;
|
|
11194
|
-
|
|
11195
|
-
varying vec3 vOutputDirection;
|
|
11196
|
-
|
|
11197
|
-
// RH coordinate system; PMREM face-indexing convention
|
|
11198
|
-
vec3 getDirection( vec2 uv, float face ) {
|
|
11199
|
-
|
|
11200
|
-
uv = 2.0 * uv - 1.0;
|
|
11201
|
-
|
|
11202
|
-
vec3 direction = vec3( uv, 1.0 );
|
|
11203
|
-
|
|
11204
|
-
if ( face == 0.0 ) {
|
|
11205
|
-
|
|
11206
|
-
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
11207
|
-
|
|
11208
|
-
} else if ( face == 1.0 ) {
|
|
11209
|
-
|
|
11210
|
-
direction = direction.xzy;
|
|
11211
|
-
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
11212
|
-
|
|
11213
|
-
} else if ( face == 2.0 ) {
|
|
11214
|
-
|
|
11215
|
-
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
11216
|
-
|
|
11217
|
-
} else if ( face == 3.0 ) {
|
|
11218
|
-
|
|
11219
|
-
direction = direction.zyx;
|
|
11220
|
-
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
11221
|
-
|
|
11222
|
-
} else if ( face == 4.0 ) {
|
|
11223
|
-
|
|
11224
|
-
direction = direction.xzy;
|
|
11225
|
-
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
11226
|
-
|
|
11227
|
-
} else if ( face == 5.0 ) {
|
|
11228
|
-
|
|
11229
|
-
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
11230
|
-
|
|
11231
|
-
}
|
|
11232
|
-
|
|
11233
|
-
return direction;
|
|
11234
|
-
|
|
11235
|
-
}
|
|
11236
|
-
|
|
11237
|
-
void main() {
|
|
11238
|
-
|
|
11239
|
-
vOutputDirection = getDirection( uv, faceIndex );
|
|
11240
|
-
gl_Position = vec4( position, 1.0 );
|
|
11241
|
-
|
|
11242
|
-
}
|
|
11188
|
+
return /* glsl */ `
|
|
11189
|
+
|
|
11190
|
+
precision mediump float;
|
|
11191
|
+
precision mediump int;
|
|
11192
|
+
|
|
11193
|
+
attribute float faceIndex;
|
|
11194
|
+
|
|
11195
|
+
varying vec3 vOutputDirection;
|
|
11196
|
+
|
|
11197
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
11198
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
11199
|
+
|
|
11200
|
+
uv = 2.0 * uv - 1.0;
|
|
11201
|
+
|
|
11202
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
11203
|
+
|
|
11204
|
+
if ( face == 0.0 ) {
|
|
11205
|
+
|
|
11206
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
11207
|
+
|
|
11208
|
+
} else if ( face == 1.0 ) {
|
|
11209
|
+
|
|
11210
|
+
direction = direction.xzy;
|
|
11211
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
11212
|
+
|
|
11213
|
+
} else if ( face == 2.0 ) {
|
|
11214
|
+
|
|
11215
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
11216
|
+
|
|
11217
|
+
} else if ( face == 3.0 ) {
|
|
11218
|
+
|
|
11219
|
+
direction = direction.zyx;
|
|
11220
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
11221
|
+
|
|
11222
|
+
} else if ( face == 4.0 ) {
|
|
11223
|
+
|
|
11224
|
+
direction = direction.xzy;
|
|
11225
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
11226
|
+
|
|
11227
|
+
} else if ( face == 5.0 ) {
|
|
11228
|
+
|
|
11229
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
11230
|
+
|
|
11231
|
+
}
|
|
11232
|
+
|
|
11233
|
+
return direction;
|
|
11234
|
+
|
|
11235
|
+
}
|
|
11236
|
+
|
|
11237
|
+
void main() {
|
|
11238
|
+
|
|
11239
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
11240
|
+
gl_Position = vec4( position, 1.0 );
|
|
11241
|
+
|
|
11242
|
+
}
|
|
11243
11243
|
`;
|
|
11244
11244
|
}
|
|
11245
11245
|
function WebGLCubeUVMaps(renderer) {
|
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ViralViewerRevitGeometry = exports.ViralViewerRevitNoneStructuralGeometry = void 0;
|
|
3
|
+
exports.ViralMouseEventType = exports.ViralViewerRevitGeometry = exports.ViralViewerRevitNoneStructuralGeometry = void 0;
|
|
4
4
|
class ViralViewerRevitNoneStructuralGeometry {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.MaterialIndex = 0;
|
|
@@ -19,4 +19,10 @@ class ViralViewerRevitGeometry {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.ViralViewerRevitGeometry = ViralViewerRevitGeometry;
|
|
22
|
+
var ViralMouseEventType;
|
|
23
|
+
(function (ViralMouseEventType) {
|
|
24
|
+
ViralMouseEventType[ViralMouseEventType["ON_HOVER"] = 0] = "ON_HOVER";
|
|
25
|
+
ViralMouseEventType[ViralMouseEventType["ON_MOUSE_DOWN"] = 1] = "ON_MOUSE_DOWN";
|
|
26
|
+
ViralMouseEventType[ViralMouseEventType["ON_MOUSE_UP"] = 2] = "ON_MOUSE_UP";
|
|
27
|
+
})(ViralMouseEventType = exports.ViralMouseEventType || (exports.ViralMouseEventType = {}));
|
|
22
28
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAyBA,MAAa,sCAAsC;IAAnD;QACI,kBAAa,GAAS,CAAC,CAAC;QACxB,aAAQ,GAAe,EAAE,CAAC;QAC1B,YAAO,GAAW,EAAE,CAAC;QACrB,SAAI,GAAS,EAAE,CAAC;QAChB,cAAS,GAAmB,EAAE,CAAC;IACnC,CAAC;CAAA;AAND,wFAMC;AACD,MAAa,wBAAwB;IAArC;QACI,aAAQ,GAAiB,EAAE,CAAC;QAC5B,YAAO,GAAa,EAAE,CAAC;QACvB,cAAS,GAA0B,IAAI,CAAC;IAC5C,CAAC;CAAA;AAJD,4DAIC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAyBA,MAAa,sCAAsC;IAAnD;QACI,kBAAa,GAAS,CAAC,CAAC;QACxB,aAAQ,GAAe,EAAE,CAAC;QAC1B,YAAO,GAAW,EAAE,CAAC;QACrB,SAAI,GAAS,EAAE,CAAC;QAChB,cAAS,GAAmB,EAAE,CAAC;IACnC,CAAC;CAAA;AAND,wFAMC;AACD,MAAa,wBAAwB;IAArC;QACI,aAAQ,GAAiB,EAAE,CAAC;QAC5B,YAAO,GAAa,EAAE,CAAC;QACvB,cAAS,GAA0B,IAAI,CAAC;IAC5C,CAAC;CAAA;AAJD,4DAIC;AAwBD,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,qEAAQ,CAAA;IACR,+EAAa,CAAA;IACb,2EAAW,CAAA;AACf,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B"}
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "viral-viewer-2",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"LICENSE",
|
|
10
|
-
"README.md"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"build": "npx tsc"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [],
|
|
17
|
-
"author": "",
|
|
18
|
-
"license": "ISC",
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/node": "^20.2.5",
|
|
21
|
-
"@types/three": "^0.152.1",
|
|
22
|
-
"typescript": "^5.0.4"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"camera-controls": "^2.3.7",
|
|
26
|
-
"lz-string": "^1.5.0",
|
|
27
|
-
"potree-core-viral": "^0.2.3",
|
|
28
|
-
"three": "^0.152.2"
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "viral-viewer-2",
|
|
3
|
+
"version": "3.2.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"build": "npx tsc"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^20.2.5",
|
|
21
|
+
"@types/three": "^0.152.1",
|
|
22
|
+
"typescript": "^5.0.4"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"camera-controls": "^2.3.7",
|
|
26
|
+
"lz-string": "^1.5.0",
|
|
27
|
+
"potree-core-viral": "^0.2.3",
|
|
28
|
+
"three": "^0.152.2"
|
|
29
|
+
}
|
|
30
30
|
}
|