@@ -35,6 +35,7 @@ class RenderTarget extends EventDispatcher {
3535 * @property {?Texture } [depthTexture=null] - Reference to a depth texture.
3636 * @property {number } [samples=0] - The MSAA samples count.
3737 * @property {number } [count=1] - Defines the number of color attachments . Must be at least `1`.
38+ * @property {number } [depth=1] - The texture depth.
3839 * @property {boolean } [multiview=false] - Whether this target is used for multiview rendering.
3940 */
4041
@@ -49,6 +50,21 @@ class RenderTarget extends EventDispatcher {
4950
5051 super ( ) ;
5152
53+ options = Object . assign ( {
54+ generateMipmaps : false ,
55+ internalFormat : null ,
56+ minFilter : LinearFilter ,
57+ depthBuffer : true ,
58+ stencilBuffer : false ,
59+ resolveDepthBuffer : true ,
60+ resolveStencilBuffer : true ,
61+ depthTexture : null ,
62+ samples : 0 ,
63+ count : 1 ,
64+ depth : 1 ,
65+ multiview : false
66+ } , options ) ;
67+
5268 /**
5369 * This flag can be used for type testing.
5470 *
@@ -80,7 +96,7 @@ class RenderTarget extends EventDispatcher {
8096 * @type {number }
8197 * @default 1
8298 */
83- this . depth = options . depth ? options . depth : 1 ;
99+ this . depth = options . depth ;
84100
85101 /**
86102 * A rectangular area inside the render target's viewport. Fragments that are
@@ -108,21 +124,7 @@ class RenderTarget extends EventDispatcher {
108124 */
109125 this . viewport = new Vector4 ( 0 , 0 , width , height ) ;
110126
111- const image = { width : width , height : height , depth : this . depth } ;
112-
113- options = Object . assign ( {
114- generateMipmaps : false ,
115- internalFormat : null ,
116- minFilter : LinearFilter ,
117- depthBuffer : true ,
118- stencilBuffer : false ,
119- resolveDepthBuffer : true ,
120- resolveStencilBuffer : true ,
121- depthTexture : null ,
122- samples : 0 ,
123- count : 1 ,
124- multiview : false
125- } , options ) ;
127+ const image = { width : width , height : height , depth : options . depth } ;
126128
127129 const texture = new Texture ( image , options . mapping , options . wrapS , options . wrapT , options . magFilter , options . minFilter , options . format , options . type , options . anisotropy , options . colorSpace ) ;
128130
@@ -263,6 +265,12 @@ class RenderTarget extends EventDispatcher {
263265 this . textures [ i ] . image . height = height ;
264266 this . textures [ i ] . image . depth = depth ;
265267
268+ if ( this . textures [ i ] . image . depth > 1 ) {
269+
270+ this . textures [ i ] . isArrayTexture = true ;
271+
272+ }
273+
266274 }
267275
268276 this . dispose ( ) ;
0 commit comments