1 | import { GLSLVersion } from "../constants.js";
|
2 | import { JSONMeta } from "../core/Object3D.js";
|
3 | import { UniformsGroup } from "../core/UniformsGroup.js";
|
4 | import { Matrix3, Matrix3Tuple } from "../math/Matrix3.js";
|
5 | import { Matrix4, Matrix4Tuple } from "../math/Matrix4.js";
|
6 | import { Vector2Tuple } from "../math/Vector2.js";
|
7 | import { Vector3Tuple } from "../math/Vector3.js";
|
8 | import { Vector4Tuple } from "../math/Vector4.js";
|
9 | import { IUniform } from "../renderers/shaders/UniformsLib.js";
|
10 | import { Material, MaterialJSON, MaterialParameters } from "./Material.js";
|
11 |
|
12 | export interface ShaderMaterialParameters extends MaterialParameters {
|
13 | uniforms?: { [uniform: string]: IUniform } | undefined;
|
14 | uniformsGroups?: UniformsGroup[] | undefined;
|
15 | vertexShader?: string | undefined;
|
16 | fragmentShader?: string | undefined;
|
17 | linewidth?: number | undefined;
|
18 | wireframe?: boolean | undefined;
|
19 | wireframeLinewidth?: number | undefined;
|
20 | lights?: boolean | undefined;
|
21 | clipping?: boolean | undefined;
|
22 | fog?: boolean | undefined;
|
23 | extensions?:
|
24 | | {
|
25 | clipCullDistance?: boolean | undefined;
|
26 | multiDraw?: boolean | undefined;
|
27 | }
|
28 | | undefined;
|
29 | glslVersion?: GLSLVersion | undefined;
|
30 | }
|
31 |
|
32 | export type ShaderMaterialUniformJSON = {
|
33 | type: "t";
|
34 | value: string;
|
35 | } | {
|
36 | type: "c";
|
37 | value: number;
|
38 | } | {
|
39 | type: "v2";
|
40 | value: Vector2Tuple;
|
41 | } | {
|
42 | type: "v3";
|
43 | value: Vector3Tuple;
|
44 | } | {
|
45 | type: "v4";
|
46 | value: Vector4Tuple;
|
47 | } | {
|
48 | type: "m3";
|
49 | value: Matrix3Tuple;
|
50 | } | {
|
51 | type: "m4";
|
52 | value: Matrix4Tuple;
|
53 | } | {
|
54 | value: unknown;
|
55 | };
|
56 |
|
57 | export interface ShaderMaterialJSON extends MaterialJSON {
|
58 | glslVersion: number | null;
|
59 | uniforms: Record<string, ShaderMaterialUniformJSON>;
|
60 |
|
61 | defines?: Record<string, unknown>;
|
62 |
|
63 | vertexShader: string;
|
64 | ragmentShader: string;
|
65 |
|
66 | lights: boolean;
|
67 | clipping: boolean;
|
68 |
|
69 | extensions?: Record<string, boolean>;
|
70 | }
|
71 |
|
72 | export class ShaderMaterial extends Material {
|
73 | constructor(parameters?: ShaderMaterialParameters);
|
74 |
|
75 | /**
|
76 | * Read-only flag to check if a given object is of type {@link ShaderMaterial}.
|
77 | * @remarks This is a _constant_ value
|
78 | * @defaultValue `true`
|
79 | */
|
80 | readonly isShaderMaterial: true;
|
81 |
|
82 | |
83 |
|
84 |
|
85 | defines: { [key: string]: any };
|
86 |
|
87 | |
88 |
|
89 |
|
90 | uniforms: { [uniform: string]: IUniform };
|
91 |
|
92 | uniformsGroups: UniformsGroup[];
|
93 |
|
94 | vertexShader: string;
|
95 |
|
96 | fragmentShader: string;
|
97 |
|
98 | |
99 |
|
100 |
|
101 | linewidth: number;
|
102 |
|
103 | |
104 |
|
105 |
|
106 | wireframe: boolean;
|
107 |
|
108 | |
109 |
|
110 |
|
111 | wireframeLinewidth: number;
|
112 |
|
113 | |
114 |
|
115 |
|
116 | fog: boolean;
|
117 |
|
118 | |
119 |
|
120 |
|
121 | lights: boolean;
|
122 |
|
123 | |
124 |
|
125 |
|
126 | clipping: boolean;
|
127 |
|
128 | |
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 | extensions: {
|
135 | clipCullDistance: boolean;
|
136 | multiDraw: boolean;
|
137 | };
|
138 |
|
139 | |
140 |
|
141 |
|
142 | defaultAttributeValues: any;
|
143 |
|
144 | |
145 |
|
146 |
|
147 | index0AttributeName: string | undefined;
|
148 |
|
149 | |
150 |
|
151 |
|
152 | uniformsNeedUpdate: boolean;
|
153 |
|
154 | |
155 |
|
156 |
|
157 | glslVersion: GLSLVersion | null;
|
158 |
|
159 | setValues(parameters: ShaderMaterialParameters): void;
|
160 |
|
161 | toJSON(meta?: JSONMeta): ShaderMaterialJSON;
|
162 | }
|