-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
/
Copy pathData3DTexture.js
112 lines (97 loc) · 2.86 KB
/
Data3DTexture.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { Texture } from './Texture.js';
import { ClampToEdgeWrapping, NearestFilter } from '../constants.js';
/**
* Creates a three-dimensional texture from raw data, with parameters to
* divide it into width, height, and depth.
*
* @augments Texture
*/
class Data3DTexture extends Texture {
/**
* Constructs a new data array texture.
*
* @param {?TypedArray} [data=null] - The buffer data.
* @param {number} [width=1] - The width of the texture.
* @param {number} [height=1] - The height of the texture.
* @param {number} [depth=1] - The depth of the texture.
*/
constructor( data = null, width = 1, height = 1, depth = 1 ) {
// We're going to add .setXXX() methods for setting properties later.
// Users can still set in Data3DTexture directly.
//
// const texture = new THREE.Data3DTexture( data, width, height, depth );
// texture.anisotropy = 16;
//
// See #14839
super( null );
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isData3DTexture = true;
/**
* The image definition of a data texture.
*
* @type {{data:TypedArray,width:number,height:number,depth:number}}
*/
this.image = { data, width, height, depth };
/**
* How the texture is sampled when a texel covers more than one pixel.
*
* Overwritten and set to `NearestFilter` by default.
*
* @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}
* @default NearestFilter
*/
this.magFilter = NearestFilter;
/**
* How the texture is sampled when a texel covers less than one pixel.
*
* Overwritten and set to `NearestFilter` by default.
*
* @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)}
* @default NearestFilter
*/
this.minFilter = NearestFilter;
/**
* This defines how the texture is wrapped in the depth and corresponds to
* *W* in UVW mapping.
*
* @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)}
* @default ClampToEdgeWrapping
*/
this.wrapR = ClampToEdgeWrapping;
/**
* Whether to generate mipmaps (if possible) for a texture.
*
* Overwritten and set to `false` by default.
*
* @type {boolean}
* @default false
*/
this.generateMipmaps = false;
/**
* If set to `true`, the texture is flipped along the vertical axis when
* uploaded to the GPU.
*
* Overwritten and set to `false` by default.
*
* @type {boolean}
* @default false
*/
this.flipY = false;
/**
* Specifies the alignment requirements for the start of each pixel row in memory.
*
* Overwritten and set to `1` by default.
*
* @type {boolean}
* @default 1
*/
this.unpackAlignment = 1;
}
}
export { Data3DTexture };