UNPKG

4.26 kBJavaScriptView Raw
1import { Component, ComponentManager } from './ComponentManager';
2import { gl } from './components/renderer/gl';
3import { createEntity } from './Entity';
4import { ConfigService } from './services/config/ConfigService';
5import { isSafari } from './utils/isSafari';
6var AST_TOKEN_TYPES;
7(function (AST_TOKEN_TYPES) {
8 AST_TOKEN_TYPES["Void"] = "Void";
9 AST_TOKEN_TYPES["Boolean"] = "Boolean";
10 AST_TOKEN_TYPES["Float"] = "Float";
11 AST_TOKEN_TYPES["Uint32"] = "Uint32";
12 AST_TOKEN_TYPES["Int32"] = "Int32";
13 AST_TOKEN_TYPES["Vector"] = "Vector";
14 AST_TOKEN_TYPES["Vector2Float"] = "vec2<f32>";
15 AST_TOKEN_TYPES["Vector3Float"] = "vec3<f32>";
16 AST_TOKEN_TYPES["Vector4Float"] = "vec4<f32>";
17 AST_TOKEN_TYPES["Vector2Boolean"] = "vec2<bool>";
18 AST_TOKEN_TYPES["Vector3Boolean"] = "vec3<bool>";
19 AST_TOKEN_TYPES["Vector4Boolean"] = "vec4<bool>";
20 AST_TOKEN_TYPES["Vector2Uint"] = "vec2<u32>";
21 AST_TOKEN_TYPES["Vector3Uint"] = "vec3<u32>";
22 AST_TOKEN_TYPES["Vector4Uint"] = "vec4<u32>";
23 AST_TOKEN_TYPES["Vector2Int"] = "vec2<i32>";
24 AST_TOKEN_TYPES["Vector3Int"] = "vec3<i32>";
25 AST_TOKEN_TYPES["Vector4Int"] = "vec4<i32>";
26 AST_TOKEN_TYPES["Matrix"] = "Matrix";
27 AST_TOKEN_TYPES["Matrix3x3Float"] = "mat3x3<f32>";
28 AST_TOKEN_TYPES["Matrix4x4Float"] = "mat4x4<i32>";
29 AST_TOKEN_TYPES["Struct"] = "Struct";
30 AST_TOKEN_TYPES["FloatArray"] = "Float[]";
31 AST_TOKEN_TYPES["Vector4FloatArray"] = "vec4<f32>[]";
32})(AST_TOKEN_TYPES || (AST_TOKEN_TYPES = {}));
33var AST_NODE_TYPES;
34(function (AST_NODE_TYPES) {
35 AST_NODE_TYPES["Program"] = "Program";
36 AST_NODE_TYPES["Identifier"] = "Identifier";
37 AST_NODE_TYPES["VariableDeclaration"] = "VariableDeclaration";
38 AST_NODE_TYPES["BlockStatement"] = "BlockStatement";
39 AST_NODE_TYPES["ReturnStatement"] = "ReturnStatement";
40 AST_NODE_TYPES["FunctionDeclaration"] = "FunctionDeclaration";
41 AST_NODE_TYPES["VariableDeclarator"] = "VariableDeclarator";
42 AST_NODE_TYPES["AssignmentExpression"] = "AssignmentExpression";
43 AST_NODE_TYPES["LogicalExpression"] = "LogicalExpression";
44 AST_NODE_TYPES["BinaryExpression"] = "BinaryExpression";
45 AST_NODE_TYPES["ArrayExpression"] = "ArrayExpression";
46 AST_NODE_TYPES["UnaryExpression"] = "UnaryExpression";
47 AST_NODE_TYPES["UpdateExpression"] = "UpdateExpression";
48 AST_NODE_TYPES["FunctionExpression"] = "FunctionExpression";
49 AST_NODE_TYPES["MemberExpression"] = "MemberExpression";
50 AST_NODE_TYPES["ConditionalExpression"] = "ConditionalExpression";
51 AST_NODE_TYPES["ExpressionStatement"] = "ExpressionStatement";
52 AST_NODE_TYPES["CallExpression"] = "CallExpression";
53 AST_NODE_TYPES["NumThreadStatement"] = "NumThreadStatement";
54 AST_NODE_TYPES["StorageStatement"] = "StorageStatement";
55 AST_NODE_TYPES["DoWhileStatement"] = "DoWhileStatement";
56 AST_NODE_TYPES["WhileStatement"] = "WhileStatement";
57 AST_NODE_TYPES["ForStatement"] = "ForStatement";
58 AST_NODE_TYPES["BreakStatement"] = "BreakStatement";
59 AST_NODE_TYPES["ContinueStatement"] = "ContinueStatement";
60 AST_NODE_TYPES["IfStatement"] = "IfStatement";
61 AST_NODE_TYPES["ImportedFunctionStatement"] = "ImportedFunctionStatement";
62})(AST_NODE_TYPES || (AST_NODE_TYPES = {}));
63var STORAGE_CLASS;
64(function (STORAGE_CLASS) {
65 STORAGE_CLASS["Input"] = "Input";
66 STORAGE_CLASS["Output"] = "Output";
67 STORAGE_CLASS["Uniform"] = "Uniform";
68 STORAGE_CLASS["Workgroup"] = "Workgroup";
69 STORAGE_CLASS["UniformConstant"] = "UniformConstant";
70 STORAGE_CLASS["Image"] = "Image";
71 STORAGE_CLASS["StorageBuffer"] = "StorageBuffer";
72 STORAGE_CLASS["Private"] = "Private";
73 STORAGE_CLASS["Function"] = "Function";
74})(STORAGE_CLASS || (STORAGE_CLASS = {}));
75/**
76 * 根据目标平台生成 Shader 代码
77 * * WebGL GLSL 1.0
78 * * WebGPU Chrome/Edge GLSL 4.5 & WGSL @see https://gpuweb.github.io/gpuweb/wgsl.html
79 * * Safari WHLSL (maybe deprecated)
80 */
81var Target;
82(function (Target) {
83 Target["GLSL100"] = "GLSL100";
84 Target["GLSL450"] = "GLSL450";
85 Target["WGSL"] = "WGSL";
86})(Target || (Target = {}));
87var DefineValuePlaceholder = '__DefineValuePlaceholder__';
88export { createEntity, Component, ComponentManager, isSafari,
89// renderer service
90gl, ConfigService, AST_TOKEN_TYPES, AST_NODE_TYPES, STORAGE_CLASS, Target, DefineValuePlaceholder };
91//# sourceMappingURL=index.js.map
\No newline at end of file