Skip to content
Merged
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/webxr": "latest",
"@typescript-eslint/eslint-plugin": "^8.58.1",
"@typescript-eslint/parser": "^8.58.1",
"@vitest/coverage-v8": "2.1.3",
"@vitest/coverage-v8": "3.2.6",
"bumpp": "^9.5.2",
"cross-env": "^5.2.0",
"electron": "^13",
Expand All @@ -65,7 +65,7 @@
"rollup-plugin-swc3": "^0.10.1",
"ts-node": "^10",
"typescript": "^5.1.6",
"vitest": "2.1.3"
"vitest": "3.2.6"
},
"lint-staged": {
"**/*.ts": [
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Font } from "./2d/text/Font";
import { BasicResources } from "./BasicResources";
import { Camera } from "./Camera";
import { Canvas } from "./Canvas";
import { EngineEventType } from "./EngineEventType";
import { EngineSettings } from "./EngineSettings";
import { Entity } from "./Entity";
import { BatcherManager } from "./RenderPipeline/BatcherManager";
Expand All @@ -32,7 +33,6 @@ import { Shader } from "./shader/Shader";
import { ShaderMacro } from "./shader/ShaderMacro";
import { ShaderMacroCollection } from "./shader/ShaderMacroCollection";
import { ShaderProgramMap } from "./shader/ShaderProgramMap";
import { ShaderProgram } from "./shader/ShaderProgram";
import { ShaderFactory } from "./shader/ShaderFactory";
import { RenderState } from "./shader/state/RenderState";
import { Texture2D, TextureFormat } from "./texture";
Expand Down Expand Up @@ -403,7 +403,7 @@ export class Engine extends EventDispatcher {
*/
run(): void {
this.resume();
this.dispatch("run", this);
this.dispatch(EngineEventType.Run, this);
}

/**
Expand Down Expand Up @@ -506,7 +506,7 @@ export class Engine extends EventDispatcher {
this._batcherManager.destroy();
this._renderTargetPool.gc();
this.xrManager?._destroy();
this.dispatch("shutdown", this);
this.dispatch(EngineEventType.Shutdown, this);

// Cancel animation
this.pause();
Expand Down Expand Up @@ -671,7 +671,7 @@ export class Engine extends EventDispatcher {
this.resourceManager._lostGraphicResources();
this._renderingStatistics._reset();
console.log("Device lost.");
this.dispatch("devicelost", this);
this.dispatch(EngineEventType.DeviceLost, this);
}

private _onDeviceRestored(): void {
Expand All @@ -692,7 +692,7 @@ export class Engine extends EventDispatcher {
._restoreResourcesContent()
.then(() => {
console.log("Graphic resource content restored.\n\n" + "Device restored.");
this.dispatch("devicerestored", this);
this.dispatch(EngineEventType.DeviceRestored, this);
})
.catch((error) => {
console.error(error);
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/EngineEventType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Engine event type.
*/
export enum EngineEventType {
/** Dispatched when the engine starts running. */
Run = "run",
/** Dispatched when the engine shuts down. */
Shutdown = "shutdown",
/** Dispatched when the graphic device is lost. */
DeviceLost = "devicelost",
/** Dispatched when the graphic device is restored. */
DeviceRestored = "devicerestored"
}
3 changes: 2 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export { dependentComponents, DependentMode } from "./ComponentsDependencies";
export { Camera } from "./Camera";
export { Transform, TransformModifyFlags } from "./Transform";
export { BoolUpdateFlag } from "./BoolUpdateFlag";
export type { EngineSettings } from "./EngineSettings";
export type { EngineConfiguration } from "./Engine";
export { EngineEventType } from "./EngineEventType";
export type { EngineSettings } from "./EngineSettings";
export type { ComponentConstructor } from "./Entity";

export { request } from "./asset/request";
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"shader-compiler-precompile": "./bundler/cli.js"
},
"scripts": {
"build": "rollup -c rollup.config.js && chmod +x bundler/cli.js",
"build": "rollup -c rollup.config.js && node -e \"require('fs').chmodSync('bundler/cli.js', 0o755)\"",
"b:types": "tsc"
},
"umd": {
Expand Down
1 change: 1 addition & 0 deletions packages/shader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
compiledShaders/
1 change: 0 additions & 1 deletion packages/shader/compiledShaders/2D/Sprite.shaderc

This file was deleted.

1 change: 0 additions & 1 deletion packages/shader/compiledShaders/2D/SpriteMask.shaderc

This file was deleted.

1 change: 0 additions & 1 deletion packages/shader/compiledShaders/2D/Text.shaderc

This file was deleted.

1 change: 0 additions & 1 deletion packages/shader/compiledShaders/2D/UIDefault.shaderc

This file was deleted.

1 change: 0 additions & 1 deletion packages/shader/compiledShaders/BlinnPhong.shaderc

This file was deleted.

Loading
Loading