1 |
|
2 | import 'reflect-metadata';
|
3 | import { Component, ComponentManager } from './ComponentManager';
|
4 | import { FrameGraphSystem } from './components/framegraph/System';
|
5 | import { GeometryComponent } from './components/geometry/GeometryComponent';
|
6 | import { GeometrySystem } from './components/geometry/System';
|
7 | import { MaterialComponent } from './components/material/MaterialComponent';
|
8 | import { MaterialSystem } from './components/material/System';
|
9 | import { CullableComponent } from './components/mesh/CullableComponent';
|
10 | import { MeshComponent } from './components/mesh/MeshComponent';
|
11 | import { MeshSystem } from './components/mesh/System';
|
12 | import { IView } from './components/renderer';
|
13 | import { PixelPickingPass } from './components/renderer/passes/PixelPickingPass';
|
14 | import { RendererSystem } from './components/renderer/System';
|
15 | import { HierarchyComponent } from './components/scenegraph/HierarchyComponent';
|
16 | import { SceneGraphSystem } from './components/scenegraph/System';
|
17 | import { TransformComponent } from './components/scenegraph/TransformComponent';
|
18 | import { createEntity } from './Entity';
|
19 | import { IDENTIFIER } from './identifier';
|
20 | import { container, createWorldContainer, lazyInject, lazyMultiInject } from './inversify.config';
|
21 | import { generateAABBFromVertices } from './utils/aabb';
|
22 | import { isSafari } from './utils/isSafari';
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | export interface ISystem {
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | initialize?(): Promise<void>;
|
34 | |
35 |
|
36 |
|
37 | execute?(views: IView[]): Promise<void>;
|
38 | |
39 |
|
40 |
|
41 | cleanup?(): void;
|
42 | |
43 |
|
44 |
|
45 | tearDown?(): void;
|
46 | }
|
47 | declare type Entity = number;
|
48 | declare enum AST_TOKEN_TYPES {
|
49 | Void = "Void",
|
50 | Boolean = "Boolean",
|
51 | Float = "Float",
|
52 | Uint32 = "Uint32",
|
53 | Int32 = "Int32",
|
54 | Vector = "Vector",
|
55 | Vector2Float = "vec2<f32>",
|
56 | Vector3Float = "vec3<f32>",
|
57 | Vector4Float = "vec4<f32>",
|
58 | Vector2Boolean = "vec2<bool>",
|
59 | Vector3Boolean = "vec3<bool>",
|
60 | Vector4Boolean = "vec4<bool>",
|
61 | Vector2Uint = "vec2<u32>",
|
62 | Vector3Uint = "vec3<u32>",
|
63 | Vector4Uint = "vec4<u32>",
|
64 | Vector2Int = "vec2<i32>",
|
65 | Vector3Int = "vec3<i32>",
|
66 | Vector4Int = "vec4<i32>",
|
67 | Matrix = "Matrix",
|
68 | Matrix3x3Float = "mat3x3<f32>",
|
69 | Matrix4x4Float = "mat4x4<i32>",
|
70 | Struct = "Struct",
|
71 | FloatArray = "Float[]",
|
72 | Vector4FloatArray = "vec4<f32>[]"
|
73 | }
|
74 | declare enum AST_NODE_TYPES {
|
75 | Program = "Program",
|
76 | Identifier = "Identifier",
|
77 | VariableDeclaration = "VariableDeclaration",
|
78 | BlockStatement = "BlockStatement",
|
79 | ReturnStatement = "ReturnStatement",
|
80 | FunctionDeclaration = "FunctionDeclaration",
|
81 | VariableDeclarator = "VariableDeclarator",
|
82 | AssignmentExpression = "AssignmentExpression",
|
83 | LogicalExpression = "LogicalExpression",
|
84 | BinaryExpression = "BinaryExpression",
|
85 | ArrayExpression = "ArrayExpression",
|
86 | UnaryExpression = "UnaryExpression",
|
87 | UpdateExpression = "UpdateExpression",
|
88 | FunctionExpression = "FunctionExpression",
|
89 | MemberExpression = "MemberExpression",
|
90 | ConditionalExpression = "ConditionalExpression",
|
91 | ExpressionStatement = "ExpressionStatement",
|
92 | CallExpression = "CallExpression",
|
93 | NumThreadStatement = "NumThreadStatement",
|
94 | StorageStatement = "StorageStatement",
|
95 | DoWhileStatement = "DoWhileStatement",
|
96 | WhileStatement = "WhileStatement",
|
97 | ForStatement = "ForStatement",
|
98 | BreakStatement = "BreakStatement",
|
99 | ContinueStatement = "ContinueStatement",
|
100 | IfStatement = "IfStatement",
|
101 | ImportedFunctionStatement = "ImportedFunctionStatement"
|
102 | }
|
103 | declare enum STORAGE_CLASS {
|
104 | Input = "Input",
|
105 | Output = "Output",
|
106 | Uniform = "Uniform",
|
107 | Workgroup = "Workgroup",
|
108 | UniformConstant = "UniformConstant",
|
109 | Image = "Image",
|
110 | StorageBuffer = "StorageBuffer",
|
111 | Private = "Private",
|
112 | Function = "Function"
|
113 | }
|
114 | declare type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
|
115 | declare type DataType = AST_TOKEN_TYPES.Uint32 | AST_TOKEN_TYPES.Int32 | AST_TOKEN_TYPES.Boolean | AST_TOKEN_TYPES.Float | AST_TOKEN_TYPES.Vector2Float | AST_TOKEN_TYPES.Vector3Float | AST_TOKEN_TYPES.Vector4Float | AST_TOKEN_TYPES.Vector2Int | AST_TOKEN_TYPES.Vector3Int | AST_TOKEN_TYPES.Vector4Int | AST_TOKEN_TYPES.Vector2Uint | AST_TOKEN_TYPES.Vector3Uint | AST_TOKEN_TYPES.Vector4Uint | AST_TOKEN_TYPES.Vector2Boolean | AST_TOKEN_TYPES.Vector3Boolean | AST_TOKEN_TYPES.Vector4Boolean | AST_TOKEN_TYPES.Matrix3x3Float | AST_TOKEN_TYPES.Matrix4x4Float | AST_TOKEN_TYPES.FloatArray | AST_TOKEN_TYPES.Vector4FloatArray | AST_TOKEN_TYPES.Void;
|
116 | interface GLSLContext {
|
117 | |
118 |
|
119 |
|
120 | name: string;
|
121 | shader?: string;
|
122 | |
123 |
|
124 |
|
125 |
|
126 |
|
127 | dispatch: [number, number, number];
|
128 | |
129 |
|
130 |
|
131 |
|
132 | threadGroupSize: [number, number, number];
|
133 | |
134 |
|
135 |
|
136 | maxIteration: number;
|
137 | |
138 |
|
139 |
|
140 | needPingpong: boolean;
|
141 | |
142 |
|
143 |
|
144 | output: {
|
145 | name: string;
|
146 | size?: [number, number];
|
147 | textureSize?: [number, number];
|
148 | length?: number;
|
149 | typedArrayConstructor?: TypedArrayConstructor;
|
150 | gpuBuffer?: GPUBuffer;
|
151 | outputElementsPerTexel?: number;
|
152 | };
|
153 | |
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 | defines: Array<{
|
160 | name: string;
|
161 | type: DataType;
|
162 | value: number;
|
163 | runtime: boolean;
|
164 | }>;
|
165 | globalDeclarations: Array<{
|
166 | name: string;
|
167 | type: DataType;
|
168 | value: string;
|
169 | shared: boolean;
|
170 | }>;
|
171 | uniforms: Array<{
|
172 | name: string;
|
173 | type: DataType;
|
174 | data?: number | number[] | Float32Array | Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array;
|
175 | size?: [number, number];
|
176 | storageClass: STORAGE_CLASS;
|
177 | readonly: boolean;
|
178 | writeonly: boolean;
|
179 | isReferer?: boolean;
|
180 | }>;
|
181 | }
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | declare enum Target {
|
189 | GLSL100 = "GLSL100",
|
190 | GLSL450 = "GLSL450",
|
191 | WGSL = "WGSL"
|
192 | }
|
193 | declare const DefineValuePlaceholder = "__DefineValuePlaceholder__";
|
194 | interface KernelBundle {
|
195 | shaders: {
|
196 | [Target.WGSL]: string;
|
197 | [Target.GLSL450]: string;
|
198 | [Target.GLSL100]: string;
|
199 | };
|
200 | context?: GLSLContext;
|
201 | toString(): string;
|
202 | }
|
203 | export * from './ComponentManager';
|
204 | export * from './services';
|
205 | export * from './shape';
|
206 | export * from './components/renderer';
|
207 | export * from './components/material/interface';
|
208 | export * from './components/mesh/interface';
|
209 | export * from './components/renderer';
|
210 | export { container, createWorldContainer, lazyInject, lazyMultiInject, createEntity, Component, ComponentManager, Entity, IDENTIFIER, FrameGraphSystem, GeometrySystem, RendererSystem, MaterialSystem, MeshSystem, SceneGraphSystem, CullableComponent, MeshComponent, TransformComponent, MaterialComponent, GeometryComponent, HierarchyComponent, isSafari, generateAABBFromVertices, PixelPickingPass, AST_TOKEN_TYPES, AST_NODE_TYPES, STORAGE_CLASS, Target, DefineValuePlaceholder, GLSLContext, DataType, KernelBundle, };
|