1 | import { Combine, DepthPackingStrategies, GLSLVersion, Mapping, ShadowMapType, ToneMapping } from "../../constants.js";
|
2 | import { Object3D } from "../../core/Object3D.js";
|
3 | import { Light } from "../../lights/Light.js";
|
4 | import { Material } from "../../materials/Material.js";
|
5 | import { Scene } from "../../scenes/Scene.js";
|
6 | import { IUniform } from "../shaders/UniformsLib.js";
|
7 | import { WebGLRenderer } from "../WebGLRenderer.js";
|
8 | import { WebGLBindingStates } from "./WebGLBindingStates.js";
|
9 | import { WebGLCapabilities } from "./WebGLCapabilities.js";
|
10 | import { WebGLClipping } from "./WebGLClipping.js";
|
11 | import { WebGLCubeMaps } from "./WebGLCubeMaps.js";
|
12 | import { WebGLExtensions } from "./WebGLExtensions.js";
|
13 | import { WebGLLightsState } from "./WebGLLights.js";
|
14 | import { WebGLProgram } from "./WebGLProgram.js";
|
15 |
|
16 | export interface WebGLProgramParameters {
|
17 | shaderID: string;
|
18 | shaderType: string;
|
19 | shaderName: string;
|
20 |
|
21 | vertexShader: string;
|
22 | fragmentShader: string;
|
23 | defines: { [define: string]: string | number | boolean } | undefined;
|
24 |
|
25 | customVertexShaderID: string | undefined;
|
26 | customFragmentShaderID: string | undefined;
|
27 |
|
28 | isRawShaderMaterial: boolean;
|
29 | glslVersion: GLSLVersion | null | undefined;
|
30 |
|
31 | precision: "lowp" | "mediump" | "highp";
|
32 |
|
33 | batching: boolean;
|
34 | batchingColor: boolean;
|
35 | instancing: boolean;
|
36 | instancingColor: boolean;
|
37 | instancingMorph: boolean;
|
38 |
|
39 | supportsVertexTextures: boolean;
|
40 | outputColorSpace: string;
|
41 | alphaToCoverage: boolean;
|
42 |
|
43 | map: boolean;
|
44 | matcap: boolean;
|
45 | envMap: boolean;
|
46 | envMapMode: Mapping | false;
|
47 | envMapCubeUVHeight: number | null;
|
48 | aoMap: boolean;
|
49 | lightMap: boolean;
|
50 | bumpMap: boolean;
|
51 | normalMap: boolean;
|
52 | displacementMap: boolean;
|
53 | emissiveMap: boolean;
|
54 |
|
55 | normalMapObjectSpace: boolean;
|
56 | normalMapTangentSpace: boolean;
|
57 |
|
58 | metalnessMap: boolean;
|
59 | roughnessMap: boolean;
|
60 |
|
61 | anisotropy: boolean;
|
62 | anisotropyMap: boolean;
|
63 |
|
64 | clearcoat: boolean;
|
65 | clearcoatMap: boolean;
|
66 | clearcoatNormalMap: boolean;
|
67 | clearcoatRoughnessMap: boolean;
|
68 |
|
69 | dispersion: boolean;
|
70 |
|
71 | iridescence: boolean;
|
72 | iridescenceMap: boolean;
|
73 | iridescenceThicknessMap: boolean;
|
74 |
|
75 | sheen: boolean;
|
76 | sheenColorMap: boolean;
|
77 | sheenRoughnessMap: boolean;
|
78 |
|
79 | specularMap: boolean;
|
80 | specularColorMap: boolean;
|
81 | specularIntensityMap: boolean;
|
82 |
|
83 | transmission: boolean;
|
84 | transmissionMap: boolean;
|
85 | thicknessMap: boolean;
|
86 |
|
87 | gradientMap: boolean;
|
88 |
|
89 | opaque: boolean;
|
90 |
|
91 | alphaMap: boolean;
|
92 | alphaTest: boolean;
|
93 | alphaHash: boolean;
|
94 |
|
95 | combine: Combine | undefined;
|
96 |
|
97 |
|
98 |
|
99 | mapUv: string | false;
|
100 | aoMapUv: string | false;
|
101 | lightMapUv: string | false;
|
102 | bumpMapUv: string | false;
|
103 | normalMapUv: string | false;
|
104 | displacementMapUv: string | false;
|
105 | emissiveMapUv: string | false;
|
106 |
|
107 | metalnessMapUv: string | false;
|
108 | roughnessMapUv: string | false;
|
109 |
|
110 | anisotropyMapUv: string | false;
|
111 |
|
112 | clearcoatMapUv: string | false;
|
113 | clearcoatNormalMapUv: string | false;
|
114 | clearcoatRoughnessMapUv: string | false;
|
115 |
|
116 | iridescenceMapUv: string | false;
|
117 | iridescenceThicknessMapUv: string | false;
|
118 |
|
119 | sheenColorMapUv: string | false;
|
120 | sheenRoughnessMapUv: string | false;
|
121 |
|
122 | specularMapUv: string | false;
|
123 | specularColorMapUv: string | false;
|
124 | specularIntensityMapUv: string | false;
|
125 |
|
126 | transmissionMapUv: string | false;
|
127 | thicknessMapUv: string | false;
|
128 |
|
129 | alphaMapUv: string | false;
|
130 |
|
131 |
|
132 |
|
133 | vertexTangents: boolean;
|
134 | vertexColors: boolean;
|
135 | vertexAlphas: boolean;
|
136 | vertexUv1s: boolean;
|
137 | vertexUv2s: boolean;
|
138 | vertexUv3s: boolean;
|
139 |
|
140 | pointsUvs: boolean;
|
141 |
|
142 | fog: boolean;
|
143 | useFog: boolean;
|
144 | fogExp2: boolean;
|
145 |
|
146 | flatShading: boolean;
|
147 |
|
148 | sizeAttenuation: boolean;
|
149 | logarithmicDepthBuffer: boolean;
|
150 | reverseDepthBuffer: boolean;
|
151 |
|
152 | skinning: boolean;
|
153 |
|
154 | morphTargets: boolean;
|
155 | morphNormals: boolean;
|
156 | morphColors: boolean;
|
157 | morphTargetsCount: number;
|
158 | morphTextureStride: number;
|
159 |
|
160 | numDirLights: number;
|
161 | numPointLights: number;
|
162 | numSpotLights: number;
|
163 | numSpotLightMaps: number;
|
164 | numRectAreaLights: number;
|
165 | numHemiLights: number;
|
166 |
|
167 | numDirLightShadows: number;
|
168 | numPointLightShadows: number;
|
169 | numSpotLightShadows: number;
|
170 | numSpotLightShadowsWithMaps: number;
|
171 |
|
172 | numLightProbes: number;
|
173 |
|
174 | numClippingPlanes: number;
|
175 | numClipIntersection: number;
|
176 |
|
177 | dithering: boolean;
|
178 |
|
179 | shadowMapEnabled: boolean;
|
180 | shadowMapType: ShadowMapType;
|
181 |
|
182 | toneMapping: ToneMapping;
|
183 |
|
184 | decodeVideoTexture: boolean;
|
185 | decodeVideoTextureEmissive: boolean;
|
186 |
|
187 | premultipliedAlpha: boolean;
|
188 |
|
189 | doubleSided: boolean;
|
190 | flipSided: boolean;
|
191 |
|
192 | useDepthPacking: boolean;
|
193 | depthPacking: DepthPackingStrategies | 0;
|
194 |
|
195 | index0AttributeName: string | undefined;
|
196 |
|
197 | extensionClipCullDistance: boolean;
|
198 | extensionMultiDraw: boolean;
|
199 |
|
200 | rendererExtensionParallelShaderCompile: boolean;
|
201 |
|
202 | customProgramCacheKey: string;
|
203 | }
|
204 |
|
205 | export interface WebGLProgramParametersWithUniforms extends WebGLProgramParameters {
|
206 | uniforms: { [uniform: string]: IUniform };
|
207 | }
|
208 |
|
209 | export class WebGLPrograms {
|
210 | constructor(
|
211 | renderer: WebGLRenderer,
|
212 | cubemaps: WebGLCubeMaps,
|
213 | extensions: WebGLExtensions,
|
214 | capabilities: WebGLCapabilities,
|
215 | bindingStates: WebGLBindingStates,
|
216 | clipping: WebGLClipping,
|
217 | );
|
218 |
|
219 | programs: WebGLProgram[];
|
220 |
|
221 | getParameters(
|
222 | material: Material,
|
223 | lights: WebGLLightsState,
|
224 | shadows: Light[],
|
225 | scene: Scene,
|
226 | object: Object3D,
|
227 | ): WebGLProgramParameters;
|
228 |
|
229 | getProgramCacheKey(parameters: WebGLProgramParameters): string;
|
230 | getUniforms(material: Material): { [uniform: string]: IUniform };
|
231 | acquireProgram(parameters: WebGLProgramParametersWithUniforms, cacheKey: string): WebGLProgram;
|
232 | releaseProgram(program: WebGLProgram): void;
|
233 | }
|