t2-mapper/docs/assets/scene-C20n9V3Y.js
2026-04-05 22:34:39 -07:00

1 line
No EOL
3.6 KiB
JavaScript

import{Ct as e,rt as t}from"./three.module-DKAirPAO.js";import{t as n}from"./logger-B058WGzf.js";var r=n(`ghostToScene`),i={x:0,y:0,z:0},a={x:1,y:1,z:1};function o(e,t){return e??t}function s(e,t){return e??t}function c(e){if(!e)return{elements:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],position:i};if(`elements`in e)return e;let{position:t,rotation:n}=e,r=n.x*n.x,a=n.y*n.y,o=n.z*n.z,s=n.x*n.y,c=n.x*n.z,l=n.y*n.z,u=n.w*n.x,d=n.w*n.y,f=n.w*n.z;return{elements:[1-2*(a+o),2*(s+f),2*(c-d),0,2*(s-f),1-2*(r+o),2*(l+u),0,2*(c+d),2*(l-u),1-2*(r+a),0,t.x,t.y,t.z,1],position:{x:t.x,y:t.y,z:t.z}}}function l(e,t){return{className:`TerrainBlock`,ghostIndex:e,terrFileName:t.terrFileName??``,detailTextureName:t.detailTextureName??``,squareSize:t.squareSize??8,emptySquareRuns:t.emptySquareRuns}}function u(e,t){return{className:`InteriorInstance`,ghostIndex:e,interiorFile:t.interiorFile??``,transform:c(t.transform),scale:t.scale??a,showTerrainInside:t.showTerrainInside??!1,skinBase:t.skinBase??``,alarmState:t.alarmState??!1}}function d(e,t){return{className:`TSStatic`,ghostIndex:e,shapeName:t.shapeName??``,transform:c(t.transform),scale:t.scale??a}}function f(e,t){let n=t.fogVolumes?t.fogVolumes.map(e=>({visibleDistance:e.visibleDistance??0,minHeight:e.minHeight??0,maxHeight:e.maxHeight??0,color:o(e.color,{r:0,g:0,b:0})})):[],r=t.cloudLayers?t.cloudLayers.map(e=>({texture:e.texture??``,heightPercent:e.heightPercent??0,speed:e.speed??0})):[];return{className:`Sky`,ghostIndex:e,materialList:t.materialList??``,fogColor:o(t.fogColor,{r:0,g:0,b:0}),visibleDistance:t.visibleDistance??1e3,fogDistance:t.fogDistance??0,skySolidColor:o(t.skySolidColor,{r:0,g:0,b:0}),useSkyTextures:t.useSkyTextures??!0,fogVolumes:n,cloudLayers:r,windVelocity:t.windVelocity??i}}function p(e,t){return{className:`Sun`,ghostIndex:e,direction:t.direction??{x:.57735,y:.57735,z:-.57735},color:s(t.color,{r:.7,g:.7,b:.7,a:1}),ambient:s(t.ambient,{r:.5,g:.5,b:.5,a:1}),textures:t.textures}}function m(e,t){return{className:`MissionArea`,ghostIndex:e,area:t.area??{x:-512,y:-512,w:1024,h:1024},flightCeiling:t.flightCeiling??2e3,flightCeilingRange:t.flightCeilingRange??50}}function h(e,t){return{className:`WaterBlock`,ghostIndex:e,transform:c(t.transform),scale:t.scale??a,surfaceName:t.surfaceName??``,envMapName:t.envMapName??``,surfaceOpacity:t.surfaceOpacity??.75,waveMagnitude:t.waveMagnitude??1,envMapIntensity:t.envMapIntensity??1}}function g(e,t,n){switch(e){case`TerrainBlock`:{let e=l(t,n);return r.debug(`TerrainBlock #%d: terrFileName=%s`,t,e.terrFileName),e}case`InteriorInstance`:{let e=u(t,n);return r.debug(`InteriorInstance #%d: interiorFile=%s`,t,e.interiorFile),e}case`TSStatic`:return d(t,n);case`Sky`:{let e=f(t,n);return r.debug(`Sky #%d: materialList=%s fogColor=(%s, %s, %s) visibleDist=%d fogDist=%d useSkyTextures=%s`,t,e.materialList,e.fogColor.r.toFixed(3),e.fogColor.g.toFixed(3),e.fogColor.b.toFixed(3),e.visibleDistance,e.fogDistance,e.useSkyTextures),e}case`Sun`:{let e=p(t,n);return r.debug(`Sun #%d: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)`,t,e.direction.x.toFixed(3),e.direction.y.toFixed(3),e.direction.z.toFixed(3),e.color.r.toFixed(3),e.color.g.toFixed(3),e.color.b.toFixed(3),e.ambient.r.toFixed(3),e.ambient.g.toFixed(3),e.ambient.b.toFixed(3)),e}case`MissionArea`:return m(t,n);case`WaterBlock`:return h(t,n);default:return null}}function _(e){return[e.y,e.z,e.x]}function v(e){return[e.y,e.z,e.x]}function y(n){let r=n.elements,i=new t,a=i.elements;a[0]=r[5],a[1]=r[6],a[2]=r[4],a[3]=0,a[4]=r[9],a[5]=r[10],a[6]=r[8],a[7]=0,a[8]=r[1],a[9]=r[2],a[10]=r[0],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1;let o=new e;return o.setFromRotationMatrix(i),o.conjugate(),o}export{g as i,v as n,_ as r,y as t};