|
@@ -1,13 +1,22 @@
|
|
import { Texture } from './Texture';
|
|
import { Texture } from './Texture';
|
|
-import { NearestFilter, UnsignedShortType, DepthFormat } from '../constants';
|
|
|
|
|
|
+import { NearestFilter, UnsignedShortType, DepthFormat, DepthStencilFormat } from '../constants';
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author Matt DesLauriers / @mattdesl
|
|
* @author Matt DesLauriers / @mattdesl
|
|
|
|
+ * @author atix / arthursilber.de
|
|
*/
|
|
*/
|
|
|
|
|
|
-function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) {
|
|
|
|
|
|
+function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
|
|
|
|
- Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, DepthFormat, type, anisotropy );
|
|
|
|
|
|
+ format = format !== undefined ? format : DepthFormat;
|
|
|
|
+
|
|
|
|
+ if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
|
|
+
|
|
|
|
+ throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' )
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
|
|
|
|
this.image = { width: width, height: height };
|
|
this.image = { width: width, height: height };
|
|
|
|
|
|
@@ -23,7 +32,6 @@ function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, mi
|
|
|
|
|
|
DepthTexture.prototype = Object.create( Texture.prototype );
|
|
DepthTexture.prototype = Object.create( Texture.prototype );
|
|
DepthTexture.prototype.constructor = DepthTexture;
|
|
DepthTexture.prototype.constructor = DepthTexture;
|
|
-
|
|
|
|
DepthTexture.prototype.isDepthTexture = true;
|
|
DepthTexture.prototype.isDepthTexture = true;
|
|
|
|
|
|
export { DepthTexture };
|
|
export { DepthTexture };
|