(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports", "three", "../libs/fflate.module.js"], factory); } else if (typeof exports !== "undefined") { factory(exports, require("three"), require("../libs/fflate.module.js")); } else { var mod = { exports: {} }; factory(mod.exports, global.three, global.fflateModule); global.TiltLoader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, fflate) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.TiltLoader = void 0; fflate = _interopRequireWildcard(fflate); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var TiltLoader = /*#__PURE__*/function (_Loader) { _inherits(TiltLoader, _Loader); var _super = _createSuper(TiltLoader); function TiltLoader() { _classCallCheck(this, TiltLoader); return _super.apply(this, arguments); } _createClass(TiltLoader, [{ key: "load", value: function load(url, onLoad, onProgress, onError) { var scope = this; var loader = new _three.FileLoader(this.manager); loader.setPath(this.path); loader.setResponseType('arraybuffer'); loader.setWithCredentials(this.withCredentials); loader.load(url, function (buffer) { try { onLoad(scope.parse(buffer)); } catch (e) { if (onError) { onError(e); } else { console.error(e); } scope.manager.itemError(url); } }, onProgress, onError); } }, { key: "parse", value: function parse(buffer) { var group = new _three.Group(); // https://docs.google.com/document/d/11ZsHozYn9FnWG7y3s3WAyKIACfbfwb4PbaS8cZ_xjvo/edit# var zip = fflate.unzipSync(new Uint8Array(buffer.slice(16))); /* const thumbnail = zip[ 'thumbnail.png' ].buffer; const img = document.createElement( 'img' ); img.src = URL.createObjectURL( new Blob( [ thumbnail ] ) ); document.body.appendChild( img ); */ var metadata = JSON.parse(fflate.strFromU8(zip['metadata.json'])); /* const blob = new Blob( [ zip[ 'data.sketch' ].buffer ], { type: 'application/octet-stream' } ); window.open( URL.createObjectURL( blob ) ); */ var data = new DataView(zip['data.sketch'].buffer); var num_strokes = data.getInt32(16, true); var brushes = {}; var offset = 20; for (var i = 0; i < num_strokes; i++) { var brush_index = data.getInt32(offset, true); var brush_color = [data.getFloat32(offset + 4, true), data.getFloat32(offset + 8, true), data.getFloat32(offset + 12, true), data.getFloat32(offset + 16, true)]; var brush_size = data.getFloat32(offset + 20, true); var stroke_mask = data.getUint32(offset + 24, true); var controlpoint_mask = data.getUint32(offset + 28, true); var offset_stroke_mask = 0; var offset_controlpoint_mask = 0; for (var j = 0; j < 4; j++) { // TOFIX: I don't understand these masks yet var byte = 1 << j; if ((stroke_mask & byte) > 0) offset_stroke_mask += 4; if ((controlpoint_mask & byte) > 0) offset_controlpoint_mask += 4; } // console.log( { brush_index, brush_color, brush_size, stroke_mask, controlpoint_mask } ); // console.log( offset_stroke_mask, offset_controlpoint_mask ); offset = offset + 28 + offset_stroke_mask + 4; // TOFIX: This is wrong var num_control_points = data.getInt32(offset, true); // console.log( { num_control_points } ); var positions = new Float32Array(num_control_points * 3); var quaternions = new Float32Array(num_control_points * 4); offset = offset + 4; for (var _j = 0, k = 0; _j < positions.length; _j += 3, k += 4) { positions[_j + 0] = data.getFloat32(offset + 0, true); positions[_j + 1] = data.getFloat32(offset + 4, true); positions[_j + 2] = data.getFloat32(offset + 8, true); quaternions[k + 0] = data.getFloat32(offset + 12, true); quaternions[k + 1] = data.getFloat32(offset + 16, true); quaternions[k + 2] = data.getFloat32(offset + 20, true); quaternions[k + 3] = data.getFloat32(offset + 24, true); offset = offset + 28 + offset_controlpoint_mask; // TOFIX: This is wrong } if (brush_index in brushes === false) { brushes[brush_index] = []; } brushes[brush_index].push([positions, quaternions, brush_size, brush_color]); } for (var _brush_index in brushes) { var geometry = new StrokeGeometry(brushes[_brush_index]); var material = getMaterial(metadata.BrushIndex[_brush_index]); group.add(new _three.Mesh(geometry, material)); } return group; } }]); return TiltLoader; }(_three.Loader); _exports.TiltLoader = TiltLoader; var StrokeGeometry = /*#__PURE__*/function (_BufferGeometry) { _inherits(StrokeGeometry, _BufferGeometry); var _super2 = _createSuper(StrokeGeometry); function StrokeGeometry(strokes) { var _this; _classCallCheck(this, StrokeGeometry); _this = _super2.call(this); var vertices = []; var colors = []; var uvs = []; var position = new _three.Vector3(); var prevPosition = new _three.Vector3(); var quaternion = new _three.Quaternion(); var prevQuaternion = new _three.Quaternion(); var vector1 = new _three.Vector3(); var vector2 = new _three.Vector3(); var vector3 = new _three.Vector3(); var vector4 = new _three.Vector3(); // size = size / 2; for (var k in strokes) { var stroke = strokes[k]; var positions = stroke[0]; var quaternions = stroke[1]; var size = stroke[2]; var color = stroke[3]; prevPosition.fromArray(positions, 0); prevQuaternion.fromArray(quaternions, 0); for (var i = 3, j = 4, l = positions.length; i < l; i += 3, j += 4) { position.fromArray(positions, i); quaternion.fromArray(quaternions, j); vector1.set(-size, 0, 0); vector1.applyQuaternion(quaternion); vector1.add(position); vector2.set(size, 0, 0); vector2.applyQuaternion(quaternion); vector2.add(position); vector3.set(size, 0, 0); vector3.applyQuaternion(prevQuaternion); vector3.add(prevPosition); vector4.set(-size, 0, 0); vector4.applyQuaternion(prevQuaternion); vector4.add(prevPosition); vertices.push(vector1.x, vector1.y, -vector1.z); vertices.push(vector2.x, vector2.y, -vector2.z); vertices.push(vector4.x, vector4.y, -vector4.z); vertices.push(vector2.x, vector2.y, -vector2.z); vertices.push(vector3.x, vector3.y, -vector3.z); vertices.push(vector4.x, vector4.y, -vector4.z); prevPosition.copy(position); prevQuaternion.copy(quaternion); colors.push.apply(colors, _toConsumableArray(color)); colors.push.apply(colors, _toConsumableArray(color)); colors.push.apply(colors, _toConsumableArray(color)); colors.push.apply(colors, _toConsumableArray(color)); colors.push.apply(colors, _toConsumableArray(color)); colors.push.apply(colors, _toConsumableArray(color)); var p1 = i / l; var p2 = (i - 3) / l; uvs.push(p1, 0); uvs.push(p1, 1); uvs.push(p2, 0); uvs.push(p1, 1); uvs.push(p2, 1); uvs.push(p2, 0); } } _this.setAttribute('position', new _three.BufferAttribute(new Float32Array(vertices), 3)); _this.setAttribute('color', new _three.BufferAttribute(new Float32Array(colors), 4)); _this.setAttribute('uv', new _three.BufferAttribute(new Float32Array(uvs), 2)); return _this; } return _createClass(StrokeGeometry); }(_three.BufferGeometry); var BRUSH_LIST_ARRAY = { '89d104cd-d012-426b-b5b3-bbaee63ac43c': 'Bubbles', '700f3aa8-9a7c-2384-8b8a-ea028905dd8c': 'CelVinyl', '0f0ff7b2-a677-45eb-a7d6-0cd7206f4816': 'ChromaticWave', '1161af82-50cf-47db-9706-0c3576d43c43': 'CoarseBristles', '79168f10-6961-464a-8be1-57ed364c5600': 'CoarseBristlesSingleSided', '1caa6d7d-f015-3f54-3a4b-8b5354d39f81': 'Comet', 'c8313697-2563-47fc-832e-290f4c04b901': 'DiamondHull', '4391aaaa-df73-4396-9e33-31e4e4930b27': 'Disco', 'd1d991f2-e7a0-4cf1-b328-f57e915e6260': 'DotMarker', '6a1cf9f9-032c-45ec-9b1d-a6680bee30f7': 'Dots', '0d3889f3-3ede-470c-8af4-f44813306126': 'DoubleTaperedFlat', '0d3889f3-3ede-470c-8af4-de4813306126': 'DoubleTaperedMarker', 'd0262945-853c-4481-9cbd-88586bed93cb': 'DuctTape', '3ca16e2f-bdcd-4da2-8631-dcef342f40f1': 'DuctTapeSingleSided', 'f6e85de3-6dcc-4e7f-87fd-cee8c3d25d51': 'Electricity', '02ffb866-7fb2-4d15-b761-1012cefb1360': 'Embers', 'cb92b597-94ca-4255-b017-0e3f42f12f9e': 'Fire', '2d35bcf0-e4d8-452c-97b1-3311be063130': 'Flat', '55303bc4-c749-4a72-98d9-d23e68e76e18': 'FlatDeprecated', '280c0a7a-aad8-416c-a7d2-df63d129ca70': 'FlatSingleSided', 'cf019139-d41c-4eb0-a1d0-5cf54b0a42f3': 'Highlighter', '6a1cf9f9-032c-45ec-9b6e-a6680bee32e9': 'HyperGrid', 'dce872c2-7b49-4684-b59b-c45387949c5c': 'Hypercolor', 'e8ef32b1-baa8-460a-9c2c-9cf8506794f5': 'HypercolorSingleSided', '2f212815-f4d3-c1a4-681a-feeaf9c6dc37': 'Icing', 'f5c336cf-5108-4b40-ade9-c687504385ab': 'Ink', 'c0012095-3ffd-4040-8ee1-fc180d346eaa': 'InkSingleSided', '4a76a27a-44d8-4bfe-9a8c-713749a499b0': 'Leaves', 'ea19de07-d0c0-4484-9198-18489a3c1487': 'LeavesSingleSided', '2241cd32-8ba2-48a5-9ee7-2caef7e9ed62': 'Light', '4391aaaa-df81-4396-9e33-31e4e4930b27': 'LightWire', 'd381e0f5-3def-4a0d-8853-31e9200bcbda': 'Lofted', '429ed64a-4e97-4466-84d3-145a861ef684': 'Marker', '79348357-432d-4746-8e29-0e25c112e3aa': 'MatteHull', 'b2ffef01-eaaa-4ab5-aa64-95a2c4f5dbc6': 'NeonPulse', 'f72ec0e7-a844-4e38-82e3-140c44772699': 'OilPaint', 'c515dad7-4393-4681-81ad-162ef052241b': 'OilPaintSingleSided', 'f1114e2e-eb8d-4fde-915a-6e653b54e9f5': 'Paper', '759f1ebd-20cd-4720-8d41-234e0da63716': 'PaperSingleSided', 'e0abbc80-0f80-e854-4970-8924a0863dcc': 'Petal', 'c33714d1-b2f9-412e-bd50-1884c9d46336': 'Plasma', 'ad1ad437-76e2-450d-a23a-e17f8310b960': 'Rainbow', 'faaa4d44-fcfb-4177-96be-753ac0421ba3': 'ShinyHull', '70d79cca-b159-4f35-990c-f02193947fe8': 'Smoke', 'd902ed8b-d0d1-476c-a8de-878a79e3a34c': 'Snow', 'accb32f5-4509-454f-93f8-1df3fd31df1b': 'SoftHighlighter', 'cf7f0059-7aeb-53a4-2b67-c83d863a9ffa': 'Spikes', '8dc4a70c-d558-4efd-a5ed-d4e860f40dc3': 'Splatter', '7a1c8107-50c5-4b70-9a39-421576d6617e': 'SplatterSingleSided', '0eb4db27-3f82-408d-b5a1-19ebd7d5b711': 'Stars', '44bb800a-fbc3-4592-8426-94ecb05ddec3': 'Streamers', '0077f88c-d93a-42f3-b59b-b31c50cdb414': 'Taffy', 'b468c1fb-f254-41ed-8ec9-57030bc5660c': 'TaperedFlat', 'c8ccb53d-ae13-45ef-8afb-b730d81394eb': 'TaperedFlatSingleSided', 'd90c6ad8-af0f-4b54-b422-e0f92abe1b3c': 'TaperedMarker', '1a26b8c0-8a07-4f8a-9fac-d2ef36e0cad0': 'TaperedMarker_Flat', '75b32cf0-fdd6-4d89-a64b-e2a00b247b0f': 'ThickPaint', 'fdf0326a-c0d1-4fed-b101-9db0ff6d071f': 'ThickPaintSingleSided', '4391385a-df73-4396-9e33-31e4e4930b27': 'Toon', 'a8fea537-da7c-4d4b-817f-24f074725d6d': 'UnlitHull', 'd229d335-c334-495a-a801-660ac8a87360': 'VelvetInk', '10201aa3-ebc2-42d8-84b7-2e63f6eeb8ab': 'Waveform', 'b67c0e81-ce6d-40a8-aeb0-ef036b081aa3': 'WetPaint', 'dea67637-cd1a-27e4-c9b1-52f4bbcb84e5': 'WetPaintSingleSided', '5347acf0-a8e2-47b6-8346-30c70719d763': 'WigglyGraphite', 'e814fef1-97fd-7194-4a2f-50c2bb918be2': 'WigglyGraphiteSingleSided', '4391385a-cf83-4396-9e33-31e4e4930b27': 'Wire' }; var common = { 'colors': { 'BloomColor': "\n\t\t\tvec3 BloomColor(vec3 color, float gain) {\n\t\t\t\t// Guarantee that there's at least a little bit of all 3 channels.\n\t\t\t\t// This makes fully-saturated strokes (which only have 2 non-zero\n\t\t\t\t// color channels) eventually clip to white rather than to a secondary.\n\t\t\t\tfloat cmin = length(color.rgb) * .05;\n\t\t\t\tcolor.rgb = max(color.rgb, vec3(cmin, cmin, cmin));\n\t\t\t\t// If we try to remove this pow() from .a, it brightens up\n\t\t\t\t// pressure-sensitive strokes; looks better as-is.\n\t\t\t\tcolor = pow(color, vec3(2.2));\n\t\t\t\tcolor.rgb *= 2. * exp(gain * 10.);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t", 'LinearToSrgb': "\n\t\t\tvec3 LinearToSrgb(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 linearColor = color.rgb;\n\t\t\t\tvec3 S1 = sqrt(linearColor);\n\t\t\t\tvec3 S2 = sqrt(S1);\n\t\t\t\tvec3 S3 = sqrt(S2);\n\t\t\t\tcolor.rgb = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * linearColor;\n\t\t\t\treturn color;\n\t\t\t}\n\t\t", 'hsv': "\n\t\t\t// uniform sampler2D lookupTex;\n\t\t\tvec4 lookup(vec4 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 lookup(vec3 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb( vec3 hsv ) {\n\t\t\t\tvec3 rgb = clamp( abs(mod(hsv.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );\n\t\t\t\treturn hsv.z * mix( vec3(1.0), rgb, hsv.y);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv( vec3 rgb ) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(rgb.bg, K.wz), vec4(rgb.gb, K.xy), step(rgb.b, rgb.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\t\t", 'SrgbToLinear': "\n\t\t\tvec3 SrgbToLinear(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 sRGB = color.rgb;\n\t\t\t\tcolor.rgb = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t" } }; var shaders = null; function getShaders() { if (shaders === null) { var loader = new _three.TextureLoader().setPath('./textures/tiltbrush/'); shaders = { 'Light': { uniforms: { mainTex: { value: loader.load('Light.webp') }, alphaTest: { value: 0.067 }, emission_gain: { value: 0.45 }, alpha: { value: 1 } }, vertexShader: "\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tattribute vec2 uv;\n\t\t\t\t\tattribute vec4 color;\n\t\t\t\t\tattribute vec3 position;\n\n\t\t\t\t\tuniform mat4 modelMatrix;\n\t\t\t\t\tuniform mat4 modelViewMatrix;\n\t\t\t\t\tuniform mat4 projectionMatrix;\n\t\t\t\t\tuniform mat4 viewMatrix;\n\t\t\t\t\tuniform mat3 normalMatrix;\n\t\t\t\t\tuniform vec3 cameraPosition;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t".concat(common.colors.LinearToSrgb, "\n\t\t\t\t\t").concat(common.colors.hsv, "\n\n\t\t\t\t\tvoid main() {\n\n\t\t\t\t\t\tvUv = uv;\n\n\t\t\t\t\t\tvColor = lookup(color.rgb);\n\n\t\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t\t}\n\t\t\t\t"), fragmentShader: "\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tuniform float emission_gain;\n\n\t\t\t\t\tuniform sampler2D mainTex;\n\t\t\t\t\tuniform float alphaTest;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t".concat(common.colors.BloomColor, "\n\t\t\t\t\t").concat(common.colors.SrgbToLinear, "\n\n\t\t\t\t\tvoid main(){\n\t\t\t\t\t\tvec4 col = texture2D(mainTex, vUv);\n\t\t\t\t\t\tvec3 color = vColor;\n\t\t\t\t\t\tcolor = BloomColor(color, emission_gain);\n\t\t\t\t\t\tcolor = color * col.rgb;\n\t\t\t\t\t\tcolor = color * col.a;\n\t\t\t\t\t\tcolor = SrgbToLinear(color);\n\t\t\t\t\t\tgl_FragColor = vec4(color, 1.0);\n\t\t\t\t\t}\n\t\t\t\t"), side: 2, transparent: true, depthFunc: 2, depthWrite: true, depthTest: false, blending: 5, blendDst: 201, blendDstAlpha: 201, blendEquation: 100, blendEquationAlpha: 100, blendSrc: 201, blendSrcAlpha: 201 } }; } return shaders; } function getMaterial(GUID) { var name = BRUSH_LIST_ARRAY[GUID]; switch (name) { case 'Light': return new _three.RawShaderMaterial(getShaders().Light); default: return new _three.MeshBasicMaterial({ vertexColors: true, side: _three.DoubleSide }); } } });