New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fozmo-3d-preview

Package Overview
Dependencies
Maintainers
0
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fozmo-3d-preview - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

lib/Base/BaseScene.d.ts

@@ -36,4 +36,4 @@ import * as THREE from 'three';

loop(delta: number): void;
destroy(): Promise<void>;
destroy(): void;
}
export {};

@@ -96,3 +96,3 @@ import * as THREE from 'three';

}
async destroy() {
destroy() {
HHConsole.info('销毁场景');

@@ -111,3 +111,2 @@ LoopManager.inst.setCurrentBaseLoop(undefined);

this.scene.clear();
await Utils.delay(50);
this.renderer.forceContextLoss();

@@ -114,0 +113,0 @@ this.renderer.domElement = null;

@@ -35,2 +35,8 @@ import { ENV } from './framework/defines/HHGameTypes';

static Launch(config: LaunchConfig): Promise<void>;
/**
* 切换模型
* @param url 模型链接
*/
static changeModel(url: string): Promise<void>;
static destroy(): void;
}

@@ -0,1 +1,2 @@

import { SpaceManager } from './manager/SpaceManager';
import { LaunchSpace } from './root';

@@ -10,2 +11,12 @@ export class Fozmo3DPreview {

}
/**
* 切换模型
* @param url 模型链接
*/
static async changeModel(url) {
await SpaceManager.inst.changeModel(url);
}
static destroy() {
SpaceManager.inst.destroy();
}
}

@@ -23,2 +23,4 @@ import { MainScene } from '../scenes/MainScene';

loadModle(url: string): Promise<void>;
changeModel(url: string): Promise<void>;
destroy(): void;
}

@@ -67,2 +67,12 @@ import { MainScene } from '../scenes/MainScene';

}
async changeModel(url) {
if (this._mainScene) {
await this._mainScene.changeModel(url);
}
}
destroy() {
if (this._mainScene) {
this._mainScene.destroy();
}
}
}

@@ -30,2 +30,3 @@ import { BaseScene, BaseSceneConfig } from '../Base/BaseScene';

private handleUSDZ;
changeModel(url: string): Promise<void>;
private loadModel;

@@ -38,2 +39,7 @@ private loadHDR;

render(delta?: number): void;
/**
* 消除场景里的模型
*/
clear(): void;
destroy(): void;
}

@@ -402,3 +402,16 @@ import { EEncryptExt, ENormalExt, ResLoaderManager } from './../manager/ResLoaderManager';

}
async changeModel(url) {
BPGameConfig.TestFile = url;
await this.loadModel(url);
const padding = 0.05;
this._orbitControl.fitToBox(this._model, true, {
cover: false,
paddingBottom: padding,
paddingLeft: padding,
paddingRight: padding,
paddingTop: padding,
});
}
async loadModel(url, rootPath = '') {
this.clear();
let file = url;

@@ -528,2 +541,26 @@ if (BPGameConfig.TestFile) {

}
/**
* 消除场景里的模型
*/
clear() {
if (this._model) {
this.scene.remove(this._model);
this._model.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.geometry?.dispose();
Object.values(child.material).forEach((value) => {
if (value && typeof value.dispose === "function") {
value.dispose();
}
});
}
});
this._model = null;
}
}
destroy() {
this._orbitControl.dispose();
this._orbitControl = null;
super.destroy();
}
}
{
"name": "fozmo-3d-preview",
"version": "1.0.02",
"version": "1.0.03",
"description": "风之末 作品预览",

@@ -5,0 +5,0 @@ "main": "lib/Fozmo3DPreview.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc