Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/core/src/EngineEventType.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/**
* Engine event type.
*/
export enum EngineEventType {
export const EngineEventType = {
/** Dispatched when the engine starts running. */
Run = "run",
Run: "run",
/** Dispatched when the engine shuts down. */
Shutdown = "shutdown",
Shutdown: "shutdown",
/** Dispatched when the graphic device is lost. */
DeviceLost = "devicelost",
DeviceLost: "devicelost",
/** Dispatched when the graphic device is restored. */
DeviceRestored = "devicerestored"
}
DeviceRestored: "devicerestored"
} as const;

export type EngineEventType = (typeof EngineEventType)[keyof typeof EngineEventType];
Comment thread
coderabbitai[bot] marked this conversation as resolved.
12 changes: 7 additions & 5 deletions packages/core/src/RenderPipeline/enums/PipelineStage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/**
* Pipeline stage.
*/
export enum PipelineStage {
export const PipelineStage = {
/** DepthOnly stage. */
DepthOnly = "DepthOnly",
DepthOnly: "DepthOnly",
/** Shadow caster stage. */
ShadowCaster = "ShadowCaster",
ShadowCaster: "ShadowCaster",
/** Forward shading stage. */
Forward = "Forward"
}
Forward: "Forward"
} as const;

export type PipelineStage = (typeof PipelineStage)[keyof typeof PipelineStage];
56 changes: 29 additions & 27 deletions packages/core/src/asset/AssetType.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
/**
* Asset Type.
*/
export enum AssetType {
export const AssetType = {
/** Plain text. */
Text = "Text",
Text: "Text",
/** JSON. */
JSON = "JSON",
JSON: "JSON",
/** ArrayBuffer. */
Buffer = "Buffer",
Buffer: "Buffer",
/** Texture. */
Texture = "Texture",
Texture: "Texture",
/** Material. */
Material = "Material",
Material: "Material",
/** Shader. */
Shader = "Shader",
Shader: "Shader",
/** Mesh. */
Mesh = "Mesh",
Mesh: "Mesh",
/** AnimationClip. */
AnimationClip = "AnimationClip",
AnimationClip: "AnimationClip",
/** AnimatorController. */
AnimatorController = "AnimatorController",
AnimatorController: "AnimatorController",
/** Prefab.*/
Prefab = "Prefab",
Prefab: "Prefab",
/** GLTF.*/
GLTF = "GLTF",
GLTF: "GLTF",
/** Compress Texture. */
KTX = "KTX",
KTX: "KTX",
/** Cube Compress Texture. */
KTXCube = "KTXCube",
KTXCube: "KTXCube",
/** KTX2 Compress Texture */
KTX2 = "KTX2",
KTX2: "KTX2",
/** Sprite. */
Sprite = "Sprite",
Sprite: "Sprite",
/** PrimitiveMesh. */
PrimitiveMesh = "PrimitiveMesh",
PrimitiveMesh: "PrimitiveMesh",
/** Sprite Atlas. */
SpriteAtlas = "SpriteAtlas",
SpriteAtlas: "SpriteAtlas",
/** Ambient light. */
AmbientLight = "AmbientLight",
AmbientLight: "AmbientLight",
/** Scene. */
Scene = "Scene",
Scene: "Scene",
/** Font. */
Font = "Font",
Font: "Font",
/** Source Font, include ttf, otf and woff. */
SourceFont = "SourceFont",
SourceFont: "SourceFont",
/** AudioClip, include ogg, wav, mp3, m4a, aac and flac. */
Audio = "Audio",
Audio: "Audio",
/** Project asset. */
Project = "project",
Project: "project",
/** PhysicsMaterial. */
PhysicsMaterial = "PhysicsMaterial",
PhysicsMaterial: "PhysicsMaterial",
/** RenderTarget. */
RenderTarget = "RenderTarget"
}
RenderTarget: "RenderTarget"
} as const;

export type AssetType = (typeof AssetType)[keyof typeof AssetType];
82 changes: 42 additions & 40 deletions packages/core/src/base/Constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,46 +87,48 @@ export enum DataType {
* GL Capabilities
* Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
* */
export enum GLCapabilityType {
shaderVertexID = "shaderVertexID",
standardDerivatives = "OES_standard_derivatives",
shaderTextureLod = "EXT_shader_texture_lod",
elementIndexUint = "OES_element_index_uint",
depthTexture = "WEBGL_depth_texture",
drawBuffers = "WEBGL_draw_buffers",
vertexArrayObject = "OES_vertex_array_object",
instancedArrays = "ANGLE_instanced_arrays",
multipleSample = "multipleSampleOnlySupportedInWebGL2",
textureFloat = "OES_texture_float",
textureFloatLinear = "OES_texture_float_linear",
textureHalfFloat = "OES_texture_half_float",
textureHalfFloatLinear = "OES_texture_half_float_linear",
WEBGL_colorBufferFloat = "WEBGL_color_buffer_float",
colorBufferFloat = "EXT_color_buffer_float",
colorBufferHalfFloat = "EXT_color_buffer_half_float",
textureFilterAnisotropic = "EXT_texture_filter_anisotropic",
blendMinMax = "EXT_blend_minmax",
fragDepth = "EXT_frag_depth",

astc = "WEBGL_compressed_texture_astc",
astc_webkit = "WEBKIT_WEBGL_compressed_texture_astc",
astc_hdr = "WEBGL_compressed_texture_astc_hdr",
etc = "WEBGL_compressed_texture_etc",
etc_webkit = "WEBKIT_WEBGL_compressed_texture_etc",
etc1 = "WEBGL_compressed_texture_etc1",
etc1_webkit = "WEBKIT_WEBGL_compressed_texture_etc1",
pvrtc = "WEBGL_compressed_texture_pvrtc",
pvrtc_webkit = "WEBKIT_WEBGL_compressed_texture_pvrtc",
s3tc = "WEBGL_compressed_texture_s3tc",
s3tc_webkit = "WEBKIT_WEBGL_compressed_texture_s3tc",
s3tc_srgb = "WEBGL_compressed_texture_s3tc_srgb",

bptc = "EXT_texture_compression_bptc",

WEBGL_lose_context = "WEBGL_lose_context",

sRGB = "EXT_sRGB"
}
export const GLCapabilityType = {
shaderVertexID: "shaderVertexID",
standardDerivatives: "OES_standard_derivatives",
shaderTextureLod: "EXT_shader_texture_lod",
elementIndexUint: "OES_element_index_uint",
depthTexture: "WEBGL_depth_texture",
drawBuffers: "WEBGL_draw_buffers",
vertexArrayObject: "OES_vertex_array_object",
instancedArrays: "ANGLE_instanced_arrays",
multipleSample: "multipleSampleOnlySupportedInWebGL2",
textureFloat: "OES_texture_float",
textureFloatLinear: "OES_texture_float_linear",
textureHalfFloat: "OES_texture_half_float",
textureHalfFloatLinear: "OES_texture_half_float_linear",
WEBGL_colorBufferFloat: "WEBGL_color_buffer_float",
colorBufferFloat: "EXT_color_buffer_float",
colorBufferHalfFloat: "EXT_color_buffer_half_float",
textureFilterAnisotropic: "EXT_texture_filter_anisotropic",
blendMinMax: "EXT_blend_minmax",
fragDepth: "EXT_frag_depth",

astc: "WEBGL_compressed_texture_astc",
astc_webkit: "WEBKIT_WEBGL_compressed_texture_astc",
astc_hdr: "WEBGL_compressed_texture_astc_hdr",
etc: "WEBGL_compressed_texture_etc",
etc_webkit: "WEBKIT_WEBGL_compressed_texture_etc",
etc1: "WEBGL_compressed_texture_etc1",
etc1_webkit: "WEBKIT_WEBGL_compressed_texture_etc1",
pvrtc: "WEBGL_compressed_texture_pvrtc",
pvrtc_webkit: "WEBKIT_WEBGL_compressed_texture_pvrtc",
s3tc: "WEBGL_compressed_texture_s3tc",
s3tc_webkit: "WEBKIT_WEBGL_compressed_texture_s3tc",
s3tc_srgb: "WEBGL_compressed_texture_s3tc_srgb",

bptc: "EXT_texture_compression_bptc",

WEBGL_lose_context: "WEBGL_lose_context",

sRGB: "EXT_sRGB"
} as const;

export type GLCapabilityType = (typeof GLCapabilityType)[keyof typeof GLCapabilityType];

export type TypedArray =
| Int8Array
Expand Down
34 changes: 18 additions & 16 deletions packages/core/src/mesh/enums/VertexAttribute.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
/**
* Vertex attribute types of a vertex in a ModelMesh.
*/
export enum VertexAttribute {
export const VertexAttribute = {
/** Vertex position. */
Position = "POSITION",
Position: "POSITION",
/** Vertex normal. */
Normal = "NORMAL",
Normal: "NORMAL",
/** Vertex color. */
Color = "COLOR_0",
Color: "COLOR_0",
/** Vertex tangent. */
Tangent = "TANGENT",
Tangent: "TANGENT",
/** Vertex bone weight. */
BoneWeight = "WEIGHTS_0",
BoneWeight: "WEIGHTS_0",
/** Vertex bone index. */
BoneIndex = "JOINTS_0",
BoneIndex: "JOINTS_0",
/** Vertex UV. */
UV = "TEXCOORD_0",
UV: "TEXCOORD_0",
/** Vertex UV1. */
UV1 = "TEXCOORD_1",
UV1: "TEXCOORD_1",
/** Vertex UV2. */
UV2 = "TEXCOORD_2",
UV2: "TEXCOORD_2",
/** Vertex UV3. */
UV3 = "TEXCOORD_3",
UV3: "TEXCOORD_3",
/** Vertex UV4. */
UV4 = "TEXCOORD_4",
UV4: "TEXCOORD_4",
/** Vertex UV5. */
UV5 = "TEXCOORD_5",
UV5: "TEXCOORD_5",
/** Vertex UV6. */
UV6 = "TEXCOORD_6",
UV6: "TEXCOORD_6",
/** Vertex UV7. */
UV7 = "TEXCOORD_7"
}
UV7: "TEXCOORD_7"
} as const;

export type VertexAttribute = (typeof VertexAttribute)[keyof typeof VertexAttribute];
Loading
Loading