参考 clearDepth()

clearDepth()

Clears the depth buffer in WebGL mode.

clearDepth() clears information about how far objects are from the camera in 3D space. This information is stored in an object called the depth buffer. Clearing the depth buffer ensures new objects aren't drawn behind old ones. Doing so can be useful for feedback effects in which the previous frame serves as the background for the current frame.

The parameter, depth, is optional. If a number is passed, as in clearDepth(0.5), it determines the range of objects to clear from the depth buffer. 0 doesn't clear any depth information, 0.5 clears depth information halfway between the near and far clipping planes, and 1 clears depth information all the way to the far clipping plane. By default, depth is 1.

Note: clearDepth() can only be used in WebGL mode.

示例

语法

clearDepth([depth])

参数

depth
Number:

amount of the depth buffer to clear between 0 (none) and 1 (far clipping plane). Defaults to 1.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/rendering.js and open a pull request!

相关参考