12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765 |
- (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: <hex>,
- * linewidth: <float>,
- * dashed: <boolean>,
- * dashScale: <float>,
- * dashSize: <float>,
- * dashOffset: <float>,
- * gapSize: <float>,
- * resolution: <Vector2>, // 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 <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- 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 <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }
- `,
- 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 <common>
- #include <color_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- 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 <clipping_planes_fragment>
- #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 <logdepthbuf_fragment>
- #include <color_fragment>
- gl_FragColor = vec4( diffuseColor.rgb, alpha );
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }
- `
- };
- 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 <common>
- // 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
|