xzw 1 miesiąc temu
rodzic
commit
8e66263249

src/custom/objects/3dgs/splatter/7zCps/7z-wasm/7zz.es6.js → build/potree/workers/7zCps/7z-wasm/7zz.es6.js


src/custom/objects/3dgs/splatter/7zCps/7z-wasm/7zz.wasm → build/potree/workers/7zCps/7z-wasm/7zz.wasm


src/custom/objects/3dgs/splatter/7zCps/7z-worker.js → build/potree/workers/7zCps/7z-worker.js


+ 2 - 2
rollup.config.js

@@ -39,7 +39,7 @@ for (const dir of buildPaths) {
 					name: 'Potree',
 					sourcemap: false
 				}
-			}, {
+			}/* , {
 				input: 'src/workers/testWorkers.js',
 				output: {
 					file: `${dir}/potree/workers/testWorkers.js`,
@@ -47,7 +47,7 @@ for (const dir of buildPaths) {
 					name: 'Potree',
 					sourcemap: false
 				}
-			},{
+			} */,{
 				input: 'src/modules/loader/2.0/DecoderWorker.js',
 				output: {
 					file: `${dir}/potree/workers/2.0/DecoderWorker.js`,

Plik diff jest za duży
+ 0 - 4458
src/custom/objects/3dgs/splatter/7zCps.js


Plik diff jest za duży
+ 0 - 20
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/7zz.umd.js


+ 0 - 56
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/License.txt

@@ -1,56 +0,0 @@
-  7-Zip
-  ~~~~~
-  License for use and distribution
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-  7-Zip Copyright (C) 1999-2015 Igor Pavlov.
-
-  Licenses for files are:
-
-    1) 7zz.*.js, 7zz.wasm: GNU LGPL + unRAR restriction
-    2) All other files:  GNU LGPL
-
-  The GNU LGPL + unRAR restriction means that you must follow both
-  GNU LGPL rules and unRAR restriction rules.
-
-
-  Note:
-    You can use 7-Zip on any computer, including a computer in a commercial
-    organization. You don't need to register or pay for 7-Zip.
-
-
-  GNU LGPL information
-  --------------------
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You can receive a copy of the GNU Lesser General Public License from
-    http://www.gnu.org/
-
-
-  unRAR restriction
-  -----------------
-
-    The decompression engine for RAR archives was developed using source
-    code of unRAR program.
-    All copyrights to original unRAR code are owned by Alexander Roshal.
-
-    The license for original unRAR code has the following restriction:
-
-      The unRAR sources cannot be used to re-create the RAR compression algorithm,
-      which is proprietary. Distribution of modified unRAR sources in separate form
-      or as a part of other software is permitted, provided that it is clearly
-      stated in the documentation and source comments that the code may
-      not be used to develop a RAR (WinRAR) compatible archiver.
-
-
-  --
-  Igor Pavlov

+ 0 - 66
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/README.md

@@ -1,66 +0,0 @@
-# 7-Zip WASM
-
-7-Zip compiled to WASM with emscripten. Based on 7-Zip 24.09 (2024-11-29).
-
-- Runs in any JavaScript environment that supports WASM (Browser or NodeJS)
-- Supports all file formats that the full `7zz` CLI supports.
-- Only Emscripten NODEFS and WORKERFS adapters are included by default.
-
-Inspired by https://github.com/sonictruth/7zip.js
-
-## Usage
-
-### Command-line
-
-```
-npx 7z-wasm --help
-```
-
-or
-
-```
-npm i -g 7z-wasm
-7z-wasm --help
-```
-
-### As a module
-
-```ts
-import SevenZip from "7z-wasm";
-
-const sevenZip = await SevenZip();
-
-const archiveData = new Uint8Array(100);
-const archiveName = "archive.7z";
-
-const stream = sevenZip.FS.open(archiveName, "w+");
-sevenZip.FS.write(stream, archiveData, 0, archiveData.length);
-sevenZip.FS.close(stream);
-
-const filesToExtract = ["some-file.txt"];
-sevenZip.callMain(["x", archiveName, ...filesToExtract]);
-console.log(sevenZip.FS.readFile(filesToExtract[0]));
-```
-
-### Working with the real file system (Node.JS only)
-
-```ts
-import SevenZip from "7z-wasm";
-
-const mountRoot = "/nodefs";
-sevenZip.FS.mkdir(mountRoot);
-sevenZip.FS.mount(sevenZip.NODEFS, { root: "/real/root/folder" }, mountRoot);
-sevenZip.FS.chdir(mountRoot + "/subfolder");
-
-sevenZip.callMain(["x", "archive.7z", "some-file.txt"]);
-```
-
-## Building
-
-Because the 7-Zip sources are not available on GitHub, the build process relies on downloading the sources from the
-7-Zip website and patching them so they compile with emcc.
-
-- Install docker
-- Execute `./build` (or `.\build`, respectively, on Windows CMD)
-
-You can pass custom options to emcc via env file (e.g. see [build-umd.env]())

+ 0 - 2
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/bin/cli

@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require("../cli.js");

+ 0 - 53
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/cli.js

@@ -1,53 +0,0 @@
-var path = require("path");
-var SevenZip = require("./7zz.umd");
-var readlineSync = require("readline-sync");
-
-var buf;
-var i = 0;
-
-SevenZip({
-    stdin: () => {
-        if (!buf) {
-            buf = readlineSync.question() + "\n";
-        }
-        if (i < buf.length) {
-            return buf.charCodeAt(i++);
-        }
-        buf = void 0;
-        i = 0;
-        return null;
-    },
-    stdout: (charCode) => {
-        if (charCode !== null) {
-            process.stdout.write(String.fromCharCode(charCode));
-        }
-    },
-	quit: (code) => {
-        if (code) {
-            process.exit(code);
-        }
-    }
-}).then(sevenZip => {
-    // HACK: The WASM 7-Zip sets file mode to 000 when extracting tar archives, making it impossible to extract sub-folders
-    var chmodOrig = sevenZip.FS.chmod;
-    sevenZip.FS.chmod = function(path, mode, dontFollow) {
-        if (!mode) {
-            return;
-        }
-        chmodOrig(path, mode, dontFollow);
-    };
-
-    var cwd = process.cwd();
-    var hostRoot = path.parse(cwd).root;
-    var hostDir = path.relative(hostRoot, cwd).split(path.sep).join("/");
-    var mountRoot = "/nodefs";
-	sevenZip.FS.mkdir(mountRoot);
-    sevenZip.FS.mount(sevenZip.NODEFS, { root: hostRoot }, mountRoot);
-    sevenZip.FS.chdir(mountRoot + "/" + hostDir);
-
-    var args = process.argv.slice(2);
-    sevenZip.callMain(args);
-}).catch(e => {
-    console.error(e);
-    process.exit(-1);
-});

+ 0 - 208
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/index.d.ts

@@ -1,208 +0,0 @@
-export interface SevenZipModuleFactory {
-    (opts?: Partial<SevenZipModuleOptions>): Promise<SevenZipModule>;
-}
-
-export interface SevenZipModuleOptions {
-    noFSInit: boolean;
-    stdin(): number;
-    stdout(charCode: number): void;
-    stderr(charCode: number): void;
-
-    preInit: Array<{ (): void }>;
-    preRun: Array<{ (): void }>;
-    postRun: Array<{ (): void }>;
-
-    locateFile(url: string, scriptDirectory: string): string;
-    print(str: string): void;
-    printErr(str: string): void;
-    quit(code: number, exitStatus: ExitStatus): void;
-    onAbort(what: string | number): void;
-    onExit(code: number): void;
-    onRuntimeInitialized(): void;
-    noExitRuntime: boolean;
-    logReadFiles: boolean;
-    wasmBinary: ArrayBuffer;
-}
-
-export interface ExitStatus {
-    name: string;
-    message: string;
-    status: number;
-}
-
-export interface SevenZipModule {
-    FS: FileSystem;
-    NODEFS: FileSystem;
-    WORKERFS: FileSystem;
-    callMain(args: string[]): void;
-}
-
-export interface FileSystem {
-    //
-    // paths
-    //
-    lookupPath(path: string, opts?: FSLookupOpts): FSLookup;
-    getPath(node: FSNode): string;
-
-    //
-    // nodes
-    //
-    isFile(mode: number): boolean;
-    isDir(mode: number): boolean;
-    isLink(mode: number): boolean;
-    isChrdev(mode: number): boolean;
-    isBlkdev(mode: number): boolean;
-    isFIFO(mode: number): boolean;
-    isSocket(mode: number): boolean;
-
-    //
-    // devices
-    //
-    major(dev: number): number;
-    minor(dev: number): number;
-    makedev(ma: number, mi: number): number;
-    registerDevice(dev: number, ops: any): void;
-
-    //
-    // core
-    //
-    syncfs(populate: boolean, callback: (e: number | null) => void): void;
-    syncfs(callback: (e: number | null) => void, populate?: boolean): void;
-    mount(type: FileSystem, opts: any, mountpoint: string): FSNode;
-    unmount(mountpoint: string): void;
-
-    mkdir(path: string, mode?: number): FSNode;
-    mkdev(path: string, mode?: number, dev?: number): FSNode;
-    symlink(oldpath: string, newpath: string): FSNode;
-    rename(old_path: string, new_path: string): void;
-    rmdir(path: string): void;
-    readdir(path: string): string[];
-    unlink(path: string): void;
-    readlink(path: string): string;
-    stat(path: string, dontFollow?: boolean): FSNodeAttr;
-    lstat(path: string): FSNodeAttr;
-    chmod(path: string, mode: number, dontFollow?: boolean): void;
-    lchmod(path: string, mode: number): void;
-    fchmod(fd: number, mode: number): void;
-    chown(path: string, uid: number, gid: number, dontFollow?: boolean): void;
-    lchown(path: string, uid: number, gid: number): void;
-    fchown(fd: number, uid: number, gid: number): void;
-    truncate(path: string, len: number): void;
-    ftruncate(fd: number, len: number): void;
-    utime(path: string, atime: number, mtime: number): void;
-    open(path: string, flags: string, mode?: number, fd_start?: number, fd_end?: number): FSStream;
-    close(stream: FSStream): void;
-    llseek(stream: FSStream, offset: number, whence: number): number;
-    read(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number): number;
-    write(
-        stream: FSStream,
-        buffer: ArrayBufferView,
-        offset: number,
-        length: number,
-        position?: number,
-        canOwn?: boolean,
-    ): number;
-    allocate(stream: FSStream, offset: number, length: number): void;
-    mmap(
-        stream: FSStream,
-        buffer: ArrayBufferView,
-        offset: number,
-        length: number,
-        position: number,
-        prot: number,
-        flags: number,
-    ): any;
-    readFile(path: string, opts: { encoding: 'binary'; flags?: string | undefined }): Uint8Array;
-    readFile(path: string, opts: { encoding: 'utf8'; flags?: string | undefined }): string;
-    readFile(path: string, opts?: { flags?: string | undefined }): Uint8Array;
-    writeFile(path: string, data: string | ArrayBufferView, opts?: { flags?: string | undefined }): void;
-
-    //
-    // module-level FS code
-    //
-    cwd(): string;
-    chdir(path: string): void;
-    init(
-        input?: null | (() => number | null),
-        output?: null | ((c: number) => any),
-        error?: null | ((c: number) => any),
-    ): void;
-
-    createLazyFile(
-        parent: string | FSNode,
-        name: string,
-        url: string,
-        canRead: boolean,
-        canWrite: boolean,
-    ): FSNode;
-    createPreloadedFile(
-        parent: string | FSNode,
-        name: string,
-        url: string,
-        canRead: boolean,
-        canWrite: boolean,
-        onload?: () => void,
-        onerror?: () => void,
-        dontCreateFile?: boolean,
-        canOwn?: boolean,
-    ): void;
-    createDataFile(
-        parent: string | FSNode,
-        name: string,
-        data: ArrayBufferView,
-        canRead: boolean,
-        canWrite: boolean,
-        canOwn: boolean,
-    ): FSNode;
-}
-
-export interface FSLookupOpts {
-    follow?: boolean;
-    follow_mount?: boolean;
-    parent?: boolean;
-}
-
-export interface FSLookup {
-    path: string;
-    node: FSNode;
-}
-
-export interface FSStream {
-    object: FSNode;
-    isRead: boolean;
-    isWrite: boolean;
-    isAppend: boolean;
-}
-export interface FSNode {
-    contents: Record<string, FSNode>;
-    id: number;
-    mode: number;
-    mount: unknown;
-    name: string;
-    parent: FSNode | undefined;
-    rdev: number;
-    timestamp: number;
-    isDevice: boolean;
-    isFolder: boolean;
-    read: boolean;
-    write: boolean;
-}
-
-export interface FSNodeAttr {
-    dev: number;
-    ino: number;
-    mode: number;
-    nlink: number;
-    uid: number;
-    gid: number;
-    rdev: unknown;
-    size: number;
-    atime: Date;
-    mtime: Date;
-    ctime: Date;
-    blksize: number;
-    blocks: number;
-}
-
-declare const factory: SevenZipModuleFactory;
-export default factory;

+ 0 - 46
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/package.json

@@ -1,46 +0,0 @@
-{
-  "name": "7z-wasm",
-  "version": "1.2.0",
-  "description": "7-Zip for JavaScript environments, compiled to WASM",
-  "bin": "bin/cli",
-  "main": "7zz.umd.js",
-  "module": "7zz.es6.js",
-  "types": "index.d.ts",
-  "scripts": {
-    "test": "mocha test/*.spec.js"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/use-strict/7z-wasm.git"
-  },
-  "keywords": [
-    "7-Zip",
-    "7zip",
-    "archive",
-    "7z",
-    "7zz",
-    "wasm",
-    "tar",
-    "zip",
-    "rar",
-    "gz",
-    "bz",
-    "bz2",
-    "nsis"
-  ],
-  "author": "Alexandru Ciuca",
-  "license": "SEE LICENSE IN License.txt",
-  "bugs": {
-    "url": "https://github.com/use-strict/7z-wasm/issues"
-  },
-  "homepage": "https://github.com/use-strict/7z-wasm#README.md",
-  "engines": {
-    "node": ">=8.0.0"
-  },
-  "dependencies": {
-    "readline-sync": "^1.4.10"
-  },
-  "devDependencies": {
-    "mocha": "^10.2.0"
-  }
-}

+ 0 - 41
src/custom/objects/3dgs/splatter/7zCps/7z-wasm/unRarLicense.txt

@@ -1,41 +0,0 @@
- ******    *****   ******   unRAR - free utility for RAR archives
- **   **  **   **  **   **  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ******   *******  ******    License for use and distribution of
- **   **  **   **  **   **   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **   **  **   **  **   **         FREE portable version
-                                   ~~~~~~~~~~~~~~~~~~~~~
-
-      The source code of unRAR utility is freeware. This means:
-
-   1. All copyrights to RAR and the utility unRAR are exclusively
-      owned by the author - Alexander Roshal.
-
-   2. The unRAR sources may be used in any software to handle RAR
-      archives without limitations free of charge, but cannot be used
-      to re-create the RAR compression algorithm, which is proprietary.
-      Distribution of modified unRAR sources in separate form or as a
-      part of other software is permitted, provided that it is clearly
-      stated in the documentation and source comments that the code may
-      not be used to develop a RAR (WinRAR) compatible archiver.
-
-   3. The unRAR utility may be freely distributed. No person or company 
-      may charge a fee for the distribution of unRAR without written
-      permission from the copyright holder.
-
-   4. THE RAR ARCHIVER AND THE UNRAR UTILITY ARE DISTRIBUTED "AS IS".
-      NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.  YOU USE AT 
-      YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, 
-      DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
-      OR MISUSING THIS SOFTWARE.
-
-   5. Installing and using the unRAR utility signifies acceptance of
-      these terms and conditions of the license.
-
-   6. If you don't agree with terms of the license you must remove
-      unRAR files from your storage devices and cease to use the
-      utility.
-
-      Thank you for your interest in RAR and unRAR.
-
-
-                                            Alexander L. Roshal

+ 53 - 71
src/custom/objects/3dgs/splatter/SplatterThree.js

@@ -3,11 +3,7 @@ import * as THREE from "../../../../../libs/three.js/build/three.module.js";
 
 import browser from '../../../utils/browser.js'
  
-
-
-
- let worker = new Worker(Potree.scriptPath + '/workers/testWorker.js') 
-
+ 
 
 //2025.11 下载   Ver2
 let lastLodTime = 0 , lastCanSort = 0, lastRender = 0, lastHit = 0
@@ -410,95 +406,81 @@ function inlineWorker(A) {
 var Decoder7z = class {//7z解压
     constructor(tree1Byte8) { 
         this.workers = []
+        this.waitings = []
         this.promiseList = new Map
         this.version = 0
         this.tree1Byte8 = tree1Byte8
-        const max = 1
-        //const wasmUrl = Potree.scriptPath + '/workers/'
-         
+        const max = 3
+        this.log = false
         let this_ = this
         for (let g = 0; g < max; g++) {
-            
-           
-            
-            let worker = new Worker(new URL("./7z-worker.js", import.meta.url), {
-              type: "module",
-            });
-            
-            
+              
+            let worker = new Worker(Potree.scriptPath + '/workers/7zCps/7z-worker.js', {
+                type: "module",
+            }) 
             //let worker = inlineWorker(getWorker7z)
-            worker.index = g
-            worker.postMessage({
-                t: 'init',
-                wasmUrl  
-            })  
+            worker.index = g 
             worker.onmessage = function({data}){ 
-                console.log('worker'+ this.index+'onmessage', data )
-                let type = data.t
-                if(type == 'opened'){
-                    var curr = data.data.fileList[0]
-                    this.postMessage({
-                        t: 'extract',
-                        idx: curr.idx,
-                        name: curr.name,
-                        id: data.data.id //标识
-                    })
-                }else{
-                    this_[type](data, this)
-                }
+                //console.log('worker'+ this.index+'onmessage', data )
+                this_[data.type](data, this)
             }
             ,
             this.workers.push(worker)
         }
         
     } 
-    decode(blob ) {//请求
+    decode(ab) {//请求
         return new Promise((resolve => { 
             let id = this.version++;
-            console.log('请求decode', id)
-            this.promiseList.set(id, {blob,resolve})  
+            this.log && console.log('请求decode', id)
+            this.waitings.push(id)
+            this.promiseList.set(id, {ab,resolve})  
             this.decodeNext() 
         }))
     } 
     decodeNext(){
-        if(!this.wasmReady)return
-        let waitDecode = this.promiseList.entries().next().value
-        if(waitDecode){
-            let id = waitDecode[0]
+       
+        //waitDecode = this.waitList.entries().next().value
+        while(this.waitings.length){ 
+            let id = this.waitings[0] 
             let worker = this.workers.find(e=>!e.inUse)
-            if(worker){
-                console.log('begin decode', id, 'worker index:', worker.index)
-                worker.inUse = true
-                worker.postMessage({
-                    t: 'open',
-                    blob: waitDecode[1].blob,
-                    id
-                });
-            } 
+            if(!worker)break;
+            
+            worker.inUse = true
+            worker.curTaskId = id 
+            
+            this.log && console.log('begin decode', id, 'worker index:', worker.index)
+            this.log && (worker.startTime = performance.now())
+            this.waitings.splice(0,1)
+            worker.postMessage({
+                filename: id+'',
+                arrayBuffer: this.promiseList.get(id).ab,
+                //id
+            });  
+            
+             
         }
     }
-    extracted({id, blob}, worker){ 
-        if (!this.promiseList.has(id))
+    
+    
+    done({result}, worker){ 
+        let id = worker.curTaskId
+        if (!this.promiseList.has(id)){
             throw Error("decode: internal error");
-        blob.arrayBuffer().then((ab)=>{
-            let result = getData(ab, this.tree1Byte8)
-             
-            this.promiseList.get(id).resolve(result)  
-            this.promiseList.delete(id)
-            console.log('decoded!', id)
-            setTimeout(()=>{
-                worker.inUse = false 
-                this.decodeNext() 
-            },1000) //"FS error  <generic error, no stack>"
-            
-        }) 
+        }
+        let ab = result[0].data.buffer
+        let data = getData(ab, this.tree1Byte8)
+         
+        this.promiseList.get(id).resolve(data)  
+        this.promiseList.delete(id)
+         
+        this.log && console.log('decoded!', id, 'costTime:', performance.now()-worker.startTime)
+        //setTimeout(()=>{
+            worker.inUse = false 
+            this.decodeNext() 
+        //},1000)   
         
-    }
-    
-    ready(){
-        this.wasmReady = true
-        this.decodeNext()
-    }
+    } 
     
 }
 
@@ -875,7 +857,7 @@ var maxTexSize = isMobile() ? 4096 : 8192
         return fetch(url).then((A => {
             if (!A.ok)
                 throw Error(`Error fetching ${fileName}: ${A.status} ${A.statusText}`);
-            return this.cps7z ? A.blob() : A.arrayBuffer()
+            return A.arrayBuffer()
         })).then((A => { 
         
             if(this.originGsData){

+ 0 - 6
src/workers/testWorker.js

@@ -1,6 +0,0 @@
-
-
-
-
-
-console.log('testhhhhhhh')