(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("three"), require("rogue-engine")); else if(typeof define === 'function' && define.amd) define(["three", "rogue-engine"], factory); else if(typeof exports === 'object') exports["rogue-engine-user-scripts"] = factory(require("three"), require("rogue-engine")); else root["rogue-engine-user-scripts"] = factory(root["three"], root["rogue-engine"]); })(self, (__WEBPACK_EXTERNAL_MODULE_three__, __WEBPACK_EXTERNAL_MODULE_rogue_engine__) => { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "rogue-engine": /*!******************************************************************************************************************!*\ !*** external {"commonjs":"rogue-engine","commonjs2":"rogue-engine","amd":"rogue-engine","root":"rogue-engine"} ***! \******************************************************************************************************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_rogue_engine__; /***/ }), /***/ "three": /*!**************************************************************************************!*\ !*** external {"commonjs":"three","commonjs2":"three","amd":"three","root":"three"} ***! \**************************************************************************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_three__; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineMaterial.js": /*!***************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineMaterial.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ LineMaterial: () => (/* binding */ LineMaterial) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /** * parameters = { * color: , * linewidth: , * dashed: , * dashScale: , * dashSize: , * dashOffset: , * gapSize: , * resolution: , // to be set by renderer * } */ three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line = { worldUnits: { value: 1 }, linewidth: { value: 1 }, resolution: { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( 1, 1 ) }, dashOffset: { value: 0 }, dashScale: { value: 1 }, dashSize: { value: 1 }, gapSize: { value: 1 } // todo FIX - maybe change to totalSize }; three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ] = { uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.merge( [ three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.common, three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.fog, three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line ] ), vertexShader: /* glsl */` #include #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; vUv = uv; #endif float aspect = resolution.x / resolution.y; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); #ifdef WORLD_UNITS worldStart = start.xyz; worldEnd = end.xyz; #else vUv = uv; #endif // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec3 ndcStart = clipStart.xyz / clipStart.w; vec3 ndcEnd = clipEnd.xyz / clipEnd.w; // direction vec2 dir = ndcEnd.xy - ndcStart.xy; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); #ifdef WORLD_UNITS // get the offset direction as perpendicular to the view vector vec3 worldDir = normalize( end.xyz - start.xyz ); vec3 offset; if ( position.y < 0.5 ) { offset = normalize( cross( start.xyz, worldDir ) ); } else { offset = normalize( cross( end.xyz, worldDir ) ); } // sign flip if ( position.x < 0.0 ) offset *= - 1.0; float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) ); // don't extend the line if we're rendering dashes because we // won't be rendering the endcaps #ifndef USE_DASH // extend the line bounds to encompass endcaps start.xyz += - worldDir * linewidth * 0.5; end.xyz += worldDir * linewidth * 0.5; // shift the position of the quad so it hugs the forward edge of the line offset.xy -= dir * forwardOffset; offset.z += 0.5; #endif // endcaps if ( position.y > 1.0 || position.y < 0.0 ) { offset.xy += dir * 2.0 * forwardOffset; } // adjust for linewidth offset *= linewidth * 0.5; // set the world position worldPos = ( position.y < 0.5 ) ? start : end; worldPos.xyz += offset; // project the worldpos vec4 clip = projectionMatrix * worldPos; // shift the depth of the projected points so the line // segments overlap neatly vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; clip.z = clipPose.z * clip.w; #else vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; #endif gl_Position = clip; vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation #include #include #include } `, fragmentShader: /* glsl */` uniform vec3 diffuse; uniform float opacity; uniform float linewidth; #ifdef USE_DASH uniform float dashOffset; uniform float dashSize; uniform float gapSize; #endif varying float vLineDistance; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #include #include #include #include #include vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { float mua; float mub; vec3 p13 = p1 - p3; vec3 p43 = p4 - p3; vec3 p21 = p2 - p1; float d1343 = dot( p13, p43 ); float d4321 = dot( p43, p21 ); float d1321 = dot( p13, p21 ); float d4343 = dot( p43, p43 ); float d2121 = dot( p21, p21 ); float denom = d2121 * d4343 - d4321 * d4321; float numer = d1343 * d4321 - d1321 * d4343; mua = numer / denom; mua = clamp( mua, 0.0, 1.0 ); mub = ( d1343 + d4321 * ( mua ) ) / d4343; mub = clamp( mub, 0.0, 1.0 ); return vec2( mua, mub ); } void main() { #include #ifdef USE_DASH if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif float alpha = opacity; #ifdef WORLD_UNITS // Find the closest points on the view ray and the line segment vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; vec3 lineDir = worldEnd - worldStart; vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); vec3 p1 = worldStart + lineDir * params.x; vec3 p2 = rayEnd * params.y; vec3 delta = p1 - p2; float len = length( delta ); float norm = len / linewidth; #ifndef USE_DASH #ifdef USE_ALPHA_TO_COVERAGE float dnorm = fwidth( norm ); alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); #else if ( norm > 0.5 ) { discard; } #endif #endif #else #ifdef USE_ALPHA_TO_COVERAGE // artifacts appear on some hardware if a derivative is taken within a conditional float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; float dlen = fwidth( len2 ); if ( abs( vUv.y ) > 1.0 ) { alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); } #else if ( abs( vUv.y ) > 1.0 ) { float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; if ( len2 > 1.0 ) discard; } #endif #endif vec4 diffuseColor = vec4( diffuse, alpha ); #include #include gl_FragColor = vec4( diffuseColor.rgb, alpha ); #include #include #include #include } ` }; class LineMaterial extends three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial { constructor( parameters ) { super( { type: 'LineMaterial', uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].uniforms ), vertexShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].vertexShader, fragmentShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].fragmentShader, clipping: true // required for clipping support } ); this.isLineMaterial = true; Object.defineProperties( this, { color: { enumerable: true, get: function () { return this.uniforms.diffuse.value; }, set: function ( value ) { this.uniforms.diffuse.value = value; } }, worldUnits: { enumerable: true, get: function () { return 'WORLD_UNITS' in this.defines; }, set: function ( value ) { if ( value === true ) { this.defines.WORLD_UNITS = ''; } else { delete this.defines.WORLD_UNITS; } } }, linewidth: { enumerable: true, get: function () { return this.uniforms.linewidth.value; }, set: function ( value ) { this.uniforms.linewidth.value = value; } }, dashed: { enumerable: true, get: function () { return Boolean( 'USE_DASH' in this.defines ); }, set( value ) { if ( Boolean( value ) !== Boolean( 'USE_DASH' in this.defines ) ) { this.needsUpdate = true; } if ( value === true ) { this.defines.USE_DASH = ''; } else { delete this.defines.USE_DASH; } } }, dashScale: { enumerable: true, get: function () { return this.uniforms.dashScale.value; }, set: function ( value ) { this.uniforms.dashScale.value = value; } }, dashSize: { enumerable: true, get: function () { return this.uniforms.dashSize.value; }, set: function ( value ) { this.uniforms.dashSize.value = value; } }, dashOffset: { enumerable: true, get: function () { return this.uniforms.dashOffset.value; }, set: function ( value ) { this.uniforms.dashOffset.value = value; } }, gapSize: { enumerable: true, get: function () { return this.uniforms.gapSize.value; }, set: function ( value ) { this.uniforms.gapSize.value = value; } }, opacity: { enumerable: true, get: function () { return this.uniforms.opacity.value; }, set: function ( value ) { this.uniforms.opacity.value = value; } }, resolution: { enumerable: true, get: function () { return this.uniforms.resolution.value; }, set: function ( value ) { this.uniforms.resolution.value.copy( value ); } }, alphaToCoverage: { enumerable: true, get: function () { return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ); }, set: function ( value ) { if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) { this.needsUpdate = true; } if ( value === true ) { this.defines.USE_ALPHA_TO_COVERAGE = ''; this.extensions.derivatives = true; } else { delete this.defines.USE_ALPHA_TO_COVERAGE; this.extensions.derivatives = false; } } } } ); this.setValues( parameters ); } } /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js": /*!***********************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ LineSegmentsGeometry: () => (/* binding */ LineSegmentsGeometry) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3(); const _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); class LineSegmentsGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferGeometry { constructor() { super(); this.isLineSegmentsGeometry = true; this.type = 'LineSegmentsGeometry'; const positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ]; const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; this.setIndex( index ); this.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( positions, 3 ) ); this.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( uvs, 2 ) ); } applyMatrix4( matrix ) { const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined ) { start.applyMatrix4( matrix ); end.applyMatrix4( matrix ); start.needsUpdate = true; } if ( this.boundingBox !== null ) { this.computeBoundingBox(); } if ( this.boundingSphere !== null ) { this.computeBoundingSphere(); } return this; } setPositions( array ) { let lineSegments; if ( array instanceof Float32Array ) { lineSegments = array; } else if ( Array.isArray( array ) ) { lineSegments = new Float32Array( array ); } const instanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz this.setAttribute( 'instanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz this.setAttribute( 'instanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz // this.computeBoundingBox(); this.computeBoundingSphere(); return this; } setColors( array ) { let colors; if ( array instanceof Float32Array ) { colors = array; } else if ( Array.isArray( array ) ) { colors = new Float32Array( array ); } const instanceColorBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb this.setAttribute( 'instanceColorStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb this.setAttribute( 'instanceColorEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb return this; } fromWireframeGeometry( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; } fromEdgesGeometry( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; } fromMesh( mesh ) { this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( mesh.geometry ) ); // set colors, maybe return this; } fromLineSegments( lineSegments ) { const geometry = lineSegments.geometry; this.setPositions( geometry.attributes.position.array ); // assumes non-indexed // set colors, maybe return this; } computeBoundingBox() { if ( this.boundingBox === null ) { this.boundingBox = new three__WEBPACK_IMPORTED_MODULE_0__.Box3(); } const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { this.boundingBox.setFromBufferAttribute( start ); _box.setFromBufferAttribute( end ); this.boundingBox.union( _box ); } } computeBoundingSphere() { if ( this.boundingSphere === null ) { this.boundingSphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere(); } if ( this.boundingBox === null ) { this.computeBoundingBox(); } const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { const center = this.boundingSphere.center; this.boundingBox.getCenter( center ); let maxRadiusSq = 0; for ( let i = 0, il = start.count; i < il; i ++ ) { _vector.fromBufferAttribute( start, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); _vector.fromBufferAttribute( end, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); } this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); if ( isNaN( this.boundingSphere.radius ) ) { console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); } } } toJSON() { // todo } applyMatrix( matrix ) { console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' ); return this.applyMatrix4( matrix ); } } /***/ }), /***/ "./node_modules/three/examples/jsm/lines/Wireframe.js": /*!************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/Wireframe.js ***! \************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Wireframe: () => (/* binding */ Wireframe) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js"); /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js"); const _start = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const _end = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); class Wireframe extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh { constructor( geometry = new _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry(), material = new _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial( { color: Math.random() * 0xffffff } ) ) { super( geometry, material ); this.isWireframe = true; this.type = 'Wireframe'; } // for backwards-compatibility, but could be a method of LineSegmentsGeometry... computeLineDistances() { const geometry = this.geometry; const instanceStart = geometry.attributes.instanceStart; const instanceEnd = geometry.attributes.instanceEnd; const lineDistances = new Float32Array( 2 * instanceStart.count ); for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) { _start.fromBufferAttribute( instanceStart, i ); _end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end ); } const instanceDistanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.setAttribute( 'instanceDistanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.setAttribute( 'instanceDistanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; } } /***/ }), /***/ "./node_modules/three/examples/jsm/lines/WireframeGeometry2.js": /*!*********************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/WireframeGeometry2.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ WireframeGeometry2: () => (/* binding */ WireframeGeometry2) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js"); class WireframeGeometry2 extends _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry { constructor( geometry ) { super(); this.isWireframeGeometry2 = true; this.type = 'WireframeGeometry2'; this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( geometry ) ); // set colors, maybe } } /***/ }), /***/ "./node_modules/three/examples/jsm/postprocessing/EffectComposer.js": /*!**************************************************************************!*\ !*** ./node_modules/three/examples/jsm/postprocessing/EffectComposer.js ***! \**************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ EffectComposer: () => (/* binding */ EffectComposer) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _shaders_CopyShader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shaders/CopyShader.js */ "./node_modules/three/examples/jsm/shaders/CopyShader.js"); /* harmony import */ var _ShaderPass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShaderPass.js */ "./node_modules/three/examples/jsm/postprocessing/ShaderPass.js"); /* harmony import */ var _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MaskPass.js */ "./node_modules/three/examples/jsm/postprocessing/MaskPass.js"); class EffectComposer { constructor( renderer, renderTarget ) { this.renderer = renderer; this._pixelRatio = renderer.getPixelRatio(); if ( renderTarget === undefined ) { const size = renderer.getSize( new three__WEBPACK_IMPORTED_MODULE_0__.Vector2() ); this._width = size.width; this._height = size.height; renderTarget = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: three__WEBPACK_IMPORTED_MODULE_0__.HalfFloatType } ); renderTarget.texture.name = 'EffectComposer.rt1'; } else { this._width = renderTarget.width; this._height = renderTarget.height; } this.renderTarget1 = renderTarget; this.renderTarget2 = renderTarget.clone(); this.renderTarget2.texture.name = 'EffectComposer.rt2'; this.writeBuffer = this.renderTarget1; this.readBuffer = this.renderTarget2; this.renderToScreen = true; this.passes = []; this.copyPass = new _ShaderPass_js__WEBPACK_IMPORTED_MODULE_1__.ShaderPass( _shaders_CopyShader_js__WEBPACK_IMPORTED_MODULE_2__.CopyShader ); this.clock = new three__WEBPACK_IMPORTED_MODULE_0__.Clock(); } swapBuffers() { const tmp = this.readBuffer; this.readBuffer = this.writeBuffer; this.writeBuffer = tmp; } addPass( pass ) { this.passes.push( pass ); pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio ); } insertPass( pass, index ) { this.passes.splice( index, 0, pass ); pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio ); } removePass( pass ) { const index = this.passes.indexOf( pass ); if ( index !== - 1 ) { this.passes.splice( index, 1 ); } } isLastEnabledPass( passIndex ) { for ( let i = passIndex + 1; i < this.passes.length; i ++ ) { if ( this.passes[ i ].enabled ) { return false; } } return true; } render( deltaTime ) { // deltaTime value is in seconds if ( deltaTime === undefined ) { deltaTime = this.clock.getDelta(); } const currentRenderTarget = this.renderer.getRenderTarget(); let maskActive = false; for ( let i = 0, il = this.passes.length; i < il; i ++ ) { const pass = this.passes[ i ]; if ( pass.enabled === false ) continue; pass.renderToScreen = ( this.renderToScreen && this.isLastEnabledPass( i ) ); pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive ); if ( pass.needsSwap ) { if ( maskActive ) { const context = this.renderer.getContext(); const stencil = this.renderer.state.buffers.stencil; //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff ); stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff ); this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime ); //context.stencilFunc( context.EQUAL, 1, 0xffffffff ); stencil.setFunc( context.EQUAL, 1, 0xffffffff ); } this.swapBuffers(); } if ( _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.MaskPass !== undefined ) { if ( pass instanceof _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.MaskPass ) { maskActive = true; } else if ( pass instanceof _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.ClearMaskPass ) { maskActive = false; } } } this.renderer.setRenderTarget( currentRenderTarget ); } reset( renderTarget ) { if ( renderTarget === undefined ) { const size = this.renderer.getSize( new three__WEBPACK_IMPORTED_MODULE_0__.Vector2() ); this._pixelRatio = this.renderer.getPixelRatio(); this._width = size.width; this._height = size.height; renderTarget = this.renderTarget1.clone(); renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio ); } this.renderTarget1.dispose(); this.renderTarget2.dispose(); this.renderTarget1 = renderTarget; this.renderTarget2 = renderTarget.clone(); this.writeBuffer = this.renderTarget1; this.readBuffer = this.renderTarget2; } setSize( width, height ) { this._width = width; this._height = height; const effectiveWidth = this._width * this._pixelRatio; const effectiveHeight = this._height * this._pixelRatio; this.renderTarget1.setSize( effectiveWidth, effectiveHeight ); this.renderTarget2.setSize( effectiveWidth, effectiveHeight ); for ( let i = 0; i < this.passes.length; i ++ ) { this.passes[ i ].setSize( effectiveWidth, effectiveHeight ); } } setPixelRatio( pixelRatio ) { this._pixelRatio = pixelRatio; this.setSize( this._width, this._height ); } dispose() { this.renderTarget1.dispose(); this.renderTarget2.dispose(); this.copyPass.dispose(); } } /***/ }), /***/ "./node_modules/three/examples/jsm/postprocessing/MaskPass.js": /*!********************************************************************!*\ !*** ./node_modules/three/examples/jsm/postprocessing/MaskPass.js ***! \********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ ClearMaskPass: () => (/* binding */ ClearMaskPass), /* harmony export */ MaskPass: () => (/* binding */ MaskPass) /* harmony export */ }); /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js"); class MaskPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_0__.Pass { constructor( scene, camera ) { super(); this.scene = scene; this.camera = camera; this.clear = true; this.needsSwap = false; this.inverse = false; } render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { const context = renderer.getContext(); const state = renderer.state; // don't update color or depth state.buffers.color.setMask( false ); state.buffers.depth.setMask( false ); // lock buffers state.buffers.color.setLocked( true ); state.buffers.depth.setLocked( true ); // set up stencil let writeValue, clearValue; if ( this.inverse ) { writeValue = 0; clearValue = 1; } else { writeValue = 1; clearValue = 0; } state.buffers.stencil.setTest( true ); state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE ); state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff ); state.buffers.stencil.setClear( clearValue ); state.buffers.stencil.setLocked( true ); // draw into the stencil buffer renderer.setRenderTarget( readBuffer ); if ( this.clear ) renderer.clear(); renderer.render( this.scene, this.camera ); renderer.setRenderTarget( writeBuffer ); if ( this.clear ) renderer.clear(); renderer.render( this.scene, this.camera ); // unlock color and depth buffer for subsequent rendering state.buffers.color.setLocked( false ); state.buffers.depth.setLocked( false ); // only render where stencil is set to 1 state.buffers.stencil.setLocked( false ); state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1 state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP ); state.buffers.stencil.setLocked( true ); } } class ClearMaskPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_0__.Pass { constructor() { super(); this.needsSwap = false; } render( renderer /*, writeBuffer, readBuffer, deltaTime, maskActive */ ) { renderer.state.buffers.stencil.setLocked( false ); renderer.state.buffers.stencil.setTest( false ); } } /***/ }), /***/ "./node_modules/three/examples/jsm/postprocessing/Pass.js": /*!****************************************************************!*\ !*** ./node_modules/three/examples/jsm/postprocessing/Pass.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ FullScreenQuad: () => (/* binding */ FullScreenQuad), /* harmony export */ Pass: () => (/* binding */ Pass) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); class Pass { constructor() { this.isPass = true; // if set to true, the pass is processed by the composer this.enabled = true; // if set to true, the pass indicates to swap read and write buffer after rendering this.needsSwap = true; // if set to true, the pass clears its buffer before rendering this.clear = false; // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer. this.renderToScreen = false; } setSize( /* width, height */ ) {} render( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) { console.error( 'THREE.Pass: .render() must be implemented in derived pass.' ); } dispose() {} } // Helper for passes that need to fill the viewport with a single quad. const _camera = new three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); // https://github.com/mrdoob/three.js/pull/21358 const _geometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry(); _geometry.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) ); _geometry.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) ); class FullScreenQuad { constructor( material ) { this._mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh( _geometry, material ); } dispose() { this._mesh.geometry.dispose(); } render( renderer ) { renderer.render( this._mesh, _camera ); } get material() { return this._mesh.material; } set material( value ) { this._mesh.material = value; } } /***/ }), /***/ "./node_modules/three/examples/jsm/postprocessing/RenderPass.js": /*!**********************************************************************!*\ !*** ./node_modules/three/examples/jsm/postprocessing/RenderPass.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ RenderPass: () => (/* binding */ RenderPass) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js"); class RenderPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_1__.Pass { constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) { super(); this.scene = scene; this.camera = camera; this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; this.clear = true; this.clearDepth = false; this.needsSwap = false; this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_0__.Color(); } render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { const oldAutoClear = renderer.autoClear; renderer.autoClear = false; let oldClearAlpha, oldOverrideMaterial; if ( this.overrideMaterial !== undefined ) { oldOverrideMaterial = this.scene.overrideMaterial; this.scene.overrideMaterial = this.overrideMaterial; } if ( this.clearColor ) { renderer.getClearColor( this._oldClearColor ); oldClearAlpha = renderer.getClearAlpha(); renderer.setClearColor( this.clearColor, this.clearAlpha ); } if ( this.clearDepth ) { renderer.clearDepth(); } renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600 if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil ); renderer.render( this.scene, this.camera ); if ( this.clearColor ) { renderer.setClearColor( this._oldClearColor, oldClearAlpha ); } if ( this.overrideMaterial !== undefined ) { this.scene.overrideMaterial = oldOverrideMaterial; } renderer.autoClear = oldAutoClear; } } /***/ }), /***/ "./node_modules/three/examples/jsm/postprocessing/ShaderPass.js": /*!**********************************************************************!*\ !*** ./node_modules/three/examples/jsm/postprocessing/ShaderPass.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ ShaderPass: () => (/* binding */ ShaderPass) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js"); class ShaderPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_1__.Pass { constructor( shader, textureID ) { super(); this.textureID = ( textureID !== undefined ) ? textureID : 'tDiffuse'; if ( shader instanceof three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial ) { this.uniforms = shader.uniforms; this.material = shader; } else if ( shader ) { this.uniforms = three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( shader.uniforms ); this.material = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial( { name: ( shader.name !== undefined ) ? shader.name : 'unspecified', defines: Object.assign( {}, shader.defines ), uniforms: this.uniforms, vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader } ); } this.fsQuad = new _Pass_js__WEBPACK_IMPORTED_MODULE_1__.FullScreenQuad( this.material ); } render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { if ( this.uniforms[ this.textureID ] ) { this.uniforms[ this.textureID ].value = readBuffer.texture; } this.fsQuad.material = this.material; if ( this.renderToScreen ) { renderer.setRenderTarget( null ); this.fsQuad.render( renderer ); } else { renderer.setRenderTarget( writeBuffer ); // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600 if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil ); this.fsQuad.render( renderer ); } } dispose() { this.material.dispose(); this.fsQuad.dispose(); } } /***/ }), /***/ "./node_modules/three/examples/jsm/shaders/CopyShader.js": /*!***************************************************************!*\ !*** ./node_modules/three/examples/jsm/shaders/CopyShader.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CopyShader: () => (/* binding */ CopyShader) /* harmony export */ }); /** * Full-screen textured quad shader */ const CopyShader = { name: 'CopyShader', uniforms: { 'tDiffuse': { value: null }, 'opacity': { value: 1.0 } }, vertexShader: /* glsl */` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: /* glsl */` uniform float opacity; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { gl_FragColor = texture2D( tDiffuse, vUv ); gl_FragColor.a *= opacity; }` }; /***/ }), /***/ "./node_modules/three/examples/jsm/shaders/FilmShader.js": /*!***************************************************************!*\ !*** ./node_modules/three/examples/jsm/shaders/FilmShader.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ FilmShader: () => (/* binding */ FilmShader) /* harmony export */ }); /** * Film grain & scanlines shader * * - ported from HLSL to WebGL / GLSL * https://web.archive.org/web/20210226214859/http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html * * Screen Space Static Postprocessor * * Produces an analogue noise overlay similar to a film grain / TV static * * Original implementation and noise algorithm * Pat 'Hawthorne' Shearon * * Optimized scanlines + noise version with intensity scaling * Georg 'Leviathan' Steinrohder * * This version is provided under a Creative Commons Attribution 3.0 License * http://creativecommons.org/licenses/by/3.0/ */ const FilmShader = { name: 'FilmShader', uniforms: { 'tDiffuse': { value: null }, 'time': { value: 0.0 }, 'nIntensity': { value: 0.5 }, 'sIntensity': { value: 0.05 }, 'sCount': { value: 4096 }, 'grayscale': { value: 1 } }, vertexShader: /* glsl */` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: /* glsl */` #include // control parameter uniform float time; uniform bool grayscale; // noise effect intensity value (0 = no effect, 1 = full effect) uniform float nIntensity; // scanlines effect intensity value (0 = no effect, 1 = full effect) uniform float sIntensity; // scanlines effect count value (0 = no effect, 4096 = full effect) uniform float sCount; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { // sample the source vec4 cTextureScreen = texture2D( tDiffuse, vUv ); // make some noise float dx = rand( vUv + time ); // add noise vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 ); // get us a sine and cosine vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) ); // add scanlines cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity; // interpolate between source and result by intensity cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb ); // convert to grayscale if desired if( grayscale ) { cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 ); } gl_FragColor = vec4( cResult, cTextureScreen.a ); }`, }; /***/ }), /***/ "./node_modules/three/examples/jsm/shaders/FocusShader.js": /*!****************************************************************!*\ !*** ./node_modules/three/examples/jsm/shaders/FocusShader.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ FocusShader: () => (/* binding */ FocusShader) /* harmony export */ }); /** * Focus shader * based on PaintEffect postprocess from ro.me * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js */ const FocusShader = { uniforms: { 'tDiffuse': { value: null }, 'screenWidth': { value: 1024 }, 'screenHeight': { value: 1024 }, 'sampleDistance': { value: 0.94 }, 'waveFactor': { value: 0.00125 } }, vertexShader: /* glsl */` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: /* glsl */` uniform float screenWidth; uniform float screenHeight; uniform float sampleDistance; uniform float waveFactor; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { vec4 color, org, tmp, add; float sample_dist, f; vec2 vin; vec2 uv = vUv; add = color = org = texture2D( tDiffuse, uv ); vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 ); sample_dist = dot( vin, vin ) * 2.0; f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0; vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f ); add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize ); if( tmp.b < color.b ) color = tmp; color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) ); color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) ); gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 ); }` }; /***/ }), /***/ "./node_modules/three/examples/jsm/shaders/RGBShiftShader.js": /*!*******************************************************************!*\ !*** ./node_modules/three/examples/jsm/shaders/RGBShiftShader.js ***! \*******************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ RGBShiftShader: () => (/* binding */ RGBShiftShader) /* harmony export */ }); /** * RGB Shift Shader * Shifts red and blue channels from center in opposite directions * Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/ * by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/ * * amount: shift distance (1 is width of input) * angle: shift angle in radians */ const RGBShiftShader = { name: 'RGBShiftShader', uniforms: { 'tDiffuse': { value: null }, 'amount': { value: 0.005 }, 'angle': { value: 0.0 } }, vertexShader: /* glsl */` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: /* glsl */` uniform sampler2D tDiffuse; uniform float amount; uniform float angle; varying vec2 vUv; void main() { vec2 offset = amount * vec2( cos(angle), sin(angle)); vec4 cr = texture2D(tDiffuse, vUv + offset); vec4 cga = texture2D(tDiffuse, vUv); vec4 cb = texture2D(tDiffuse, vUv - offset); gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a); }` }; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ /************************************************************************/ /******/ /* webpack/runtime/chunk loaded */ /******/ (() => { /******/ var deferred = []; /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { /******/ if(chunkIds) { /******/ priority = priority || 0; /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; /******/ deferred[i] = [chunkIds, fn, priority]; /******/ return; /******/ } /******/ var notFulfilled = Infinity; /******/ for (var i = 0; i < deferred.length; i++) { /******/ var [chunkIds, fn, priority] = deferred[i]; /******/ var fulfilled = true; /******/ for (var j = 0; j < chunkIds.length; j++) { /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { /******/ chunkIds.splice(j--, 1); /******/ } else { /******/ fulfilled = false; /******/ if(priority < notFulfilled) notFulfilled = priority; /******/ } /******/ } /******/ if(fulfilled) { /******/ deferred.splice(i--, 1) /******/ var r = fn(); /******/ if (r !== undefined) result = r; /******/ } /******/ } /******/ return result; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ /******/ (() => { /******/ // no baseURI /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "rogue-engine-user-scripts": 0 /******/ }; /******/ /******/ // no chunk on demand loading /******/ /******/ // no prefetching /******/ /******/ // no preloaded /******/ /******/ // no HMR /******/ /******/ // no HMR manifest /******/ /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { /******/ for(moduleId in moreModules) { /******/ if(__webpack_require__.o(moreModules, moduleId)) { /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(runtime) var result = runtime(__webpack_require__); /******/ } /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunkroguetemplateproject"] = self["webpackChunkroguetemplateproject"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*****************************************************!*\ !*** ./Assets/Components/ColoredDotScreenShader.js ***! \*****************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ ColoredDotScreenShader: () => (/* binding */ ColoredDotScreenShader) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__); const ColoredDotScreenShader = { name: "ColoredDotScreenShader", uniforms: { "tDiffuse": { value: null }, "tSize": { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(256, 256) }, "center": { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0.5, 0.5) }, "angle": { value: 1.57 }, "scale": { value: 1 } }, vertexShader: ` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: ` uniform vec2 center; uniform float angle; uniform float scale; uniform vec2 tSize; uniform sampler2D tDiffuse; varying vec2 vUv; float pattern() { float s = sin( angle ), c = cos( angle ); vec2 tex = vUv * tSize - center; vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale; return ( sin( point.x ) * sin( point.y ) ) * 4.0; } void main() { vec4 color = texture2D( tDiffuse, vUv ); gl_FragColor = vec4( vec3(color.r, color.g, color.b) * pattern(), color.a ); }` }; })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*************************************************************!*\ !*** ./Assets/Components/CylinderDistortionComponent.re.ts ***! \*************************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ CylinderDistortionComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class CylinderDistortionComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { awake() { this.distort(); } start() { } update() { } distort() { const positions = this.object3d.geometry.getAttribute("position"); const normals = this.object3d.geometry.getAttribute("normal"); const uv = this.object3d.geometry.getAttribute("uv"); const pos = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0); const norm = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0); const uvPoint = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0); const alteredPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0); for (let i = 0; i < positions.array.length / positions.itemSize; i++) { const offset = i * positions.itemSize; pos.set(positions.array[offset], positions.array[offset + 1], positions.array[offset + 2]); norm.set(normals.array[offset], normals.array[offset + 1], normals.array[offset + 2]); const uvOffset = i * uv.itemSize; uvPoint.set(uv.array[uvOffset], uv.array[uvOffset + 1]); alteredPosition.set(pos.x, pos.y, pos.z); const modifier = 1 - Math.cos(pos.y / 12); alteredPosition.add(norm.multiplyScalar(12 * modifier * Math.random())); positions.array[offset] = alteredPosition.x; positions.array[offset + 1] = alteredPosition.y; positions.array[offset + 2] = alteredPosition.z; } } } __name(CylinderDistortionComponent, "CylinderDistortionComponent"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(CylinderDistortionComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*****************************************************************!*\ !*** ./Assets/Components/GradientShaderMaterialComponent.re.ts ***! \*****************************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ GradientShaderMaterialComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class GradientShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.fragmentShader = `uniform vec3 colorA; uniform vec3 colorB; uniform float meshHeight; varying vec3 vUv; void main() { float lerpValue = vUv.y / meshHeight; gl_FragColor = vec4(mix(colorA, colorB, lerpValue), 1.0); }`; this.vertexShader = `varying vec3 vBC; varying vec3 vUv; void main() { vUv = position; vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * modelViewPosition; }`; this.elapsed = 0; } awake() { this.shaderMaterial = new three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial({ extensions: { derivatives: true }, transparent: false, side: three__WEBPACK_IMPORTED_MODULE_1__.FrontSide, uniforms: { colorA: { type: "vec3", value: new three__WEBPACK_IMPORTED_MODULE_1__.Color(791336) }, colorB: { type: "vec3", value: new three__WEBPACK_IMPORTED_MODULE_1__.Color(464455) }, meshHeight: { type: "float", value: 25 } }, fragmentShader: this.fragmentShader, vertexShader: this.vertexShader }); } start() { if (this.object3d.material instanceof three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial) { console.log("It's a shader"); } else { console.log("no shader here"); } this.object3d.material = this.shaderMaterial; } update() { } } __name(GradientShaderMaterialComponent, "GradientShaderMaterialComponent"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(GradientShaderMaterialComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*********************************************************!*\ !*** ./Assets/Components/PostProcessingComponent.re.ts ***! \*********************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ PostProcessingComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three/examples/jsm/postprocessing/EffectComposer.js */ "./node_modules/three/examples/jsm/postprocessing/EffectComposer.js"); /* harmony import */ var three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/postprocessing/RenderPass.js */ "./node_modules/three/examples/jsm/postprocessing/RenderPass.js"); /* harmony import */ var three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three/examples/jsm/postprocessing/ShaderPass.js */ "./node_modules/three/examples/jsm/postprocessing/ShaderPass.js"); /* harmony import */ var three_examples_jsm_shaders_RGBShiftShader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three/examples/jsm/shaders/RGBShiftShader.js */ "./node_modules/three/examples/jsm/shaders/RGBShiftShader.js"); /* harmony import */ var three_examples_jsm_shaders_FocusShader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three/examples/jsm/shaders/FocusShader.js */ "./node_modules/three/examples/jsm/shaders/FocusShader.js"); /* harmony import */ var three_examples_jsm_shaders_FilmShader_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! three/examples/jsm/shaders/FilmShader.js */ "./node_modules/three/examples/jsm/shaders/FilmShader.js"); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class PostProcessingComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.shaders = []; this.elapsed = 0; } awake() { this.elapsed = 0; this.composer = new three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_1__.EffectComposer(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderer); this.composer.addPass(new three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_2__.RenderPass(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.scene, rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.camera)); this.addShader(three_examples_jsm_shaders_RGBShiftShader_js__WEBPACK_IMPORTED_MODULE_3__.RGBShiftShader, { "angle": 0, "amount": 2e-3 }); this.addShader(three_examples_jsm_shaders_FocusShader_js__WEBPACK_IMPORTED_MODULE_4__.FocusShader, { "sampleDistance": 0.95, "waveFactor": 3e-3 }); this.addShader(three_examples_jsm_shaders_FilmShader_js__WEBPACK_IMPORTED_MODULE_5__.FilmShader, { "time": 0, "nIntensity": 1, "sIntensity": 0.8, "sCount": 1024, "grayscale": false }); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderFunc = () => { this.composer.render(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime); }; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.onStop(() => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderFunc = () => rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.defaultRenderFunc(); }); } addShader(shaderClass, uniforms = {}) { const effect1 = new three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_6__.ShaderPass(shaderClass); for (let key in uniforms) { effect1.uniforms[key].value = uniforms[key]; } this.shaders.push(effect1); this.composer.addPass(effect1); } start() { } update() { this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime; this.shaders.forEach((shaderPass) => { if (shaderPass.uniforms["time"]) { shaderPass.uniforms["time"].value = this.elapsed; } if (shaderPass.uniforms["uTime"]) { shaderPass.uniforms["uTime"].value = this.elapsed; } if (shaderPass.uniforms["u_time"]) { shaderPass.uniforms["u_time"].value = this.elapsed; } }); } } __name(PostProcessingComponent, "PostProcessingComponent"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(PostProcessingComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!***************************************************!*\ !*** ./Assets/Components/RotationComponent.re.ts ***! \***************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ RotationComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class RotationComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.rotationSpeed = -1; } awake() { } start() { } update() { this.object3d.rotateY(this.rotationSpeed / 1e3); } } __name(RotationComponent, "RotationComponent"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.num() ], RotationComponent.prototype, "rotationSpeed", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RotationComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*************************************************************!*\ !*** ./Assets/Components/StarShaderMaterialComponent.re.ts ***! \*************************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ StarShaderMaterialComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class StarShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.elapsed = 0; } awake() { this.material = this.object3d.material; this.material.uniforms = { uTime: { type: "float", value: 0 } }; this.elapsed = 0; } start() { } update() { console.log("tick"); this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime; this.material.uniforms["uTime"].value = this.elapsed; } } __name(StarShaderMaterialComponent, "StarShaderMaterialComponent"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(StarShaderMaterialComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { var __webpack_exports__ = {}; /*!*********************************************************************!*\ !*** ./Assets/Components/VaporwaveSunShaderMaterialComponent.re.ts ***! \*********************************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ VaporwaveSunShaderMaterialComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class VaporwaveSunShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.elapsed = 0; this.uniforms = {}; this.vertexShader = `#define GLSLIFY 1 varying vec3 v_position; varying vec3 v_normal; varying vec2 v_Uv; void main() { // Save the varyings v_position = position; v_normal = normalize(normalMatrix * normal); v_Uv = uv; // Vertex shader output gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } `; this.fragmentShader = `#define GLSLIFY 1 uniform float u_time; varying vec3 v_position; varying vec3 v_normal; varying vec2 v_Uv; void main() { float invertedUv = 1.0 - v_Uv.y; float yPos = 64.0 * (invertedUv * invertedUv * invertedUv); float delta = 2.0 * u_time; // Don't paint the pixels between the stripes if (cos(yPos + delta) > 0.0 && v_Uv.y < 0.6) { discard; } float lerpValue = v_Uv.y / 1.0; vec3 colorA = vec3(1., 1., 0); vec3 colorB = vec3(1.0, 0.0, 1.0); gl_FragColor = vec4(mix(colorB, colorA, lerpValue), 1.0); } `; } awake() { this.initMaterial(); } update() { this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime; this.uniforms.u_time.value = this.elapsed; } start() { this.initMaterial(); } initMaterial() { this.elapsed = 0; this.uniforms = { u_time: { type: "f", value: 0 } }; const material = this.object3d.material; material.uniforms = this.uniforms; material.vertexShader = this.vertexShader; material.fragmentShader = this.fragmentShader; material.extensions.derivatives = true; material.side = three__WEBPACK_IMPORTED_MODULE_1__.FrontSide; material.transparent = true; material.needsUpdate = true; material.uniformsNeedUpdate = true; } } __name(VaporwaveSunShaderMaterialComponent, "VaporwaveSunShaderMaterialComponent"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(VaporwaveSunShaderMaterialComponent); })(); // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. (() => { /*!******************************************************************!*\ !*** ./Assets/Components/WireframeShaderMaterialComponent.re.ts ***! \******************************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ WireframeShaderMaterialComponent) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js"); /* harmony import */ var three_examples_jsm_lines_Wireframe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three/examples/jsm/lines/Wireframe.js */ "./node_modules/three/examples/jsm/lines/Wireframe.js"); /* harmony import */ var three_examples_jsm_lines_WireframeGeometry2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three/examples/jsm/lines/WireframeGeometry2.js */ "./node_modules/three/examples/jsm/lines/WireframeGeometry2.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class WireframeShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { awake() { } start() { let geometry = new three_examples_jsm_lines_WireframeGeometry2_js__WEBPACK_IMPORTED_MODULE_1__.WireframeGeometry2(this.object3d.geometry); const matLine = new three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial({ color: 4465407, linewidth: 5, dashed: false }); matLine.resolution.set(window.innerWidth, window.innerHeight); const wireframe = new three_examples_jsm_lines_Wireframe_js__WEBPACK_IMPORTED_MODULE_3__.Wireframe(geometry, matLine); wireframe.computeLineDistances(); wireframe.scale.set(1, 1, 1); this.object3d.add(wireframe); this.object3d.material = this.baseMaterial; } update() { } } __name(WireframeShaderMaterialComponent, "WireframeShaderMaterialComponent"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.material() ], WireframeShaderMaterialComponent.prototype, "baseMaterial", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(WireframeShaderMaterialComponent); })(); __webpack_exports__ = __webpack_require__.O(__webpack_exports__); /******/ return __webpack_exports__; /******/ })() ; }); //# sourceMappingURL=rogue-engine-user-scripts.js.map