版本:3.8.0
depthRenderTexture这个是用一个专门的相机来渲染场景里的东西到这个RenderTexture上面的。
depthMaterial就是水面材质,需要用这个深度图来计算水面物体的浮沫。
PhysicsWaterDemo.setDepthTexture(this.depthMaterial, this.depthRenderTexture.window.framebuffer.depthStencilTexture);
public static setDepthTexture(depthMaterial: Material, depthTexture: gfx.Texture, texturePropertyName: string = "depthTexture"): void {
depthMaterial.setProperty(texturePropertyName, depthTexture);
const pass0 = depthMaterial.passes[0];
const bindingIndex = pass0.getBinding(texturePropertyName);
pass0.bindTexture(bindingIndex, depthTexture);
pass0.bindSampler(bindingIndex, director.root.pipeline.globalDSManager.pointSampler);
}
运行起来,效果正常,但会有很多Webgl的警告,是我哪里写错了吗。
