rogue-engine-user-scripts.js 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("three"), require("rogue-engine"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["three", "rogue-engine"], factory);
  6. else if(typeof exports === 'object')
  7. exports["rogue-engine-user-scripts"] = factory(require("three"), require("rogue-engine"));
  8. else
  9. root["rogue-engine-user-scripts"] = factory(root["three"], root["rogue-engine"]);
  10. })(self, (__WEBPACK_EXTERNAL_MODULE_three__, __WEBPACK_EXTERNAL_MODULE_rogue_engine__) => {
  11. return /******/ (() => { // webpackBootstrap
  12. /******/ "use strict";
  13. /******/ var __webpack_modules__ = ({
  14. /***/ "rogue-engine":
  15. /*!******************************************************************************************************************!*\
  16. !*** external {"commonjs":"rogue-engine","commonjs2":"rogue-engine","amd":"rogue-engine","root":"rogue-engine"} ***!
  17. \******************************************************************************************************************/
  18. /***/ ((module) => {
  19. module.exports = __WEBPACK_EXTERNAL_MODULE_rogue_engine__;
  20. /***/ }),
  21. /***/ "three":
  22. /*!**************************************************************************************!*\
  23. !*** external {"commonjs":"three","commonjs2":"three","amd":"three","root":"three"} ***!
  24. \**************************************************************************************/
  25. /***/ ((module) => {
  26. module.exports = __WEBPACK_EXTERNAL_MODULE_three__;
  27. /***/ }),
  28. /***/ "./node_modules/three/examples/jsm/lines/LineMaterial.js":
  29. /*!***************************************************************!*\
  30. !*** ./node_modules/three/examples/jsm/lines/LineMaterial.js ***!
  31. \***************************************************************/
  32. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  33. __webpack_require__.r(__webpack_exports__);
  34. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  35. /* harmony export */ LineMaterial: () => (/* binding */ LineMaterial)
  36. /* harmony export */ });
  37. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  38. /**
  39. * parameters = {
  40. * color: <hex>,
  41. * linewidth: <float>,
  42. * dashed: <boolean>,
  43. * dashScale: <float>,
  44. * dashSize: <float>,
  45. * dashOffset: <float>,
  46. * gapSize: <float>,
  47. * resolution: <Vector2>, // to be set by renderer
  48. * }
  49. */
  50. three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line = {
  51. worldUnits: { value: 1 },
  52. linewidth: { value: 1 },
  53. resolution: { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( 1, 1 ) },
  54. dashOffset: { value: 0 },
  55. dashScale: { value: 1 },
  56. dashSize: { value: 1 },
  57. gapSize: { value: 1 } // todo FIX - maybe change to totalSize
  58. };
  59. three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ] = {
  60. uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.merge( [
  61. three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.common,
  62. three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.fog,
  63. three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line
  64. ] ),
  65. vertexShader:
  66. /* glsl */`
  67. #include <common>
  68. #include <color_pars_vertex>
  69. #include <fog_pars_vertex>
  70. #include <logdepthbuf_pars_vertex>
  71. #include <clipping_planes_pars_vertex>
  72. uniform float linewidth;
  73. uniform vec2 resolution;
  74. attribute vec3 instanceStart;
  75. attribute vec3 instanceEnd;
  76. attribute vec3 instanceColorStart;
  77. attribute vec3 instanceColorEnd;
  78. #ifdef WORLD_UNITS
  79. varying vec4 worldPos;
  80. varying vec3 worldStart;
  81. varying vec3 worldEnd;
  82. #ifdef USE_DASH
  83. varying vec2 vUv;
  84. #endif
  85. #else
  86. varying vec2 vUv;
  87. #endif
  88. #ifdef USE_DASH
  89. uniform float dashScale;
  90. attribute float instanceDistanceStart;
  91. attribute float instanceDistanceEnd;
  92. varying float vLineDistance;
  93. #endif
  94. void trimSegment( const in vec4 start, inout vec4 end ) {
  95. // trim end segment so it terminates between the camera plane and the near plane
  96. // conservative estimate of the near plane
  97. float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
  98. float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
  99. float nearEstimate = - 0.5 * b / a;
  100. float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
  101. end.xyz = mix( start.xyz, end.xyz, alpha );
  102. }
  103. void main() {
  104. #ifdef USE_COLOR
  105. vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
  106. #endif
  107. #ifdef USE_DASH
  108. vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
  109. vUv = uv;
  110. #endif
  111. float aspect = resolution.x / resolution.y;
  112. // camera space
  113. vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
  114. vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
  115. #ifdef WORLD_UNITS
  116. worldStart = start.xyz;
  117. worldEnd = end.xyz;
  118. #else
  119. vUv = uv;
  120. #endif
  121. // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
  122. // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
  123. // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
  124. // perhaps there is a more elegant solution -- WestLangley
  125. bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
  126. if ( perspective ) {
  127. if ( start.z < 0.0 && end.z >= 0.0 ) {
  128. trimSegment( start, end );
  129. } else if ( end.z < 0.0 && start.z >= 0.0 ) {
  130. trimSegment( end, start );
  131. }
  132. }
  133. // clip space
  134. vec4 clipStart = projectionMatrix * start;
  135. vec4 clipEnd = projectionMatrix * end;
  136. // ndc space
  137. vec3 ndcStart = clipStart.xyz / clipStart.w;
  138. vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
  139. // direction
  140. vec2 dir = ndcEnd.xy - ndcStart.xy;
  141. // account for clip-space aspect ratio
  142. dir.x *= aspect;
  143. dir = normalize( dir );
  144. #ifdef WORLD_UNITS
  145. // get the offset direction as perpendicular to the view vector
  146. vec3 worldDir = normalize( end.xyz - start.xyz );
  147. vec3 offset;
  148. if ( position.y < 0.5 ) {
  149. offset = normalize( cross( start.xyz, worldDir ) );
  150. } else {
  151. offset = normalize( cross( end.xyz, worldDir ) );
  152. }
  153. // sign flip
  154. if ( position.x < 0.0 ) offset *= - 1.0;
  155. float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
  156. // don't extend the line if we're rendering dashes because we
  157. // won't be rendering the endcaps
  158. #ifndef USE_DASH
  159. // extend the line bounds to encompass endcaps
  160. start.xyz += - worldDir * linewidth * 0.5;
  161. end.xyz += worldDir * linewidth * 0.5;
  162. // shift the position of the quad so it hugs the forward edge of the line
  163. offset.xy -= dir * forwardOffset;
  164. offset.z += 0.5;
  165. #endif
  166. // endcaps
  167. if ( position.y > 1.0 || position.y < 0.0 ) {
  168. offset.xy += dir * 2.0 * forwardOffset;
  169. }
  170. // adjust for linewidth
  171. offset *= linewidth * 0.5;
  172. // set the world position
  173. worldPos = ( position.y < 0.5 ) ? start : end;
  174. worldPos.xyz += offset;
  175. // project the worldpos
  176. vec4 clip = projectionMatrix * worldPos;
  177. // shift the depth of the projected points so the line
  178. // segments overlap neatly
  179. vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
  180. clip.z = clipPose.z * clip.w;
  181. #else
  182. vec2 offset = vec2( dir.y, - dir.x );
  183. // undo aspect ratio adjustment
  184. dir.x /= aspect;
  185. offset.x /= aspect;
  186. // sign flip
  187. if ( position.x < 0.0 ) offset *= - 1.0;
  188. // endcaps
  189. if ( position.y < 0.0 ) {
  190. offset += - dir;
  191. } else if ( position.y > 1.0 ) {
  192. offset += dir;
  193. }
  194. // adjust for linewidth
  195. offset *= linewidth;
  196. // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
  197. offset /= resolution.y;
  198. // select end
  199. vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
  200. // back to clip space
  201. offset *= clip.w;
  202. clip.xy += offset;
  203. #endif
  204. gl_Position = clip;
  205. vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
  206. #include <logdepthbuf_vertex>
  207. #include <clipping_planes_vertex>
  208. #include <fog_vertex>
  209. }
  210. `,
  211. fragmentShader:
  212. /* glsl */`
  213. uniform vec3 diffuse;
  214. uniform float opacity;
  215. uniform float linewidth;
  216. #ifdef USE_DASH
  217. uniform float dashOffset;
  218. uniform float dashSize;
  219. uniform float gapSize;
  220. #endif
  221. varying float vLineDistance;
  222. #ifdef WORLD_UNITS
  223. varying vec4 worldPos;
  224. varying vec3 worldStart;
  225. varying vec3 worldEnd;
  226. #ifdef USE_DASH
  227. varying vec2 vUv;
  228. #endif
  229. #else
  230. varying vec2 vUv;
  231. #endif
  232. #include <common>
  233. #include <color_pars_fragment>
  234. #include <fog_pars_fragment>
  235. #include <logdepthbuf_pars_fragment>
  236. #include <clipping_planes_pars_fragment>
  237. vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
  238. float mua;
  239. float mub;
  240. vec3 p13 = p1 - p3;
  241. vec3 p43 = p4 - p3;
  242. vec3 p21 = p2 - p1;
  243. float d1343 = dot( p13, p43 );
  244. float d4321 = dot( p43, p21 );
  245. float d1321 = dot( p13, p21 );
  246. float d4343 = dot( p43, p43 );
  247. float d2121 = dot( p21, p21 );
  248. float denom = d2121 * d4343 - d4321 * d4321;
  249. float numer = d1343 * d4321 - d1321 * d4343;
  250. mua = numer / denom;
  251. mua = clamp( mua, 0.0, 1.0 );
  252. mub = ( d1343 + d4321 * ( mua ) ) / d4343;
  253. mub = clamp( mub, 0.0, 1.0 );
  254. return vec2( mua, mub );
  255. }
  256. void main() {
  257. #include <clipping_planes_fragment>
  258. #ifdef USE_DASH
  259. if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
  260. if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
  261. #endif
  262. float alpha = opacity;
  263. #ifdef WORLD_UNITS
  264. // Find the closest points on the view ray and the line segment
  265. vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
  266. vec3 lineDir = worldEnd - worldStart;
  267. vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
  268. vec3 p1 = worldStart + lineDir * params.x;
  269. vec3 p2 = rayEnd * params.y;
  270. vec3 delta = p1 - p2;
  271. float len = length( delta );
  272. float norm = len / linewidth;
  273. #ifndef USE_DASH
  274. #ifdef USE_ALPHA_TO_COVERAGE
  275. float dnorm = fwidth( norm );
  276. alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
  277. #else
  278. if ( norm > 0.5 ) {
  279. discard;
  280. }
  281. #endif
  282. #endif
  283. #else
  284. #ifdef USE_ALPHA_TO_COVERAGE
  285. // artifacts appear on some hardware if a derivative is taken within a conditional
  286. float a = vUv.x;
  287. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  288. float len2 = a * a + b * b;
  289. float dlen = fwidth( len2 );
  290. if ( abs( vUv.y ) > 1.0 ) {
  291. alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
  292. }
  293. #else
  294. if ( abs( vUv.y ) > 1.0 ) {
  295. float a = vUv.x;
  296. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  297. float len2 = a * a + b * b;
  298. if ( len2 > 1.0 ) discard;
  299. }
  300. #endif
  301. #endif
  302. vec4 diffuseColor = vec4( diffuse, alpha );
  303. #include <logdepthbuf_fragment>
  304. #include <color_fragment>
  305. gl_FragColor = vec4( diffuseColor.rgb, alpha );
  306. #include <tonemapping_fragment>
  307. #include <encodings_fragment>
  308. #include <fog_fragment>
  309. #include <premultiplied_alpha_fragment>
  310. }
  311. `
  312. };
  313. class LineMaterial extends three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial {
  314. constructor( parameters ) {
  315. super( {
  316. type: 'LineMaterial',
  317. uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].uniforms ),
  318. vertexShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].vertexShader,
  319. fragmentShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib[ 'line' ].fragmentShader,
  320. clipping: true // required for clipping support
  321. } );
  322. this.isLineMaterial = true;
  323. Object.defineProperties( this, {
  324. color: {
  325. enumerable: true,
  326. get: function () {
  327. return this.uniforms.diffuse.value;
  328. },
  329. set: function ( value ) {
  330. this.uniforms.diffuse.value = value;
  331. }
  332. },
  333. worldUnits: {
  334. enumerable: true,
  335. get: function () {
  336. return 'WORLD_UNITS' in this.defines;
  337. },
  338. set: function ( value ) {
  339. if ( value === true ) {
  340. this.defines.WORLD_UNITS = '';
  341. } else {
  342. delete this.defines.WORLD_UNITS;
  343. }
  344. }
  345. },
  346. linewidth: {
  347. enumerable: true,
  348. get: function () {
  349. return this.uniforms.linewidth.value;
  350. },
  351. set: function ( value ) {
  352. this.uniforms.linewidth.value = value;
  353. }
  354. },
  355. dashed: {
  356. enumerable: true,
  357. get: function () {
  358. return Boolean( 'USE_DASH' in this.defines );
  359. },
  360. set( value ) {
  361. if ( Boolean( value ) !== Boolean( 'USE_DASH' in this.defines ) ) {
  362. this.needsUpdate = true;
  363. }
  364. if ( value === true ) {
  365. this.defines.USE_DASH = '';
  366. } else {
  367. delete this.defines.USE_DASH;
  368. }
  369. }
  370. },
  371. dashScale: {
  372. enumerable: true,
  373. get: function () {
  374. return this.uniforms.dashScale.value;
  375. },
  376. set: function ( value ) {
  377. this.uniforms.dashScale.value = value;
  378. }
  379. },
  380. dashSize: {
  381. enumerable: true,
  382. get: function () {
  383. return this.uniforms.dashSize.value;
  384. },
  385. set: function ( value ) {
  386. this.uniforms.dashSize.value = value;
  387. }
  388. },
  389. dashOffset: {
  390. enumerable: true,
  391. get: function () {
  392. return this.uniforms.dashOffset.value;
  393. },
  394. set: function ( value ) {
  395. this.uniforms.dashOffset.value = value;
  396. }
  397. },
  398. gapSize: {
  399. enumerable: true,
  400. get: function () {
  401. return this.uniforms.gapSize.value;
  402. },
  403. set: function ( value ) {
  404. this.uniforms.gapSize.value = value;
  405. }
  406. },
  407. opacity: {
  408. enumerable: true,
  409. get: function () {
  410. return this.uniforms.opacity.value;
  411. },
  412. set: function ( value ) {
  413. this.uniforms.opacity.value = value;
  414. }
  415. },
  416. resolution: {
  417. enumerable: true,
  418. get: function () {
  419. return this.uniforms.resolution.value;
  420. },
  421. set: function ( value ) {
  422. this.uniforms.resolution.value.copy( value );
  423. }
  424. },
  425. alphaToCoverage: {
  426. enumerable: true,
  427. get: function () {
  428. return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines );
  429. },
  430. set: function ( value ) {
  431. if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) {
  432. this.needsUpdate = true;
  433. }
  434. if ( value === true ) {
  435. this.defines.USE_ALPHA_TO_COVERAGE = '';
  436. this.extensions.derivatives = true;
  437. } else {
  438. delete this.defines.USE_ALPHA_TO_COVERAGE;
  439. this.extensions.derivatives = false;
  440. }
  441. }
  442. }
  443. } );
  444. this.setValues( parameters );
  445. }
  446. }
  447. /***/ }),
  448. /***/ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js":
  449. /*!***********************************************************************!*\
  450. !*** ./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js ***!
  451. \***********************************************************************/
  452. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  453. __webpack_require__.r(__webpack_exports__);
  454. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  455. /* harmony export */ LineSegmentsGeometry: () => (/* binding */ LineSegmentsGeometry)
  456. /* harmony export */ });
  457. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  458. const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();
  459. const _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
  460. class LineSegmentsGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferGeometry {
  461. constructor() {
  462. super();
  463. this.isLineSegmentsGeometry = true;
  464. this.type = 'LineSegmentsGeometry';
  465. 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 ];
  466. const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];
  467. const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
  468. this.setIndex( index );
  469. this.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( positions, 3 ) );
  470. this.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( uvs, 2 ) );
  471. }
  472. applyMatrix4( matrix ) {
  473. const start = this.attributes.instanceStart;
  474. const end = this.attributes.instanceEnd;
  475. if ( start !== undefined ) {
  476. start.applyMatrix4( matrix );
  477. end.applyMatrix4( matrix );
  478. start.needsUpdate = true;
  479. }
  480. if ( this.boundingBox !== null ) {
  481. this.computeBoundingBox();
  482. }
  483. if ( this.boundingSphere !== null ) {
  484. this.computeBoundingSphere();
  485. }
  486. return this;
  487. }
  488. setPositions( array ) {
  489. let lineSegments;
  490. if ( array instanceof Float32Array ) {
  491. lineSegments = array;
  492. } else if ( Array.isArray( array ) ) {
  493. lineSegments = new Float32Array( array );
  494. }
  495. const instanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
  496. this.setAttribute( 'instanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
  497. this.setAttribute( 'instanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
  498. //
  499. this.computeBoundingBox();
  500. this.computeBoundingSphere();
  501. return this;
  502. }
  503. setColors( array ) {
  504. let colors;
  505. if ( array instanceof Float32Array ) {
  506. colors = array;
  507. } else if ( Array.isArray( array ) ) {
  508. colors = new Float32Array( array );
  509. }
  510. const instanceColorBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
  511. this.setAttribute( 'instanceColorStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
  512. this.setAttribute( 'instanceColorEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
  513. return this;
  514. }
  515. fromWireframeGeometry( geometry ) {
  516. this.setPositions( geometry.attributes.position.array );
  517. return this;
  518. }
  519. fromEdgesGeometry( geometry ) {
  520. this.setPositions( geometry.attributes.position.array );
  521. return this;
  522. }
  523. fromMesh( mesh ) {
  524. this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( mesh.geometry ) );
  525. // set colors, maybe
  526. return this;
  527. }
  528. fromLineSegments( lineSegments ) {
  529. const geometry = lineSegments.geometry;
  530. this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
  531. // set colors, maybe
  532. return this;
  533. }
  534. computeBoundingBox() {
  535. if ( this.boundingBox === null ) {
  536. this.boundingBox = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();
  537. }
  538. const start = this.attributes.instanceStart;
  539. const end = this.attributes.instanceEnd;
  540. if ( start !== undefined && end !== undefined ) {
  541. this.boundingBox.setFromBufferAttribute( start );
  542. _box.setFromBufferAttribute( end );
  543. this.boundingBox.union( _box );
  544. }
  545. }
  546. computeBoundingSphere() {
  547. if ( this.boundingSphere === null ) {
  548. this.boundingSphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere();
  549. }
  550. if ( this.boundingBox === null ) {
  551. this.computeBoundingBox();
  552. }
  553. const start = this.attributes.instanceStart;
  554. const end = this.attributes.instanceEnd;
  555. if ( start !== undefined && end !== undefined ) {
  556. const center = this.boundingSphere.center;
  557. this.boundingBox.getCenter( center );
  558. let maxRadiusSq = 0;
  559. for ( let i = 0, il = start.count; i < il; i ++ ) {
  560. _vector.fromBufferAttribute( start, i );
  561. maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
  562. _vector.fromBufferAttribute( end, i );
  563. maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
  564. }
  565. this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
  566. if ( isNaN( this.boundingSphere.radius ) ) {
  567. console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );
  568. }
  569. }
  570. }
  571. toJSON() {
  572. // todo
  573. }
  574. applyMatrix( matrix ) {
  575. console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );
  576. return this.applyMatrix4( matrix );
  577. }
  578. }
  579. /***/ }),
  580. /***/ "./node_modules/three/examples/jsm/lines/Wireframe.js":
  581. /*!************************************************************!*\
  582. !*** ./node_modules/three/examples/jsm/lines/Wireframe.js ***!
  583. \************************************************************/
  584. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  585. __webpack_require__.r(__webpack_exports__);
  586. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  587. /* harmony export */ Wireframe: () => (/* binding */ Wireframe)
  588. /* harmony export */ });
  589. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  590. /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js");
  591. /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js");
  592. const _start = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
  593. const _end = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
  594. class Wireframe extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh {
  595. 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 } ) ) {
  596. super( geometry, material );
  597. this.isWireframe = true;
  598. this.type = 'Wireframe';
  599. }
  600. // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
  601. computeLineDistances() {
  602. const geometry = this.geometry;
  603. const instanceStart = geometry.attributes.instanceStart;
  604. const instanceEnd = geometry.attributes.instanceEnd;
  605. const lineDistances = new Float32Array( 2 * instanceStart.count );
  606. for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) {
  607. _start.fromBufferAttribute( instanceStart, i );
  608. _end.fromBufferAttribute( instanceEnd, i );
  609. lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
  610. lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end );
  611. }
  612. const instanceDistanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
  613. geometry.setAttribute( 'instanceDistanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
  614. geometry.setAttribute( 'instanceDistanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
  615. return this;
  616. }
  617. }
  618. /***/ }),
  619. /***/ "./node_modules/three/examples/jsm/lines/WireframeGeometry2.js":
  620. /*!*********************************************************************!*\
  621. !*** ./node_modules/three/examples/jsm/lines/WireframeGeometry2.js ***!
  622. \*********************************************************************/
  623. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  624. __webpack_require__.r(__webpack_exports__);
  625. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  626. /* harmony export */ WireframeGeometry2: () => (/* binding */ WireframeGeometry2)
  627. /* harmony export */ });
  628. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  629. /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js");
  630. class WireframeGeometry2 extends _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry {
  631. constructor( geometry ) {
  632. super();
  633. this.isWireframeGeometry2 = true;
  634. this.type = 'WireframeGeometry2';
  635. this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( geometry ) );
  636. // set colors, maybe
  637. }
  638. }
  639. /***/ }),
  640. /***/ "./node_modules/three/examples/jsm/postprocessing/EffectComposer.js":
  641. /*!**************************************************************************!*\
  642. !*** ./node_modules/three/examples/jsm/postprocessing/EffectComposer.js ***!
  643. \**************************************************************************/
  644. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  645. __webpack_require__.r(__webpack_exports__);
  646. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  647. /* harmony export */ EffectComposer: () => (/* binding */ EffectComposer)
  648. /* harmony export */ });
  649. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  650. /* harmony import */ var _shaders_CopyShader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shaders/CopyShader.js */ "./node_modules/three/examples/jsm/shaders/CopyShader.js");
  651. /* harmony import */ var _ShaderPass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShaderPass.js */ "./node_modules/three/examples/jsm/postprocessing/ShaderPass.js");
  652. /* harmony import */ var _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MaskPass.js */ "./node_modules/three/examples/jsm/postprocessing/MaskPass.js");
  653. class EffectComposer {
  654. constructor( renderer, renderTarget ) {
  655. this.renderer = renderer;
  656. this._pixelRatio = renderer.getPixelRatio();
  657. if ( renderTarget === undefined ) {
  658. const size = renderer.getSize( new three__WEBPACK_IMPORTED_MODULE_0__.Vector2() );
  659. this._width = size.width;
  660. this._height = size.height;
  661. renderTarget = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: three__WEBPACK_IMPORTED_MODULE_0__.HalfFloatType } );
  662. renderTarget.texture.name = 'EffectComposer.rt1';
  663. } else {
  664. this._width = renderTarget.width;
  665. this._height = renderTarget.height;
  666. }
  667. this.renderTarget1 = renderTarget;
  668. this.renderTarget2 = renderTarget.clone();
  669. this.renderTarget2.texture.name = 'EffectComposer.rt2';
  670. this.writeBuffer = this.renderTarget1;
  671. this.readBuffer = this.renderTarget2;
  672. this.renderToScreen = true;
  673. this.passes = [];
  674. this.copyPass = new _ShaderPass_js__WEBPACK_IMPORTED_MODULE_1__.ShaderPass( _shaders_CopyShader_js__WEBPACK_IMPORTED_MODULE_2__.CopyShader );
  675. this.clock = new three__WEBPACK_IMPORTED_MODULE_0__.Clock();
  676. }
  677. swapBuffers() {
  678. const tmp = this.readBuffer;
  679. this.readBuffer = this.writeBuffer;
  680. this.writeBuffer = tmp;
  681. }
  682. addPass( pass ) {
  683. this.passes.push( pass );
  684. pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
  685. }
  686. insertPass( pass, index ) {
  687. this.passes.splice( index, 0, pass );
  688. pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
  689. }
  690. removePass( pass ) {
  691. const index = this.passes.indexOf( pass );
  692. if ( index !== - 1 ) {
  693. this.passes.splice( index, 1 );
  694. }
  695. }
  696. isLastEnabledPass( passIndex ) {
  697. for ( let i = passIndex + 1; i < this.passes.length; i ++ ) {
  698. if ( this.passes[ i ].enabled ) {
  699. return false;
  700. }
  701. }
  702. return true;
  703. }
  704. render( deltaTime ) {
  705. // deltaTime value is in seconds
  706. if ( deltaTime === undefined ) {
  707. deltaTime = this.clock.getDelta();
  708. }
  709. const currentRenderTarget = this.renderer.getRenderTarget();
  710. let maskActive = false;
  711. for ( let i = 0, il = this.passes.length; i < il; i ++ ) {
  712. const pass = this.passes[ i ];
  713. if ( pass.enabled === false ) continue;
  714. pass.renderToScreen = ( this.renderToScreen && this.isLastEnabledPass( i ) );
  715. pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive );
  716. if ( pass.needsSwap ) {
  717. if ( maskActive ) {
  718. const context = this.renderer.getContext();
  719. const stencil = this.renderer.state.buffers.stencil;
  720. //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );
  721. stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff );
  722. this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime );
  723. //context.stencilFunc( context.EQUAL, 1, 0xffffffff );
  724. stencil.setFunc( context.EQUAL, 1, 0xffffffff );
  725. }
  726. this.swapBuffers();
  727. }
  728. if ( _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.MaskPass !== undefined ) {
  729. if ( pass instanceof _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.MaskPass ) {
  730. maskActive = true;
  731. } else if ( pass instanceof _MaskPass_js__WEBPACK_IMPORTED_MODULE_3__.ClearMaskPass ) {
  732. maskActive = false;
  733. }
  734. }
  735. }
  736. this.renderer.setRenderTarget( currentRenderTarget );
  737. }
  738. reset( renderTarget ) {
  739. if ( renderTarget === undefined ) {
  740. const size = this.renderer.getSize( new three__WEBPACK_IMPORTED_MODULE_0__.Vector2() );
  741. this._pixelRatio = this.renderer.getPixelRatio();
  742. this._width = size.width;
  743. this._height = size.height;
  744. renderTarget = this.renderTarget1.clone();
  745. renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
  746. }
  747. this.renderTarget1.dispose();
  748. this.renderTarget2.dispose();
  749. this.renderTarget1 = renderTarget;
  750. this.renderTarget2 = renderTarget.clone();
  751. this.writeBuffer = this.renderTarget1;
  752. this.readBuffer = this.renderTarget2;
  753. }
  754. setSize( width, height ) {
  755. this._width = width;
  756. this._height = height;
  757. const effectiveWidth = this._width * this._pixelRatio;
  758. const effectiveHeight = this._height * this._pixelRatio;
  759. this.renderTarget1.setSize( effectiveWidth, effectiveHeight );
  760. this.renderTarget2.setSize( effectiveWidth, effectiveHeight );
  761. for ( let i = 0; i < this.passes.length; i ++ ) {
  762. this.passes[ i ].setSize( effectiveWidth, effectiveHeight );
  763. }
  764. }
  765. setPixelRatio( pixelRatio ) {
  766. this._pixelRatio = pixelRatio;
  767. this.setSize( this._width, this._height );
  768. }
  769. dispose() {
  770. this.renderTarget1.dispose();
  771. this.renderTarget2.dispose();
  772. this.copyPass.dispose();
  773. }
  774. }
  775. /***/ }),
  776. /***/ "./node_modules/three/examples/jsm/postprocessing/MaskPass.js":
  777. /*!********************************************************************!*\
  778. !*** ./node_modules/three/examples/jsm/postprocessing/MaskPass.js ***!
  779. \********************************************************************/
  780. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  781. __webpack_require__.r(__webpack_exports__);
  782. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  783. /* harmony export */ ClearMaskPass: () => (/* binding */ ClearMaskPass),
  784. /* harmony export */ MaskPass: () => (/* binding */ MaskPass)
  785. /* harmony export */ });
  786. /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js");
  787. class MaskPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_0__.Pass {
  788. constructor( scene, camera ) {
  789. super();
  790. this.scene = scene;
  791. this.camera = camera;
  792. this.clear = true;
  793. this.needsSwap = false;
  794. this.inverse = false;
  795. }
  796. render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
  797. const context = renderer.getContext();
  798. const state = renderer.state;
  799. // don't update color or depth
  800. state.buffers.color.setMask( false );
  801. state.buffers.depth.setMask( false );
  802. // lock buffers
  803. state.buffers.color.setLocked( true );
  804. state.buffers.depth.setLocked( true );
  805. // set up stencil
  806. let writeValue, clearValue;
  807. if ( this.inverse ) {
  808. writeValue = 0;
  809. clearValue = 1;
  810. } else {
  811. writeValue = 1;
  812. clearValue = 0;
  813. }
  814. state.buffers.stencil.setTest( true );
  815. state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE );
  816. state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff );
  817. state.buffers.stencil.setClear( clearValue );
  818. state.buffers.stencil.setLocked( true );
  819. // draw into the stencil buffer
  820. renderer.setRenderTarget( readBuffer );
  821. if ( this.clear ) renderer.clear();
  822. renderer.render( this.scene, this.camera );
  823. renderer.setRenderTarget( writeBuffer );
  824. if ( this.clear ) renderer.clear();
  825. renderer.render( this.scene, this.camera );
  826. // unlock color and depth buffer for subsequent rendering
  827. state.buffers.color.setLocked( false );
  828. state.buffers.depth.setLocked( false );
  829. // only render where stencil is set to 1
  830. state.buffers.stencil.setLocked( false );
  831. state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
  832. state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );
  833. state.buffers.stencil.setLocked( true );
  834. }
  835. }
  836. class ClearMaskPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_0__.Pass {
  837. constructor() {
  838. super();
  839. this.needsSwap = false;
  840. }
  841. render( renderer /*, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
  842. renderer.state.buffers.stencil.setLocked( false );
  843. renderer.state.buffers.stencil.setTest( false );
  844. }
  845. }
  846. /***/ }),
  847. /***/ "./node_modules/three/examples/jsm/postprocessing/Pass.js":
  848. /*!****************************************************************!*\
  849. !*** ./node_modules/three/examples/jsm/postprocessing/Pass.js ***!
  850. \****************************************************************/
  851. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  852. __webpack_require__.r(__webpack_exports__);
  853. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  854. /* harmony export */ FullScreenQuad: () => (/* binding */ FullScreenQuad),
  855. /* harmony export */ Pass: () => (/* binding */ Pass)
  856. /* harmony export */ });
  857. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  858. class Pass {
  859. constructor() {
  860. this.isPass = true;
  861. // if set to true, the pass is processed by the composer
  862. this.enabled = true;
  863. // if set to true, the pass indicates to swap read and write buffer after rendering
  864. this.needsSwap = true;
  865. // if set to true, the pass clears its buffer before rendering
  866. this.clear = false;
  867. // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
  868. this.renderToScreen = false;
  869. }
  870. setSize( /* width, height */ ) {}
  871. render( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
  872. console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );
  873. }
  874. dispose() {}
  875. }
  876. // Helper for passes that need to fill the viewport with a single quad.
  877. const _camera = new three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
  878. // https://github.com/mrdoob/three.js/pull/21358
  879. const _geometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();
  880. _geometry.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
  881. _geometry.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
  882. class FullScreenQuad {
  883. constructor( material ) {
  884. this._mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh( _geometry, material );
  885. }
  886. dispose() {
  887. this._mesh.geometry.dispose();
  888. }
  889. render( renderer ) {
  890. renderer.render( this._mesh, _camera );
  891. }
  892. get material() {
  893. return this._mesh.material;
  894. }
  895. set material( value ) {
  896. this._mesh.material = value;
  897. }
  898. }
  899. /***/ }),
  900. /***/ "./node_modules/three/examples/jsm/postprocessing/RenderPass.js":
  901. /*!**********************************************************************!*\
  902. !*** ./node_modules/three/examples/jsm/postprocessing/RenderPass.js ***!
  903. \**********************************************************************/
  904. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  905. __webpack_require__.r(__webpack_exports__);
  906. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  907. /* harmony export */ RenderPass: () => (/* binding */ RenderPass)
  908. /* harmony export */ });
  909. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  910. /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js");
  911. class RenderPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_1__.Pass {
  912. constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
  913. super();
  914. this.scene = scene;
  915. this.camera = camera;
  916. this.overrideMaterial = overrideMaterial;
  917. this.clearColor = clearColor;
  918. this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
  919. this.clear = true;
  920. this.clearDepth = false;
  921. this.needsSwap = false;
  922. this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_0__.Color();
  923. }
  924. render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
  925. const oldAutoClear = renderer.autoClear;
  926. renderer.autoClear = false;
  927. let oldClearAlpha, oldOverrideMaterial;
  928. if ( this.overrideMaterial !== undefined ) {
  929. oldOverrideMaterial = this.scene.overrideMaterial;
  930. this.scene.overrideMaterial = this.overrideMaterial;
  931. }
  932. if ( this.clearColor ) {
  933. renderer.getClearColor( this._oldClearColor );
  934. oldClearAlpha = renderer.getClearAlpha();
  935. renderer.setClearColor( this.clearColor, this.clearAlpha );
  936. }
  937. if ( this.clearDepth ) {
  938. renderer.clearDepth();
  939. }
  940. renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
  941. // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
  942. if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
  943. renderer.render( this.scene, this.camera );
  944. if ( this.clearColor ) {
  945. renderer.setClearColor( this._oldClearColor, oldClearAlpha );
  946. }
  947. if ( this.overrideMaterial !== undefined ) {
  948. this.scene.overrideMaterial = oldOverrideMaterial;
  949. }
  950. renderer.autoClear = oldAutoClear;
  951. }
  952. }
  953. /***/ }),
  954. /***/ "./node_modules/three/examples/jsm/postprocessing/ShaderPass.js":
  955. /*!**********************************************************************!*\
  956. !*** ./node_modules/three/examples/jsm/postprocessing/ShaderPass.js ***!
  957. \**********************************************************************/
  958. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  959. __webpack_require__.r(__webpack_exports__);
  960. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  961. /* harmony export */ ShaderPass: () => (/* binding */ ShaderPass)
  962. /* harmony export */ });
  963. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  964. /* harmony import */ var _Pass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pass.js */ "./node_modules/three/examples/jsm/postprocessing/Pass.js");
  965. class ShaderPass extends _Pass_js__WEBPACK_IMPORTED_MODULE_1__.Pass {
  966. constructor( shader, textureID ) {
  967. super();
  968. this.textureID = ( textureID !== undefined ) ? textureID : 'tDiffuse';
  969. if ( shader instanceof three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial ) {
  970. this.uniforms = shader.uniforms;
  971. this.material = shader;
  972. } else if ( shader ) {
  973. this.uniforms = three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( shader.uniforms );
  974. this.material = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial( {
  975. name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
  976. defines: Object.assign( {}, shader.defines ),
  977. uniforms: this.uniforms,
  978. vertexShader: shader.vertexShader,
  979. fragmentShader: shader.fragmentShader
  980. } );
  981. }
  982. this.fsQuad = new _Pass_js__WEBPACK_IMPORTED_MODULE_1__.FullScreenQuad( this.material );
  983. }
  984. render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
  985. if ( this.uniforms[ this.textureID ] ) {
  986. this.uniforms[ this.textureID ].value = readBuffer.texture;
  987. }
  988. this.fsQuad.material = this.material;
  989. if ( this.renderToScreen ) {
  990. renderer.setRenderTarget( null );
  991. this.fsQuad.render( renderer );
  992. } else {
  993. renderer.setRenderTarget( writeBuffer );
  994. // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
  995. if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
  996. this.fsQuad.render( renderer );
  997. }
  998. }
  999. dispose() {
  1000. this.material.dispose();
  1001. this.fsQuad.dispose();
  1002. }
  1003. }
  1004. /***/ }),
  1005. /***/ "./node_modules/three/examples/jsm/shaders/CopyShader.js":
  1006. /*!***************************************************************!*\
  1007. !*** ./node_modules/three/examples/jsm/shaders/CopyShader.js ***!
  1008. \***************************************************************/
  1009. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1010. __webpack_require__.r(__webpack_exports__);
  1011. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1012. /* harmony export */ CopyShader: () => (/* binding */ CopyShader)
  1013. /* harmony export */ });
  1014. /**
  1015. * Full-screen textured quad shader
  1016. */
  1017. const CopyShader = {
  1018. name: 'CopyShader',
  1019. uniforms: {
  1020. 'tDiffuse': { value: null },
  1021. 'opacity': { value: 1.0 }
  1022. },
  1023. vertexShader: /* glsl */`
  1024. varying vec2 vUv;
  1025. void main() {
  1026. vUv = uv;
  1027. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  1028. }`,
  1029. fragmentShader: /* glsl */`
  1030. uniform float opacity;
  1031. uniform sampler2D tDiffuse;
  1032. varying vec2 vUv;
  1033. void main() {
  1034. gl_FragColor = texture2D( tDiffuse, vUv );
  1035. gl_FragColor.a *= opacity;
  1036. }`
  1037. };
  1038. /***/ }),
  1039. /***/ "./node_modules/three/examples/jsm/shaders/FilmShader.js":
  1040. /*!***************************************************************!*\
  1041. !*** ./node_modules/three/examples/jsm/shaders/FilmShader.js ***!
  1042. \***************************************************************/
  1043. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1044. __webpack_require__.r(__webpack_exports__);
  1045. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1046. /* harmony export */ FilmShader: () => (/* binding */ FilmShader)
  1047. /* harmony export */ });
  1048. /**
  1049. * Film grain & scanlines shader
  1050. *
  1051. * - ported from HLSL to WebGL / GLSL
  1052. * https://web.archive.org/web/20210226214859/http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html
  1053. *
  1054. * Screen Space Static Postprocessor
  1055. *
  1056. * Produces an analogue noise overlay similar to a film grain / TV static
  1057. *
  1058. * Original implementation and noise algorithm
  1059. * Pat 'Hawthorne' Shearon
  1060. *
  1061. * Optimized scanlines + noise version with intensity scaling
  1062. * Georg 'Leviathan' Steinrohder
  1063. *
  1064. * This version is provided under a Creative Commons Attribution 3.0 License
  1065. * http://creativecommons.org/licenses/by/3.0/
  1066. */
  1067. const FilmShader = {
  1068. name: 'FilmShader',
  1069. uniforms: {
  1070. 'tDiffuse': { value: null },
  1071. 'time': { value: 0.0 },
  1072. 'nIntensity': { value: 0.5 },
  1073. 'sIntensity': { value: 0.05 },
  1074. 'sCount': { value: 4096 },
  1075. 'grayscale': { value: 1 }
  1076. },
  1077. vertexShader: /* glsl */`
  1078. varying vec2 vUv;
  1079. void main() {
  1080. vUv = uv;
  1081. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  1082. }`,
  1083. fragmentShader: /* glsl */`
  1084. #include <common>
  1085. // control parameter
  1086. uniform float time;
  1087. uniform bool grayscale;
  1088. // noise effect intensity value (0 = no effect, 1 = full effect)
  1089. uniform float nIntensity;
  1090. // scanlines effect intensity value (0 = no effect, 1 = full effect)
  1091. uniform float sIntensity;
  1092. // scanlines effect count value (0 = no effect, 4096 = full effect)
  1093. uniform float sCount;
  1094. uniform sampler2D tDiffuse;
  1095. varying vec2 vUv;
  1096. void main() {
  1097. // sample the source
  1098. vec4 cTextureScreen = texture2D( tDiffuse, vUv );
  1099. // make some noise
  1100. float dx = rand( vUv + time );
  1101. // add noise
  1102. vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );
  1103. // get us a sine and cosine
  1104. vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );
  1105. // add scanlines
  1106. cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;
  1107. // interpolate between source and result by intensity
  1108. cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );
  1109. // convert to grayscale if desired
  1110. if( grayscale ) {
  1111. cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );
  1112. }
  1113. gl_FragColor = vec4( cResult, cTextureScreen.a );
  1114. }`,
  1115. };
  1116. /***/ }),
  1117. /***/ "./node_modules/three/examples/jsm/shaders/FocusShader.js":
  1118. /*!****************************************************************!*\
  1119. !*** ./node_modules/three/examples/jsm/shaders/FocusShader.js ***!
  1120. \****************************************************************/
  1121. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1122. __webpack_require__.r(__webpack_exports__);
  1123. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1124. /* harmony export */ FocusShader: () => (/* binding */ FocusShader)
  1125. /* harmony export */ });
  1126. /**
  1127. * Focus shader
  1128. * based on PaintEffect postprocess from ro.me
  1129. * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
  1130. */
  1131. const FocusShader = {
  1132. uniforms: {
  1133. 'tDiffuse': { value: null },
  1134. 'screenWidth': { value: 1024 },
  1135. 'screenHeight': { value: 1024 },
  1136. 'sampleDistance': { value: 0.94 },
  1137. 'waveFactor': { value: 0.00125 }
  1138. },
  1139. vertexShader: /* glsl */`
  1140. varying vec2 vUv;
  1141. void main() {
  1142. vUv = uv;
  1143. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  1144. }`,
  1145. fragmentShader: /* glsl */`
  1146. uniform float screenWidth;
  1147. uniform float screenHeight;
  1148. uniform float sampleDistance;
  1149. uniform float waveFactor;
  1150. uniform sampler2D tDiffuse;
  1151. varying vec2 vUv;
  1152. void main() {
  1153. vec4 color, org, tmp, add;
  1154. float sample_dist, f;
  1155. vec2 vin;
  1156. vec2 uv = vUv;
  1157. add = color = org = texture2D( tDiffuse, uv );
  1158. vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );
  1159. sample_dist = dot( vin, vin ) * 2.0;
  1160. f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;
  1161. vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );
  1162. add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );
  1163. if( tmp.b < color.b ) color = tmp;
  1164. add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );
  1165. if( tmp.b < color.b ) color = tmp;
  1166. add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );
  1167. if( tmp.b < color.b ) color = tmp;
  1168. add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );
  1169. if( tmp.b < color.b ) color = tmp;
  1170. add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );
  1171. if( tmp.b < color.b ) color = tmp;
  1172. add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );
  1173. if( tmp.b < color.b ) color = tmp;
  1174. add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );
  1175. if( tmp.b < color.b ) color = tmp;
  1176. color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );
  1177. color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );
  1178. gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );
  1179. }`
  1180. };
  1181. /***/ }),
  1182. /***/ "./node_modules/three/examples/jsm/shaders/RGBShiftShader.js":
  1183. /*!*******************************************************************!*\
  1184. !*** ./node_modules/three/examples/jsm/shaders/RGBShiftShader.js ***!
  1185. \*******************************************************************/
  1186. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1187. __webpack_require__.r(__webpack_exports__);
  1188. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1189. /* harmony export */ RGBShiftShader: () => (/* binding */ RGBShiftShader)
  1190. /* harmony export */ });
  1191. /**
  1192. * RGB Shift Shader
  1193. * Shifts red and blue channels from center in opposite directions
  1194. * Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/
  1195. * by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/
  1196. *
  1197. * amount: shift distance (1 is width of input)
  1198. * angle: shift angle in radians
  1199. */
  1200. const RGBShiftShader = {
  1201. name: 'RGBShiftShader',
  1202. uniforms: {
  1203. 'tDiffuse': { value: null },
  1204. 'amount': { value: 0.005 },
  1205. 'angle': { value: 0.0 }
  1206. },
  1207. vertexShader: /* glsl */`
  1208. varying vec2 vUv;
  1209. void main() {
  1210. vUv = uv;
  1211. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  1212. }`,
  1213. fragmentShader: /* glsl */`
  1214. uniform sampler2D tDiffuse;
  1215. uniform float amount;
  1216. uniform float angle;
  1217. varying vec2 vUv;
  1218. void main() {
  1219. vec2 offset = amount * vec2( cos(angle), sin(angle));
  1220. vec4 cr = texture2D(tDiffuse, vUv + offset);
  1221. vec4 cga = texture2D(tDiffuse, vUv);
  1222. vec4 cb = texture2D(tDiffuse, vUv - offset);
  1223. gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);
  1224. }`
  1225. };
  1226. /***/ })
  1227. /******/ });
  1228. /************************************************************************/
  1229. /******/ // The module cache
  1230. /******/ var __webpack_module_cache__ = {};
  1231. /******/
  1232. /******/ // The require function
  1233. /******/ function __webpack_require__(moduleId) {
  1234. /******/ // Check if module is in cache
  1235. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  1236. /******/ if (cachedModule !== undefined) {
  1237. /******/ return cachedModule.exports;
  1238. /******/ }
  1239. /******/ // Create a new module (and put it into the cache)
  1240. /******/ var module = __webpack_module_cache__[moduleId] = {
  1241. /******/ // no module.id needed
  1242. /******/ // no module.loaded needed
  1243. /******/ exports: {}
  1244. /******/ };
  1245. /******/
  1246. /******/ // Execute the module function
  1247. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  1248. /******/
  1249. /******/ // Return the exports of the module
  1250. /******/ return module.exports;
  1251. /******/ }
  1252. /******/
  1253. /******/ // expose the modules object (__webpack_modules__)
  1254. /******/ __webpack_require__.m = __webpack_modules__;
  1255. /******/
  1256. /************************************************************************/
  1257. /******/ /* webpack/runtime/chunk loaded */
  1258. /******/ (() => {
  1259. /******/ var deferred = [];
  1260. /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
  1261. /******/ if(chunkIds) {
  1262. /******/ priority = priority || 0;
  1263. /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
  1264. /******/ deferred[i] = [chunkIds, fn, priority];
  1265. /******/ return;
  1266. /******/ }
  1267. /******/ var notFulfilled = Infinity;
  1268. /******/ for (var i = 0; i < deferred.length; i++) {
  1269. /******/ var [chunkIds, fn, priority] = deferred[i];
  1270. /******/ var fulfilled = true;
  1271. /******/ for (var j = 0; j < chunkIds.length; j++) {
  1272. /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
  1273. /******/ chunkIds.splice(j--, 1);
  1274. /******/ } else {
  1275. /******/ fulfilled = false;
  1276. /******/ if(priority < notFulfilled) notFulfilled = priority;
  1277. /******/ }
  1278. /******/ }
  1279. /******/ if(fulfilled) {
  1280. /******/ deferred.splice(i--, 1)
  1281. /******/ var r = fn();
  1282. /******/ if (r !== undefined) result = r;
  1283. /******/ }
  1284. /******/ }
  1285. /******/ return result;
  1286. /******/ };
  1287. /******/ })();
  1288. /******/
  1289. /******/ /* webpack/runtime/compat get default export */
  1290. /******/ (() => {
  1291. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1292. /******/ __webpack_require__.n = (module) => {
  1293. /******/ var getter = module && module.__esModule ?
  1294. /******/ () => (module['default']) :
  1295. /******/ () => (module);
  1296. /******/ __webpack_require__.d(getter, { a: getter });
  1297. /******/ return getter;
  1298. /******/ };
  1299. /******/ })();
  1300. /******/
  1301. /******/ /* webpack/runtime/define property getters */
  1302. /******/ (() => {
  1303. /******/ // define getter functions for harmony exports
  1304. /******/ __webpack_require__.d = (exports, definition) => {
  1305. /******/ for(var key in definition) {
  1306. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  1307. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  1308. /******/ }
  1309. /******/ }
  1310. /******/ };
  1311. /******/ })();
  1312. /******/
  1313. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  1314. /******/ (() => {
  1315. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  1316. /******/ })();
  1317. /******/
  1318. /******/ /* webpack/runtime/make namespace object */
  1319. /******/ (() => {
  1320. /******/ // define __esModule on exports
  1321. /******/ __webpack_require__.r = (exports) => {
  1322. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1323. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  1324. /******/ }
  1325. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  1326. /******/ };
  1327. /******/ })();
  1328. /******/
  1329. /******/ /* webpack/runtime/jsonp chunk loading */
  1330. /******/ (() => {
  1331. /******/ // no baseURI
  1332. /******/
  1333. /******/ // object to store loaded and loading chunks
  1334. /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
  1335. /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
  1336. /******/ var installedChunks = {
  1337. /******/ "rogue-engine-user-scripts": 0
  1338. /******/ };
  1339. /******/
  1340. /******/ // no chunk on demand loading
  1341. /******/
  1342. /******/ // no prefetching
  1343. /******/
  1344. /******/ // no preloaded
  1345. /******/
  1346. /******/ // no HMR
  1347. /******/
  1348. /******/ // no HMR manifest
  1349. /******/
  1350. /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
  1351. /******/
  1352. /******/ // install a JSONP callback for chunk loading
  1353. /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
  1354. /******/ var [chunkIds, moreModules, runtime] = data;
  1355. /******/ // add "moreModules" to the modules object,
  1356. /******/ // then flag all "chunkIds" as loaded and fire callback
  1357. /******/ var moduleId, chunkId, i = 0;
  1358. /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
  1359. /******/ for(moduleId in moreModules) {
  1360. /******/ if(__webpack_require__.o(moreModules, moduleId)) {
  1361. /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
  1362. /******/ }
  1363. /******/ }
  1364. /******/ if(runtime) var result = runtime(__webpack_require__);
  1365. /******/ }
  1366. /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
  1367. /******/ for(;i < chunkIds.length; i++) {
  1368. /******/ chunkId = chunkIds[i];
  1369. /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
  1370. /******/ installedChunks[chunkId][0]();
  1371. /******/ }
  1372. /******/ installedChunks[chunkId] = 0;
  1373. /******/ }
  1374. /******/ return __webpack_require__.O(result);
  1375. /******/ }
  1376. /******/
  1377. /******/ var chunkLoadingGlobal = self["webpackChunkroguetemplateproject"] = self["webpackChunkroguetemplateproject"] || [];
  1378. /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
  1379. /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
  1380. /******/ })();
  1381. /******/
  1382. /************************************************************************/
  1383. var __webpack_exports__ = {};
  1384. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1385. (() => {
  1386. var __webpack_exports__ = {};
  1387. /*!*****************************************************!*\
  1388. !*** ./Assets/Components/ColoredDotScreenShader.js ***!
  1389. \*****************************************************/
  1390. __webpack_require__.r(__webpack_exports__);
  1391. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1392. /* harmony export */ ColoredDotScreenShader: () => (/* binding */ ColoredDotScreenShader)
  1393. /* harmony export */ });
  1394. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
  1395. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
  1396. const ColoredDotScreenShader = {
  1397. name: "ColoredDotScreenShader",
  1398. uniforms: {
  1399. "tDiffuse": { value: null },
  1400. "tSize": { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(256, 256) },
  1401. "center": { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0.5, 0.5) },
  1402. "angle": { value: 1.57 },
  1403. "scale": { value: 1 }
  1404. },
  1405. vertexShader: `
  1406. varying vec2 vUv;
  1407. void main() {
  1408. vUv = uv;
  1409. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  1410. }`,
  1411. fragmentShader: `
  1412. uniform vec2 center;
  1413. uniform float angle;
  1414. uniform float scale;
  1415. uniform vec2 tSize;
  1416. uniform sampler2D tDiffuse;
  1417. varying vec2 vUv;
  1418. float pattern() {
  1419. float s = sin( angle ), c = cos( angle );
  1420. vec2 tex = vUv * tSize - center;
  1421. vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;
  1422. return ( sin( point.x ) * sin( point.y ) ) * 4.0;
  1423. }
  1424. void main() {
  1425. vec4 color = texture2D( tDiffuse, vUv );
  1426. gl_FragColor = vec4( vec3(color.r, color.g, color.b) * pattern(), color.a );
  1427. }`
  1428. };
  1429. })();
  1430. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1431. (() => {
  1432. var __webpack_exports__ = {};
  1433. /*!*************************************************************!*\
  1434. !*** ./Assets/Components/CylinderDistortionComponent.re.ts ***!
  1435. \*************************************************************/
  1436. __webpack_require__.r(__webpack_exports__);
  1437. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1438. /* harmony export */ "default": () => (/* binding */ CylinderDistortionComponent)
  1439. /* harmony export */ });
  1440. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1441. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1442. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
  1443. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
  1444. var __defProp = Object.defineProperty;
  1445. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1446. class CylinderDistortionComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1447. awake() {
  1448. this.distort();
  1449. }
  1450. start() {
  1451. }
  1452. update() {
  1453. }
  1454. distort() {
  1455. const positions = this.object3d.geometry.getAttribute("position");
  1456. const normals = this.object3d.geometry.getAttribute("normal");
  1457. const uv = this.object3d.geometry.getAttribute("uv");
  1458. const pos = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
  1459. const norm = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
  1460. const uvPoint = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0);
  1461. const alteredPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
  1462. for (let i = 0; i < positions.array.length / positions.itemSize; i++) {
  1463. const offset = i * positions.itemSize;
  1464. pos.set(positions.array[offset], positions.array[offset + 1], positions.array[offset + 2]);
  1465. norm.set(normals.array[offset], normals.array[offset + 1], normals.array[offset + 2]);
  1466. const uvOffset = i * uv.itemSize;
  1467. uvPoint.set(uv.array[uvOffset], uv.array[uvOffset + 1]);
  1468. alteredPosition.set(pos.x, pos.y, pos.z);
  1469. const modifier = 1 - Math.cos(pos.y / 12);
  1470. alteredPosition.add(norm.multiplyScalar(12 * modifier * Math.random()));
  1471. positions.array[offset] = alteredPosition.x;
  1472. positions.array[offset + 1] = alteredPosition.y;
  1473. positions.array[offset + 2] = alteredPosition.z;
  1474. }
  1475. }
  1476. }
  1477. __name(CylinderDistortionComponent, "CylinderDistortionComponent");
  1478. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(CylinderDistortionComponent);
  1479. })();
  1480. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1481. (() => {
  1482. var __webpack_exports__ = {};
  1483. /*!*****************************************************************!*\
  1484. !*** ./Assets/Components/GradientShaderMaterialComponent.re.ts ***!
  1485. \*****************************************************************/
  1486. __webpack_require__.r(__webpack_exports__);
  1487. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1488. /* harmony export */ "default": () => (/* binding */ GradientShaderMaterialComponent)
  1489. /* harmony export */ });
  1490. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1491. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1492. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
  1493. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
  1494. var __defProp = Object.defineProperty;
  1495. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1496. class GradientShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1497. constructor() {
  1498. super(...arguments);
  1499. this.fragmentShader = `uniform vec3 colorA;
  1500. uniform vec3 colorB;
  1501. uniform float meshHeight;
  1502. varying vec3 vUv;
  1503. void main() {
  1504. float lerpValue = vUv.y / meshHeight;
  1505. gl_FragColor = vec4(mix(colorA, colorB, lerpValue), 1.0);
  1506. }`;
  1507. this.vertexShader = `varying vec3 vBC;
  1508. varying vec3 vUv;
  1509. void main() {
  1510. vUv = position;
  1511. vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);
  1512. gl_Position = projectionMatrix * modelViewPosition;
  1513. }`;
  1514. this.elapsed = 0;
  1515. }
  1516. awake() {
  1517. this.shaderMaterial = new three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial({
  1518. extensions: {
  1519. derivatives: true
  1520. },
  1521. transparent: false,
  1522. side: three__WEBPACK_IMPORTED_MODULE_1__.FrontSide,
  1523. uniforms: {
  1524. colorA: { type: "vec3", value: new three__WEBPACK_IMPORTED_MODULE_1__.Color(791336) },
  1525. colorB: { type: "vec3", value: new three__WEBPACK_IMPORTED_MODULE_1__.Color(464455) },
  1526. meshHeight: { type: "float", value: 25 }
  1527. },
  1528. fragmentShader: this.fragmentShader,
  1529. vertexShader: this.vertexShader
  1530. });
  1531. }
  1532. start() {
  1533. if (this.object3d.material instanceof three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial) {
  1534. console.log("It's a shader");
  1535. } else {
  1536. console.log("no shader here");
  1537. }
  1538. this.object3d.material = this.shaderMaterial;
  1539. }
  1540. update() {
  1541. }
  1542. }
  1543. __name(GradientShaderMaterialComponent, "GradientShaderMaterialComponent");
  1544. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(GradientShaderMaterialComponent);
  1545. })();
  1546. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1547. (() => {
  1548. var __webpack_exports__ = {};
  1549. /*!*********************************************************!*\
  1550. !*** ./Assets/Components/PostProcessingComponent.re.ts ***!
  1551. \*********************************************************/
  1552. __webpack_require__.r(__webpack_exports__);
  1553. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1554. /* harmony export */ "default": () => (/* binding */ PostProcessingComponent)
  1555. /* harmony export */ });
  1556. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1557. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1558. /* 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");
  1559. /* 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");
  1560. /* 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");
  1561. /* 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");
  1562. /* 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");
  1563. /* 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");
  1564. var __defProp = Object.defineProperty;
  1565. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1566. class PostProcessingComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1567. constructor() {
  1568. super(...arguments);
  1569. this.shaders = [];
  1570. this.elapsed = 0;
  1571. }
  1572. awake() {
  1573. this.elapsed = 0;
  1574. this.composer = new three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_1__.EffectComposer(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderer);
  1575. 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));
  1576. this.addShader(three_examples_jsm_shaders_RGBShiftShader_js__WEBPACK_IMPORTED_MODULE_3__.RGBShiftShader, {
  1577. "angle": 0,
  1578. "amount": 2e-3
  1579. });
  1580. this.addShader(three_examples_jsm_shaders_FocusShader_js__WEBPACK_IMPORTED_MODULE_4__.FocusShader, {
  1581. "sampleDistance": 0.95,
  1582. "waveFactor": 3e-3
  1583. });
  1584. this.addShader(three_examples_jsm_shaders_FilmShader_js__WEBPACK_IMPORTED_MODULE_5__.FilmShader, {
  1585. "time": 0,
  1586. "nIntensity": 1,
  1587. "sIntensity": 0.8,
  1588. "sCount": 1024,
  1589. "grayscale": false
  1590. });
  1591. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderFunc = () => {
  1592. this.composer.render(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime);
  1593. };
  1594. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.onStop(() => {
  1595. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.renderFunc = () => rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.defaultRenderFunc();
  1596. });
  1597. }
  1598. addShader(shaderClass, uniforms = {}) {
  1599. const effect1 = new three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_6__.ShaderPass(shaderClass);
  1600. for (let key in uniforms) {
  1601. effect1.uniforms[key].value = uniforms[key];
  1602. }
  1603. this.shaders.push(effect1);
  1604. this.composer.addPass(effect1);
  1605. }
  1606. start() {
  1607. }
  1608. update() {
  1609. this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime;
  1610. this.shaders.forEach((shaderPass) => {
  1611. if (shaderPass.uniforms["time"]) {
  1612. shaderPass.uniforms["time"].value = this.elapsed;
  1613. }
  1614. if (shaderPass.uniforms["uTime"]) {
  1615. shaderPass.uniforms["uTime"].value = this.elapsed;
  1616. }
  1617. if (shaderPass.uniforms["u_time"]) {
  1618. shaderPass.uniforms["u_time"].value = this.elapsed;
  1619. }
  1620. });
  1621. }
  1622. }
  1623. __name(PostProcessingComponent, "PostProcessingComponent");
  1624. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(PostProcessingComponent);
  1625. })();
  1626. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1627. (() => {
  1628. var __webpack_exports__ = {};
  1629. /*!***************************************************!*\
  1630. !*** ./Assets/Components/RotationComponent.re.ts ***!
  1631. \***************************************************/
  1632. __webpack_require__.r(__webpack_exports__);
  1633. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1634. /* harmony export */ "default": () => (/* binding */ RotationComponent)
  1635. /* harmony export */ });
  1636. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1637. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1638. var __defProp = Object.defineProperty;
  1639. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  1640. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1641. var __decorateClass = (decorators, target, key, kind) => {
  1642. var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  1643. for (var i = decorators.length - 1, decorator; i >= 0; i--)
  1644. if (decorator = decorators[i])
  1645. result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  1646. if (kind && result)
  1647. __defProp(target, key, result);
  1648. return result;
  1649. };
  1650. class RotationComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1651. constructor() {
  1652. super(...arguments);
  1653. this.rotationSpeed = -1;
  1654. }
  1655. awake() {
  1656. }
  1657. start() {
  1658. }
  1659. update() {
  1660. this.object3d.rotateY(this.rotationSpeed / 1e3);
  1661. }
  1662. }
  1663. __name(RotationComponent, "RotationComponent");
  1664. __decorateClass([
  1665. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.num()
  1666. ], RotationComponent.prototype, "rotationSpeed", 2);
  1667. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RotationComponent);
  1668. })();
  1669. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1670. (() => {
  1671. var __webpack_exports__ = {};
  1672. /*!*************************************************************!*\
  1673. !*** ./Assets/Components/StarShaderMaterialComponent.re.ts ***!
  1674. \*************************************************************/
  1675. __webpack_require__.r(__webpack_exports__);
  1676. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1677. /* harmony export */ "default": () => (/* binding */ StarShaderMaterialComponent)
  1678. /* harmony export */ });
  1679. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1680. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1681. var __defProp = Object.defineProperty;
  1682. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1683. class StarShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1684. constructor() {
  1685. super(...arguments);
  1686. this.elapsed = 0;
  1687. }
  1688. awake() {
  1689. this.material = this.object3d.material;
  1690. this.material.uniforms = {
  1691. uTime: { type: "float", value: 0 }
  1692. };
  1693. this.elapsed = 0;
  1694. }
  1695. start() {
  1696. }
  1697. update() {
  1698. console.log("tick");
  1699. this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime;
  1700. this.material.uniforms["uTime"].value = this.elapsed;
  1701. }
  1702. }
  1703. __name(StarShaderMaterialComponent, "StarShaderMaterialComponent");
  1704. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(StarShaderMaterialComponent);
  1705. })();
  1706. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1707. (() => {
  1708. var __webpack_exports__ = {};
  1709. /*!*********************************************************************!*\
  1710. !*** ./Assets/Components/VaporwaveSunShaderMaterialComponent.re.ts ***!
  1711. \*********************************************************************/
  1712. __webpack_require__.r(__webpack_exports__);
  1713. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1714. /* harmony export */ "default": () => (/* binding */ VaporwaveSunShaderMaterialComponent)
  1715. /* harmony export */ });
  1716. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1717. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1718. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
  1719. /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
  1720. var __defProp = Object.defineProperty;
  1721. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1722. class VaporwaveSunShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1723. constructor() {
  1724. super(...arguments);
  1725. this.elapsed = 0;
  1726. this.uniforms = {};
  1727. this.vertexShader = `#define GLSLIFY 1
  1728. varying vec3 v_position;
  1729. varying vec3 v_normal;
  1730. varying vec2 v_Uv;
  1731. void main() {
  1732. // Save the varyings
  1733. v_position = position;
  1734. v_normal = normalize(normalMatrix * normal);
  1735. v_Uv = uv;
  1736. // Vertex shader output
  1737. gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
  1738. }
  1739. `;
  1740. this.fragmentShader = `#define GLSLIFY 1
  1741. uniform float u_time;
  1742. varying vec3 v_position;
  1743. varying vec3 v_normal;
  1744. varying vec2 v_Uv;
  1745. void main() {
  1746. float invertedUv = 1.0 - v_Uv.y;
  1747. float yPos = 64.0 * (invertedUv * invertedUv * invertedUv);
  1748. float delta = 2.0 * u_time;
  1749. // Don't paint the pixels between the stripes
  1750. if (cos(yPos + delta) > 0.0 && v_Uv.y < 0.6) {
  1751. discard;
  1752. }
  1753. float lerpValue = v_Uv.y / 1.0;
  1754. vec3 colorA = vec3(1., 1., 0);
  1755. vec3 colorB = vec3(1.0, 0.0, 1.0);
  1756. gl_FragColor = vec4(mix(colorB, colorA, lerpValue), 1.0);
  1757. }
  1758. `;
  1759. }
  1760. awake() {
  1761. this.initMaterial();
  1762. }
  1763. update() {
  1764. this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime;
  1765. this.uniforms.u_time.value = this.elapsed;
  1766. }
  1767. start() {
  1768. this.initMaterial();
  1769. }
  1770. initMaterial() {
  1771. this.elapsed = 0;
  1772. this.uniforms = {
  1773. u_time: {
  1774. type: "f",
  1775. value: 0
  1776. }
  1777. };
  1778. const material = this.object3d.material;
  1779. material.uniforms = this.uniforms;
  1780. material.vertexShader = this.vertexShader;
  1781. material.fragmentShader = this.fragmentShader;
  1782. material.extensions.derivatives = true;
  1783. material.side = three__WEBPACK_IMPORTED_MODULE_1__.FrontSide;
  1784. material.transparent = true;
  1785. material.needsUpdate = true;
  1786. material.uniformsNeedUpdate = true;
  1787. }
  1788. }
  1789. __name(VaporwaveSunShaderMaterialComponent, "VaporwaveSunShaderMaterialComponent");
  1790. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(VaporwaveSunShaderMaterialComponent);
  1791. })();
  1792. // This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules.
  1793. (() => {
  1794. /*!******************************************************************!*\
  1795. !*** ./Assets/Components/WireframeShaderMaterialComponent.re.ts ***!
  1796. \******************************************************************/
  1797. __webpack_require__.r(__webpack_exports__);
  1798. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1799. /* harmony export */ "default": () => (/* binding */ WireframeShaderMaterialComponent)
  1800. /* harmony export */ });
  1801. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
  1802. /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
  1803. /* 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");
  1804. /* 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");
  1805. /* 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");
  1806. var __defProp = Object.defineProperty;
  1807. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  1808. var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
  1809. var __decorateClass = (decorators, target, key, kind) => {
  1810. var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  1811. for (var i = decorators.length - 1, decorator; i >= 0; i--)
  1812. if (decorator = decorators[i])
  1813. result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  1814. if (kind && result)
  1815. __defProp(target, key, result);
  1816. return result;
  1817. };
  1818. class WireframeShaderMaterialComponent extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
  1819. awake() {
  1820. }
  1821. start() {
  1822. let geometry = new three_examples_jsm_lines_WireframeGeometry2_js__WEBPACK_IMPORTED_MODULE_1__.WireframeGeometry2(this.object3d.geometry);
  1823. const matLine = new three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial({
  1824. color: 4465407,
  1825. linewidth: 5,
  1826. dashed: false
  1827. });
  1828. matLine.resolution.set(window.innerWidth, window.innerHeight);
  1829. const wireframe = new three_examples_jsm_lines_Wireframe_js__WEBPACK_IMPORTED_MODULE_3__.Wireframe(geometry, matLine);
  1830. wireframe.computeLineDistances();
  1831. wireframe.scale.set(1, 1, 1);
  1832. this.object3d.add(wireframe);
  1833. this.object3d.material = this.baseMaterial;
  1834. }
  1835. update() {
  1836. }
  1837. }
  1838. __name(WireframeShaderMaterialComponent, "WireframeShaderMaterialComponent");
  1839. __decorateClass([
  1840. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.material()
  1841. ], WireframeShaderMaterialComponent.prototype, "baseMaterial", 2);
  1842. rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(WireframeShaderMaterialComponent);
  1843. })();
  1844. __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
  1845. /******/ return __webpack_exports__;
  1846. /******/ })()
  1847. ;
  1848. });
  1849. //# sourceMappingURL=rogue-engine-user-scripts.js.map