fozmo-3d-preview
Advanced tools
Comparing version 1.0.65 to 1.0.66
@@ -14,2 +14,3 @@ import * as THREE from 'three'; | ||
interaction: boolean; | ||
alpha: boolean; | ||
} | ||
@@ -16,0 +17,0 @@ type UpdateFunc = (delta: number) => void; |
@@ -22,3 +22,3 @@ import * as THREE from 'three'; | ||
this.scene = new THREE.Scene(); | ||
const { gl = { stencil: false }, powerPreference = 'high-performance', enableShadowMap = true, cameraFOV = 45, cameraFOVLandscape = 80, cameraNear = 0.1, cameraFar = 1000, autoRender = true, interaction = true, fps = BPGameConfig.FPS, } = config; | ||
const { gl = { stencil: false }, powerPreference = 'high-performance', enableShadowMap = true, cameraFOV = 45, cameraFOVLandscape = 80, cameraNear = 0.1, cameraFar = 1000, autoRender = true, interaction = true, fps = BPGameConfig.FPS, alpha = false } = config; | ||
this.cameraFOV = cameraFOV; | ||
@@ -30,3 +30,3 @@ this.cameraFOVLandscape = cameraFOVLandscape; | ||
this.container = container; | ||
this.renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference, ...gl }); | ||
this.renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference, ...gl, alpha }); | ||
Utils.setPixelRatio(this.renderer); | ||
@@ -33,0 +33,0 @@ this.renderer.setSize(this.container.clientWidth, this.container.clientHeight); |
@@ -127,2 +127,6 @@ import { ENV } from './framework/defines/HHGameTypes'; | ||
saveCallback?: (params: RenderParam, showToast: boolean) => void; | ||
/** | ||
* 是否背景透明 | ||
*/ | ||
alpha?: boolean; | ||
} | ||
@@ -129,0 +133,0 @@ export declare class Fozmo3DPreview { |
@@ -56,3 +56,3 @@ import { MainScene } from '../scenes/MainScene'; | ||
*/ | ||
initScene() { | ||
initScene(alpha = false) { | ||
if (!this._mainScene) { | ||
@@ -64,2 +64,3 @@ this._mainScene = new MainScene(BPGameConfig.ElementId, { | ||
interaction: false, | ||
alpha | ||
}); | ||
@@ -88,3 +89,3 @@ this.pushScene(this._mainScene); | ||
async loadModle(url, config) { | ||
this.initScene(); | ||
this.initScene(config.alpha === undefined ? false : config.alpha); | ||
try { | ||
@@ -91,0 +92,0 @@ this._mainScene.pause = true; |
@@ -35,2 +35,3 @@ import { BaseScene, BaseSceneConfig } from '../Base/BaseScene'; | ||
closed: boolean; | ||
private _alpha; | ||
constructor(elementId?: string, config?: Partial<BaseSceneConfig>); | ||
@@ -37,0 +38,0 @@ init(url: string, config: LaunchConfig): Promise<boolean>; |
@@ -258,2 +258,3 @@ import { EEncryptExt, ENormalExt, ResLoaderManager } from './../manager/ResLoaderManager'; | ||
closed = false; | ||
_alpha = false; | ||
constructor(elementId = 'game', config = {}) { | ||
@@ -265,2 +266,3 @@ super(elementId, config); | ||
HHConsole.log('Launch Config', config); | ||
this._alpha = config.alpha === undefined ? false : config.alpha; | ||
this.closed = false; | ||
@@ -620,3 +622,8 @@ if (config.params !== undefined && !!config.params) { | ||
if (v) { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
} | ||
} | ||
@@ -629,3 +636,8 @@ else { | ||
.onChange((v) => { | ||
this.scene.background = new THREE.Color(v); | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(v); | ||
} | ||
}); | ||
@@ -987,3 +999,8 @@ const lutFolder = gui.addFolder('达芬奇调色'); | ||
if (this._params.usePureBGColor) { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
} | ||
} | ||
@@ -1109,6 +1126,16 @@ this._bloomPass.enabled = this._params.bloomEnabled; | ||
if (!this._params.usePureBGColor) { | ||
this.scene.background = envtexture; | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = envtexture; | ||
} | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
} | ||
} | ||
@@ -1136,6 +1163,16 @@ this.scene.environment = envtexture; | ||
if (!this._params.usePureBGColor) { | ||
this.scene.background = texture; | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = texture; | ||
} | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
if (this._alpha) { | ||
this.scene.background = null; | ||
} | ||
else { | ||
this.scene.background = new THREE.Color(this._params.bgColor); | ||
} | ||
} | ||
@@ -1142,0 +1179,0 @@ this.scene.environment = texture; |
{ | ||
"name": "fozmo-3d-preview", | ||
"version": "1.0.65", | ||
"version": "1.0.66", | ||
"description": "风之末 作品预览", | ||
@@ -5,0 +5,0 @@ "main": "lib/Fozmo3DPreview.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
210042
6228