@@ -70,13 +70,9 @@ implemented in JavaScript they'd look something like:
70
70
``` js
71
71
// PSEUDO CODE!!!
72
72
gl .createTexture = function () {
73
- return new Texture ();
73
+ return new WebGLTexture ();
74
74
};
75
75
76
- class Texture () {
77
- mips = [new Array (6 )]; // faces of mip levels
78
- }
79
-
80
76
gl .activeTexture = function (unit ) {
81
77
gl .activeTextureUnit = unit - gl .TEXTURE0 ; // convert to 0 based index
82
78
};
@@ -96,14 +92,13 @@ be implemented something like
96
92
gl .texImage2D = function (target , level , internalFormat , width , height , border , format , type , data ) {
97
93
const textureUnit = gl .textureUnits [gl .activeTextureUnit ];
98
94
const texture = textureUnit[target];
99
- const face = targetToFace (target) // 0-5, 0 for 2D texture, 0-5 for cube maps
100
- texture .mips [face][level] = convertDataToInternalFormat (internalFormat, width, height, format, type, data);
95
+ texture .setMipLevel (target, level, convertDataToInternalFormat (internalFormat, width, height, format, type, data));
101
96
}
102
97
103
98
gl .texParameteri = function (target , pname , value ) {
104
99
const textureUnit = gl .textureUnits [gl .activeTextureUnit ];
105
100
const texture = textureUnit[target];
106
- texture[ pname] = value;
101
+ texture . setSetting ( pname, value) ;
107
102
}
108
103
```
109
104
0 commit comments