|
15 | 15 | * =============================================================================
|
16 | 16 | */
|
17 | 17 |
|
18 |
| -import {ENV} from '../../environment'; |
19 | 18 | import {PixelData, TypedArray} from '../../types';
|
20 | 19 |
|
21 | 20 | import {getGlslDifferences} from './glsl_version';
|
22 | 21 | import * as tex_util from './tex_util';
|
| 22 | +import {TextureConfig} from './tex_util'; |
23 | 23 | import * as webgl_util from './webgl_util';
|
24 | 24 |
|
25 |
| -export interface TextureConfig { |
26 |
| - internalFormatFloat: number; |
27 |
| - textureFormatFloat: number; |
28 |
| - internalFormatPackedHalfFloat: number; |
29 |
| - internalFormatHalfFloat: number; |
30 |
| - internalFormatPackedFloat: number; |
31 |
| - |
32 |
| - // The format to use during a gl.readPixels call. |
33 |
| - downloadTextureFormat: number; |
34 |
| - // How many channels need to be unpacked after a gl.readPixels call. |
35 |
| - downloadUnpackNumChannels: number; |
36 |
| - |
37 |
| - defaultNumChannels: number; |
38 |
| - textureTypeHalfFloat: number; |
39 |
| -} |
40 |
| - |
41 | 25 | export function createVertexShader(
|
42 | 26 | gl: WebGLRenderingContext, debug: boolean): WebGLShader {
|
43 | 27 | const glsl = getGlslDifferences();
|
@@ -69,60 +53,6 @@ export function createIndexBuffer(
|
69 | 53 | return webgl_util.createStaticIndexBuffer(gl, debug, triangleVertexIndices);
|
70 | 54 | }
|
71 | 55 |
|
72 |
| -export function getTextureConfig( |
73 |
| - // tslint:disable-next-line:no-any |
74 |
| - gl: WebGLRenderingContext, textureHalfFloatExtension?: any): TextureConfig { |
75 |
| - // tslint:disable-next-line:no-any |
76 |
| - const glany = gl as any; |
77 |
| - |
78 |
| - let internalFormatFloat: number; |
79 |
| - let internalFormatHalfFloat: number; |
80 |
| - let internalFormatPackedHalfFloat: number; |
81 |
| - let internalFormatPackedFloat: number; |
82 |
| - let textureFormatFloat: number; |
83 |
| - |
84 |
| - let downloadTextureFormat: number; |
85 |
| - let downloadUnpackNumChannels: number; |
86 |
| - |
87 |
| - let defaultNumChannels: number; |
88 |
| - let textureTypeHalfFloat: number; |
89 |
| - |
90 |
| - if (ENV.getNumber('WEBGL_VERSION') === 2) { |
91 |
| - internalFormatFloat = glany.R32F; |
92 |
| - internalFormatHalfFloat = glany.R16F; |
93 |
| - internalFormatPackedHalfFloat = glany.RGBA16F; |
94 |
| - internalFormatPackedFloat = glany.RGBA32F; |
95 |
| - textureFormatFloat = glany.RED; |
96 |
| - downloadUnpackNumChannels = 4; |
97 |
| - defaultNumChannels = 1; |
98 |
| - textureTypeHalfFloat = glany.HALF_FLOAT; |
99 |
| - } else { |
100 |
| - internalFormatFloat = gl.RGBA; |
101 |
| - internalFormatHalfFloat = gl.RGBA; |
102 |
| - internalFormatPackedHalfFloat = gl.RGBA; |
103 |
| - internalFormatPackedFloat = glany.RGBA; |
104 |
| - textureFormatFloat = gl.RGBA; |
105 |
| - downloadUnpackNumChannels = 4; |
106 |
| - defaultNumChannels = 4; |
107 |
| - textureTypeHalfFloat = textureHalfFloatExtension != null ? |
108 |
| - textureHalfFloatExtension.HALF_FLOAT_OES : |
109 |
| - null; |
110 |
| - } |
111 |
| - downloadTextureFormat = gl.RGBA; |
112 |
| - |
113 |
| - return { |
114 |
| - internalFormatFloat, |
115 |
| - internalFormatHalfFloat, |
116 |
| - internalFormatPackedHalfFloat, |
117 |
| - internalFormatPackedFloat, |
118 |
| - textureFormatFloat, |
119 |
| - downloadTextureFormat, |
120 |
| - downloadUnpackNumChannels, |
121 |
| - defaultNumChannels, |
122 |
| - textureTypeHalfFloat |
123 |
| - }; |
124 |
| -} |
125 |
| - |
126 | 56 | function createAndConfigureTexture(
|
127 | 57 | gl: WebGLRenderingContext, debug: boolean, width: number, height: number,
|
128 | 58 | internalFormat: number, textureFormat: number,
|
|
0 commit comments