layabox / LayaAir

LayaAir is a fully platform rendering engine with rich 2D/3D rendering capabilities and a mature integrated development platform

Home Page:https://www.layaair.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.0 透明相机报错

Geequlim opened this issue · comments

环境信息

Chrome 110.0.5481.177 on Arch Linux
LayaAir Master3.0 with f77aed3

错误描述

相机的 clearFlag 设置为 DepthOnly 时无法正确清屏,并报错如下

[.WebGL-0x24d803f1cd00] GL_INVALID_OPERATION: Invalid copy texture format combination.

用例

创建用于在UI上一层,播放3D粒子特效的透明场景场景

示例代码

async initialize() {
	this.scene = new Laya.Scene3D();
	if (this.scene.physicsSimulation) this.scene.physicsSimulation.fixedTimeStep = 1;
	Laya.stage.addChild(this.scene);

	this.directionLight = new Laya.DirectionLight();
	this.scene.addChild(this.directionLight);

	this.camera = new Laya.Camera(0, 0.01, 1000);
	this.camera.orthographic = true;
	this.camera.orthographicVerticalSize = 20;
	this.camera.clearFlag = Laya.CameraClearFlags.DepthOnly;
	this.camera.depthTextureFormat = Laya.RenderTargetFormat.DEPTH_32;

	this.camera.enableHDR = false;
	this.scene.addChild(this.camera);
}
commented

fix in #972