getInternalDepthFormat method

int getInternalDepthFormat(
  1. bool useStencil, [
  2. int? depthType
])

Implementation

int getInternalDepthFormat(bool useStencil, [int? depthType ]) {
	late int glInternalFormat;

	if ( useStencil ) {
		if ( depthType == null || depthType == UnsignedIntType || depthType == UnsignedInt248Type ) {
			glInternalFormat = WebGL.DEPTH24_STENCIL8;
		} else if ( depthType == FloatType ) {
			glInternalFormat = WebGL.DEPTH32F_STENCIL8;
		} else if ( depthType == UnsignedShortType ) {
			glInternalFormat = WebGL.DEPTH24_STENCIL8;
			console.warning( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );
		}
	} else {
		if ( depthType == null || depthType == UnsignedIntType || depthType == UnsignedInt248Type ) {
			glInternalFormat = WebGL.DEPTH_COMPONENT24;
		} else if ( depthType == FloatType ) {
			glInternalFormat = WebGL.DEPTH_COMPONENT32F;
		} else if ( depthType == UnsignedShortType ) {
			glInternalFormat = WebGL.DEPTH_COMPONENT16;
		}
	}

	return glInternalFormat;
}