oda-engine 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/publishFlow.mjs +78 -37
- package/package.json +1 -1
- package/web-dist/assets/{GaussianSplatUtils-CB77cP9U.js → GaussianSplatUtils-CptQkDVX.js} +1 -1
- package/web-dist/assets/{KTX2Loader-6OIWUF7s.js → KTX2Loader-C53LJqss.js} +1 -1
- package/web-dist/assets/{SPZLoader-zYj0Alfv.js → SPZLoader-BQ3tjaTv.js} +1 -1
- package/web-dist/assets/{gaussianSplat-CJTI1sEh.js → gaussianSplat-_9tcWegB.js} +1 -1
- package/web-dist/assets/{index-DMyJcoZJ.js → index-Baka-ZO7.js} +116 -116
- package/web-dist/index.html +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ oda schema [config|scene] a document's JSON Schema
|
|
|
138
138
|
|
|
139
139
|
## Publishing
|
|
140
140
|
|
|
141
|
-
`oda check` asks the live Oda too, unless you pass `--offline`: what its server takes, what its player plays and which `@nowhere/sdk` names that player has, and a dry run of the planet (its files described, never sent). An answer that does not come is said as not checked. It exits 0 when everything passed (or with `--offline`), 1 for a problem with the project or a "no" from the live Oda, and 2 when the project passed but the live Oda could not be asked: not a problem with the game, and not a pass either. `oda login` signs you in with Google in your browser; the session is kept in `~/.config/nowhere/session.json`, readable only by you. `oda publish` checks the project, takes the planet's picture and splat from the preview, commits the project (publishing needs a commit: a project's first commit is what keeps it the same planet everywhere) and uploads it. Publishing again updates the planet.
|
|
141
|
+
`oda check` asks the live Oda too, unless you pass `--offline`: what its server takes, what its player plays and which `@nowhere/sdk` names that player has, and a dry run of the planet (its files described, never sent). An answer that does not come is said as not checked. It exits 0 when everything passed (or with `--offline`), 1 for a problem with the project or a "no" from the live Oda, and 2 when the project passed but the live Oda could not be asked: not a problem with the game, and not a pass either. `oda login` signs you in with Google in your browser; the session is kept in `~/.config/nowhere/session.json`, readable only by you. `oda publish` checks the project, takes the planet's picture and splat from the preview (a planet goes up with its splat or not at all: with no preview, or a preview that gives no splat after three tries, nothing is published), commits the project (publishing needs a commit: a project's first commit is what keeps it the same planet everywhere) and uploads it. Publishing again updates the planet.
|
|
142
142
|
|
|
143
143
|
## A project
|
|
144
144
|
|
package/lib/publishFlow.mjs
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
// (vendor/publish.cjs: schema, build, gates, budgets, what the live server
|
|
3
3
|
// and player can do, a commit, one request),
|
|
4
4
|
// signed in through account.mjs. The planet's picture and splat come from the
|
|
5
|
-
// preview page
|
|
5
|
+
// preview page, as the studio takes them from its viewport.
|
|
6
|
+
//
|
|
7
|
+
// A planet goes up with its splat or not at all (the creator, 2026-11-15):
|
|
8
|
+
// the web world shows a planet only as the splat inside its glass. The splat
|
|
9
|
+
// is baked from the space running in the preview, so with no preview there
|
|
10
|
+
// is no publish, and a bake that gives nothing three times publishes nothing.
|
|
6
11
|
|
|
7
12
|
import fsp from 'node:fs/promises'
|
|
8
13
|
import path from 'node:path'
|
|
9
14
|
import { account } from './account.mjs'
|
|
10
15
|
import { publishModule } from './project.mjs'
|
|
16
|
+
import { schema } from './resources.mjs'
|
|
11
17
|
|
|
12
18
|
/** Long edges the planet's picture is tried at, largest first, and the
|
|
13
19
|
* server's budget for it (LIMITS.previewKb in @nowhere/schema). */
|
|
@@ -15,6 +21,20 @@ const PICTURE_EDGES = [2560, 1600, 1024, 768, 512]
|
|
|
15
21
|
const PREVIEW_BYTES = 1024 * 1024
|
|
16
22
|
/** Times the preview is asked for a still before it is given up on. */
|
|
17
23
|
const PICTURE_TRIES = 5
|
|
24
|
+
/** Bakes of the splat before the publish is given up on, and the wait
|
|
25
|
+
* between two: a space still bringing its files in can come out empty
|
|
26
|
+
* (as the studio does, store.ts runPublish). */
|
|
27
|
+
export const SPLAT_TRIES = 3
|
|
28
|
+
export const SPLAT_RETRY_MS = 2500
|
|
29
|
+
/** How long one bake is waited for: the bake's own limit is a minute. */
|
|
30
|
+
const BAKE_WAIT_MS = 120_000
|
|
31
|
+
|
|
32
|
+
/** What the publish says when there is no preview to bake the splat in. */
|
|
33
|
+
export const NO_PREVIEW_SPLAT =
|
|
34
|
+
"A planet is published with its splat, and the splat is baked from the space running in the preview, which could not be opened here (it runs in Google Chrome or Chromium). Open the preview (oda dev) and publish again; nothing was published."
|
|
35
|
+
/** What the publish says when the preview gave no splat. */
|
|
36
|
+
export const NO_SPLAT =
|
|
37
|
+
"The planet's world (its splat) could not be made in the preview, so nothing was published. Let the space finish showing in the preview, then publish again."
|
|
18
38
|
|
|
19
39
|
const SAY = {
|
|
20
40
|
checking: 'Checking the project…',
|
|
@@ -23,52 +43,73 @@ const SAY = {
|
|
|
23
43
|
verifying: 'Oda is checking it…',
|
|
24
44
|
}
|
|
25
45
|
|
|
26
|
-
/**
|
|
27
|
-
|
|
46
|
+
/**
|
|
47
|
+
* { state: 'done', result } or { state: 'failed' | 'signin', error, findings }.
|
|
48
|
+
* `using` stands in for the account, the publish module, the schema and the
|
|
49
|
+
* wait between bakes (a check's fakes); left out, the real ones.
|
|
50
|
+
*/
|
|
51
|
+
export async function publishProject(root, { preview = null, say = () => {}, using = {} } = {}) {
|
|
28
52
|
// Signed in first: there is no point taking pictures for a publish that
|
|
29
53
|
// cannot happen.
|
|
30
|
-
if (!(await account().getAccessToken())) return { state: 'signin', error: 'Not signed in to Oda.' }
|
|
31
|
-
const publish = publishModule()
|
|
54
|
+
if (!(await (using.account ?? account()).getAccessToken())) return { state: 'signin', error: 'Not signed in to Oda.' }
|
|
55
|
+
const publish = using.publish ?? publishModule()
|
|
56
|
+
const wait = using.wait ?? ((ms) => new Promise((r) => setTimeout(r, ms)))
|
|
32
57
|
|
|
33
|
-
if (preview
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
break
|
|
50
|
-
}
|
|
51
|
-
if (Buffer.byteLength(m[1], 'base64') <= PREVIEW_BYTES) break
|
|
52
|
-
if (longEdge === PICTURE_EDGES[PICTURE_EDGES.length - 1]) break
|
|
53
|
-
m = null
|
|
54
|
-
say(`(the picture at ${longEdge} px is over ${PREVIEW_BYTES / 1024} KB; taking it smaller)`)
|
|
58
|
+
if (!preview || !(await preview.ensurePage(20_000).catch(() => false))) {
|
|
59
|
+
return { state: 'failed', error: NO_PREVIEW_SPLAT }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
say('Taking the planet’s picture and its splat from the preview…')
|
|
63
|
+
try {
|
|
64
|
+
// As the studio does (splatBaker.ts): smaller until it fits the server's
|
|
65
|
+
// budget, since one over it goes up with no picture at all.
|
|
66
|
+
let m = null
|
|
67
|
+
for (const longEdge of PICTURE_EDGES) {
|
|
68
|
+
// A page that has only just mounted the game answers no still for a
|
|
69
|
+
// few seconds; asked once, the picture already on disk went up.
|
|
70
|
+
for (let tries = 0; tries < PICTURE_TRIES && !m; tries++) {
|
|
71
|
+
if (tries) await wait(2000)
|
|
72
|
+
const { png } = await preview.request('preview', { longEdge }, 30_000)
|
|
73
|
+
m = /^data:image\/png;base64,(.+)$/.exec(png ?? '')
|
|
55
74
|
}
|
|
56
|
-
if (m
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
if (!m) {
|
|
76
|
+
say('(the preview gave no picture; the one already on disk goes up)')
|
|
77
|
+
break
|
|
59
78
|
}
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
if (Buffer.byteLength(m[1], 'base64') <= PREVIEW_BYTES) break
|
|
80
|
+
if (longEdge === PICTURE_EDGES[PICTURE_EDGES.length - 1]) break
|
|
81
|
+
m = null
|
|
82
|
+
say(`(the picture at ${longEdge} px is over ${PREVIEW_BYTES / 1024} KB; taking it smaller)`)
|
|
83
|
+
}
|
|
84
|
+
if (m && Buffer.byteLength(m[1], 'base64') <= PREVIEW_BYTES) {
|
|
85
|
+
await fsp.mkdir(path.join(root, '.nowhere'), { recursive: true })
|
|
86
|
+
await fsp.writeFile(path.join(root, '.nowhere', 'preview.png'), Buffer.from(m[1], 'base64'))
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
say(`(no new picture: ${err.message})`)
|
|
90
|
+
}
|
|
91
|
+
// The splat, checked as the server will check it: one that would not be
|
|
92
|
+
// taken is no splat.
|
|
93
|
+
const { checkSplat } = using.schema ?? (await schema())
|
|
94
|
+
let bytes = null
|
|
95
|
+
let why = null
|
|
96
|
+
for (let attempt = 0; attempt < SPLAT_TRIES && !bytes; attempt++) {
|
|
97
|
+
if (attempt > 0) {
|
|
98
|
+
say(`(no splat yet${why ? `: ${why}` : ''}; baking again)`)
|
|
99
|
+
await wait(SPLAT_RETRY_MS)
|
|
62
100
|
}
|
|
63
101
|
try {
|
|
64
|
-
const { splat } = await preview.request('bake', {},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
102
|
+
const { splat } = await preview.request('bake', {}, BAKE_WAIT_MS)
|
|
103
|
+
const baked = splat ? Buffer.from(splat, 'base64') : null
|
|
104
|
+
const verdict = baked ? checkSplat(new Uint8Array(baked.buffer, baked.byteOffset, baked.byteLength)) : null
|
|
105
|
+
if (verdict?.ok) bytes = baked
|
|
106
|
+
else why = baked ? `the bake is ${verdict?.error ?? 'not a splat'}` : 'the bake gave nothing'
|
|
68
107
|
} catch (err) {
|
|
69
|
-
|
|
108
|
+
why = err.message
|
|
70
109
|
}
|
|
71
110
|
}
|
|
111
|
+
if (!bytes) return { state: 'failed', error: why ? `${NO_SPLAT} (Last try: ${String(why).replace(/\.$/, '')}.)` : NO_SPLAT }
|
|
112
|
+
await publish.writeSplat(root, bytes)
|
|
72
113
|
|
|
73
114
|
return publish.run({
|
|
74
115
|
root,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oda-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Make Oda games from your own tools: a CLI and an MCP server for Claude Code, Codex and any other agent, with a live preview in the browser and publishing to the Oda universe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aD as E,a6 as d,a7 as b,an as H,aE as A,af as u}from"./index-
|
|
1
|
+
import{aD as E,a6 as d,a7 as b,an as H,aE as A,af as u}from"./index-Baka-ZO7.js";const y=.2820947917738781,B=[0,9,15,21],p=[0,3,4,6],c=new H,m=new H,h=new b,w=new E,f=new d,g=new d;function D(t,r,n,e,i,l,a,s,S){w.set(l,a,s,S).normalize(),f.set(n,e,i),h.compose(g,w,f),c.setFromMatrix4(h),m.copy(c).transpose(),c.multiply(m);const o=c.elements;t[r]=o[0],t[r+1]=o[3],t[r+2]=o[6],t[r+3]=o[4],t[r+4]=o[7],t[r+5]=o[8]}function G(t,r){const n=new Uint32Array(t*p[r]);return n.fill(2155905152),{packed:n,bytes:new Uint8ClampedArray(n.buffer)}}function _(t,r,n){const e=p[n];if(!(t instanceof Uint32Array))throw new Error(`THREE.createGaussianSplatGeometry: sphericalHarmonics${n} must use packed uint32 words.`);if(t.length!==r*e)throw new Error(`THREE.createGaussianSplatGeometry: Invalid sphericalHarmonics${n} packed length.`);return new u(t,e)}function $(t){if(t===void 0||t.isBufferGeometry!==!0)return 0;let r=0;for(let e=1;e<=3;e++){const i=t.getAttribute(`sphericalHarmonics${e}`);if(i===void 0)break;if(i.itemSize!==p[e])throw new Error(`THREE.getSphericalHarmonicsDegree: Invalid sphericalHarmonics${e} itemSize.`);if(!(i.array instanceof Uint32Array))throw new Error(`THREE.getSphericalHarmonicsDegree: sphericalHarmonics${e} must use packed uint32 words.`);r=e}for(let e=r+1;e<=3;e++)if(t.getAttribute(`sphericalHarmonics${e}`)!==void 0)throw new Error("THREE.getSphericalHarmonicsDegree: Spherical harmonics attributes must be contiguous.");const n=t.getAttribute("position");if(n!==void 0){for(let e=1;e<=r;e++)if(t.getAttribute(`sphericalHarmonics${e}`).count!==n.count)throw new Error("THREE.getSphericalHarmonicsDegree: Spherical harmonics attribute counts must match position.")}return r}function T(t,r,n,e={}){const i=new A;i.setAttribute("position",new u(t,3)),i.setAttribute("covariance",new u(r,6)),i.setAttribute("color",new u(n,4,!0));const l=t.length/3;for(let a=1;a<=3;a++){const s=e[`sh${a}`]||e[`sphericalHarmonics${a}`];s!==void 0&&i.setAttribute(`sphericalHarmonics${a}`,_(s,l,a))}return $(i),i.computeBoundingBox(),i.computeBoundingSphere(),i}export{B as S,G as a,p as b,T as c,y as d,$ as g,D as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as ut,S as ye,L as mt,F as $,a as Tt,b as gt,c as Ce,d as Z,e as we,f as yt,N as de,R as fe,g as ie,h as oe,i as Ct,j as wt,k as Ft,l as St,m as ae,n as he,o as le,p as ee,q as Q,r as Et,s as xt,t as Ut,u as Rt,v as Fe,w as Se,x as pe,y as X,z as K,A as G,U as c,H as L,B as Ee,D as xe,E as Ue,G as z,I as Bt,J as At,K as Pt,M as ue,O as bt,P as kt,Q as Gt}from"./index-
|
|
1
|
+
import{C as ut,S as ye,L as mt,F as $,a as Tt,b as gt,c as Ce,d as Z,e as we,f as yt,N as de,R as fe,g as ie,h as oe,i as Ct,j as wt,k as Ft,l as St,m as ae,n as he,o as le,p as ee,q as Q,r as Et,s as xt,t as Ut,u as Rt,v as Fe,w as Se,x as pe,y as X,z as K,A as G,U as c,H as L,B as Ee,D as xe,E as Ue,G as z,I as Bt,J as At,K as Pt,M as ue,O as bt,P as kt,Q as Gt}from"./index-Baka-ZO7.js";import{Q as Lt}from"./zstddec.module-CfFeQW7d.js";class Dt{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:r,msg:i,transfer:o}=this.queue.shift();this.workersResolve[e]=r,this.workers[e].postMessage(i,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(s=>{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=s,this.workers[r].postMessage(e,t)):this.queue.push({resolve:s,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const vt=0,me=2,Ht=1,Te=2,Ot=0,Mt=1,It=10,Nt=0,Re=9,Be=15,Ae=16,Pe=22,be=37,ke=43,Ge=76,Le=83,ce=91,De=97,ve=100,He=103,Oe=109,Me=122,Ie=123,Ne=131,Ve=132,We=133,Xe=134,Ke=137,ze=138,je=139,qe=140,Ye=141,Je=142,Qe=145,Ze=146,$e=148,et=152,tt=153,rt=154,st=155,nt=156,it=157,ot=158,at=165,lt=166,pt=1000054e3,ct=1000054001,_t=1000054004,dt=1000054005,_e=1000066e3,ft=1000066004;class W{constructor(e,t,s,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const s=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,r)}}const S=[171,75,84,88,32,50,48,187,13,10,26,10];function ge(n){return new TextDecoder().decode(n)}function Vt(n){const e=new Uint8Array(n.buffer,n.byteOffset,S.length);if(e[0]!==S[0]||e[1]!==S[1]||e[2]!==S[2]||e[3]!==S[3]||e[4]!==S[4]||e[5]!==S[5]||e[6]!==S[6]||e[7]!==S[7]||e[8]!==S[8]||e[9]!==S[9]||e[10]!==S[10]||e[11]!==S[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},s=17*Uint32Array.BYTES_PER_ELEMENT,r=new W(n,S.length,s,!0);t.vkFormat=r._nextUint32(),t.typeSize=r._nextUint32(),t.pixelWidth=r._nextUint32(),t.pixelHeight=r._nextUint32(),t.pixelDepth=r._nextUint32(),t.layerCount=r._nextUint32(),t.faceCount=r._nextUint32(),t.levelCount=r._nextUint32(),t.supercompressionScheme=r._nextUint32();const i=r._nextUint32(),o=r._nextUint32(),m=r._nextUint32(),E=r._nextUint32(),C=r._nextUint64(),x=r._nextUint64(),_=3*Math.max(t.levelCount,1)*8,w=new W(n,S.length+s,_,!0);for(let d=0,u=Math.max(t.levelCount,1);d<u;d++)t.levels.push({levelData:new Uint8Array(n.buffer,n.byteOffset+w._nextUint64(),w._nextUint64()),uncompressedByteLength:w._nextUint64()});const l=new W(n,i,o,!0);l._skip(4);const p=l._nextUint16(),a=l._nextUint16(),g=l._nextUint16(),F=l._nextUint16(),f={vendorId:p,descriptorType:a,versionNumber:g,colorModel:l._nextUint8(),colorPrimaries:l._nextUint8(),transferFunction:l._nextUint8(),flags:l._nextUint8(),texelBlockDimension:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],bytesPlane:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],samples:[]},y=(F/4-6)/4;for(let d=0;d<y;d++){const u={bitOffset:l._nextUint16(),bitLength:l._nextUint8(),channelType:l._nextUint8(),samplePosition:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&u.channelType?(u.sampleLower=l._nextInt32(),u.sampleUpper=l._nextInt32()):(u.sampleLower=l._nextUint32(),u.sampleUpper=l._nextUint32()),f.samples[d]=u}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(f);const T=new W(n,m,E,!0);for(;T._offset<E;){const d=T._nextUint32(),u=T._scan(d),U=ge(u);if(t.keyValue[U]=T._nextUint8Array(d-u.byteLength-1),U.match(/^ktx/i)){const J=ge(t.keyValue[U]);t.keyValue[U]=J.substring(0,J.lastIndexOf("\0"))}T._skip(d%4?4-d%4:0)}if(x<=0)return t;const h=new W(n,C,x,!0),b=h._nextUint16(),B=h._nextUint16(),j=h._nextUint32(),D=h._nextUint32(),v=h._nextUint32(),H=h._nextUint32(),O=[];for(let d=0,u=Math.max(t.levelCount,1);d<u;d++)O.push({imageFlags:h._nextUint32(),rgbSliceByteOffset:h._nextUint32(),rgbSliceByteLength:h._nextUint32(),alphaSliceByteOffset:h._nextUint32(),alphaSliceByteLength:h._nextUint32()});const M=C+h._offset,A=M+j,I=A+D,P=I+v,q=new Uint8Array(n.buffer,n.byteOffset+M,j),N=new Uint8Array(n.buffer,n.byteOffset+A,D),V=new Uint8Array(n.buffer,n.byteOffset+I,v),Y=new Uint8Array(n.buffer,n.byteOffset+P,H);return t.globalData={endpointCount:b,selectorCount:B,imageDescs:O,endpointsData:q,selectorsData:N,tablesData:V,extendedData:Y},t}const Wt="display-p3",Xt="display-p3-linear";({...ut.spaces[ye]});const Kt="",zt="",te=new WeakMap;let re=0,se;class R extends mt{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Dt,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},typeof navigator<"u"&&typeof navigator.platform<"u"&&typeof navigator.userAgent<"u"&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Android")<0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc1Supported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new $(this.manager);e.setWithCredentials(this.withCredentials);const t=new $(this.manager);t.setWithCredentials(this.withCredentials),t.setResponseType("arraybuffer");let s,r;this.transcoderPath===""?(s=e.loadAsync(zt),r=t.loadAsync(Kt)):(e.setPath(this.transcoderPath),s=e.loadAsync("basis_transcoder.js"),t.setPath(this.transcoderPath),r=t.loadAsync("basis_transcoder.wasm")),this.transcoderPending=Promise.all([s,r]).then(([i,o])=>{const m=R.BasisWorker.toString(),E=["/* constants */","let _EngineFormat = "+JSON.stringify(R.EngineFormat),"let _EngineType = "+JSON.stringify(R.EngineType),"let _TranscoderFormat = "+JSON.stringify(R.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(R.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",m.substring(m.indexOf("{")+1,m.lastIndexOf("}"))].join(`
|
|
2
2
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([E])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const C=new Worker(this.workerSourceURL),x=this.transcoderBinary.slice(0);return C.postMessage({type:"init",config:this.workerConfig,transcoderBinary:x},[x]),C})}),re>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),re++}return this.transcoderPending}load(e,t,s,r){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const i=new $(this.manager);i.setPath(this.path),i.setCrossOrigin(this.crossOrigin),i.setWithCredentials(this.withCredentials),i.setRequestHeader(this.requestHeader),i.setResponseType("arraybuffer"),i.load(e,o=>{this.parse(o,t,r)},s,r)}parse(e,t,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(te.has(e))return te.get(e).promise.then(t).catch(s);this._createTexture(e).then(r=>t?t(r):null).catch(s)}_createTextureFrom(e,t){const{type:s,error:r,data:{faces:i,width:o,height:m,format:E,type:C,dfdFlags:x}}=e;if(s==="error")return Promise.reject(r);let _;if(t.faceCount===6)_=new Tt(i,E,C);else{const w=i[0].mipmaps;_=t.layerCount>1?new gt(w,o,m,t.layerCount,E,C):new Ce(w,o,m,E,C)}return _.minFilter=i[0].mipmaps.length===1?Z:we,_.magFilter=Z,_.generateMipmaps=!1,_.needsUpdate=!0,_.colorSpace=ht(t),_.premultiplyAlpha=!!(x&Ht),_}async _createTexture(e,t={}){const s=Vt(new Uint8Array(e)),r=s.vkFormat===_e&&s.dataFormatDescriptor[0].colorModel===167;if(!(s.vkFormat===Nt||r&&!this.workerConfig.astcHDRSupported))return Yt(s);const o=t,m=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])).then(E=>this._createTextureFrom(E.data,s));return te.set(e,{promise:m}),m}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),re--}}R.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};R.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25};R.EngineFormat={RGBAFormat:G,RGBA_ASTC_4x4_Format:Q,RGB_BPTC_UNSIGNED_Format:Gt,RGBA_BPTC_Format:oe,RGBA_ETC2_EAC_Format:Se,RGBA_PVRTC_4BPPV1_Format:ie,RGBA_S3TC_DXT5_Format:ae,RGB_ETC1_Format:kt,RGB_ETC2_Format:Fe,RGB_PVRTC_4BPPV1_Format:bt,RGBA_S3TC_DXT1_Format:le};R.EngineType={UnsignedByteType:c,HalfFloatType:L,FloatType:z};R.BasisWorker=function(){let n,e,t;const s=_EngineFormat,r=_EngineType,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",function(p){const a=p.data;switch(a.type){case"init":n=a.config,m(a.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:g,buffers:F,width:f,height:y,hasAlpha:T,format:h,type:b,dfdFlags:B}=E(a.buffer);self.postMessage({type:"transcode",id:a.id,data:{faces:g,width:f,height:y,hasAlpha:T,format:h,type:b,dfdFlags:B}},F)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}});break}});function m(p){e=new Promise(a=>{t={wasmBinary:p,onRuntimeInitialized:a},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function E(p){const a=new t.KTX2File(new Uint8Array(p));function g(){a.close(),a.delete()}if(!a.isValid())throw g(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let F;if(a.isUASTC())F=o.UASTC;else if(a.isETC1S())F=o.ETC1S;else if(a.isHDR())F=o.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const f=a.getWidth(),y=a.getHeight(),T=a.getLayers()||1,h=a.getLevels(),b=a.getFaces(),B=a.getHasAlpha(),j=a.getDFDFlags(),{transcoderFormat:D,engineFormat:v,engineType:H}=_(F,f,y,B);if(!f||!y||!h)throw g(),new Error("THREE.KTX2Loader: Invalid texture");if(!a.startTranscoding())throw g(),new Error("THREE.KTX2Loader: .startTranscoding failed");const O=[],M=[];for(let A=0;A<b;A++){const I=[];for(let P=0;P<h;P++){const q=[];let N,V;for(let d=0;d<T;d++){const u=a.getImageLevelInfo(P,d,A);A===0&&P===0&&d===0&&(u.origWidth%4!==0||u.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),h>1?(N=u.origWidth,V=u.origHeight):(N=u.width,V=u.height);let U=new Uint8Array(a.getImageTranscodedSizeInBytes(P,d,0,D));const J=a.transcodeImage(U,P,d,A,D,0,-1,-1);if(H===r.HalfFloatType&&(U=new Uint16Array(U.buffer,U.byteOffset,U.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!J)throw g(),new Error("THREE.KTX2Loader: .transcodeImage failed.");q.push(U)}const Y=l(q);I.push({data:Y,width:N,height:V}),M.push(Y.buffer)}O.push({mipmaps:I,width:f,height:y,format:v,type:H})}return g(),{faces:O,buffers:M,width:f,height:y,hasAlpha:B,dfdFlags:j,format:v,type:H}}const C=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.BC1,i.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.ETC1],engineFormat:[s.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[i.BC6H],engineFormat:[s.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.RGBA32,i.RGBA32],engineFormat:[s.RGBAFormat,s.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[i.RGBA_HALF],engineFormat:[s.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],x={[o.ETC1S]:C.filter(p=>p.basisFormat.includes(o.ETC1S)).sort((p,a)=>p.priorityETC1S-a.priorityETC1S),[o.UASTC]:C.filter(p=>p.basisFormat.includes(o.UASTC)).sort((p,a)=>p.priorityUASTC-a.priorityUASTC),[o.UASTC_HDR]:C.filter(p=>p.basisFormat.includes(o.UASTC_HDR)).sort((p,a)=>p.priorityHDR-a.priorityHDR)};function _(p,a,g,F){const f=x[p];for(let y=0;y<f.length;y++){const T=f[y];if(T.if&&!n[T.if]||!T.basisFormat.includes(p)||F&&T.transcoderFormat.length<2||T.needsPowerOfTwo&&!(w(a)&&w(g)))continue;const h=T.transcoderFormat[F?1:0],b=T.engineFormat[F?1:0],B=T.engineType[0];return{transcoderFormat:h,engineFormat:b,engineType:B}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function w(p){return p<=2?!0:(p&p-1)===0&&p!==0}function l(p){if(p.length===1)return p[0];let a=0;for(let f=0;f<p.length;f++){const y=p[f];a+=y.byteLength}const g=new Uint8Array(a);let F=0;for(let f=0;f<p.length;f++){const y=p[f];g.set(y,F),F+=y.byteLength}return g}};const jt=new Set([G,pe,K,X]),qt=new Set([ce]),ne={[Oe]:G,[He]:K,[ve]:X,[De]:G,[Le]:K,[Ge]:X,[ce]:G,[ke]:G,[be]:G,[Pe]:K,[Ae]:K,[Be]:X,[Re]:X,[Ie]:pe,[Me]:pe,[et]:Se,[$e]:Fe,[tt]:Rt,[rt]:Ut,[st]:xt,[nt]:Et,[_e]:Q,[ot]:Q,[it]:Q,[ft]:ee,[lt]:ee,[at]:ee,[Xe]:le,[We]:le,[Ve]:he,[Ne]:he,[ze]:ae,[Ke]:ae,[qe]:St,[je]:Ft,[Je]:wt,[Ye]:Ct,[Ze]:oe,[Qe]:oe,[dt]:ie,[ct]:ie,[_t]:fe,[pt]:fe},k={[Oe]:z,[He]:z,[ve]:z,[De]:L,[Le]:L,[Ge]:L,[ce]:Ue,[ke]:c,[be]:c,[Pe]:c,[Ae]:c,[Be]:c,[Re]:c,[Ie]:xe,[Me]:Ee,[et]:c,[$e]:c,[tt]:c,[rt]:c,[st]:c,[nt]:c,[_e]:L,[ot]:c,[it]:c,[ft]:L,[lt]:c,[at]:c,[Xe]:c,[We]:c,[Ve]:c,[Ne]:c,[ze]:c,[Ke]:c,[qe]:c,[je]:c,[Je]:c,[Ye]:c,[Ze]:c,[Qe]:c,[dt]:c,[ct]:c,[_t]:c,[pt]:c};async function Yt(n){const{vkFormat:e}=n;if(ne[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);k[e]===void 0&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let t;n.supercompressionScheme===me&&(se||(se=new Promise(async o=>{const m=new Lt;await m.init(),o(m)})),t=await se);const s=[];for(let o=0;o<n.levels.length;o++){const m=Math.max(1,n.pixelWidth>>o),E=Math.max(1,n.pixelHeight>>o),C=n.pixelDepth?Math.max(1,n.pixelDepth>>o):0,x=n.levels[o];let _;if(n.supercompressionScheme===vt)_=x.levelData;else if(n.supercompressionScheme===me)_=t.decode(x.levelData,x.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let w;k[e]===z?w=new Float32Array(_.buffer,_.byteOffset,_.byteLength/Float32Array.BYTES_PER_ELEMENT):k[e]===L||k[e]===Ue?w=new Uint16Array(_.buffer,_.byteOffset,_.byteLength/Uint16Array.BYTES_PER_ELEMENT):k[e]===xe||k[e]===Ee?w=new Uint32Array(_.buffer,_.byteOffset,_.byteLength/Uint32Array.BYTES_PER_ELEMENT):w=_,s.push({data:w,width:m,height:E,depth:C})}const r=n.levelCount===0||s.length>1;let i;if(jt.has(ne[e]))i=n.pixelDepth===0?new Bt(s[0].data,n.pixelWidth,n.pixelHeight):new At(s[0].data,n.pixelWidth,n.pixelHeight,n.pixelDepth),i.minFilter=r?Pt:ue,i.magFilter=ue,i.generateMipmaps=n.levelCount===0,i.normalized=qt.has(e);else{if(n.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new Ce(s,n.pixelWidth,n.pixelHeight),i.minFilter=r?we:Z,i.magFilter=Z}return i.mipmaps=s,i.type=k[e],i.format=ne[e],i.colorSpace=ht(n),i.needsUpdate=!0,Promise.resolve(i)}function ht(n){const e=n.dataFormatDescriptor[0];return e.colorPrimaries===Mt?e.transferFunction===Te?ye:yt:e.colorPrimaries===It?e.transferFunction===Te?Wt:Xt:e.colorPrimaries===Ot?de:(console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),de)}export{R as KTX2Loader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as C,F as b,T as v,V as R}from"./index-
|
|
1
|
+
import{L as C,F as b,T as v,V as R}from"./index-Baka-ZO7.js";import{Q as M}from"./zstddec.module-CfFeQW7d.js";import{w as F,c as B,a as I,S as q,b as N,d as G}from"./GaussianSplatUtils-CptQkDVX.js";const D=1347635022,T=16,V=G/.15,k=128,Q=2,x=3,Z=[0,3,8,15,24];let _;const g=new Float32Array(256),H=new Uint8ClampedArray(256);for(let n=0;n<256;n++)g[n]=Math.exp(n/16-10),H[n]=((n/255-.5)*V+.5)*255;const A=new Float64Array(1024);for(let n=0;n<1024;n++){const e=Math.SQRT1_2*((n&511)/511);A[n]=(n&512)!==0?-e:e}const $=[0,0,0,0];class ne extends C{constructor(e){super(e)}load(e,o,r,t){const s=this,a=new b(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(f){s.parse(f,o,function(i){t?t(i):console.error(i),s.manager.itemError(e)})},r,t)}parse(e,o,r){try{if(e.byteLength>=8){const a=new DataView(e),f=a.getUint32(0,!0),i=a.getUint32(4,!0);if(f===D){if(i!==4)throw new Error(`THREE.SPZLoader: SPZ version ${i} is not supported.`);const c=X().then(S=>this.parseRawSPZV4(new Uint8Array(e),S));return o!==void 0&&c.then(o).catch(r),c}}const t=v(new Uint8Array(e)),s=this.parseRawSPZ(t);return o!==void 0&&o(s),s}catch(t){if(r!==void 0){r(t);return}throw t}}parseRawSPZ(e){if(e.byteLength<T)throw new Error("THREE.SPZLoader: Invalid SPZ header.");const o=new DataView(e.buffer,e.byteOffset,e.byteLength),r=o.getUint32(0,!0),t=o.getUint32(4,!0),s=o.getUint32(8,!0),a=o.getUint8(12),f=o.getUint8(13),i=o.getUint8(14);if(r!==D)throw new Error("THREE.SPZLoader: Invalid SPZ magic.");if(t<1||t>3)throw new Error(`THREE.SPZLoader: SPZ version ${t} is not supported.`);if(a>=Z.length)throw new Error(`THREE.SPZLoader: Unsupported SPZ spherical harmonics degree ${a}.`);const c=Math.min(a,x),S=s*3*(t===1?2:3),u=s*(t===3?4:3),p=s*Z[a]*3,w=(i&k)!==0?s*6:0,m=T+S+s+s*3+s*3+u+p+w;if(e.byteLength!==m)throw new Error("THREE.SPZLoader: Invalid SPZ byte length.");let d=T;const E=e.subarray(d,d+S);d+=S;const l=e.subarray(d,d+s);d+=s;const O=e.subarray(d,d+s*3);d+=s*3;const h=e.subarray(d,d+s*3);d+=s*3;const P=e.subarray(d,d+u);d+=u;const U=e.subarray(d,d+p);return z({positions:E,alphas:l,colors:O,scales:h,rotations:P,sphericalHarmonics:U,count:s,version:t,fractionalBits:f,shDegree:c,storedShDegree:a})}parseRawSPZV4(e,o){const r=new DataView(e.buffer,e.byteOffset,e.byteLength),t=r.getUint32(8,!0),s=r.getUint8(12),a=Math.min(s,x),f=r.getUint8(13),i=r.getUint8(14),c=r.getUint8(15),S=r.getUint32(16,!0);(i&Q)!==0&&console.warn("THREE.SPZLoader: SPZ vendor extensions are not supported and will be skipped.");const u=t*3*3,p=t*4,w=t*Z[s]*3,m=[u,t,t*3,t*3,p,w],d=[];let E=S+c*16;for(let h=0;h<c;h++){const P=S+h*16,U=Number(r.getBigUint64(P,!0));d.push({compressedOffset:E,compressedSize:U}),E+=U}const l=[];let O=0;for(let h=0;h<m.length;h++){const P=m[h];if(P===0){l.push(new Uint8Array);continue}const U=d[O++],L=e.subarray(U.compressedOffset,U.compressedOffset+U.compressedSize);l.push(o.decode(L,P))}return z({positions:l[0],alphas:l[1],colors:l[2],scales:l[3],rotations:l[4],sphericalHarmonics:l[5],count:t,version:4,fractionalBits:f,shDegree:a,storedShDegree:s})}}function X(){if(_===void 0){const n=new M;_=n.init().then(()=>n).catch(e=>{throw _=void 0,e})}return _}function z({positions:n,alphas:e,colors:o,scales:r,rotations:t,sphericalHarmonics:s,count:a,version:f,fractionalBits:i,shDegree:c,storedShDegree:S}){const u=new Float32Array(a*3),p=new Float32Array(a*6),w=new Uint8ClampedArray(a*4),m={};Y(n,u,0,a,f,i);const d=f>=3?t.byteOffset%4===0?new Uint32Array(t.buffer,t.byteOffset,a):new Uint32Array(t.buffer.slice(t.byteOffset,t.byteOffset+a*4)):null,E=$;for(let l=0;l<a;l++){const O=l*3,h=l*4,P=g[r[O]],U=g[r[O+1]],L=g[r[O+2]];f>=3?J(d[l],E):j(t,O,E),F(p,l*6,P,U,L,E[0],E[1],E[2],E[3]),w[h]=H[o[O]],w[h+1]=H[o[O+1]],w[h+2]=H[o[O+2]],w[h+3]=e[l]}return W(s,0,a,c,m,S),B(u,p,w,m)}function W(n,e,o,r,t,s=r){if(r===0)return;const a=[];for(let i=1;i<=r;i++){const c=I(o,i);t[`sh${i}`]=c.packed,a.push({bytes:c.bytes,components:q[i],stride:N[i]*4})}const f=Z[s]*3;for(let i=0;i<o;i++){let S=e+i*f;for(let u=0;u<a.length;u++){const p=a[u],w=i*p.stride;for(let m=0;m<p.components;m++)p.bytes[w+m]=n[S++]}}}function Y(n,e,o,r,t,s){if(t===1){for(let f=0;f<r;f++){const i=f*3,c=o+i*2;e[i]=R.fromHalfFloat(n[c]|n[c+1]<<8),e[i+1]=R.fromHalfFloat(n[c+2]|n[c+3]<<8),e[i+2]=R.fromHalfFloat(n[c+4]|n[c+5]<<8)}return}const a=1/(1<<s);for(let f=0;f<r;f++){const i=f*3,c=o+f*9;e[i]=y(n,c)*a,e[i+1]=y(n,c+3)*a,e[i+2]=y(n,c+6)*a}}function y(n,e){return(n[e]<<8|n[e+1]<<16|n[e+2]<<24)>>8}function j(n,e,o){const r=n[e]/127.5-1,t=n[e+1]/127.5-1,s=n[e+2]/127.5-1;o[0]=r,o[1]=t,o[2]=s,o[3]=Math.sqrt(Math.max(0,1-r*r-t*t-s*s))}function J(n,e){const o=n>>>30,r=A[n&1023],t=A[n>>>10&1023],s=A[n>>>20&1023];switch(o){case 0:e[1]=s,e[2]=t,e[3]=r;break;case 1:e[0]=s,e[2]=t,e[3]=r;break;case 2:e[0]=s,e[1]=t,e[3]=r;break;default:e[0]=s,e[1]=t,e[2]=r;break}e[o]=Math.sqrt(Math.max(0,1-(r*r+t*t+s*s)))}export{ne as SPZLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as H,X as V,Y as O,Z as lt,_ as M,$ as P,a0 as Nt,a1 as le,a2 as ue,a3 as me,a4 as de,a5 as ut,a6 as B,a7 as E,a8 as Zt,a9 as N,aa as L,ab as he,ac as jt,ad as pe,ae as ge,af as xe,ag as w,ah as mt,ai as y,aj as dt,ak as be,al as fe,am as _e,an as ye,ao as Ae,ap as Ve,aq as ht,ar as Se,as as Mt,at as Q,au as pt,av as qt,aw as Wt,ax as tt,ay as zt,az as et,aA as ve,aB as we,aC as Be}from"./index-DMyJcoZJ.js";import{g as Ce,b as He,S as gt}from"./GaussianSplatUtils-CB77cP9U.js";class Re{constructor(t,{binCount:e=4096,workgroupSize:n=256}={}){this.count=t,this.binCount=e,this.workgroupSize=n;const s=new Uint32Array(t);for(let l=0;l<t;l++)s[l]=l;this.orderAttribute=new H(s,1,Uint32Array);const a=new H(new Uint32Array(t),1,Uint32Array),r=new H(new Uint32Array(e),1,Uint32Array),c=new H(new Uint32Array(e),1,Uint32Array);this.orderRead=V(this.orderAttribute,"uint",t).toReadOnly(),this.orderWrite=V(this.orderAttribute,"uint",t),this.binRead=V(a,"uint",t).toReadOnly(),this.binWrite=V(a,"uint",t),this.histogramAtomic=V(r,"uint",e).toAtomic(),this.offsetAtomic=V(c,"uint",e).toAtomic(),this._webGLBuffersEnabled=!1,this._cpuBins=new Uint32Array(t),this._cpuCounts=new Uint32Array(e),this._cpuOffsets=new Uint32Array(e),this._resetNode=null,this._histogramNode=null,this._prefixNode=null,this._scatterNode=null}setBinNode(t){const{binCount:e,workgroupSize:n,count:s}=this;this._resetNode=O(()=>{lt(this.histogramAtomic.element(M),P(0)),lt(this.offsetAtomic.element(M),P(0))})().compute(e,[n]).setName("CountingSortReset"),this._histogramNode=O(()=>{const a=t().toVar("bin");this.binWrite.element(M).assign(a),Nt(this.histogramAtomic.element(a),P(1))})().compute(s,[n]).setName("CountingSortHistogram"),this._prefixNode=O(()=>{const a=P(0).toVar("sum");le({start:0,end:e,type:"uint",name:"bin",condition:"<"},({bin:r})=>{const c=ue(this.histogramAtomic.element(r)).toVar("count");lt(this.offsetAtomic.element(r),a),a.addAssign(c)})})().compute(1).setName("CountingSortPrefix"),this._scatterNode=O(()=>{const a=this.binRead.element(M).toVar("bin"),r=Nt(this.offsetAtomic.element(a),P(1)).toVar("targetIndex");this.orderWrite.element(r).assign(M)})().compute(s,[n]).setName("CountingSortScatter")}compute(t){t.compute(this._resetNode),t.compute(this._histogramNode),t.compute(this._prefixNode),t.compute(this._scatterNode)}computeCPU(t){const{count:e,binCount:n}=this,s=this.orderAttribute.array,a=this._cpuBins,r=this._cpuCounts,c=this._cpuOffsets;r.fill(0);for(let i=0;i<e;i++){const u=t(i);a[i]=u,r[u]++}let l=0;for(let i=0;i<n;i++)c[i]=l,l+=r[i];for(let i=0;i<e;i++)s[c[a[i]]++]=i;this.orderAttribute.needsUpdate=!0,this.orderAttribute.pbo!==void 0&&(this.orderAttribute.pbo.needsUpdate=!0)}enableWebGLBuffers(){this._webGLBuffersEnabled!==!0&&(this.orderAttribute.setUsage(me),this.orderRead.setPBO(!0),this._webGLBuffersEnabled=!0)}}const T=4096,Ft=256,Ne=.9995,Dt=.3,F=2,Me=1e-4,We=.2,Pt=1024,ze=1.4,It=new B,Ot=new B,ot=new B,xt=new B,Ut=new Zt,Tt=new E,Lt=new E,Et=new E,I=new pe,bt=new jt,q=new ye,nt=new B,ft=new B,kt=new B,st=new B;class Fe extends de{constructor(t,{autoSort:e=!0}={}){const n=t.getAttribute("position"),s=t.getAttribute("covariance"),a=t.getAttribute("color"),r=Ce(t),c=n.count;t.boundingBox===null&&t.computeBoundingBox(),t.boundingSphere===null&&t.computeBoundingSphere();const l=Pe(c),i=Ie(c,n.array,s.array,a.array,{degree:r,sh1:r>=1?t.getAttribute("sphericalHarmonics1").array:void 0,sh2:r>=2?t.getAttribute("sphericalHarmonics2").array:void 0,sh3:r>=3?t.getAttribute("sphericalHarmonics3").array:void 0}),u=ut(new B),m=Ee(i,u),_=new Re(c,{binCount:T,workgroupSize:Ft}),p=ke(i,_,u),f=Ge(p.vertexNode,p.fragmentNode);f.receivedShadowPositionNode=p.shadowPositionNode,super(l,f),this.isGaussianSplat=!0,this.type="GaussianSplat",this.splatGeometry=t,this.boundingBox=null,this.boundingSphere=null,this.autoSort=e,this._buffers=i,this._sort=_,this._sortMatrix=ut(new E),this._sortDepthRange=ut(new Zt(0,1)),this._sortInitialized=!1,this._lastSortDirection=new B,this._localCameraPosition=u,this._sphericalHarmonicsComputeNode=m,this._sphericalHarmonicsInitialized=!1,this._lastSphericalHarmonicsCameraMatrix=new E,this._lastSphericalHarmonicsWorldMatrix=new E,this._sphericalHarmonicsVertexNode=p.sphericalHarmonicsVertexNode,this._precomputedSphericalHarmonicsVertexNode=p.vertexNode,this._positionAttribute=n;const h=i.centerRead,A=this._sortMatrix,d=this._sortDepthRange;_.setBinNode(()=>{const g=h.element(M).xyz.toVar("center"),x=A.mul(N(g,1)).xyz.toVar("viewCenter").z.negate().toVar("depth"),S=L(d.y.sub(d.x),1e-4).toVar("range"),C=x.sub(d.x).div(S).clamp(0,1).toVar("normalized"),v=P(C.mul(T-1)).toVar("depthBin");return P(T-1).sub(v)}),this.onBeforeRender=(g,b,x)=>{const S=g.backend&&g.backend.isWebGLBackend===!0?this._sphericalHarmonicsVertexNode:this._precomputedSphericalHarmonicsVertexNode;S!==null&&f.vertexNode!==S&&(f.vertexNode=S,f.needsUpdate=!0),this.updateSphericalHarmonics(g,x),this.autoSort===!0&&this.updateSort(g,x)}}updateSphericalHarmonics(t,e){if(this._sphericalHarmonicsComputeNode===null)return!1;const n=t.backend&&t.backend.isWebGLBackend===!0;return this._sphericalHarmonicsInitialized===!0&&e.matrixWorld.equals(this._lastSphericalHarmonicsCameraMatrix)&&this.matrixWorld.equals(this._lastSphericalHarmonicsWorldMatrix)&&(n===!0||this._buffers.sphericalHarmonicsContributionRead!==void 0)||(n===!0&&Gt(this._buffers),Tt.copy(this.matrixWorld).invert(),this._localCameraPosition.value.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Tt),this._lastSphericalHarmonicsCameraMatrix.copy(e.matrixWorld),this._lastSphericalHarmonicsWorldMatrix.copy(this.matrixWorld),this._sphericalHarmonicsInitialized=!0,n===!0)?!1:(Oe(this._buffers),t.compute(this._sphericalHarmonicsComputeNode),!0)}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new he),this.boundingBox.makeEmpty();const t=this.splatGeometry.getAttribute("position"),e=this.splatGeometry.getAttribute("covariance"),n=t.count;for(let s=0;s<n;s++){const a=t.getX(s),r=t.getY(s),c=t.getZ(s),l=e.getComponent(s,0),i=e.getComponent(s,3),u=e.getComponent(s,5),m=F*Math.sqrt(Math.max(l,i,u));this.boundingBox.expandByPoint(st.set(a-m,r-m,c-m)),this.boundingBox.expandByPoint(st.set(a+m,r+m,c+m))}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new jt),this.computeBoundingBox(),this.boundingBox.getBoundingSphere(this.boundingSphere);const t=this.splatGeometry.getAttribute("position"),e=this.splatGeometry.getAttribute("covariance"),n=t.count,s=this.boundingSphere.center;let a=0;for(let r=0;r<n;r++){const c=t.getX(r),l=t.getY(r),i=t.getZ(r),u=e.getComponent(r,0),m=e.getComponent(r,3),_=e.getComponent(r,5),p=F*Math.sqrt(Math.max(u,m,_));a=Math.max(a,s.distanceTo(st.set(c,l,i))+p)}this.boundingSphere.radius=a}raycast(t,e){const n=this.matrixWorld;if(this.boundingSphere===null&&this.computeBoundingSphere(),bt.copy(this.boundingSphere),bt.applyMatrix4(n),t.ray.intersectsSphere(bt)===!1||(Et.copy(n).invert(),I.copy(t.ray).applyMatrix4(Et),this.boundingBox!==null&&I.intersectsBox(this.boundingBox)===!1))return;const s=this.splatGeometry.getAttribute("position"),a=this.splatGeometry.getAttribute("covariance"),r=this.splatGeometry.getAttribute("color"),c=s.count;for(let l=0;l<c;l++)De(s,a,r,l,n,t,e,this)}updateSort(t,e){this.updateWorldMatrix(!0,!1);const n=this._needsSort(e);return this._sortInitialized===!1||n===!0?(this._updateSortUniforms(e),t.backend&&t.backend.isWebGLBackend===!0?(Gt(this._buffers),this._sort.enableWebGLBuffers(),this._sortCPU()):this._sort.compute(t),this._sortInitialized=!0,this._lastSortDirection.copy(xt),!0):!1}_needsSort(t){Lt.multiplyMatrices(t.matrixWorldInverse,this.matrixWorld);const e=Lt.elements;return xt.set(e[2],e[6],e[10]).normalize(),xt.dot(this._lastSortDirection)<Ne}_updateSortUniforms(t){this._sortMatrix.value.multiplyMatrices(t.matrixWorldInverse,this.matrixWorld),this.boundingSphere===null&&this.computeBoundingSphere(),It.copy(this.boundingSphere.center).applyMatrix4(this.matrixWorld),Ot.copy(It).applyMatrix4(t.matrixWorldInverse),ot.setFromMatrixScale(this.matrixWorld);const e=this.boundingSphere.radius*Math.max(ot.x,ot.y,ot.z),n=-Ot.z,s=Math.max(t.near,n-e),a=Math.max(s+1e-4,n+e);Ut.set(s,a),this._sortDepthRange.value.copy(Ut)}_sortCPU(){const t=this._positionAttribute.array,e=this._sortMatrix.value.elements,n=this._sortDepthRange.value.x,s=Math.max(this._sortDepthRange.value.y-n,1e-4),a=(T-1)/s;this._sort.computeCPU(r=>{const c=r*3,l=-(e[2]*t[c]+e[6]*t[c+1]+e[10]*t[c+2]+e[14]),i=Math.min(T-1,Math.max(0,Math.floor((l-n)*a)));return T-1-i})}}function De(o,t,e,n,s,a,r,c){if(e.getW(n)<We)return;const l=t.getComponent(n,0),i=t.getComponent(n,3),u=t.getComponent(n,5),m=Math.max(l,i,u);if(m<=0)return;const _=st.fromBufferAttribute(o,n),p=F*Math.sqrt(m);if(I.distanceSqToPoint(_)>p*p)return;const f=t.getComponent(n,1),h=t.getComponent(n,2),A=t.getComponent(n,4),d=m*Me;if(q.set(l+d,f,h,f,i+d,A,h,A,u+d),q.determinant()<=0)return;q.invert(),ft.copy(I.direction).applyMatrix3(q);const b=I.direction.dot(ft);if(b<=0)return;nt.copy(I.origin).sub(_),kt.copy(nt).applyMatrix3(q);const x=2*nt.dot(ft),S=nt.dot(kt)-F*F,C=x*x-4*b*S;if(C<0)return;const v=Math.sqrt(C);let R=(-x-v)/(2*b);if(R<0&&(R=(-x+v)/(2*b)),R<0)return;const W=new B;I.at(R,W).applyMatrix4(s);const z=a.ray.origin.distanceTo(W);z<a.near||z>a.far||r.push({distance:z,point:W,index:n,face:null,faceIndex:null,barycoord:null,object:c})}function Pe(o){const t=new ge;return t.setAttribute("position",new xe(new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]),3)),t.setIndex([0,1,2,0,2,3]),t.instanceCount=o,t}function Ie(o,t,e,n,s){const a=new Float32Array(o*4),r=new Float32Array(o*4),c=new Float32Array(o*4),l=new Uint32Array(o),i=s.degree;for(let h=0;h<o;h++){const A=h*3,d=h*4,g=h*6;a[d]=t[A],a[d+1]=t[A+1],a[d+2]=t[A+2],r[d]=e[g],r[d+1]=e[g+1],r[d+2]=e[g+2],r[d+3]=e[g+3],c[d]=e[g+4],c[d+1]=e[g+5],l[h]=(n[d]|n[d+1]<<8|n[d+2]<<16|n[d+3]<<24)>>>0}const u=new H(a,4),m=new H(r,4),_=new H(c,4),p=new H(l,1),f={count:o,sphericalHarmonicsDegree:i,webGLBuffersEnabled:!1,centerRead:V(u,"vec4",o).toReadOnly(),covarianceARead:V(m,"vec4",o).toReadOnly(),covarianceBRead:V(_,"vec4",o).toReadOnly(),colorRead:V(p,"uint",o).toReadOnly()};for(let h=1;h<=i;h++){const A=He[h],d=new H(s[`sh${h}`],1);f[`sphericalHarmonics${h}Attribute`]=d,f[`sphericalHarmonics${h}Read`]=V(d,"uint",o*A).toReadOnly(),f[`sphericalHarmonics${h}Words`]=A}return f}function Oe(o){if(o.sphericalHarmonicsContributionRead!==void 0)return;const t=new H(new Float32Array(o.count*4),4);o.sphericalHarmonicsContributionRead=V(t,"vec4",o.count).toReadOnly(),o.sphericalHarmonicsContributionWrite=V(t,"vec4",o.count)}function Gt(o){if(o.webGLBuffersEnabled!==!0){o.centerRead.setPBO(!0),o.covarianceARead.setPBO(!0),o.covarianceBRead.setPBO(!0),o.colorRead.setPBO(!0);for(let t=1;t<=o.sphericalHarmonicsDegree;t++)o[`sphericalHarmonics${t}Read`].setPBO(!0);o.webGLBuffersEnabled=!0}}function Ue(o,t,e,n){const s=[];let a=n;for(let r=0;r<e&&a>0;r++){const c=o.element(t.mul(e).add(r)).toVar(),l=Math.min(4,a);for(let i=0;i<l;i++){const u=c.shiftRight(i*8).bitAnd(255);s.push(qt(u).sub(128).div(128))}a-=l}return s}function Te(o,t){const e=[],n=o.length/3;for(let s=0;s<n;s++){const a=s*3;e.push(w(o[a],o[a+1],o[a+2]).toVar(`${t}${s}`))}return e}function Le(o,t){let e=o[0].mul(t[0]);for(let n=1;n<o.length;n++)e=e.add(o[n].mul(t[n]));return e}function _t(o,t,e,n,s,a){const r=Ue(o,t,e,n),c=Te(r,s);return Le(c,a)}function Yt(o,t,e,n,s){const a=Ae(t.sub(e)).toVar("sphericalHarmonicsViewDirection"),r=a.x,c=a.y,l=a.z;if(o.addAssign(_t(s.sphericalHarmonics1Read,n,s.sphericalHarmonics1Words,gt[1],"sh1_",[c.mul(-.4886025),l.mul(.4886025),r.mul(-.4886025)])),s.sphericalHarmonicsDegree>=2){const i=r.mul(r).toVar("shXX"),u=c.mul(c).toVar("shYY"),m=l.mul(l).toVar("shZZ");if(o.addAssign(_t(s.sphericalHarmonics2Read,n,s.sphericalHarmonics2Words,gt[2],"sh2_",[r.mul(c).mul(1.0925484),c.mul(l).mul(-1.0925484),m.mul(2).sub(i).sub(u).mul(.3153915),r.mul(l).mul(-1.0925484),i.sub(u).mul(.5462742)])),s.sphericalHarmonicsDegree>=3){const _=r.mul(c).toVar("shXY");o.addAssign(_t(s.sphericalHarmonics3Read,n,s.sphericalHarmonics3Words,gt[3],"sh3_",[c.mul(i.mul(3).sub(u)).mul(-.5900436),_.mul(l).mul(2.8906114),c.mul(m.mul(4).sub(i).sub(u)).mul(-.4570458),l.mul(m.mul(2).sub(i.mul(3)).sub(u.mul(3))).mul(.3731763),r.mul(m.mul(4).sub(i).sub(u)).mul(-.4570458),l.mul(i.sub(u)).mul(1.4453057),r.mul(i.sub(u.mul(3))).mul(-.5900436)]))}}}function Ee(o,t){return o.sphericalHarmonicsDegree===0?null:O(()=>{const e=M,n=o.centerRead.element(e).xyz.toVar("center"),s=w(0).toVar("sphericalHarmonicsContribution");Yt(s,n,t,e,o),o.sphericalHarmonicsContributionWrite.element(e).assign(N(s,0))})().compute(o.count,[Ft]).setName("GaussianSplatSphericalHarmonics")}function ke(o,t,e){const n=mt("vec2","vSplatUv"),s=mt("vec4","vSplatColor"),a=mt("vec3","vSplatWorldPosition"),r=u=>O(()=>{const m=t.orderRead.element(M).toVar("splatIndex"),_=o.centerRead.element(m).xyz.toVar("center"),p=o.covarianceARead.element(m).toVar("covA"),f=o.covarianceBRead.element(m).toVar("covB"),h=Ve(o.colorRead.element(m)).toVar("splatColor"),A=h.rgb.toVar("splatRgb");o.sphericalHarmonicsDegree>0&&(u===!0?A.addAssign(o.sphericalHarmonicsContributionRead.element(m).rgb):Yt(A,_,e,m,o)),n.assign(ht.xy),a.assign(Se.mul(N(_,1)).xyz);const d=Mt.mul(N(_,1)).toVar("viewCenter4"),g=d.xyz.toVar("viewCenter"),b=Q.mul(d).toVar("centerClip"),x=Mt,S=w(x[0].x,x[1].x,x[2].x).toVar("r0"),C=w(x[0].y,x[1].y,x[2].y).toVar("r1"),v=w(x[0].z,x[1].z,x[2].z).toVar("r2"),R=w(p.x,p.y,p.z).toVar("cov0"),W=w(p.y,p.w,f.x).toVar("cov1"),z=w(p.z,f.x,f.y).toVar("cov2"),rt=w(y(S,R),y(S,W),y(S,z)).toVar("vc0"),yt=w(y(C,R),y(C,W),y(C,z)).toVar("vc1"),Xt=w(y(v,R),y(v,W),y(v,z)).toVar("vc2"),$t=y(rt,S).toVar("c00"),Kt=y(rt,C).toVar("c01"),At=y(rt,v).toVar("c02"),Jt=y(yt,C).toVar("c11"),Vt=y(yt,v).toVar("c12"),at=y(Xt,v).toVar("c22"),Qt=pt(g.z,-.01).toVar("z"),Y=qt(1).div(Qt).toVar("invZ"),St=Y.mul(Y).toVar("invZ2"),U=Wt.zw.mul(.5).mul(tt(Q[0].x,Q[1].y)).toVar("focal"),it=Q[3].w.toVar("orthographic"),vt=it.oneMinus().toVar("perspective"),k=zt(U.x.negate().mul(Y),U.x,it).toVar("j00"),G=zt(U.y.negate().mul(Y),U.y,it).toVar("j11"),Z=U.x.mul(g.x).mul(St).mul(vt).toVar("j02"),j=U.y.mul(g.y).mul(St).mul(vt).toVar("j12"),wt=k.mul(k).mul($t).add(k.mul(Z).mul(At).mul(2)).add(Z.mul(Z).mul(at)).toVar("cov2dABase"),D=k.mul(G).mul(Kt).add(k.mul(j).mul(At)).add(Z.mul(G).mul(Vt)).add(Z.mul(j).mul(at)).toVar("cov2dB"),Bt=G.mul(G).mul(Jt).add(G.mul(j).mul(Vt).mul(2)).add(j.mul(j).mul(at)).toVar("cov2dCBase"),X=wt.add(Dt).toVar("cov2dA"),$=Bt.add(Dt).toVar("cov2dC"),te=wt.mul(Bt).sub(D.mul(D)).toVar("detBase"),ee=X.mul($).sub(D.mul(D)).toVar("det"),oe=et(L(te.div(L(ee,1e-6)),0)).toVar("alphaScale");s.assign(N(A.clamp(0,1),h.a.mul(oe)));const Ct=X.add($).mul(.5).toVar("halfTrace"),ct=et(L(X.sub($).mul(.5).pow2().add(D.mul(D)),1e-7)).toVar("radius"),ne=L(Ct.add(ct),1e-7).toVar("lambda1"),se=L(Ct.sub(ct),1e-7).toVar("lambda2"),K=tt(1,0).toVar("axis1");dt(ct.greaterThan(1e-5),()=>{const Rt=ve(D.mul(2),X.sub($)).mul(.5).toVar("angle");K.assign(tt(we(Rt),Be(Rt)))});const re=tt(K.y.negate(),K.x).toVar("axis2"),ae=pt(et(ne),Pt).toVar("scale1"),ie=pt(et(se),Pt).toVar("scale2"),ce=K.mul(ht.x).mul(ae).add(re.mul(ht.y).mul(ie)).toVar("offsetPixels").mul(2).div(Wt.zw).toVar("offsetNdc"),Ht=b.add(N(ce.mul(b.w),0,0)).toVar("clip"),J=b.w.mul(ze).toVar("clipLimit");return dt(g.z.greaterThanEqual(-.01).or(b.z.lessThan(b.w.negate())).or(b.z.greaterThan(b.w)).or(b.x.lessThan(J.negate())).or(b.x.greaterThan(J)).or(b.y.lessThan(J.negate())).or(b.y.greaterThan(J)),()=>{Ht.assign(N(2,2,2,1))}),Ht})(),c=r(!0),l=o.sphericalHarmonicsDegree>0?r(!1):null,i=O(()=>{const u=y(n,n).toVar("r2");return dt(u.greaterThan(4),()=>{be()}),N(s.rgb,fe(u.mul(-.5)).mul(s.a))})();return{vertexNode:c,sphericalHarmonicsVertexNode:l,fragmentNode:i,shadowPositionNode:a}}function Ge(o,t){const e=new _e;return e.vertexNode=o,e.colorNode=t,e.transparent=!0,e.depthWrite=!1,e.depthTest=!0,e.forceSinglePass=!0,e.fog=!1,e}export{Fe as GaussianSplat};
|
|
1
|
+
import{W as H,X as V,Y as O,Z as lt,_ as M,$ as P,a0 as Nt,a1 as le,a2 as ue,a3 as me,a4 as de,a5 as ut,a6 as B,a7 as E,a8 as Zt,a9 as N,aa as L,ab as he,ac as jt,ad as pe,ae as ge,af as xe,ag as w,ah as mt,ai as y,aj as dt,ak as be,al as fe,am as _e,an as ye,ao as Ae,ap as Ve,aq as ht,ar as Se,as as Mt,at as Q,au as pt,av as qt,aw as Wt,ax as tt,ay as zt,az as et,aA as ve,aB as we,aC as Be}from"./index-Baka-ZO7.js";import{g as Ce,b as He,S as gt}from"./GaussianSplatUtils-CptQkDVX.js";class Re{constructor(t,{binCount:e=4096,workgroupSize:n=256}={}){this.count=t,this.binCount=e,this.workgroupSize=n;const s=new Uint32Array(t);for(let l=0;l<t;l++)s[l]=l;this.orderAttribute=new H(s,1,Uint32Array);const a=new H(new Uint32Array(t),1,Uint32Array),r=new H(new Uint32Array(e),1,Uint32Array),c=new H(new Uint32Array(e),1,Uint32Array);this.orderRead=V(this.orderAttribute,"uint",t).toReadOnly(),this.orderWrite=V(this.orderAttribute,"uint",t),this.binRead=V(a,"uint",t).toReadOnly(),this.binWrite=V(a,"uint",t),this.histogramAtomic=V(r,"uint",e).toAtomic(),this.offsetAtomic=V(c,"uint",e).toAtomic(),this._webGLBuffersEnabled=!1,this._cpuBins=new Uint32Array(t),this._cpuCounts=new Uint32Array(e),this._cpuOffsets=new Uint32Array(e),this._resetNode=null,this._histogramNode=null,this._prefixNode=null,this._scatterNode=null}setBinNode(t){const{binCount:e,workgroupSize:n,count:s}=this;this._resetNode=O(()=>{lt(this.histogramAtomic.element(M),P(0)),lt(this.offsetAtomic.element(M),P(0))})().compute(e,[n]).setName("CountingSortReset"),this._histogramNode=O(()=>{const a=t().toVar("bin");this.binWrite.element(M).assign(a),Nt(this.histogramAtomic.element(a),P(1))})().compute(s,[n]).setName("CountingSortHistogram"),this._prefixNode=O(()=>{const a=P(0).toVar("sum");le({start:0,end:e,type:"uint",name:"bin",condition:"<"},({bin:r})=>{const c=ue(this.histogramAtomic.element(r)).toVar("count");lt(this.offsetAtomic.element(r),a),a.addAssign(c)})})().compute(1).setName("CountingSortPrefix"),this._scatterNode=O(()=>{const a=this.binRead.element(M).toVar("bin"),r=Nt(this.offsetAtomic.element(a),P(1)).toVar("targetIndex");this.orderWrite.element(r).assign(M)})().compute(s,[n]).setName("CountingSortScatter")}compute(t){t.compute(this._resetNode),t.compute(this._histogramNode),t.compute(this._prefixNode),t.compute(this._scatterNode)}computeCPU(t){const{count:e,binCount:n}=this,s=this.orderAttribute.array,a=this._cpuBins,r=this._cpuCounts,c=this._cpuOffsets;r.fill(0);for(let i=0;i<e;i++){const u=t(i);a[i]=u,r[u]++}let l=0;for(let i=0;i<n;i++)c[i]=l,l+=r[i];for(let i=0;i<e;i++)s[c[a[i]]++]=i;this.orderAttribute.needsUpdate=!0,this.orderAttribute.pbo!==void 0&&(this.orderAttribute.pbo.needsUpdate=!0)}enableWebGLBuffers(){this._webGLBuffersEnabled!==!0&&(this.orderAttribute.setUsage(me),this.orderRead.setPBO(!0),this._webGLBuffersEnabled=!0)}}const T=4096,Ft=256,Ne=.9995,Dt=.3,F=2,Me=1e-4,We=.2,Pt=1024,ze=1.4,It=new B,Ot=new B,ot=new B,xt=new B,Ut=new Zt,Tt=new E,Lt=new E,Et=new E,I=new pe,bt=new jt,q=new ye,nt=new B,ft=new B,kt=new B,st=new B;class Fe extends de{constructor(t,{autoSort:e=!0}={}){const n=t.getAttribute("position"),s=t.getAttribute("covariance"),a=t.getAttribute("color"),r=Ce(t),c=n.count;t.boundingBox===null&&t.computeBoundingBox(),t.boundingSphere===null&&t.computeBoundingSphere();const l=Pe(c),i=Ie(c,n.array,s.array,a.array,{degree:r,sh1:r>=1?t.getAttribute("sphericalHarmonics1").array:void 0,sh2:r>=2?t.getAttribute("sphericalHarmonics2").array:void 0,sh3:r>=3?t.getAttribute("sphericalHarmonics3").array:void 0}),u=ut(new B),m=Ee(i,u),_=new Re(c,{binCount:T,workgroupSize:Ft}),p=ke(i,_,u),f=Ge(p.vertexNode,p.fragmentNode);f.receivedShadowPositionNode=p.shadowPositionNode,super(l,f),this.isGaussianSplat=!0,this.type="GaussianSplat",this.splatGeometry=t,this.boundingBox=null,this.boundingSphere=null,this.autoSort=e,this._buffers=i,this._sort=_,this._sortMatrix=ut(new E),this._sortDepthRange=ut(new Zt(0,1)),this._sortInitialized=!1,this._lastSortDirection=new B,this._localCameraPosition=u,this._sphericalHarmonicsComputeNode=m,this._sphericalHarmonicsInitialized=!1,this._lastSphericalHarmonicsCameraMatrix=new E,this._lastSphericalHarmonicsWorldMatrix=new E,this._sphericalHarmonicsVertexNode=p.sphericalHarmonicsVertexNode,this._precomputedSphericalHarmonicsVertexNode=p.vertexNode,this._positionAttribute=n;const h=i.centerRead,A=this._sortMatrix,d=this._sortDepthRange;_.setBinNode(()=>{const g=h.element(M).xyz.toVar("center"),x=A.mul(N(g,1)).xyz.toVar("viewCenter").z.negate().toVar("depth"),S=L(d.y.sub(d.x),1e-4).toVar("range"),C=x.sub(d.x).div(S).clamp(0,1).toVar("normalized"),v=P(C.mul(T-1)).toVar("depthBin");return P(T-1).sub(v)}),this.onBeforeRender=(g,b,x)=>{const S=g.backend&&g.backend.isWebGLBackend===!0?this._sphericalHarmonicsVertexNode:this._precomputedSphericalHarmonicsVertexNode;S!==null&&f.vertexNode!==S&&(f.vertexNode=S,f.needsUpdate=!0),this.updateSphericalHarmonics(g,x),this.autoSort===!0&&this.updateSort(g,x)}}updateSphericalHarmonics(t,e){if(this._sphericalHarmonicsComputeNode===null)return!1;const n=t.backend&&t.backend.isWebGLBackend===!0;return this._sphericalHarmonicsInitialized===!0&&e.matrixWorld.equals(this._lastSphericalHarmonicsCameraMatrix)&&this.matrixWorld.equals(this._lastSphericalHarmonicsWorldMatrix)&&(n===!0||this._buffers.sphericalHarmonicsContributionRead!==void 0)||(n===!0&&Gt(this._buffers),Tt.copy(this.matrixWorld).invert(),this._localCameraPosition.value.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Tt),this._lastSphericalHarmonicsCameraMatrix.copy(e.matrixWorld),this._lastSphericalHarmonicsWorldMatrix.copy(this.matrixWorld),this._sphericalHarmonicsInitialized=!0,n===!0)?!1:(Oe(this._buffers),t.compute(this._sphericalHarmonicsComputeNode),!0)}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new he),this.boundingBox.makeEmpty();const t=this.splatGeometry.getAttribute("position"),e=this.splatGeometry.getAttribute("covariance"),n=t.count;for(let s=0;s<n;s++){const a=t.getX(s),r=t.getY(s),c=t.getZ(s),l=e.getComponent(s,0),i=e.getComponent(s,3),u=e.getComponent(s,5),m=F*Math.sqrt(Math.max(l,i,u));this.boundingBox.expandByPoint(st.set(a-m,r-m,c-m)),this.boundingBox.expandByPoint(st.set(a+m,r+m,c+m))}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new jt),this.computeBoundingBox(),this.boundingBox.getBoundingSphere(this.boundingSphere);const t=this.splatGeometry.getAttribute("position"),e=this.splatGeometry.getAttribute("covariance"),n=t.count,s=this.boundingSphere.center;let a=0;for(let r=0;r<n;r++){const c=t.getX(r),l=t.getY(r),i=t.getZ(r),u=e.getComponent(r,0),m=e.getComponent(r,3),_=e.getComponent(r,5),p=F*Math.sqrt(Math.max(u,m,_));a=Math.max(a,s.distanceTo(st.set(c,l,i))+p)}this.boundingSphere.radius=a}raycast(t,e){const n=this.matrixWorld;if(this.boundingSphere===null&&this.computeBoundingSphere(),bt.copy(this.boundingSphere),bt.applyMatrix4(n),t.ray.intersectsSphere(bt)===!1||(Et.copy(n).invert(),I.copy(t.ray).applyMatrix4(Et),this.boundingBox!==null&&I.intersectsBox(this.boundingBox)===!1))return;const s=this.splatGeometry.getAttribute("position"),a=this.splatGeometry.getAttribute("covariance"),r=this.splatGeometry.getAttribute("color"),c=s.count;for(let l=0;l<c;l++)De(s,a,r,l,n,t,e,this)}updateSort(t,e){this.updateWorldMatrix(!0,!1);const n=this._needsSort(e);return this._sortInitialized===!1||n===!0?(this._updateSortUniforms(e),t.backend&&t.backend.isWebGLBackend===!0?(Gt(this._buffers),this._sort.enableWebGLBuffers(),this._sortCPU()):this._sort.compute(t),this._sortInitialized=!0,this._lastSortDirection.copy(xt),!0):!1}_needsSort(t){Lt.multiplyMatrices(t.matrixWorldInverse,this.matrixWorld);const e=Lt.elements;return xt.set(e[2],e[6],e[10]).normalize(),xt.dot(this._lastSortDirection)<Ne}_updateSortUniforms(t){this._sortMatrix.value.multiplyMatrices(t.matrixWorldInverse,this.matrixWorld),this.boundingSphere===null&&this.computeBoundingSphere(),It.copy(this.boundingSphere.center).applyMatrix4(this.matrixWorld),Ot.copy(It).applyMatrix4(t.matrixWorldInverse),ot.setFromMatrixScale(this.matrixWorld);const e=this.boundingSphere.radius*Math.max(ot.x,ot.y,ot.z),n=-Ot.z,s=Math.max(t.near,n-e),a=Math.max(s+1e-4,n+e);Ut.set(s,a),this._sortDepthRange.value.copy(Ut)}_sortCPU(){const t=this._positionAttribute.array,e=this._sortMatrix.value.elements,n=this._sortDepthRange.value.x,s=Math.max(this._sortDepthRange.value.y-n,1e-4),a=(T-1)/s;this._sort.computeCPU(r=>{const c=r*3,l=-(e[2]*t[c]+e[6]*t[c+1]+e[10]*t[c+2]+e[14]),i=Math.min(T-1,Math.max(0,Math.floor((l-n)*a)));return T-1-i})}}function De(o,t,e,n,s,a,r,c){if(e.getW(n)<We)return;const l=t.getComponent(n,0),i=t.getComponent(n,3),u=t.getComponent(n,5),m=Math.max(l,i,u);if(m<=0)return;const _=st.fromBufferAttribute(o,n),p=F*Math.sqrt(m);if(I.distanceSqToPoint(_)>p*p)return;const f=t.getComponent(n,1),h=t.getComponent(n,2),A=t.getComponent(n,4),d=m*Me;if(q.set(l+d,f,h,f,i+d,A,h,A,u+d),q.determinant()<=0)return;q.invert(),ft.copy(I.direction).applyMatrix3(q);const b=I.direction.dot(ft);if(b<=0)return;nt.copy(I.origin).sub(_),kt.copy(nt).applyMatrix3(q);const x=2*nt.dot(ft),S=nt.dot(kt)-F*F,C=x*x-4*b*S;if(C<0)return;const v=Math.sqrt(C);let R=(-x-v)/(2*b);if(R<0&&(R=(-x+v)/(2*b)),R<0)return;const W=new B;I.at(R,W).applyMatrix4(s);const z=a.ray.origin.distanceTo(W);z<a.near||z>a.far||r.push({distance:z,point:W,index:n,face:null,faceIndex:null,barycoord:null,object:c})}function Pe(o){const t=new ge;return t.setAttribute("position",new xe(new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]),3)),t.setIndex([0,1,2,0,2,3]),t.instanceCount=o,t}function Ie(o,t,e,n,s){const a=new Float32Array(o*4),r=new Float32Array(o*4),c=new Float32Array(o*4),l=new Uint32Array(o),i=s.degree;for(let h=0;h<o;h++){const A=h*3,d=h*4,g=h*6;a[d]=t[A],a[d+1]=t[A+1],a[d+2]=t[A+2],r[d]=e[g],r[d+1]=e[g+1],r[d+2]=e[g+2],r[d+3]=e[g+3],c[d]=e[g+4],c[d+1]=e[g+5],l[h]=(n[d]|n[d+1]<<8|n[d+2]<<16|n[d+3]<<24)>>>0}const u=new H(a,4),m=new H(r,4),_=new H(c,4),p=new H(l,1),f={count:o,sphericalHarmonicsDegree:i,webGLBuffersEnabled:!1,centerRead:V(u,"vec4",o).toReadOnly(),covarianceARead:V(m,"vec4",o).toReadOnly(),covarianceBRead:V(_,"vec4",o).toReadOnly(),colorRead:V(p,"uint",o).toReadOnly()};for(let h=1;h<=i;h++){const A=He[h],d=new H(s[`sh${h}`],1);f[`sphericalHarmonics${h}Attribute`]=d,f[`sphericalHarmonics${h}Read`]=V(d,"uint",o*A).toReadOnly(),f[`sphericalHarmonics${h}Words`]=A}return f}function Oe(o){if(o.sphericalHarmonicsContributionRead!==void 0)return;const t=new H(new Float32Array(o.count*4),4);o.sphericalHarmonicsContributionRead=V(t,"vec4",o.count).toReadOnly(),o.sphericalHarmonicsContributionWrite=V(t,"vec4",o.count)}function Gt(o){if(o.webGLBuffersEnabled!==!0){o.centerRead.setPBO(!0),o.covarianceARead.setPBO(!0),o.covarianceBRead.setPBO(!0),o.colorRead.setPBO(!0);for(let t=1;t<=o.sphericalHarmonicsDegree;t++)o[`sphericalHarmonics${t}Read`].setPBO(!0);o.webGLBuffersEnabled=!0}}function Ue(o,t,e,n){const s=[];let a=n;for(let r=0;r<e&&a>0;r++){const c=o.element(t.mul(e).add(r)).toVar(),l=Math.min(4,a);for(let i=0;i<l;i++){const u=c.shiftRight(i*8).bitAnd(255);s.push(qt(u).sub(128).div(128))}a-=l}return s}function Te(o,t){const e=[],n=o.length/3;for(let s=0;s<n;s++){const a=s*3;e.push(w(o[a],o[a+1],o[a+2]).toVar(`${t}${s}`))}return e}function Le(o,t){let e=o[0].mul(t[0]);for(let n=1;n<o.length;n++)e=e.add(o[n].mul(t[n]));return e}function _t(o,t,e,n,s,a){const r=Ue(o,t,e,n),c=Te(r,s);return Le(c,a)}function Yt(o,t,e,n,s){const a=Ae(t.sub(e)).toVar("sphericalHarmonicsViewDirection"),r=a.x,c=a.y,l=a.z;if(o.addAssign(_t(s.sphericalHarmonics1Read,n,s.sphericalHarmonics1Words,gt[1],"sh1_",[c.mul(-.4886025),l.mul(.4886025),r.mul(-.4886025)])),s.sphericalHarmonicsDegree>=2){const i=r.mul(r).toVar("shXX"),u=c.mul(c).toVar("shYY"),m=l.mul(l).toVar("shZZ");if(o.addAssign(_t(s.sphericalHarmonics2Read,n,s.sphericalHarmonics2Words,gt[2],"sh2_",[r.mul(c).mul(1.0925484),c.mul(l).mul(-1.0925484),m.mul(2).sub(i).sub(u).mul(.3153915),r.mul(l).mul(-1.0925484),i.sub(u).mul(.5462742)])),s.sphericalHarmonicsDegree>=3){const _=r.mul(c).toVar("shXY");o.addAssign(_t(s.sphericalHarmonics3Read,n,s.sphericalHarmonics3Words,gt[3],"sh3_",[c.mul(i.mul(3).sub(u)).mul(-.5900436),_.mul(l).mul(2.8906114),c.mul(m.mul(4).sub(i).sub(u)).mul(-.4570458),l.mul(m.mul(2).sub(i.mul(3)).sub(u.mul(3))).mul(.3731763),r.mul(m.mul(4).sub(i).sub(u)).mul(-.4570458),l.mul(i.sub(u)).mul(1.4453057),r.mul(i.sub(u.mul(3))).mul(-.5900436)]))}}}function Ee(o,t){return o.sphericalHarmonicsDegree===0?null:O(()=>{const e=M,n=o.centerRead.element(e).xyz.toVar("center"),s=w(0).toVar("sphericalHarmonicsContribution");Yt(s,n,t,e,o),o.sphericalHarmonicsContributionWrite.element(e).assign(N(s,0))})().compute(o.count,[Ft]).setName("GaussianSplatSphericalHarmonics")}function ke(o,t,e){const n=mt("vec2","vSplatUv"),s=mt("vec4","vSplatColor"),a=mt("vec3","vSplatWorldPosition"),r=u=>O(()=>{const m=t.orderRead.element(M).toVar("splatIndex"),_=o.centerRead.element(m).xyz.toVar("center"),p=o.covarianceARead.element(m).toVar("covA"),f=o.covarianceBRead.element(m).toVar("covB"),h=Ve(o.colorRead.element(m)).toVar("splatColor"),A=h.rgb.toVar("splatRgb");o.sphericalHarmonicsDegree>0&&(u===!0?A.addAssign(o.sphericalHarmonicsContributionRead.element(m).rgb):Yt(A,_,e,m,o)),n.assign(ht.xy),a.assign(Se.mul(N(_,1)).xyz);const d=Mt.mul(N(_,1)).toVar("viewCenter4"),g=d.xyz.toVar("viewCenter"),b=Q.mul(d).toVar("centerClip"),x=Mt,S=w(x[0].x,x[1].x,x[2].x).toVar("r0"),C=w(x[0].y,x[1].y,x[2].y).toVar("r1"),v=w(x[0].z,x[1].z,x[2].z).toVar("r2"),R=w(p.x,p.y,p.z).toVar("cov0"),W=w(p.y,p.w,f.x).toVar("cov1"),z=w(p.z,f.x,f.y).toVar("cov2"),rt=w(y(S,R),y(S,W),y(S,z)).toVar("vc0"),yt=w(y(C,R),y(C,W),y(C,z)).toVar("vc1"),Xt=w(y(v,R),y(v,W),y(v,z)).toVar("vc2"),$t=y(rt,S).toVar("c00"),Kt=y(rt,C).toVar("c01"),At=y(rt,v).toVar("c02"),Jt=y(yt,C).toVar("c11"),Vt=y(yt,v).toVar("c12"),at=y(Xt,v).toVar("c22"),Qt=pt(g.z,-.01).toVar("z"),Y=qt(1).div(Qt).toVar("invZ"),St=Y.mul(Y).toVar("invZ2"),U=Wt.zw.mul(.5).mul(tt(Q[0].x,Q[1].y)).toVar("focal"),it=Q[3].w.toVar("orthographic"),vt=it.oneMinus().toVar("perspective"),k=zt(U.x.negate().mul(Y),U.x,it).toVar("j00"),G=zt(U.y.negate().mul(Y),U.y,it).toVar("j11"),Z=U.x.mul(g.x).mul(St).mul(vt).toVar("j02"),j=U.y.mul(g.y).mul(St).mul(vt).toVar("j12"),wt=k.mul(k).mul($t).add(k.mul(Z).mul(At).mul(2)).add(Z.mul(Z).mul(at)).toVar("cov2dABase"),D=k.mul(G).mul(Kt).add(k.mul(j).mul(At)).add(Z.mul(G).mul(Vt)).add(Z.mul(j).mul(at)).toVar("cov2dB"),Bt=G.mul(G).mul(Jt).add(G.mul(j).mul(Vt).mul(2)).add(j.mul(j).mul(at)).toVar("cov2dCBase"),X=wt.add(Dt).toVar("cov2dA"),$=Bt.add(Dt).toVar("cov2dC"),te=wt.mul(Bt).sub(D.mul(D)).toVar("detBase"),ee=X.mul($).sub(D.mul(D)).toVar("det"),oe=et(L(te.div(L(ee,1e-6)),0)).toVar("alphaScale");s.assign(N(A.clamp(0,1),h.a.mul(oe)));const Ct=X.add($).mul(.5).toVar("halfTrace"),ct=et(L(X.sub($).mul(.5).pow2().add(D.mul(D)),1e-7)).toVar("radius"),ne=L(Ct.add(ct),1e-7).toVar("lambda1"),se=L(Ct.sub(ct),1e-7).toVar("lambda2"),K=tt(1,0).toVar("axis1");dt(ct.greaterThan(1e-5),()=>{const Rt=ve(D.mul(2),X.sub($)).mul(.5).toVar("angle");K.assign(tt(we(Rt),Be(Rt)))});const re=tt(K.y.negate(),K.x).toVar("axis2"),ae=pt(et(ne),Pt).toVar("scale1"),ie=pt(et(se),Pt).toVar("scale2"),ce=K.mul(ht.x).mul(ae).add(re.mul(ht.y).mul(ie)).toVar("offsetPixels").mul(2).div(Wt.zw).toVar("offsetNdc"),Ht=b.add(N(ce.mul(b.w),0,0)).toVar("clip"),J=b.w.mul(ze).toVar("clipLimit");return dt(g.z.greaterThanEqual(-.01).or(b.z.lessThan(b.w.negate())).or(b.z.greaterThan(b.w)).or(b.x.lessThan(J.negate())).or(b.x.greaterThan(J)).or(b.y.lessThan(J.negate())).or(b.y.greaterThan(J)),()=>{Ht.assign(N(2,2,2,1))}),Ht})(),c=r(!0),l=o.sphericalHarmonicsDegree>0?r(!1):null,i=O(()=>{const u=y(n,n).toVar("r2");return dt(u.greaterThan(4),()=>{be()}),N(s.rgb,fe(u.mul(-.5)).mul(s.a))})();return{vertexNode:c,sphericalHarmonicsVertexNode:l,fragmentNode:i,shadowPositionNode:a}}function Ge(o,t){const e=new _e;return e.vertexNode=o,e.colorNode=t,e.transparent=!0,e.depthWrite=!1,e.depthTest=!0,e.forceSinglePass=!0,e.fog=!1,e}export{Fe as GaussianSplat};
|