未验证 提交 4a1f478c 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15756 from DavidPeicho/feature/texture3d-wrapR

Adds support for TEXTURE_WRAP_R in DataTexture3D
......@@ -32,10 +32,18 @@
<div>[example:webgl2_materials_texture3d WebGL2 / materials / texture3d]</div>
<div>[example:webgl2_materials_texture3d_volume WebGL2 / materials / texture3d / volume]</div>
<h2>Properties</h2>
<h2>Properties</h2>
<p>
See the base [page:Texture Texture] class for common properties.
See the base [page:Texture Texture] class for common properties.
</p>
<h3>[property:number wrapR]</h3>
<p>
This defines how the texture is wrapped in the depth direction.<br />
The default is [page:Textures THREE.ClampToEdgeWrapping], where the edge is clamped to the outer edge texels.
The other two choices are [page:Textures THREE.RepeatWrapping] and [page:Textures THREE.MirroredRepeatWrapping].
See the [page:Textures texture constants] page for details.
</p>
<h2>Methods</h2>
......
......@@ -66,6 +66,7 @@ function glconstants() {
TEXTURE_MIN_FILTER: 10241,
TEXTURE_WRAP_S: 10242,
TEXTURE_WRAP_T: 10243,
TEXTURE_WRAP_R: 32882,
REPEAT: 10497,
COLOR_BUFFER_BIT: 16384,
FUNC_ADD: 32774,
......
......@@ -434,6 +434,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, utils.convert( texture.wrapS ) );
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, utils.convert( texture.wrapT ) );
if ( textureType === _gl.TEXTURE_3D ) {
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, utils.convert( texture.wrapR ) );
}
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, utils.convert( texture.magFilter ) );
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, utils.convert( texture.minFilter ) );
......@@ -442,6 +448,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
if ( textureType === _gl.TEXTURE_3D ) {
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
}
if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
......
......@@ -3,7 +3,7 @@
*/
import { Texture } from './Texture.js';
import { NearestFilter } from '../constants.js';
import { ClampToEdgeWrapping, NearestFilter } from '../constants.js';
function DataTexture3D( data, width, height, depth ) {
......@@ -22,6 +22,8 @@ function DataTexture3D( data, width, height, depth ) {
this.magFilter = NearestFilter;
this.minFilter = NearestFilter;
this.wrapR = ClampToEdgeWrapping;
this.generateMipmaps = false;
this.flipY = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册