|
@@ -1,15 +1,7 @@
|
|
|
import * as THREE from "../../libs/three.js/build/three.module.js";
|
|
|
|
|
|
-!function() {
|
|
|
- if ("performance"in window == 0 && (window.performance = {}),
|
|
|
- "now"in window.performance == 0) {
|
|
|
- var e = Date.now();
|
|
|
- performance.timing && performance.timing.navigationStart && (e = performance.timing.navigationStart),
|
|
|
- window.performance.now = function() {
|
|
|
- return Date.now() - e
|
|
|
- }
|
|
|
- }
|
|
|
-}(),
|
|
|
+
|
|
|
+
|
|
|
THREE.WebGLRenderer.prototype.paramThreeToGL = function(e) {
|
|
|
var t, i = this.extensions, r = this.getContext();//context;
|
|
|
if (e === THREE.RepeatWrapping)
|
|
@@ -246,317 +238,4 @@ THREE.Object3D.prototype.traverse = function ( callback ) {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/* ,
|
|
|
-
|
|
|
-THREE.WebGLState = function(e, t, i) {
|
|
|
- var r = this
|
|
|
- , o = new THREE.Vector4
|
|
|
- , a = e.getParameter(e.MAX_VERTEX_ATTRIBS)
|
|
|
- , s = new Uint8Array(a)
|
|
|
- , l = new Uint8Array(a)
|
|
|
- , c = new Uint8Array(a)
|
|
|
- , h = {}
|
|
|
- , u = null
|
|
|
- , d = null
|
|
|
- , p = null
|
|
|
- , f = null
|
|
|
- , g = null
|
|
|
- , m = null
|
|
|
- , v = null
|
|
|
- , A = null
|
|
|
- , y = !1
|
|
|
- , C = null
|
|
|
- , I = null
|
|
|
- , E = null
|
|
|
- , b = null
|
|
|
- , w = null
|
|
|
- , _ = null
|
|
|
- , T = null
|
|
|
- , x = null
|
|
|
- , S = null
|
|
|
- , M = null
|
|
|
- , R = null
|
|
|
- , P = null
|
|
|
- , O = null
|
|
|
- , L = null
|
|
|
- , D = null
|
|
|
- , N = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)
|
|
|
- , B = void 0
|
|
|
- , F = {}
|
|
|
- , V = new THREE.Vector4
|
|
|
- , U = null
|
|
|
- , k = null
|
|
|
- , H = new THREE.Vector4
|
|
|
- , G = new THREE.Vector4;
|
|
|
- this.init = function() {
|
|
|
- this.clearColor(0, 0, 0, 1),
|
|
|
- this.clearDepth(1),
|
|
|
- this.clearStencil(0),
|
|
|
- this.enable(e.DEPTH_TEST),
|
|
|
- e.depthFunc(e.LEQUAL),
|
|
|
- e.frontFace(e.CCW),
|
|
|
- e.cullFace(e.BACK),
|
|
|
- this.enable(e.CULL_FACE),
|
|
|
- this.enable(e.BLEND),
|
|
|
- e.blendEquation(e.FUNC_ADD),
|
|
|
- e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.initAttributes = function() {
|
|
|
- for (var e = 0, t = s.length; e < t; e++)
|
|
|
- s[e] = 0
|
|
|
- }
|
|
|
- ,
|
|
|
- this.enableAttribute = function(i) {
|
|
|
- if (s[i] = 1,
|
|
|
- 0 === l[i] && (e.enableVertexAttribArray(i),
|
|
|
- l[i] = 1),
|
|
|
- 0 !== c[i]) {
|
|
|
- var n = t.get("ANGLE_instanced_arrays");
|
|
|
- n.vertexAttribDivisorANGLE(i, 0),
|
|
|
- c[i] = 0
|
|
|
- }
|
|
|
- }
|
|
|
- ,
|
|
|
- this.enableAttributeAndDivisor = function(t, i, n) {
|
|
|
- s[t] = 1,
|
|
|
- 0 === l[t] && (e.enableVertexAttribArray(t),
|
|
|
- l[t] = 1),
|
|
|
- c[t] !== i && (n.vertexAttribDivisorANGLE(t, i),
|
|
|
- c[t] = i)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.disableUnusedAttributes = function() {
|
|
|
- for (var t = 0, i = l.length; t < i; t++)
|
|
|
- l[t] !== s[t] && (e.disableVertexAttribArray(t),
|
|
|
- l[t] = 0)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.enable = function(t) {
|
|
|
- h[t] !== !0 && (e.enable(t),
|
|
|
- h[t] = !0)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.disable = function(t) {
|
|
|
- h[t] !== !1 && (e.disable(t),
|
|
|
- h[t] = !1)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.getCompressedTextureFormats = function() {
|
|
|
- if (null === u && (u = [],
|
|
|
- t.get("WEBGL_compressed_texture_pvrtc") || t.get("WEBGL_compressed_texture_s3tc") || t.get("WEBGL_compressed_texture_etc1")))
|
|
|
- for (var i = e.getParameter(e.COMPRESSED_TEXTURE_FORMATS), n = 0; n < i.length; n++)
|
|
|
- u.push(i[n]);
|
|
|
- return u
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setBlending = function(t, r, o, a, s, l, c, h) {
|
|
|
- t === THREE.NoBlending ? this.disable(e.BLEND) : this.enable(e.BLEND),
|
|
|
- t === d && h === y || (t === THREE.AdditiveBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
|
|
|
- e.blendFuncSeparate(e.ONE, e.ONE, e.ONE, e.ONE)) : (e.blendEquation(e.FUNC_ADD),
|
|
|
- e.blendFunc(e.SRC_ALPHA, e.ONE)) : t === THREE.SubtractiveBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
|
|
|
- e.blendFuncSeparate(e.ZERO, e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ONE_MINUS_SRC_ALPHA)) : (e.blendEquation(e.FUNC_ADD),
|
|
|
- e.blendFunc(e.ZERO, e.ONE_MINUS_SRC_COLOR)) : t === THREE.MultiplyBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
|
|
|
- e.blendFuncSeparate(e.ZERO, e.ZERO, e.SRC_COLOR, e.SRC_ALPHA)) : (e.blendEquation(e.FUNC_ADD),
|
|
|
- e.blendFunc(e.ZERO, e.SRC_COLOR)) : h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
|
|
|
- e.blendFuncSeparate(e.ONE, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA)) : (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
|
|
|
- e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA)),
|
|
|
- d = t,
|
|
|
- y = h),
|
|
|
- t === THREE.CustomBlending ? (s = s || r,
|
|
|
- l = l || o,
|
|
|
- c = c || a,
|
|
|
- r === p && s === m || (e.blendEquationSeparate(i(r), i(s)),
|
|
|
- p = r,
|
|
|
- m = s),
|
|
|
- o === f && a === g && l === v && c === A || (e.blendFuncSeparate(i(o), i(a), i(l), i(c)),
|
|
|
- f = o,
|
|
|
- g = a,
|
|
|
- v = l,
|
|
|
- A = c)) : (p = null,
|
|
|
- f = null,
|
|
|
- g = null,
|
|
|
- m = null,
|
|
|
- v = null,
|
|
|
- A = null)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setDepthFunc = function(t) {
|
|
|
- if (C !== t) {
|
|
|
- if (t)
|
|
|
- switch (t) {
|
|
|
- case THREE.NeverDepth:
|
|
|
- e.depthFunc(e.NEVER);
|
|
|
- break;
|
|
|
- case THREE.AlwaysDepth:
|
|
|
- e.depthFunc(e.ALWAYS);
|
|
|
- break;
|
|
|
- case THREE.LessDepth:
|
|
|
- e.depthFunc(e.LESS);
|
|
|
- break;
|
|
|
- case THREE.LessEqualDepth:
|
|
|
- e.depthFunc(e.LEQUAL);
|
|
|
- break;
|
|
|
- case THREE.EqualDepth:
|
|
|
- e.depthFunc(e.EQUAL);
|
|
|
- break;
|
|
|
- case THREE.GreaterEqualDepth:
|
|
|
- e.depthFunc(e.GEQUAL);
|
|
|
- break;
|
|
|
- case THREE.GreaterDepth:
|
|
|
- e.depthFunc(e.GREATER);
|
|
|
- break;
|
|
|
- case THREE.NotEqualDepth:
|
|
|
- e.depthFunc(e.NOTEQUAL);
|
|
|
- break;
|
|
|
- default:
|
|
|
- e.depthFunc(e.LEQUAL)
|
|
|
- }
|
|
|
- else
|
|
|
- e.depthFunc(e.LEQUAL);
|
|
|
- C = t
|
|
|
- }
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setDepthTest = function(t) {
|
|
|
- t ? this.enable(e.DEPTH_TEST) : this.disable(e.DEPTH_TEST)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setDepthWrite = function(t) {
|
|
|
- I !== t && (e.depthMask(t),
|
|
|
- I = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setColorWrite = function(t) {
|
|
|
- E !== t && (e.colorMask(t, t, t, t),
|
|
|
- E = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setStencilFunc = function(t, i, n) {
|
|
|
- w === t && _ === i && T === n || (e.stencilFunc(t, i, n),
|
|
|
- w = t,
|
|
|
- _ = i,
|
|
|
- T = n)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setStencilOp = function(t, i, n) {
|
|
|
- x === t && S === i && M === n || (e.stencilOp(t, i, n),
|
|
|
- x = t,
|
|
|
- S = i,
|
|
|
- M = n)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setStencilTest = function(t) {
|
|
|
- t ? this.enable(e.STENCIL_TEST) : this.disable(e.STENCIL_TEST)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setStencilWrite = function(t) {
|
|
|
- b !== t && (e.stencilMask(t),
|
|
|
- b = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setFlipSided = function(t) {
|
|
|
- R !== t && (t ? e.frontFace(e.CW) : e.frontFace(e.CCW),
|
|
|
- R = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setLineWidth = function(t) {
|
|
|
- t !== P && (e.lineWidth(t),
|
|
|
- P = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setPolygonOffset = function(t, i, n) {
|
|
|
- t ? this.enable(e.POLYGON_OFFSET_FILL) : this.disable(e.POLYGON_OFFSET_FILL),
|
|
|
- !t || O === i && L === n || (e.polygonOffset(i, n),
|
|
|
- O = i,
|
|
|
- L = n)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.getScissorTest = function() {
|
|
|
- return D
|
|
|
- }
|
|
|
- ,
|
|
|
- this.setScissorTest = function(t) {
|
|
|
- D = t,
|
|
|
- t ? this.enable(e.SCISSOR_TEST) : this.disable(e.SCISSOR_TEST)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.activeTexture = function(t) {
|
|
|
- void 0 === t && (t = e.TEXTURE0 + N - 1),
|
|
|
- B !== t && (e.activeTexture(t),
|
|
|
- B = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.bindTexture = function(t, i) {
|
|
|
- void 0 === B && r.activeTexture();
|
|
|
- var n = F[B];
|
|
|
- void 0 === n && (n = {
|
|
|
- type: void 0,
|
|
|
- texture: void 0
|
|
|
- },
|
|
|
- F[B] = n),
|
|
|
- n.type === t && n.texture === i || (e.bindTexture(t, i),
|
|
|
- n.type = t,
|
|
|
- n.texture = i)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.compressedTexImage2D = function() {
|
|
|
- try {
|
|
|
- e.compressedTexImage2D.apply(e, arguments)
|
|
|
- } catch (e) {
|
|
|
- console.error(e)
|
|
|
- }
|
|
|
- }
|
|
|
- ,
|
|
|
- this.texImage2D = function() {
|
|
|
- try {
|
|
|
- e.texImage2D.apply(e, arguments)
|
|
|
- } catch (e) {
|
|
|
- console.error(e)
|
|
|
- }
|
|
|
- }
|
|
|
- ,
|
|
|
- this.clearColor = function(t, i, n, r) {
|
|
|
- o.set(t, i, n, r),
|
|
|
- V.equals(o) === !1 && (e.clearColor(t, i, n, r),
|
|
|
- V.copy(o))
|
|
|
- }
|
|
|
- ,
|
|
|
- this.clearDepth = function(t) {
|
|
|
- U !== t && (e.clearDepth(t),
|
|
|
- U = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.clearStencil = function(t) {
|
|
|
- k !== t && (e.clearStencil(t),
|
|
|
- k = t)
|
|
|
- }
|
|
|
- ,
|
|
|
- this.scissor = function(t) {
|
|
|
- H.equals(t) === !1 && (e.scissor(t.x, t.y, t.z, t.w),
|
|
|
- H.copy(t))
|
|
|
- }
|
|
|
- ,
|
|
|
- this.viewport = function(t) {
|
|
|
- G.equals(t) === !1 && (e.viewport(t.x, t.y, t.z, t.w),
|
|
|
- G.copy(t))
|
|
|
- }
|
|
|
- ,
|
|
|
- this.reset = function() {
|
|
|
- for (var t = 0; t < l.length; t++)
|
|
|
- 1 === l[t] && (e.disableVertexAttribArray(t),
|
|
|
- l[t] = 0);
|
|
|
- h = {},
|
|
|
- u = null,
|
|
|
- B = void 0,
|
|
|
- F = {},
|
|
|
- d = null,
|
|
|
- E = null,
|
|
|
- I = null,
|
|
|
- b = null,
|
|
|
- R = null
|
|
|
- }
|
|
|
-} */
|
|
|
+
|