12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("rogue-engine"), require("three"));
- else if(typeof define === 'function' && define.amd)
- define(["rogue-engine", "three"], factory);
- else if(typeof exports === 'object')
- exports["rogue-engine-user-scripts"] = factory(require("rogue-engine"), require("three"));
- else
- root["rogue-engine-user-scripts"] = factory(root["rogue-engine"], root["three"]);
- })(self, function(__WEBPACK_EXTERNAL_MODULE_rogue_engine__, __WEBPACK_EXTERNAL_MODULE_three__) {
- return /******/ (() => { // webpackBootstrap
- /******/ "use strict";
- /******/ var __webpack_modules__ = ({
- /***/ "./Assets/Components/CombatLogic.re.js":
- /*!*********************************************!*\
- !*** ./Assets/Components/CombatLogic.re.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ CombatLogic)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Library/SimpleTweens */ "./Assets/Components/Library/SimpleTweens.js");
- /* harmony import */ var _TileRaycastReceiver_re__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TileRaycastReceiver.re */ "./Assets/Components/TileRaycastReceiver.re.js");
- /* harmony import */ var _Library_Easings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Library/Easings */ "./Assets/Components/Library/Easings.js");
- /* harmony import */ var _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Library/AsyncLoader */ "./Assets/Components/Library/AsyncLoader.js");
- /* harmony import */ var _Pathway_re__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Pathway.re */ "./Assets/Components/Pathway.re.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class CombatLogic extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.tileMaterials = [];
- this.boardDimensions = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(8, 8);
- this.maxColors = 5;
- this.tweenManager = new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.TweenManager();
- this.loader = new _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_5__["default"]();
- this.selectedTiles = [];
- this.movesRemaining = 8;
- this.score = 0;
- }
- awake() {
- this.tweenManager.awake();
- }
- start() {
- for (let child of this.playGrid.children) {
- this.playGrid.remove(child);
- }
- for (let i = 0; i < this.boardDimensions.x * this.boardDimensions.y; i++) {
- let position = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(i % this.boardDimensions.x, Math.floor(i / this.boardDimensions.x));
- this.instantiateTile(position, Math.floor(1500 * Math.random()) + 1800);
- }
- this.tweenManager.start();
- }
- instantiateTile(gridPosition, delay, startingY = 14, easingFunction = _Library_Easings__WEBPACK_IMPORTED_MODULE_4__["default"].Elastic.EaseOut) {
- let tile = this.tile.instantiate(this.playGrid);
- let component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_TileRaycastReceiver_re__WEBPACK_IMPORTED_MODULE_3__["default"], tile);
- component.initialize(gridPosition, this.boardDimensions, this.tileMaterials[Math.floor(Math.random() * Math.min(this.maxColors, this.tileMaterials.length))], this.hoverMaterial, this.tweenManager, delay, startingY, easingFunction);
- }
- update() {
- this.tweenManager.update();
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0) {
- let pathway = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_Pathway_re__WEBPACK_IMPORTED_MODULE_6__["default"], this.playGrid);
- if (pathway) {
- pathway.clearPoints();
- }
- if (this.selectedTiles.length == 1) {
- this.selectedTiles.length = 0;
- }
- if (this.selectedTiles.length > 1 && this.selectedTiles.length < 5) {
- this.movesRemaining--;
- }
- if (this.selectedTiles.length >= 5) {
- this.movesRemaining += Math.floor((this.selectedTiles.length - 5) / 3);
- }
- let moveScore = this.selectedTiles.length * 10;
- this.selectedTiles.forEach((tileComponent) => {
- moveScore *= Math.max(1, Math.floor(this.selectedTiles.indexOf(tileComponent) / 5));
- tileComponent.remove(this.tweenManager);
- this.instantiateTile(tileComponent.object3d.gridPosition, Math.floor(1500 * Math.random()) + 300, 14, _Library_Easings__WEBPACK_IMPORTED_MODULE_4__["default"].Exponential.EaseOut);
- });
- this.selectedTiles.length = 0;
- this.score += moveScore;
- }
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.keyboard.getKeyUp("Escape")) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("Main Menu");
- }
- if (this.movesRemaining == 0) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("World Map");
- }
- }
- addTile(tileComponent) {
- let isAdded = false;
- if (this.isStepBack(tileComponent)) {
- this.selectedTiles.pop(tileComponent);
- } else if (this.isValidTileToSelect(tileComponent)) {
- this.selectedTiles.push(tileComponent);
- isAdded = true;
- }
- let pathway = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_Pathway_re__WEBPACK_IMPORTED_MODULE_6__["default"], this.playGrid);
- if (pathway) {
- pathway.recomputePath(this.selectedTiles);
- }
- return [isAdded, this.selectedTiles];
- }
- isValidTileToSelect(tileComponent) {
- if (this.selectedTiles.length == 0) {
- return true;
- }
- let lastAddedTile = this.selectedTiles[this.selectedTiles.length - 1];
- let initialColor = lastAddedTile.getOriginalMaterial().name;
- return this.selectedTiles.indexOf(tileComponent) == -1 && tileComponent.getOriginalMaterial().name == initialColor && this.isNearbyTile(lastAddedTile.object3d.gridPosition, tileComponent.object3d.gridPosition);
- }
- isNearbyTile(startingPosition, newPosition) {
- return (newPosition.x == startingPosition.x - 1 || newPosition.x == startingPosition.x || newPosition.x == startingPosition.x + 1) && (newPosition.y == startingPosition.y - 1 || newPosition.y == startingPosition.y || newPosition.y == startingPosition.y + 1);
- }
- isStepBack(tileComponent) {
- return this.selectedTiles.length > 1 && this.selectedTiles.indexOf(tileComponent) == this.selectedTiles.length - 2;
- }
- }
- __name(CombatLogic, "CombatLogic");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D")
- ], CombatLogic.prototype, "playGrid", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Prefab")
- ], CombatLogic.prototype, "tile", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Material")
- ], CombatLogic.prototype, "hoverMaterial", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.PropList("Material")
- ], CombatLogic.prototype, "tileMaterials", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2")
- ], CombatLogic.prototype, "boardDimensions", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], CombatLogic.prototype, "maxColors", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(CombatLogic);
- /***/ }),
- /***/ "./Assets/Components/FloatObject.re.js":
- /*!*********************************************!*\
- !*** ./Assets/Components/FloatObject.re.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ FloatObject)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class FloatObject extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.elapsed = 0;
- this.amplitude = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0);
- this.offset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
- this.period = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 4, 0);
- }
- awake() {
- }
- start() {
- this.elapsed = 0;
- }
- update() {
- this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime;
- this.object3d.position.x = this.amplitude.x * Math.cos(this.period.x * this.elapsed) + this.offset.x;
- this.object3d.position.y = this.amplitude.y * Math.sin(this.period.y * this.elapsed) + this.offset.y;
- this.object3d.position.z = this.amplitude.z * Math.sin(this.period.z * this.elapsed) + this.offset.z;
- }
- }
- __name(FloatObject, "FloatObject");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], FloatObject.prototype, "amplitude", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], FloatObject.prototype, "offset", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], FloatObject.prototype, "period", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(FloatObject);
- /***/ }),
- /***/ "./Assets/Components/HouseRaycastReceiver.re.js":
- /*!******************************************************!*\
- !*** ./Assets/Components/HouseRaycastReceiver.re.js ***!
- \******************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ HouseRaycastReceiver)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js");
- var __defProp = Object.defineProperty;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- class HouseRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] {
- constructor() {
- super(...arguments);
- this.isHovered = false;
- this.elapsed = 0;
- this.clearHoverId = 0;
- }
- awake() {
- }
- start() {
- this.elapsed = 0;
- }
- update() {
- if (this.isHovered) {
- this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime;
- this.object3d.position.y = 0.5 * Math.sin(4 * this.elapsed) + 1;
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default";
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("World Map");
- }
- } else {
- if (this.object3d.position.y != 0) {
- this.object3d.position.y = 0;
- }
- }
- }
- onMouseOver(intersect) {
- if (!this.isHovered) {
- this.isHovered = true;
- }
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer";
- return false;
- }
- onMouseOut() {
- if (!this.isHovered) {
- return;
- }
- this.isHovered = false;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default";
- }
- }
- __name(HouseRaycastReceiver, "HouseRaycastReceiver");
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(HouseRaycastReceiver);
- /***/ }),
- /***/ "./Assets/Components/Library/AsyncLoader.js":
- /*!**************************************************!*\
- !*** ./Assets/Components/Library/AsyncLoader.js ***!
- \**************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ AsyncLoader)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- var __defProp = Object.defineProperty;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- class AsyncLoader {
- loadStaticText(filepath) {
- return new Promise((success, failure) => {
- fetch(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getStaticPath(filepath)).then((result) => {
- result.text().then((text) => {
- success(text);
- }, (error) => {
- failure(error);
- });
- }, (error) => {
- failure(error);
- });
- });
- }
- }
- __name(AsyncLoader, "AsyncLoader");
- /***/ }),
- /***/ "./Assets/Components/Library/Easings.js":
- /*!**********************************************!*\
- !*** ./Assets/Components/Library/Easings.js ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- var Easing = {};
- Easing.Linear = {};
- Easing.Linear.EaseNone = (percentageComplete) => percentageComplete;
- Easing.Quadratic = {};
- Easing.Quadratic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete;
- Easing.Quadratic.EaseOut = (percentageComplete) => -percentageComplete * (percentageComplete - 2);
- Easing.Quadratic.EaseInOut = (percentageComplete) => {
- if ((percentageComplete *= 2) < 1)
- return 0.5 * percentageComplete * percentageComplete;
- return -0.5 * (--percentageComplete * (percentageComplete - 2) - 1);
- };
- Easing.Cubic = {};
- Easing.Cubic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete;
- Easing.Cubic.EaseOut = (percentageComplete) => --percentageComplete * percentageComplete * percentageComplete + 1;
- Easing.Cubic.EaseInOut = (percentageComplete) => {
- if ((percentageComplete *= 2) < 1)
- return 0.5 * percentageComplete * percentageComplete * percentageComplete;
- return 0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete + 2);
- };
- Easing.Quartic = {};
- Easing.Quartic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete * percentageComplete;
- Easing.Quartic.EaseOut = (percentageComplete) => -(--percentageComplete * percentageComplete * percentageComplete * percentageComplete - 1);
- Easing.Quartic.EaseInOut = (percentageComplete) => {
- if ((percentageComplete *= 2) < 1)
- return 0.5 * percentageComplete * percentageComplete * percentageComplete * percentageComplete;
- return -0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete * percentageComplete - 2);
- };
- Easing.Quintic = {};
- Easing.Quintic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete * percentageComplete * percentageComplete;
- Easing.Quintic.EaseOut = (percentageComplete) => (percentageComplete = percentageComplete - 1) * percentageComplete * percentageComplete * percentageComplete * percentageComplete + 1;
- Easing.Quintic.EaseInOut = (percentageComplete) => {
- if ((percentageComplete *= 2) < 1)
- return 0.5 * percentageComplete * percentageComplete * percentageComplete * percentageComplete * percentageComplete;
- return 0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete * percentageComplete * percentageComplete + 2);
- };
- Easing.Sinusoidal = {};
- Easing.Sinusoidal.EaseIn = (percentageComplete) => -Math.cos(percentageComplete * Math.PI / 2) + 1;
- Easing.Sinusoidal.EaseOut = (percentageComplete) => Math.sin(percentageComplete * Math.PI / 2);
- Easing.Sinusoidal.EaseInOut = (percentageComplete) => -0.5 * (Math.cos(Math.PI * percentageComplete) - 1);
- Easing.Exponential = {};
- Easing.Exponential.EaseIn = (percentageComplete) => {
- return percentageComplete == 0 ? 0 : Math.pow(2, 10 * (percentageComplete - 1));
- };
- Easing.Exponential.EaseOut = (percentageComplete) => {
- return percentageComplete == 1 ? 1 : -Math.pow(2, -10 * percentageComplete) + 1;
- };
- Easing.Exponential.EaseInOut = (percentageComplete) => {
- if (percentageComplete == 0)
- return 0;
- if (percentageComplete == 1)
- return 1;
- if ((percentageComplete *= 2) < 1)
- return 0.5 * Math.pow(2, 10 * (percentageComplete - 1));
- return 0.5 * (-Math.pow(2, -10 * (percentageComplete - 1)) + 2);
- };
- Easing.Circular = {};
- Easing.Circular.EaseIn = (percentageComplete) => -(Math.sqrt(1 - percentageComplete * percentageComplete) - 1);
- Easing.Circular.EaseOut = (percentageComplete) => Math.sqrt(1 - --percentageComplete * percentageComplete);
- Easing.Circular.EaseInOut = (percentageComplete) => {
- if ((percentageComplete /= 0.5) < 1)
- return -0.5 * (Math.sqrt(1 - percentageComplete * percentageComplete) - 1);
- return 0.5 * (Math.sqrt(1 - (percentageComplete -= 2) * percentageComplete) + 1);
- };
- Easing.Elastic = {};
- Easing.Elastic.EaseIn = (percentageComplete) => {
- var s, a = 0.1, p = 0.4;
- if (percentageComplete == 0)
- return 0;
- if (percentageComplete == 1)
- return 1;
- if (!p)
- p = 0.3;
- if (!a || a < 1) {
- a = 1;
- s = p / 4;
- } else
- s = p / (2 * Math.PI) * Math.asin(1 / a);
- return -(a * Math.pow(2, 10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p));
- };
- Easing.Elastic.EaseOut = (percentageComplete) => {
- var s, a = 0.1, p = 0.4;
- if (percentageComplete == 0)
- return 0;
- if (percentageComplete == 1)
- return 1;
- if (!p)
- p = 0.3;
- if (!a || a < 1) {
- a = 1;
- s = p / 4;
- } else
- s = p / (2 * Math.PI) * Math.asin(1 / a);
- return a * Math.pow(2, -10 * percentageComplete) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p) + 1;
- };
- Easing.Elastic.EaseInOut = (percentageComplete) => {
- var s, a = 0.1, p = 0.4;
- if (percentageComplete == 0)
- return 0;
- if (percentageComplete == 1)
- return 1;
- if (!p)
- p = 0.3;
- if (!a || a < 1) {
- a = 1;
- s = p / 4;
- } else
- s = p / (2 * Math.PI) * Math.asin(1 / a);
- if ((percentageComplete *= 2) < 1)
- return -0.5 * (a * Math.pow(2, 10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p));
- return a * Math.pow(2, -10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p) * 0.5 + 1;
- };
- Easing.Back = {};
- Easing.Back.EaseIn = (percentageComplete) => {
- var s = 1.70158;
- return percentageComplete * percentageComplete * ((s + 1) * percentageComplete - s);
- };
- Easing.Back.EaseOut = (percentageComplete) => {
- var s = 1.70158;
- return (percentageComplete = percentageComplete - 1) * percentageComplete * ((s + 1) * percentageComplete + s) + 1;
- };
- Easing.Back.EaseInOut = (percentageComplete) => {
- var s = 1.70158 * 1.525;
- if ((percentageComplete *= 2) < 1)
- return 0.5 * (percentageComplete * percentageComplete * ((s + 1) * percentageComplete - s));
- return 0.5 * ((percentageComplete -= 2) * percentageComplete * ((s + 1) * percentageComplete + s) + 2);
- };
- Easing.Bounce = {};
- Easing.Bounce.EaseIn = (percentageComplete) => 1 - Easing.Bounce.EaseOut(1 - percentageComplete);
- Easing.Bounce.EaseOut = (percentageComplete) => {
- if ((percentageComplete /= 1) < 1 / 2.75) {
- return 7.5625 * percentageComplete * percentageComplete;
- } else if (percentageComplete < 2 / 2.75) {
- return 7.5625 * (percentageComplete -= 1.5 / 2.75) * percentageComplete + 0.75;
- } else if (percentageComplete < 2.5 / 2.75) {
- return 7.5625 * (percentageComplete -= 2.25 / 2.75) * percentageComplete + 0.9375;
- } else {
- return 7.5625 * (percentageComplete -= 2.625 / 2.75) * percentageComplete + 0.984375;
- }
- };
- Easing.Bounce.EaseInOut = (percentageComplete) => {
- if (percentageComplete < 0.5)
- return Easing.Bounce.EaseIn(percentageComplete * 2) * 0.5;
- return Easing.Bounce.EaseOut(percentageComplete * 2 - 1) * 0.5 + 0.5;
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Easing);
- /***/ }),
- /***/ "./Assets/Components/Library/GameData.js":
- /*!***********************************************!*\
- !*** ./Assets/Components/Library/GameData.js ***!
- \***********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- var GameData = {};
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GameData);
- /***/ }),
- /***/ "./Assets/Components/Library/SimpleTweens.js":
- /*!***************************************************!*\
- !*** ./Assets/Components/Library/SimpleTweens.js ***!
- \***************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "TweenManager": () => (/* binding */ TweenManager),
- /* harmony export */ "SimpleTween": () => (/* binding */ SimpleTween)
- /* harmony export */ });
- /* harmony import */ var _Easings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Easings */ "./Assets/Components/Library/Easings.js");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- class TweenManager {
- constructor() {
- this.activeTweens = [];
- this.elapsed = 0;
- }
- awake() {
- }
- start() {
- this.elapsed = 0;
- }
- update() {
- this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_1__.Runtime.deltaTime;
- let tweensToRemove = [];
- this.activeTweens.forEach((tween) => {
- if (tween.update(this.elapsed)) {
- tweensToRemove.push(tween);
- }
- });
- for (let i = tweensToRemove.length - 1; i >= 0; i--) {
- this.remove(tweensToRemove[i]);
- }
- }
- add(simpleTween) {
- this.activeTweens.push(simpleTween);
- simpleTween.start(this.elapsed);
- }
- remove(simpleTween) {
- delete this.activeTweens[this.activeTweens.indexOf(simpleTween)];
- }
- }
- __name(TweenManager, "TweenManager");
- class SimpleTween {
- constructor(initialObject, targetProperties, duration = 1e3, easingFunction = _Easings__WEBPACK_IMPORTED_MODULE_0__["default"].Linear.EaseNone, onComplete = () => {
- }) {
- this.initialObject = initialObject;
- this.targetProperties = targetProperties;
- this.duration = duration / 1e3;
- this.easingFunction = easingFunction;
- this.onComplete = onComplete;
- }
- start(elapsed) {
- this.copy = {};
- for (let key in this.targetProperties) {
- this.copy[key] = this.initialObject[key];
- }
- this.begin = elapsed;
- }
- update(elapsed) {
- if (elapsed >= this.begin + this.duration) {
- for (let key in this.targetProperties) {
- this.initialObject[key] = this.targetProperties[key];
- }
- this.onComplete();
- return true;
- }
- let delta = (elapsed - this.begin) / this.duration;
- for (let key in this.targetProperties) {
- this.initialObject[key] = (this.targetProperties[key] - this.copy[key]) * this.easingFunction(delta) + this.copy[key];
- }
- return false;
- }
- }
- __name(SimpleTween, "SimpleTween");
- /***/ }),
- /***/ "./Assets/Components/OrbitCamera.re.js":
- /*!*********************************************!*\
- !*** ./Assets/Components/OrbitCamera.re.js ***!
- \*********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ OrbitCamera)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class OrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.rotateStart = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
- this.rotateEnd = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
- this.rotateDelta = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
- this.enableRotate = true;
- this.rotateSpeed = 1;
- this.minAzimuthAngle = -Infinity;
- this.maxAzimuthAngle = Infinity;
- this.minPolarAngle = 0;
- this.maxPolarAngle = Math.PI;
- this.enableDolly = true;
- this.dollySpeed = 1;
- this.minDistance = 1;
- this.maxDistance = 50;
- this.scale = 1;
- this.EPS = 1e-6;
- this.twoPI = 2 * Math.PI;
- this.spherical = new three__WEBPACK_IMPORTED_MODULE_1__.Spherical();
- this.sphericalDelta = new three__WEBPACK_IMPORTED_MODULE_1__.Spherical();
- this.offset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
- this.rotateMouseButton = 2;
- this.quat = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion().setFromUnitVectors(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0), new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0));
- this.quatInverse = this.quat.clone().invert();
- this.lastPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
- this.lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion();
- this.initialOffset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
- }
- awake() {
- }
- start() {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.addEventListener("contextmenu", (event) => {
- event.preventDefault();
- });
- this.quat = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion().setFromUnitVectors(this.object3d.up, new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0));
- this.quatInverse = this.quat.clone().invert();
- this.initialOffset.copy(this.object3d.position).sub(this.target.position);
- this.offset.copy(this.initialOffset);
- }
- update() {
- let normalizedScreenPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0);
- this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse, normalizedScreenPosition);
- if (this.enableRotate && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonDown(this.rotateMouseButton)) {
- this.rotateStart.set(normalizedScreenPosition.x, normalizedScreenPosition.y);
- }
- if (this.enableRotate && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(this.rotateMouseButton)) {
- this.rotateEnd.set(normalizedScreenPosition.x, normalizedScreenPosition.y);
- this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed);
- this.rotateLeft(this.twoPI * this.rotateDelta.x);
- this.rotateUp(this.twoPI * -this.rotateDelta.y);
- this.rotateStart.copy(this.rotateEnd);
- }
- if (this.enableDolly && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.wheelY > 0) {
- this.dollyOut();
- }
- if (this.enableDolly && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.wheelY < 0) {
- this.dollyIn();
- }
- this.updateCamera();
- }
- rotateLeft(angle) {
- this.sphericalDelta.theta -= angle;
- }
- rotateUp(angle) {
- this.sphericalDelta.phi -= angle;
- }
- updateCamera() {
- this.offset.applyQuaternion(this.quat);
- this.spherical.setFromVector3(this.offset);
- this.spherical.theta += this.sphericalDelta.theta;
- this.spherical.phi += this.sphericalDelta.phi;
- let min = this.minAzimuthAngle;
- let max = this.maxAzimuthAngle;
- if (isFinite(min) && isFinite(max)) {
- if (min < -Math.PI) {
- min += this.twoPI;
- } else if (min > Math.PI) {
- min -= this.twoPI;
- }
- if (max < -Math.PI) {
- max += this.twoPI;
- } else if (max > Math.PI) {
- max -= this.twoPI;
- }
- if (min <= max) {
- this.spherical.theta = Math.max(min, Math.min(max, this.spherical.theta));
- } else {
- this.spherical.theta = this.spherical.theta > (min + max) / 2 ? Math.max(min, this.spherical.theta) : Math.min(max, this.spherical.theta);
- }
- }
- this.spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this.spherical.phi));
- this.spherical.makeSafe();
- this.spherical.radius *= this.scale;
- this.spherical.radius = Math.max(this.minDistance, Math.min(this.maxDistance, this.spherical.radius));
- this.offset.setFromSpherical(this.spherical);
- this.offset.applyQuaternion(this.quatInverse);
- this.object3d.position.copy(this.target.position).add(this.offset);
- this.object3d.lookAt(this.target.position);
- this.sphericalDelta.set(0, 0, 0);
- this.scale = 1;
- if (this.lastPosition.distanceToSquared(this.object3d.position) > this.EPS || 8 * (1 - this.lastQuaternion.dot(this.object3d.quaternion)) > this.EPS) {
- this.lastPosition.copy(this.object3d.position);
- this.lastQuaternion.copy(this.object3d.quaternion);
- }
- }
- dollyOut() {
- this.scale /= Math.pow(0.95, this.dollySpeed);
- }
- dollyIn() {
- this.scale *= Math.pow(0.95, this.dollySpeed);
- }
- normalizeScreenInput(browserVector, gameVector) {
- const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect();
- gameVector.x = (browserVector.x - bounds.left) / bounds.width * 2 - 1;
- gameVector.y = -((browserVector.y - bounds.top) / bounds.height) * 2 + 1;
- }
- }
- __name(OrbitCamera, "OrbitCamera");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D")
- ], OrbitCamera.prototype, "target", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Boolean")
- ], OrbitCamera.prototype, "enableRotate", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "rotateSpeed", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "minAzimuthAngle", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "maxAzimuthAngle", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "minPolarAngle", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "maxPolarAngle", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Boolean")
- ], OrbitCamera.prototype, "enableDolly", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "dollySpeed", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "minDistance", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "maxDistance", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], OrbitCamera.prototype, "offset", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], OrbitCamera.prototype, "rotateMouseButton", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(OrbitCamera);
- /***/ }),
- /***/ "./Assets/Components/ParticleSystem.re.js":
- /*!************************************************!*\
- !*** ./Assets/Components/ParticleSystem.re.js ***!
- \************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ ParticleSystem)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class ParticleSystem extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.vertexShader = `
- uniform float pointMultiplier;
- varying vec4 vColor;
- void main() {
- vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
- gl_Position = projectionMatrix * mvPosition;
- gl_PointSize = pointMultiplier / gl_Position.w;
- vColor = color;
- }`;
- this.fragmentShader = `
- uniform sampler2D diffuseTexture;
- varying vec4 vColor;
- void main() {
- gl_FragColor = texture2D(diffuseTexture, gl_PointCoord) * vColor;
- }`;
- this.color = new three__WEBPACK_IMPORTED_MODULE_1__.Color(255, 255, 255);
- this.alpha = 1;
- this.blending = 0;
- this.blendingOptions = ["Additive", "Normal", "Multiply", "None", "Subtractive"];
- this.max = 500;
- this.spawnPerTick = 1;
- this.lifespan = 2;
- this.initialVelocity = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
- this.thrustScalar = 0.01;
- this.positionRandomBounds = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1, 1, 1);
- this.velocityRandomBounds = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1, 1, 1);
- }
- start() {
- const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect();
- const uniforms = {
- diffuseTexture: {
- value: this.texture
- },
- pointMultiplier: {
- value: bounds.width - bounds.left
- }
- };
- this.material = new three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial({
- uniforms,
- vertexShader: this.vertexShader,
- fragmentShader: this.fragmentShader,
- blending: this.convertBlending(this.blending),
- depthTest: true,
- depthWrite: false,
- transparent: true,
- vertexColors: true
- });
- this.geometry = new three__WEBPACK_IMPORTED_MODULE_1__.BufferGeometry();
- this.geometry.setAttribute("position", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute([], 3));
- this.geometry.setAttribute("color", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute([], 4));
- this.globalPointsObject.geometry = this.geometry;
- this.globalPointsObject.material = this.material;
- this.particles = [];
- this.updateGeometry();
- }
- convertBlending(selectIndex) {
- switch (this.blendingOptions[selectIndex]) {
- case "Additive":
- return three__WEBPACK_IMPORTED_MODULE_1__.AdditiveBlending;
- case "Normal":
- return three__WEBPACK_IMPORTED_MODULE_1__.NormalBlending;
- case "Multiply":
- return three__WEBPACK_IMPORTED_MODULE_1__.MultiplyBlending;
- case "None":
- return three__WEBPACK_IMPORTED_MODULE_1__.NoBlending;
- case "Subtractive":
- return three__WEBPACK_IMPORTED_MODULE_1__.SubtractiveBlending;
- default:
- return three__WEBPACK_IMPORTED_MODULE_1__.AdditiveBlending;
- }
- }
- awake() {
- }
- update() {
- this.addParticles();
- this.updateParticles(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime);
- this.updateGeometry();
- }
- addParticles() {
- if (this.particles.length >= this.max) {
- return;
- }
- for (let i = 0; i < this.spawnPerTick; i++) {
- const life = this.lifespan;
- const newPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
- this.initialLocation.getWorldPosition(newPosition);
- newPosition.add(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1 * Math.random() - 0.5, 1 * Math.random() - 0.5, 1 * Math.random() - 0.5).multiply(this.positionRandomBounds));
- const newVelocity = this.initialVelocity.clone();
- newVelocity.add(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1 * Math.random() - 0.5, 1 * Math.random() - 0.5, 1 * Math.random() - 0.5).multiply(this.velocityRandomBounds));
- this.particles.push({
- position: newPosition,
- life,
- maxLife: life,
- velocity: newVelocity,
- color: this.color,
- alpha: this.alpha
- });
- }
- }
- updateGeometry() {
- const positions = [];
- const colors = [];
- for (let p of this.particles) {
- positions.push(p.position.x, p.position.y, p.position.z);
- colors.push(p.color.r, p.color.g, p.color.b, p.alpha);
- }
- this.geometry.setAttribute("position", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute(positions, 3));
- this.geometry.setAttribute("color", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute(colors, 4));
- this.geometry.attributes.position.needsUpdate = true;
- this.geometry.attributes.color.needsUpdate = true;
- }
- updateParticles(deltaTime) {
- for (let p of this.particles) {
- p.life -= deltaTime;
- }
- this.particles = this.particles.filter((p) => {
- return p.life > 0;
- });
- for (let p of this.particles) {
- p.position.add(p.velocity.clone());
- }
- let camera = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.getObjectByProperty("uuid", rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.activeCamera);
- this.particles.sort((a, b) => {
- const d1 = camera.position.distanceTo(a.position);
- const d2 = camera.position.distanceTo(b.position);
- if (d1 > d2) {
- return -1;
- }
- if (d1 < d2) {
- return 1;
- }
- return 0;
- });
- }
- }
- __name(ParticleSystem, "ParticleSystem");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Texture")
- ], ParticleSystem.prototype, "texture", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Color")
- ], ParticleSystem.prototype, "color", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], ParticleSystem.prototype, "alpha", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Select")
- ], ParticleSystem.prototype, "blending", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D")
- ], ParticleSystem.prototype, "globalPointsObject", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], ParticleSystem.prototype, "max", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], ParticleSystem.prototype, "spawnPerTick", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], ParticleSystem.prototype, "lifespan", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D")
- ], ParticleSystem.prototype, "initialLocation", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], ParticleSystem.prototype, "initialVelocity", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number")
- ], ParticleSystem.prototype, "thrustScalar", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], ParticleSystem.prototype, "positionRandomBounds", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], ParticleSystem.prototype, "velocityRandomBounds", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ParticleSystem);
- /***/ }),
- /***/ "./Assets/Components/Pathway.re.js":
- /*!*****************************************!*\
- !*** ./Assets/Components/Pathway.re.js ***!
- \*****************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ Pathway)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/lines/LineGeometry */ "./node_modules/three/examples/jsm/lines/LineGeometry.js");
- /* harmony import */ var three_examples_jsm_lines_LineMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three/examples/jsm/lines/LineMaterial */ "./node_modules/three/examples/jsm/lines/LineMaterial.js");
- /* harmony import */ var three_examples_jsm_lines_Line2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three/examples/jsm/lines/Line2 */ "./node_modules/three/examples/jsm/lines/Line2.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class Pathway extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.linePoints = [];
- this.colors = [];
- this.lineColorShift = new three__WEBPACK_IMPORTED_MODULE_1__.Color(0.1, 0.1, 0.1);
- }
- awake() {
- }
- start() {
- this.lineGeo = new three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__.LineGeometry();
- this.lineMat = new three_examples_jsm_lines_LineMaterial__WEBPACK_IMPORTED_MODULE_3__.LineMaterial({
- color: 16777215,
- linewidth: 5,
- vertexColors: true,
- dashed: false,
- wireframe: false
- });
- const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect();
- this.lineMat.resolution.set(bounds.width, bounds.height);
- }
- updateGeometry() {
- if (this.linePoints.length < 2) {
- return;
- }
- const positions = [];
- const colors = [];
- for (let p of this.linePoints) {
- positions.push(p.x, p.y, p.z);
- }
- for (let c of this.colors) {
- colors.push(Math.min(1, c.r + this.lineColorShift.r), Math.min(1, c.g + this.lineColorShift.g), Math.min(1, c.b + this.lineColorShift.b));
- }
- this.lineGeo = new three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__.LineGeometry();
- this.lineGeo.setPositions(positions);
- this.lineGeo.setColors(colors);
- if (this.line) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.remove(this.line);
- }
- this.line = new three_examples_jsm_lines_Line2__WEBPACK_IMPORTED_MODULE_4__.Line2(this.lineGeo, this.lineMat);
- this.line.scale.set(1, 1, 1);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.add(this.line);
- this.line.computeLineDistances();
- }
- addPoint(position, color) {
- let dupePosition = position.clone();
- dupePosition.y -= 4;
- dupePosition.z += 0.1;
- this.linePoints.push(dupePosition);
- this.colors.push(color);
- this.updateGeometry();
- }
- recomputePath(tileComponents) {
- this.clearPoints();
- tileComponents.forEach((tileComponent, index) => {
- this.addPoint(tileComponent.object3d.position, tileComponent.object3d.originalMaterial.color);
- });
- this.updateGeometry();
- }
- clearPoints() {
- this.linePoints.length = 0;
- this.colors.length = 0;
- if (this.line) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.remove(this.line);
- }
- }
- update() {
- }
- }
- __name(Pathway, "Pathway");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.color()
- ], Pathway.prototype, "lineColorShift", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(Pathway);
- /***/ }),
- /***/ "./Assets/Components/RaycastReceiver.re.js":
- /*!*************************************************!*\
- !*** ./Assets/Components/RaycastReceiver.re.js ***!
- \*************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ RaycastReceiver)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- var __defProp = Object.defineProperty;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- class RaycastReceiver extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- onMouseOver(intersect) {
- throw new Error("Abstract class: Please inherit from this class to use it's behavior");
- }
- onMouseOut() {
- throw new Error("Abstract class: Please inherit from this class to use it's behavior");
- }
- }
- __name(RaycastReceiver, "RaycastReceiver");
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RaycastReceiver);
- /***/ }),
- /***/ "./Assets/Components/RaycastReporter.re.js":
- /*!*************************************************!*\
- !*** ./Assets/Components/RaycastReporter.re.js ***!
- \*************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ RaycastReporter)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class RaycastReporter extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.receiverClass = ["RaycastReceiver"];
- this.allHovered = [];
- }
- awake() {
- }
- start() {
- this.mouse = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0);
- this.raycaster = new three__WEBPACK_IMPORTED_MODULE_1__.Raycaster();
- this.updated = false;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.enabled = true;
- }
- normalizeScreenInput(browserVector, gameVector) {
- const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect();
- gameVector.x = (browserVector.x - bounds.left) / bounds.width * 2 - 1;
- gameVector.y = -((browserVector.y - bounds.top) / bounds.height) * 2 + 1;
- }
- getMouseInput() {
- if (!rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.isMoving) {
- return;
- }
- this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse, this.mouse);
- this.updated = true;
- }
- getTouchInput() {
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches.length == 0) {
- return;
- }
- this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches[0], this.mouse);
- this.updated = true;
- }
- update() {
- this.updated = false;
- this.getMouseInput();
- this.getTouchInput();
- if (!this.updated) {
- return;
- }
- this.raycaster.setFromCamera(this.mouse, this.object3d);
- let intersects = this.raycaster.intersectObjects(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.children);
- let listeningComponents = [];
- intersects.forEach((intersect) => {
- let object3d = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.getObjectByProperty("uuid", intersect.object.uuid);
- let component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__["default"], object3d);
- while (component == null && object3d.parent != null) {
- object3d = object3d.parent;
- component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__["default"], object3d);
- }
- if (component != null) {
- listeningComponents = listeningComponents.filter((dataThing) => {
- dataThing.component.object3d.uuid != component.object3d.uuid;
- });
- listeningComponents.push({ component, intersect });
- }
- });
- for (let i = 0; i < this.allHovered.length; i++) {
- let dataThing = this.allHovered[i];
- if (!listeningComponents.includes(dataThing)) {
- dataThing.component.onMouseOut();
- }
- }
- this.allHovered = [];
- for (let i = 0; i < listeningComponents.length; i++) {
- let dataThing = listeningComponents[i];
- this.allHovered.push(dataThing);
- if (dataThing.component.onMouseOver(dataThing.intersect) === false) {
- break;
- }
- }
- }
- }
- __name(RaycastReporter, "RaycastReporter");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.PropList("String")
- ], RaycastReporter.prototype, "receiverClass", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RaycastReporter);
- /***/ }),
- /***/ "./Assets/Components/SceneLinkRaycastReceiver.re.js":
- /*!**********************************************************!*\
- !*** ./Assets/Components/SceneLinkRaycastReceiver.re.js ***!
- \**********************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ SceneLinkRaycastReceiver)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class SceneLinkRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] {
- awake() {
- }
- start() {
- }
- update() {
- if (this.isHovered && (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0)) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default";
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.targetScene);
- }
- }
- onMouseOver(intersect) {
- this.isHovered = true;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer";
- }
- onMouseOut() {
- this.isHovered = false;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default";
- }
- }
- __name(SceneLinkRaycastReceiver, "SceneLinkRaycastReceiver");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("String")
- ], SceneLinkRaycastReceiver.prototype, "targetScene", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(SceneLinkRaycastReceiver);
- /***/ }),
- /***/ "./Assets/Components/ScrollObject.re.js":
- /*!**********************************************!*\
- !*** ./Assets/Components/ScrollObject.re.js ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ ScrollObject)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class ScrollObject extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.offsetPerTick = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0.01, 0);
- this.completedBound = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 10, 0);
- this.nextScene = "Title Screen";
- }
- awake() {
- }
- start() {
- }
- update() {
- this.object3d.position.add(this.offsetPerTick);
- if (this.object3d.position.x >= this.completedBound.x && this.object3d.position.y >= this.completedBound.y && this.object3d.position.z >= this.completedBound.z) {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.nextScene);
- }
- }
- }
- __name(ScrollObject, "ScrollObject");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], ScrollObject.prototype, "offsetPerTick", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3")
- ], ScrollObject.prototype, "completedBound", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ScrollObject);
- /***/ }),
- /***/ "./Assets/Components/ScrollTexture.re.js":
- /*!***********************************************!*\
- !*** ./Assets/Components/ScrollTexture.re.js ***!
- \***********************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ ScrollTexture)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class ScrollTexture extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.offsetPerTick = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(-1e-3, 1e-3);
- }
- update() {
- this.materialToOffset.map.offset.add(this.offsetPerTick);
- }
- }
- __name(ScrollTexture, "ScrollTexture");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2")
- ], ScrollTexture.prototype, "offsetPerTick", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Material")
- ], ScrollTexture.prototype, "materialToOffset", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ScrollTexture);
- /***/ }),
- /***/ "./Assets/Components/TileRaycastReceiver.re.js":
- /*!*****************************************************!*\
- !*** ./Assets/Components/TileRaycastReceiver.re.js ***!
- \*****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ TileRaycastReceiver)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js");
- /* harmony import */ var _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Library/SimpleTweens */ "./Assets/Components/Library/SimpleTweens.js");
- /* harmony import */ var _Library_Easings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Library/Easings */ "./Assets/Components/Library/Easings.js");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _CombatLogic_re__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CombatLogic.re */ "./Assets/Components/CombatLogic.re.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class TileRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] {
- constructor() {
- super(...arguments);
- this.tileSize = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2(1.1, 1.1);
- }
- onMouseOver(intersect) {
- if (this.object3d.isAnimating) {
- return;
- }
- this.currentObj = intersect.object;
- this.currentObj.material = this.currentObj.highlightMaterial;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer";
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches.length == 1) {
- let game = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_CombatLogic_re__WEBPACK_IMPORTED_MODULE_5__["default"]);
- let [isAdded, selectedTiles] = game.addTile(this);
- if (isAdded) {
- if (this.hoverSound) {
- this.hoverSound.play();
- }
- } else {
- if (selectedTiles[selectedTiles.length - 1] != this) {
- this.currentObj.material = this.currentObj.originalMaterial;
- }
- }
- }
- }
- onMouseOut() {
- if (this.object3d.isAnimating || !this.currentObj) {
- return;
- }
- if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(0)) {
- }
- this.currentObj.material = this.currentObj.originalMaterial;
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default";
- }
- getOriginalMaterial() {
- return this.object3d.originalMaterial;
- }
- getPosition() {
- return this.object3d.position;
- }
- awake() {
- }
- start() {
- if (this.dropInSound) {
- this.dropInSound.setVolume(0.7);
- this.dropInSound.setLoop(false);
- }
- if (this.hoverSound) {
- this.hoverSound.setVolume(0.7);
- this.hoverSound.setLoop(false);
- }
- if (this.clearSound) {
- this.clearSound.setVolume(1);
- this.clearSound.setLoop(false);
- }
- }
- update() {
- }
- initialize(gridPosition, boardDimensions, originalMaterial, hoverMaterial, tweenManager, delay, startingZ, easingFunction) {
- let offset = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2((boardDimensions.x * this.tileSize.x - 1) / 2, (boardDimensions.y * this.tileSize.y - 1) / 2);
- let actualPosition = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3(this.tileSize.x * gridPosition.x - offset.x, this.tileSize.y * gridPosition.y - offset.y, startingZ);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Debug.log(JSON.stringify(actualPosition));
- this.object3d.position.copy(actualPosition);
- this.object3d.originalMaterial = originalMaterial;
- this.object3d.highlightMaterial = hoverMaterial;
- this.object3d.material = originalMaterial;
- this.object3d.gridPosition = gridPosition;
- this.object3d.isAnimating = true;
- setTimeout(() => {
- if (this.dropInSound) {
- this.dropInSound.play();
- }
- }, delay / 3 * Math.random());
- tweenManager.add(new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.SimpleTween(this.object3d.position, { z: 0 }, delay, easingFunction, () => {
- this.object3d.isAnimating = false;
- }));
- }
- remove(tweenManager) {
- this.object3d.isAnimating = true;
- setTimeout(() => {
- if (this.clearSound) {
- this.clearSound.play();
- }
- }, 150 * Math.random());
- tweenManager.add(new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.SimpleTween(this.object3d.position, { z: -14 }, Math.floor(1500 * Math.random()) + 300, _Library_Easings__WEBPACK_IMPORTED_MODULE_3__["default"].Quadratic.EaseIn, () => {
- this.object3d.parent.remove(this.object3d);
- }));
- }
- }
- __name(TileRaycastReceiver, "TileRaycastReceiver");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2")
- ], TileRaycastReceiver.prototype, "tileSize", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio")
- ], TileRaycastReceiver.prototype, "dropInSound", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio")
- ], TileRaycastReceiver.prototype, "hoverSound", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio")
- ], TileRaycastReceiver.prototype, "clearSound", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(TileRaycastReceiver);
- /***/ }),
- /***/ "./Assets/Components/TitleScreenControl.re.js":
- /*!****************************************************!*\
- !*** ./Assets/Components/TitleScreenControl.re.js ***!
- \****************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (/* binding */ TitleScreenControl)
- /* harmony export */ });
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine");
- /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Library/AsyncLoader */ "./Assets/Components/Library/AsyncLoader.js");
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
- class TitleScreenControl extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component {
- constructor() {
- super(...arguments);
- this.introScene = "Combat Screen";
- this.creditsScene = "Credits";
- this.loader = new _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_1__["default"]();
- }
- awake() {
- }
- start() {
- this.loader.loadStaticText("title-screen.html").then((html) => {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.uiContainer.innerHTML = html;
- document.getElementById("play-button").addEventListener("mouseup", () => {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.introScene);
- });
- document.getElementById("play-button").addEventListener("touchend", () => {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.introScene);
- });
- document.getElementById("credits-button").addEventListener("mouseup", () => {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.creditsScene);
- });
- document.getElementById("credits-button").addEventListener("touchend", () => {
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.creditsScene);
- });
- });
- }
- update() {
- }
- }
- __name(TitleScreenControl, "TitleScreenControl");
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.text()
- ], TitleScreenControl.prototype, "introScene", 2);
- __decorateClass([
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.text()
- ], TitleScreenControl.prototype, "creditsScene", 2);
- rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(TitleScreenControl);
- /***/ }),
- /***/ "rogue-engine":
- /*!******************************************************************************************************************!*\
- !*** external {"commonjs":"rogue-engine","commonjs2":"rogue-engine","amd":"rogue-engine","root":"rogue-engine"} ***!
- \******************************************************************************************************************/
- /***/ ((module) => {
- module.exports = __WEBPACK_EXTERNAL_MODULE_rogue_engine__;
- /***/ }),
- /***/ "three":
- /*!**************************************************************************************!*\
- !*** external {"commonjs":"three","commonjs2":"three","amd":"three","root":"three"} ***!
- \**************************************************************************************/
- /***/ ((module) => {
- module.exports = __WEBPACK_EXTERNAL_MODULE_three__;
- /***/ }),
- /***/ "./node_modules/three/examples/jsm/lines/Line2.js":
- /*!********************************************************!*\
- !*** ./node_modules/three/examples/jsm/lines/Line2.js ***!
- \********************************************************/
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Line2": () => (/* binding */ Line2)
- /* harmony export */ });
- /* harmony import */ var _lines_LineSegments2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lines/LineSegments2.js */ "./node_modules/three/examples/jsm/lines/LineSegments2.js");
- /* harmony import */ var _lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineGeometry.js */ "./node_modules/three/examples/jsm/lines/LineGeometry.js");
- /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js");
- class Line2 extends _lines_LineSegments2_js__WEBPACK_IMPORTED_MODULE_0__.LineSegments2 {
- constructor( geometry = new _lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineGeometry(), material = new _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial( { color: Math.random() * 0xffffff } ) ) {
- super( geometry, material );
- this.type = 'Line2';
- }
- }
- Line2.prototype.isLine2 = true;
- /***/ }),
- /***/ "./node_modules/three/examples/jsm/lines/LineGeometry.js":
- /*!***************************************************************!*\
- !*** ./node_modules/three/examples/jsm/lines/LineGeometry.js ***!
- \***************************************************************/
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LineGeometry": () => (/* binding */ LineGeometry)
- /* harmony export */ });
- /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js");
- class LineGeometry extends _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_0__.LineSegmentsGeometry {
- constructor() {
- super();
- this.type = 'LineGeometry';
- }
- setPositions( array ) {
- // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format
- var length = array.length - 3;
- var points = new Float32Array( 2 * length );
- for ( var i = 0; i < length; i += 3 ) {
- points[ 2 * i ] = array[ i ];
- points[ 2 * i + 1 ] = array[ i + 1 ];
- points[ 2 * i + 2 ] = array[ i + 2 ];
- points[ 2 * i + 3 ] = array[ i + 3 ];
- points[ 2 * i + 4 ] = array[ i + 4 ];
- points[ 2 * i + 5 ] = array[ i + 5 ];
- }
- super.setPositions( points );
- return this;
- }
- setColors( array ) {
- // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format
- var length = array.length - 3;
- var colors = new Float32Array( 2 * length );
- for ( var i = 0; i < length; i += 3 ) {
- colors[ 2 * i ] = array[ i ];
- colors[ 2 * i + 1 ] = array[ i + 1 ];
- colors[ 2 * i + 2 ] = array[ i + 2 ];
- colors[ 2 * i + 3 ] = array[ i + 3 ];
- colors[ 2 * i + 4 ] = array[ i + 4 ];
- colors[ 2 * i + 5 ] = array[ i + 5 ];
- }
- super.setColors( colors );
- return this;
- }
- fromLine( line ) {
- var geometry = line.geometry;
- if ( geometry.isGeometry ) {
- console.error( 'THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.' );
- return;
- } else if ( geometry.isBufferGeometry ) {
- this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
- }
- // set colors, maybe
- return this;
- }
- }
- LineGeometry.prototype.isLineGeometry = true;
- /***/ }),
- /***/ "./node_modules/three/examples/jsm/lines/LineMaterial.js":
- /*!***************************************************************!*\
- !*** ./node_modules/three/examples/jsm/lines/LineMaterial.js ***!
- \***************************************************************/
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LineMaterial": () => (/* binding */ LineMaterial)
- /* harmony export */ });
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
- /**
- * parameters = {
- * color: <hex>,
- * linewidth: <float>,
- * dashed: <boolean>,
- * dashScale: <float>,
- * dashSize: <float>,
- * gapSize: <float>,
- * resolution: <Vector2>, // to be set by renderer
- * }
- */
- three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line = {
- worldUnits: { value: 1 },
- linewidth: { value: 1 },
- resolution: { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( 1, 1 ) },
- dashScale: { value: 1 },
- dashSize: { value: 1 },
- gapSize: { value: 1 } // todo FIX - maybe change to totalSize
- };
- three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line = {
- uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.merge( [
- three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.common,
- three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.fog,
- three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line
- ] ),
- vertexShader:
- /* glsl */`
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- uniform float linewidth;
- uniform vec2 resolution;
- attribute vec3 instanceStart;
- attribute vec3 instanceEnd;
- attribute vec3 instanceColorStart;
- attribute vec3 instanceColorEnd;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #ifdef USE_DASH
- uniform float dashScale;
- attribute float instanceDistanceStart;
- attribute float instanceDistanceEnd;
- varying float vLineDistance;
- #endif
- void trimSegment( const in vec4 start, inout vec4 end ) {
- // trim end segment so it terminates between the camera plane and the near plane
- // conservative estimate of the near plane
- float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
- float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
- float nearEstimate = - 0.5 * b / a;
- float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
- end.xyz = mix( start.xyz, end.xyz, alpha );
- }
- void main() {
- #ifdef USE_COLOR
- vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
- #endif
- #ifdef USE_DASH
- vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
- vUv = uv;
- #endif
- float aspect = resolution.x / resolution.y;
- // camera space
- vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
- vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
- #ifdef WORLD_UNITS
- worldStart = start.xyz;
- worldEnd = end.xyz;
- #else
- vUv = uv;
- #endif
- // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
- // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
- // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
- // perhaps there is a more elegant solution -- WestLangley
- bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
- if ( perspective ) {
- if ( start.z < 0.0 && end.z >= 0.0 ) {
- trimSegment( start, end );
- } else if ( end.z < 0.0 && start.z >= 0.0 ) {
- trimSegment( end, start );
- }
- }
- // clip space
- vec4 clipStart = projectionMatrix * start;
- vec4 clipEnd = projectionMatrix * end;
- // ndc space
- vec3 ndcStart = clipStart.xyz / clipStart.w;
- vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
- // direction
- vec2 dir = ndcEnd.xy - ndcStart.xy;
- // account for clip-space aspect ratio
- dir.x *= aspect;
- dir = normalize( dir );
- #ifdef WORLD_UNITS
- // get the offset direction as perpendicular to the view vector
- vec3 worldDir = normalize( end.xyz - start.xyz );
- vec3 offset;
- if ( position.y < 0.5 ) {
- offset = normalize( cross( start.xyz, worldDir ) );
- } else {
- offset = normalize( cross( end.xyz, worldDir ) );
- }
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
- // don't extend the line if we're rendering dashes because we
- // won't be rendering the endcaps
- #ifndef USE_DASH
- // extend the line bounds to encompass endcaps
- start.xyz += - worldDir * linewidth * 0.5;
- end.xyz += worldDir * linewidth * 0.5;
- // shift the position of the quad so it hugs the forward edge of the line
- offset.xy -= dir * forwardOffset;
- offset.z += 0.5;
- #endif
- // endcaps
- if ( position.y > 1.0 || position.y < 0.0 ) {
- offset.xy += dir * 2.0 * forwardOffset;
- }
- // adjust for linewidth
- offset *= linewidth * 0.5;
- // set the world position
- worldPos = ( position.y < 0.5 ) ? start : end;
- worldPos.xyz += offset;
- // project the worldpos
- vec4 clip = projectionMatrix * worldPos;
- // shift the depth of the projected points so the line
- // segements overlap neatly
- vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
- clip.z = clipPose.z * clip.w;
- #else
- vec2 offset = vec2( dir.y, - dir.x );
- // undo aspect ratio adjustment
- dir.x /= aspect;
- offset.x /= aspect;
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- // endcaps
- if ( position.y < 0.0 ) {
- offset += - dir;
- } else if ( position.y > 1.0 ) {
- offset += dir;
- }
- // adjust for linewidth
- offset *= linewidth;
- // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
- offset /= resolution.y;
- // select end
- vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
- // back to clip space
- offset *= clip.w;
- clip.xy += offset;
- #endif
- gl_Position = clip;
- vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }
- `,
- fragmentShader:
- /* glsl */`
- uniform vec3 diffuse;
- uniform float opacity;
- uniform float linewidth;
- #ifdef USE_DASH
- uniform float dashSize;
- uniform float gapSize;
- #endif
- varying float vLineDistance;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #include <common>
- #include <color_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
- float mua;
- float mub;
- vec3 p13 = p1 - p3;
- vec3 p43 = p4 - p3;
- vec3 p21 = p2 - p1;
- float d1343 = dot( p13, p43 );
- float d4321 = dot( p43, p21 );
- float d1321 = dot( p13, p21 );
- float d4343 = dot( p43, p43 );
- float d2121 = dot( p21, p21 );
- float denom = d2121 * d4343 - d4321 * d4321;
- float numer = d1343 * d4321 - d1321 * d4343;
- mua = numer / denom;
- mua = clamp( mua, 0.0, 1.0 );
- mub = ( d1343 + d4321 * ( mua ) ) / d4343;
- mub = clamp( mub, 0.0, 1.0 );
- return vec2( mua, mub );
- }
- void main() {
- #include <clipping_planes_fragment>
- #ifdef USE_DASH
- if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
- if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
- #endif
- float alpha = opacity;
- #ifdef WORLD_UNITS
- // Find the closest points on the view ray and the line segment
- vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
- vec3 lineDir = worldEnd - worldStart;
- vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
- vec3 p1 = worldStart + lineDir * params.x;
- vec3 p2 = rayEnd * params.y;
- vec3 delta = p1 - p2;
- float len = length( delta );
- float norm = len / linewidth;
- #ifndef USE_DASH
- #ifdef USE_ALPHA_TO_COVERAGE
- float dnorm = fwidth( norm );
- alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
- #else
- if ( norm > 0.5 ) {
- discard;
- }
- #endif
- #endif
- #else
- #ifdef USE_ALPHA_TO_COVERAGE
- // artifacts appear on some hardware if a derivative is taken within a conditional
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- float dlen = fwidth( len2 );
- if ( abs( vUv.y ) > 1.0 ) {
- alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
- }
- #else
- if ( abs( vUv.y ) > 1.0 ) {
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- if ( len2 > 1.0 ) discard;
- }
- #endif
- #endif
- vec4 diffuseColor = vec4( diffuse, alpha );
- #include <logdepthbuf_fragment>
- #include <color_fragment>
- gl_FragColor = vec4( diffuseColor.rgb, alpha );
- #include <tonemapping_fragment>
- #include <encodings_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }
- `
- };
- class LineMaterial extends three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial {
- constructor( parameters ) {
- super( {
- type: 'LineMaterial',
- uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.uniforms ),
- vertexShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.vertexShader,
- fragmentShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.fragmentShader,
- clipping: true // required for clipping support
- } );
- Object.defineProperties( this, {
- color: {
- enumerable: true,
- get: function () {
- return this.uniforms.diffuse.value;
- },
- set: function ( value ) {
- this.uniforms.diffuse.value = value;
- }
- },
- worldUnits: {
- enumerable: true,
- get: function () {
- return 'WORLD_UNITS' in this.defines;
- },
- set: function ( value ) {
- if ( value === true ) {
- this.defines.WORLD_UNITS = '';
- } else {
- delete this.defines.WORLD_UNITS;
- }
- }
- },
- linewidth: {
- enumerable: true,
- get: function () {
- return this.uniforms.linewidth.value;
- },
- set: function ( value ) {
- this.uniforms.linewidth.value = value;
- }
- },
- dashed: {
- enumerable: true,
- get: function () {
- return Boolean( 'USE_DASH' in this.defines );
- },
- set( value ) {
- if ( Boolean( value ) !== Boolean( 'USE_DASH' in this.defines ) ) {
- this.needsUpdate = true;
- }
- if ( value === true ) {
- this.defines.USE_DASH = '';
- } else {
- delete this.defines.USE_DASH;
- }
- }
- },
- dashScale: {
- enumerable: true,
- get: function () {
- return this.uniforms.dashScale.value;
- },
- set: function ( value ) {
- this.uniforms.dashScale.value = value;
- }
- },
- dashSize: {
- enumerable: true,
- get: function () {
- return this.uniforms.dashSize.value;
- },
- set: function ( value ) {
- this.uniforms.dashSize.value = value;
- }
- },
- dashOffset: {
- enumerable: true,
- get: function () {
- return this.uniforms.dashOffset.value;
- },
- set: function ( value ) {
- this.uniforms.dashOffset.value = value;
- }
- },
- gapSize: {
- enumerable: true,
- get: function () {
- return this.uniforms.gapSize.value;
- },
- set: function ( value ) {
- this.uniforms.gapSize.value = value;
- }
- },
- opacity: {
- enumerable: true,
- get: function () {
- return this.uniforms.opacity.value;
- },
- set: function ( value ) {
- this.uniforms.opacity.value = value;
- }
- },
- resolution: {
- enumerable: true,
- get: function () {
- return this.uniforms.resolution.value;
- },
- set: function ( value ) {
- this.uniforms.resolution.value.copy( value );
- }
- },
- alphaToCoverage: {
- enumerable: true,
- get: function () {
- return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines );
- },
- set: function ( value ) {
- if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) {
- this.needsUpdate = true;
- }
- if ( value === true ) {
- this.defines.USE_ALPHA_TO_COVERAGE = '';
- this.extensions.derivatives = true;
- } else {
- delete this.defines.USE_ALPHA_TO_COVERAGE;
- this.extensions.derivatives = false;
- }
- }
- }
- } );
- this.setValues( parameters );
- }
- }
- LineMaterial.prototype.isLineMaterial = true;
- /***/ }),
- /***/ "./node_modules/three/examples/jsm/lines/LineSegments2.js":
- /*!****************************************************************!*\
- !*** ./node_modules/three/examples/jsm/lines/LineSegments2.js ***!
- \****************************************************************/
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LineSegments2": () => (/* binding */ LineSegments2)
- /* harmony export */ });
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
- /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js");
- /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js");
- const _start = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- const _end = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- const _start4 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4();
- const _end4 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4();
- const _ssOrigin = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4();
- const _ssOrigin3 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- const _mvMatrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();
- const _line = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();
- const _closestPoint = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();
- const _sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere();
- const _clipToWorldVector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4();
- class LineSegments2 extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh {
- constructor( geometry = new _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry(), material = new _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial( { color: Math.random() * 0xffffff } ) ) {
- super( geometry, material );
- this.type = 'LineSegments2';
- }
- // for backwards-compatability, but could be a method of LineSegmentsGeometry...
- computeLineDistances() {
- const geometry = this.geometry;
- const instanceStart = geometry.attributes.instanceStart;
- const instanceEnd = geometry.attributes.instanceEnd;
- const lineDistances = new Float32Array( 2 * instanceStart.count );
- for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) {
- _start.fromBufferAttribute( instanceStart, i );
- _end.fromBufferAttribute( instanceEnd, i );
- lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
- lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end );
- }
- const instanceDistanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
- geometry.setAttribute( 'instanceDistanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
- geometry.setAttribute( 'instanceDistanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
- return this;
- }
- raycast( raycaster, intersects ) {
- if ( raycaster.camera === null ) {
- console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.' );
- }
- const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
- const ray = raycaster.ray;
- const camera = raycaster.camera;
- const projectionMatrix = camera.projectionMatrix;
- const matrixWorld = this.matrixWorld;
- const geometry = this.geometry;
- const material = this.material;
- const resolution = material.resolution;
- const lineWidth = material.linewidth + threshold;
- const instanceStart = geometry.attributes.instanceStart;
- const instanceEnd = geometry.attributes.instanceEnd;
- // camera forward is negative
- const near = - camera.near;
- // clip space is [ - 1, 1 ] so multiply by two to get the full
- // width in clip space
- const ssMaxWidth = 2.0 * Math.max( lineWidth / resolution.width, lineWidth / resolution.height );
- //
- // check if we intersect the sphere bounds
- if ( geometry.boundingSphere === null ) {
- geometry.computeBoundingSphere();
- }
- _sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld );
- const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( ray.origin ) );
- // get the w component to scale the world space line width
- _clipToWorldVector.set( 0, 0, - distanceToSphere, 1.0 ).applyMatrix4( camera.projectionMatrix );
- _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
- _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );
- // increase the sphere bounds by the worst case line screen space width
- const sphereMargin = Math.abs( ssMaxWidth / _clipToWorldVector.w ) * 0.5;
- _sphere.radius += sphereMargin;
- if ( raycaster.ray.intersectsSphere( _sphere ) === false ) {
- return;
- }
- //
- // check if we intersect the box bounds
- if ( geometry.boundingBox === null ) {
- geometry.computeBoundingBox();
- }
- _box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld );
- const distanceToBox = Math.max( camera.near, _box.distanceToPoint( ray.origin ) );
- // get the w component to scale the world space line width
- _clipToWorldVector.set( 0, 0, - distanceToBox, 1.0 ).applyMatrix4( camera.projectionMatrix );
- _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
- _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );
- // increase the sphere bounds by the worst case line screen space width
- const boxMargin = Math.abs( ssMaxWidth / _clipToWorldVector.w ) * 0.5;
- _box.max.x += boxMargin;
- _box.max.y += boxMargin;
- _box.max.z += boxMargin;
- _box.min.x -= boxMargin;
- _box.min.y -= boxMargin;
- _box.min.z -= boxMargin;
- if ( raycaster.ray.intersectsBox( _box ) === false ) {
- return;
- }
- //
- // pick a point 1 unit out along the ray to avoid the ray origin
- // sitting at the camera origin which will cause "w" to be 0 when
- // applying the projection matrix.
- ray.at( 1, _ssOrigin );
- // ndc space [ - 1.0, 1.0 ]
- _ssOrigin.w = 1;
- _ssOrigin.applyMatrix4( camera.matrixWorldInverse );
- _ssOrigin.applyMatrix4( projectionMatrix );
- _ssOrigin.multiplyScalar( 1 / _ssOrigin.w );
- // screen space
- _ssOrigin.x *= resolution.x / 2;
- _ssOrigin.y *= resolution.y / 2;
- _ssOrigin.z = 0;
- _ssOrigin3.copy( _ssOrigin );
- _mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
- for ( let i = 0, l = instanceStart.count; i < l; i ++ ) {
- _start4.fromBufferAttribute( instanceStart, i );
- _end4.fromBufferAttribute( instanceEnd, i );
- _start4.w = 1;
- _end4.w = 1;
- // camera space
- _start4.applyMatrix4( _mvMatrix );
- _end4.applyMatrix4( _mvMatrix );
- // skip the segment if it's entirely behind the camera
- var isBehindCameraNear = _start4.z > near && _end4.z > near;
- if ( isBehindCameraNear ) {
- continue;
- }
- // trim the segment if it extends behind camera near
- if ( _start4.z > near ) {
- const deltaDist = _start4.z - _end4.z;
- const t = ( _start4.z - near ) / deltaDist;
- _start4.lerp( _end4, t );
- } else if ( _end4.z > near ) {
- const deltaDist = _end4.z - _start4.z;
- const t = ( _end4.z - near ) / deltaDist;
- _end4.lerp( _start4, t );
- }
- // clip space
- _start4.applyMatrix4( projectionMatrix );
- _end4.applyMatrix4( projectionMatrix );
- // ndc space [ - 1.0, 1.0 ]
- _start4.multiplyScalar( 1 / _start4.w );
- _end4.multiplyScalar( 1 / _end4.w );
- // screen space
- _start4.x *= resolution.x / 2;
- _start4.y *= resolution.y / 2;
- _end4.x *= resolution.x / 2;
- _end4.y *= resolution.y / 2;
- // create 2d segment
- _line.start.copy( _start4 );
- _line.start.z = 0;
- _line.end.copy( _end4 );
- _line.end.z = 0;
- // get closest point on ray to segment
- const param = _line.closestPointToPointParameter( _ssOrigin3, true );
- _line.at( param, _closestPoint );
- // check if the intersection point is within clip space
- const zPos = three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.lerp( _start4.z, _end4.z, param );
- const isInClipSpace = zPos >= - 1 && zPos <= 1;
- const isInside = _ssOrigin3.distanceTo( _closestPoint ) < lineWidth * 0.5;
- if ( isInClipSpace && isInside ) {
- _line.start.fromBufferAttribute( instanceStart, i );
- _line.end.fromBufferAttribute( instanceEnd, i );
- _line.start.applyMatrix4( matrixWorld );
- _line.end.applyMatrix4( matrixWorld );
- const pointOnLine = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- const point = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );
- intersects.push( {
- point: point,
- pointOnLine: pointOnLine,
- distance: ray.origin.distanceTo( point ),
- object: this,
- face: null,
- faceIndex: i,
- uv: null,
- uv2: null,
- } );
- }
- }
- }
- }
- LineSegments2.prototype.LineSegments2 = true;
- /***/ }),
- /***/ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js ***!
- \***********************************************************************/
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "LineSegmentsGeometry": () => (/* binding */ LineSegmentsGeometry)
- /* harmony export */ });
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three");
- const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();
- const _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();
- class LineSegmentsGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferGeometry {
- constructor() {
- super();
- this.type = 'LineSegmentsGeometry';
- const positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];
- const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];
- const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
- this.setIndex( index );
- this.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( positions, 3 ) );
- this.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( uvs, 2 ) );
- }
- applyMatrix4( matrix ) {
- const start = this.attributes.instanceStart;
- const end = this.attributes.instanceEnd;
- if ( start !== undefined ) {
- start.applyMatrix4( matrix );
- end.applyMatrix4( matrix );
- start.needsUpdate = true;
- }
- if ( this.boundingBox !== null ) {
- this.computeBoundingBox();
- }
- if ( this.boundingSphere !== null ) {
- this.computeBoundingSphere();
- }
- return this;
- }
- setPositions( array ) {
- let lineSegments;
- if ( array instanceof Float32Array ) {
- lineSegments = array;
- } else if ( Array.isArray( array ) ) {
- lineSegments = new Float32Array( array );
- }
- const instanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
- this.setAttribute( 'instanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
- this.setAttribute( 'instanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
- //
- this.computeBoundingBox();
- this.computeBoundingSphere();
- return this;
- }
- setColors( array ) {
- let colors;
- if ( array instanceof Float32Array ) {
- colors = array;
- } else if ( Array.isArray( array ) ) {
- colors = new Float32Array( array );
- }
- const instanceColorBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
- this.setAttribute( 'instanceColorStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
- this.setAttribute( 'instanceColorEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
- return this;
- }
- fromWireframeGeometry( geometry ) {
- this.setPositions( geometry.attributes.position.array );
- return this;
- }
- fromEdgesGeometry( geometry ) {
- this.setPositions( geometry.attributes.position.array );
- return this;
- }
- fromMesh( mesh ) {
- this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( mesh.geometry ) );
- // set colors, maybe
- return this;
- }
- fromLineSegments( lineSegments ) {
- const geometry = lineSegments.geometry;
- if ( geometry.isGeometry ) {
- console.error( 'THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.' );
- return;
- } else if ( geometry.isBufferGeometry ) {
- this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
- }
- // set colors, maybe
- return this;
- }
- computeBoundingBox() {
- if ( this.boundingBox === null ) {
- this.boundingBox = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();
- }
- const start = this.attributes.instanceStart;
- const end = this.attributes.instanceEnd;
- if ( start !== undefined && end !== undefined ) {
- this.boundingBox.setFromBufferAttribute( start );
- _box.setFromBufferAttribute( end );
- this.boundingBox.union( _box );
- }
- }
- computeBoundingSphere() {
- if ( this.boundingSphere === null ) {
- this.boundingSphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere();
- }
- if ( this.boundingBox === null ) {
- this.computeBoundingBox();
- }
- const start = this.attributes.instanceStart;
- const end = this.attributes.instanceEnd;
- if ( start !== undefined && end !== undefined ) {
- const center = this.boundingSphere.center;
- this.boundingBox.getCenter( center );
- let maxRadiusSq = 0;
- for ( let i = 0, il = start.count; i < il; i ++ ) {
- _vector.fromBufferAttribute( start, i );
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
- _vector.fromBufferAttribute( end, i );
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
- }
- this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
- if ( isNaN( this.boundingSphere.radius ) ) {
- console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );
- }
- }
- }
- toJSON() {
- // todo
- }
- applyMatrix( matrix ) {
- console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );
- return this.applyMatrix4( matrix );
- }
- }
- LineSegmentsGeometry.prototype.isLineSegmentsGeometry = true;
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = __webpack_modules__;
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/chunk loaded */
- /******/ (() => {
- /******/ var deferred = [];
- /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
- /******/ if(chunkIds) {
- /******/ priority = priority || 0;
- /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
- /******/ deferred[i] = [chunkIds, fn, priority];
- /******/ return;
- /******/ }
- /******/ var notFulfilled = Infinity;
- /******/ for (var i = 0; i < deferred.length; i++) {
- /******/ var [chunkIds, fn, priority] = deferred[i];
- /******/ var fulfilled = true;
- /******/ for (var j = 0; j < chunkIds.length; j++) {
- /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
- /******/ chunkIds.splice(j--, 1);
- /******/ } else {
- /******/ fulfilled = false;
- /******/ if(priority < notFulfilled) notFulfilled = priority;
- /******/ }
- /******/ }
- /******/ if(fulfilled) {
- /******/ deferred.splice(i--, 1)
- /******/ var r = fn();
- /******/ if (r !== undefined) result = r;
- /******/ }
- /******/ }
- /******/ return result;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/compat get default export */
- /******/ (() => {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = (module) => {
- /******/ var getter = module && module.__esModule ?
- /******/ () => (module['default']) :
- /******/ () => (module);
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ (() => {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = (exports, definition) => {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ (() => {
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
- /******/ })();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ (() => {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = (exports) => {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/jsonp chunk loading */
- /******/ (() => {
- /******/ // no baseURI
- /******/
- /******/ // object to store loaded and loading chunks
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
- /******/ var installedChunks = {
- /******/ "rogue-engine-user-scripts": 0
- /******/ };
- /******/
- /******/ // no chunk on demand loading
- /******/
- /******/ // no prefetching
- /******/
- /******/ // no preloaded
- /******/
- /******/ // no HMR
- /******/
- /******/ // no HMR manifest
- /******/
- /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
- /******/
- /******/ // install a JSONP callback for chunk loading
- /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
- /******/ var [chunkIds, moreModules, runtime] = data;
- /******/ // add "moreModules" to the modules object,
- /******/ // then flag all "chunkIds" as loaded and fire callback
- /******/ var moduleId, chunkId, i = 0;
- /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
- /******/ for(moduleId in moreModules) {
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
- /******/ }
- /******/ }
- /******/ if(runtime) var result = runtime(__webpack_require__);
- /******/ }
- /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
- /******/ for(;i < chunkIds.length; i++) {
- /******/ chunkId = chunkIds[i];
- /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
- /******/ installedChunks[chunkId][0]();
- /******/ }
- /******/ installedChunks[chunkId] = 0;
- /******/ }
- /******/ return __webpack_require__.O(result);
- /******/ }
- /******/
- /******/ var chunkLoadingGlobal = self["webpackChunk_name_"] = self["webpackChunk_name_"] || [];
- /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
- /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
- /******/ })();
- /******/
- /************************************************************************/
- /******/
- /******/ // startup
- /******/ // Load entry module and return exports
- /******/ // This entry module is referenced by other modules so it can't be inlined
- /******/ __webpack_require__("./Assets/Components/CombatLogic.re.js");
- /******/ __webpack_require__("./Assets/Components/FloatObject.re.js");
- /******/ __webpack_require__("./Assets/Components/HouseRaycastReceiver.re.js");
- /******/ __webpack_require__("./Assets/Components/Library/AsyncLoader.js");
- /******/ __webpack_require__("./Assets/Components/Library/Easings.js");
- /******/ __webpack_require__("./Assets/Components/Library/GameData.js");
- /******/ __webpack_require__("./Assets/Components/Library/SimpleTweens.js");
- /******/ __webpack_require__("./Assets/Components/OrbitCamera.re.js");
- /******/ __webpack_require__("./Assets/Components/ParticleSystem.re.js");
- /******/ __webpack_require__("./Assets/Components/Pathway.re.js");
- /******/ __webpack_require__("./Assets/Components/RaycastReceiver.re.js");
- /******/ __webpack_require__("./Assets/Components/RaycastReporter.re.js");
- /******/ __webpack_require__("./Assets/Components/SceneLinkRaycastReceiver.re.js");
- /******/ __webpack_require__("./Assets/Components/ScrollObject.re.js");
- /******/ __webpack_require__("./Assets/Components/ScrollTexture.re.js");
- /******/ __webpack_require__("./Assets/Components/TileRaycastReceiver.re.js");
- /******/ var __webpack_exports__ = __webpack_require__("./Assets/Components/TitleScreenControl.re.js");
- /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
- /******/
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });
- //# sourceMappingURL=rogue-engine-user-scripts.js.map
|