bloody-engine 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/batch-renderer.test.d.ts +12 -0
- package/dist/web/batch-renderer.test.d.ts.map +1 -0
- package/dist/web/core/buffer.d.ts +58 -0
- package/dist/web/core/buffer.d.ts.map +1 -0
- package/dist/web/core/grahpic-device.d.ts +66 -0
- package/dist/web/core/grahpic-device.d.ts.map +1 -0
- package/dist/web/core/index.d.ts +8 -0
- package/dist/web/core/index.d.ts.map +1 -0
- package/dist/web/core/resource-loader-factory.d.ts +90 -0
- package/dist/web/core/resource-loader-factory.d.ts.map +1 -0
- package/dist/web/core/resource-loader.d.ts +71 -0
- package/dist/web/core/resource-loader.d.ts.map +1 -0
- package/dist/web/core/resource-pipeline.d.ts +139 -0
- package/dist/web/core/resource-pipeline.d.ts.map +1 -0
- package/dist/web/core/shader.d.ts +62 -0
- package/dist/web/core/shader.d.ts.map +1 -0
- package/dist/web/core/texture.d.ts +69 -0
- package/dist/web/core/texture.d.ts.map +1 -0
- package/dist/web/demo-node.d.ts +2 -0
- package/dist/web/demo-node.d.ts.map +1 -0
- package/dist/web/examples/batch-renderer-demo.d.ts +10 -0
- package/dist/web/examples/batch-renderer-demo.d.ts.map +1 -0
- package/dist/web/examples/projection-examples.d.ts +87 -0
- package/dist/web/examples/projection-examples.d.ts.map +1 -0
- package/dist/web/examples/resource-loader-demo.d.ts +14 -0
- package/dist/web/examples/resource-loader-demo.d.ts.map +1 -0
- package/dist/web/examples/shader-examples.d.ts +92 -0
- package/dist/web/examples/shader-examples.d.ts.map +1 -0
- package/dist/web/examples/sprite-batch-renderer-demo.d.ts +12 -0
- package/dist/web/examples/sprite-batch-renderer-demo.d.ts.map +1 -0
- package/dist/web/index-node-batch.d.ts +10 -0
- package/dist/web/index-node-batch.d.ts.map +1 -0
- package/dist/web/index.d.ts +7 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/platforms/browser/browser-context.d.ts +31 -0
- package/dist/web/platforms/browser/browser-context.d.ts.map +1 -0
- package/dist/web/platforms/browser/browser-resource-loader.d.ts +67 -0
- package/dist/web/platforms/browser/browser-resource-loader.d.ts.map +1 -0
- package/dist/web/platforms/node/node-context.d.ts +31 -0
- package/dist/web/platforms/node/node-context.d.ts.map +1 -0
- package/dist/web/platforms/node/node-resource-loader.d.ts +73 -0
- package/dist/web/platforms/node/node-resource-loader.d.ts.map +1 -0
- package/dist/web/platforms/node/sdl-window.d.ts +41 -0
- package/dist/web/platforms/node/sdl-window.d.ts.map +1 -0
- package/dist/web/projection.test.d.ts +5 -0
- package/dist/web/projection.test.d.ts.map +1 -0
- package/dist/web/public-api.d.ts +20 -0
- package/dist/web/public-api.d.ts.map +1 -0
- package/dist/web/rendering/batch-renderer.d.ts +273 -0
- package/dist/web/rendering/batch-renderer.d.ts.map +1 -0
- package/dist/web/rendering/camera.d.ts +153 -0
- package/dist/web/rendering/camera.d.ts.map +1 -0
- package/dist/web/rendering/projection.d.ts +108 -0
- package/dist/web/rendering/projection.d.ts.map +1 -0
- package/dist/web/rendering/rendering-context-factory.d.ts +24 -0
- package/dist/web/rendering/rendering-context-factory.d.ts.map +1 -0
- package/dist/web/rendering/rendering-context.d.ts +77 -0
- package/dist/web/rendering/rendering-context.d.ts.map +1 -0
- package/dist/web/rendering/vertex.d.ts +98 -0
- package/dist/web/rendering/vertex.d.ts.map +1 -0
- package/dist/web/scene/scene.d.ts +139 -0
- package/dist/web/scene/scene.d.ts.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ProjectionConfig, GridCoord, ScreenCoord } from '../rendering/projection';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize the projection system with game-specific settings
|
|
4
|
+
*/
|
|
5
|
+
export declare function initializeGameProjection(): ProjectionConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Entity in the game world with position and height
|
|
8
|
+
*/
|
|
9
|
+
interface GameEntity {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
gridPos: GridCoord;
|
|
13
|
+
screenPos?: ScreenCoord;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Update an entity's screen position based on its grid position
|
|
17
|
+
*/
|
|
18
|
+
export declare function updateEntityScreenPosition(entity: GameEntity, projection: ProjectionConfig): void;
|
|
19
|
+
/**
|
|
20
|
+
* Create a game entity at a grid position
|
|
21
|
+
*/
|
|
22
|
+
export declare function createEntity(id: string, name: string, gridPos: GridCoord, projection: ProjectionConfig): GameEntity;
|
|
23
|
+
/**
|
|
24
|
+
* Handle mouse click event to select a game entity
|
|
25
|
+
* Returns the grid cell that was clicked
|
|
26
|
+
*/
|
|
27
|
+
export declare function handleMouseClick(event: MouseEvent, canvas: HTMLCanvasElement, projection: ProjectionConfig): GridCoord;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate Manhattan distance between two grid positions
|
|
30
|
+
* Ignores height differences (for ground-level pathfinding)
|
|
31
|
+
*/
|
|
32
|
+
export declare function calculateGridDistance(from: GridCoord, to: GridCoord): number;
|
|
33
|
+
/**
|
|
34
|
+
* Calculate 3D Euclidean distance considering height
|
|
35
|
+
* Useful for flying units or elevation-aware costs
|
|
36
|
+
*/
|
|
37
|
+
export declare function calculate3DDistance(from: GridCoord, to: GridCoord): number;
|
|
38
|
+
/**
|
|
39
|
+
* Move an entity towards a target position
|
|
40
|
+
*/
|
|
41
|
+
export declare function moveEntityTowards(entity: GameEntity, target: GridCoord, projection: ProjectionConfig): void;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate render priority based on grid position
|
|
44
|
+
* In isometric view, objects further "back" should render first
|
|
45
|
+
*
|
|
46
|
+
* The render priority is based on the sum of grid coordinates
|
|
47
|
+
* This ensures proper depth sorting for non-overlapping isometric tiles
|
|
48
|
+
*/
|
|
49
|
+
export declare function calculateRenderPriority(gridCoord: GridCoord): number;
|
|
50
|
+
/**
|
|
51
|
+
* Sort entities by render priority
|
|
52
|
+
*/
|
|
53
|
+
export declare function sortEntitiesByDepth(entities: GameEntity[]): GameEntity[];
|
|
54
|
+
/**
|
|
55
|
+
* Simple height map - returns terrain height at a grid position
|
|
56
|
+
*/
|
|
57
|
+
type TerrainHeightMap = (x: number, y: number) => number;
|
|
58
|
+
/**
|
|
59
|
+
* Create a simple height map function
|
|
60
|
+
*/
|
|
61
|
+
export declare function createTerrainHeightMap(): TerrainHeightMap;
|
|
62
|
+
/**
|
|
63
|
+
* Position an entity on terrain (automatically set height)
|
|
64
|
+
*/
|
|
65
|
+
export declare function placeEntityOnTerrain(entity: GameEntity, heightMap: TerrainHeightMap, projection: ProjectionConfig): void;
|
|
66
|
+
/**
|
|
67
|
+
* Game camera with grid-based positioning
|
|
68
|
+
*/
|
|
69
|
+
export interface Camera {
|
|
70
|
+
center: GridCoord;
|
|
71
|
+
viewWidth: number;
|
|
72
|
+
viewHeight: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a camera centered on a grid position
|
|
76
|
+
*/
|
|
77
|
+
export declare function createCamera(centerGrid: GridCoord, viewWidthPixels: number, viewHeightPixels: number, projection: ProjectionConfig): Camera;
|
|
78
|
+
/**
|
|
79
|
+
* Check if an entity is within camera view
|
|
80
|
+
*/
|
|
81
|
+
export declare function isEntityInView(entity: GameEntity, camera: Camera, projection: ProjectionConfig, margin?: number): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Run a complete example scenario
|
|
84
|
+
*/
|
|
85
|
+
export declare function runExampleScenario(): void;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=projection-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-examples.d.ts","sourceRoot":"","sources":["../../../src/examples/projection-examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAKL,gBAAgB,EAEhB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAMjC;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,gBAAgB,CAa3D;AAMD;;GAEG;AACH,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAcN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,EAClB,UAAU,EAAE,gBAAgB,GAC3B,UAAU,CAIZ;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,gBAAgB,GAC3B,SAAS,CAkBX;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,CAE5E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,CAM1E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAaN;AAMD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAIpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAKxE;AAMD;;GAEG;AACH,KAAK,gBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAEzD;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAazD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAaN;AAMD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,EACrB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,gBAAgB,GAC3B,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,gBAAgB,EAC5B,MAAM,GAAE,MAAW,GAClB,OAAO,CAYT;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAsEzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource Loader Demo
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the resource loading system with:
|
|
5
|
+
* - Loading shader source code from external files
|
|
6
|
+
* - Using ResourcePipeline for async resource management
|
|
7
|
+
* - Caching and batch loading
|
|
8
|
+
* - Cross-platform resource loading (Browser/Node.js)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Browser-based Resource Loader Demo
|
|
12
|
+
*/
|
|
13
|
+
export declare function runBrowserResourceLoaderDemo(): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=resource-loader-demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-loader-demo.d.ts","sourceRoot":"","sources":["../../../src/examples/resource-loader-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyCH;;GAEG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAyRlE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shader Examples and Presets
|
|
3
|
+
* Collection of shader implementations for different effects
|
|
4
|
+
*/
|
|
5
|
+
export declare const BASIC_SHADER: {
|
|
6
|
+
vertex: string;
|
|
7
|
+
fragment: string;
|
|
8
|
+
uniforms: string[];
|
|
9
|
+
attributes: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const GLOW_SHADER: {
|
|
12
|
+
vertex: string;
|
|
13
|
+
fragment: string;
|
|
14
|
+
uniforms: string[];
|
|
15
|
+
attributes: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare const WAVE_SHADER: {
|
|
18
|
+
vertex: string;
|
|
19
|
+
fragment: string;
|
|
20
|
+
uniforms: string[];
|
|
21
|
+
attributes: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare const NEON_SHADER: {
|
|
24
|
+
vertex: string;
|
|
25
|
+
fragment: string;
|
|
26
|
+
uniforms: string[];
|
|
27
|
+
attributes: string[];
|
|
28
|
+
};
|
|
29
|
+
export declare const HOLOGRAM_SHADER: {
|
|
30
|
+
vertex: string;
|
|
31
|
+
fragment: string;
|
|
32
|
+
uniforms: string[];
|
|
33
|
+
attributes: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare const CHROMATIC_SHADER: {
|
|
36
|
+
vertex: string;
|
|
37
|
+
fragment: string;
|
|
38
|
+
uniforms: string[];
|
|
39
|
+
attributes: string[];
|
|
40
|
+
};
|
|
41
|
+
export declare const PSYCHEDELIC_SHADER: {
|
|
42
|
+
vertex: string;
|
|
43
|
+
fragment: string;
|
|
44
|
+
uniforms: string[];
|
|
45
|
+
attributes: string[];
|
|
46
|
+
};
|
|
47
|
+
export declare const SHADER_LIBRARY: {
|
|
48
|
+
BASIC: {
|
|
49
|
+
vertex: string;
|
|
50
|
+
fragment: string;
|
|
51
|
+
uniforms: string[];
|
|
52
|
+
attributes: string[];
|
|
53
|
+
};
|
|
54
|
+
GLOW: {
|
|
55
|
+
vertex: string;
|
|
56
|
+
fragment: string;
|
|
57
|
+
uniforms: string[];
|
|
58
|
+
attributes: string[];
|
|
59
|
+
};
|
|
60
|
+
WAVE: {
|
|
61
|
+
vertex: string;
|
|
62
|
+
fragment: string;
|
|
63
|
+
uniforms: string[];
|
|
64
|
+
attributes: string[];
|
|
65
|
+
};
|
|
66
|
+
NEON: {
|
|
67
|
+
vertex: string;
|
|
68
|
+
fragment: string;
|
|
69
|
+
uniforms: string[];
|
|
70
|
+
attributes: string[];
|
|
71
|
+
};
|
|
72
|
+
HOLOGRAM: {
|
|
73
|
+
vertex: string;
|
|
74
|
+
fragment: string;
|
|
75
|
+
uniforms: string[];
|
|
76
|
+
attributes: string[];
|
|
77
|
+
};
|
|
78
|
+
CHROMATIC: {
|
|
79
|
+
vertex: string;
|
|
80
|
+
fragment: string;
|
|
81
|
+
uniforms: string[];
|
|
82
|
+
attributes: string[];
|
|
83
|
+
};
|
|
84
|
+
PSYCHEDELIC: {
|
|
85
|
+
vertex: string;
|
|
86
|
+
fragment: string;
|
|
87
|
+
uniforms: string[];
|
|
88
|
+
attributes: string[];
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export type ShaderPreset = keyof typeof SHADER_LIBRARY;
|
|
92
|
+
//# sourceMappingURL=shader-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-examples.d.ts","sourceRoot":"","sources":["../../../src/examples/shader-examples.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,YAAY;;;;;CA0BxB,CAAC;AAKF,eAAO,MAAM,WAAW;;;;;CAkCvB,CAAC;AAKF,eAAO,MAAM,WAAW;;;;;CAiCvB,CAAC;AAKF,eAAO,MAAM,WAAW;;;;;CAuCvB,CAAC;AAKF,eAAO,MAAM,eAAe;;;;;CAmC3B,CAAC;AAKF,eAAO,MAAM,gBAAgB;;;;;CAiC5B,CAAC;AAKF,eAAO,MAAM,kBAAkB;;;;;CAoC9B,CAAC;AAKF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sprite Batch Renderer Demo - V2
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the 2.5D sprite batch renderer with:
|
|
5
|
+
* - Full vertex structure (position, texture coords, color tint, texture index)
|
|
6
|
+
* - Z-depth layering for 2.5D positioning
|
|
7
|
+
* - Per-sprite color tinting
|
|
8
|
+
* - Texture atlas support via texture index
|
|
9
|
+
* - UV rect selection for sprite sheets
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=sprite-batch-renderer-demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprite-batch-renderer-demo.d.ts","sourceRoot":"","sources":["../../../src/examples/sprite-batch-renderer-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch Renderer Version of index-node.ts
|
|
3
|
+
*
|
|
4
|
+
* Comparison version using BatchRenderer instead of traditional VertexBuffer
|
|
5
|
+
* Demonstrates the difference between:
|
|
6
|
+
* - Traditional: Create static buffers, render with fixed transforms
|
|
7
|
+
* - Batch: Dynamic buffer, update vertices each frame, batch render
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=index-node-batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node-batch.d.ts","sourceRoot":"","sources":["../../src/index-node-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RenderingContext, RenderingContextOptions } from '../../rendering/rendering-context';
|
|
2
|
+
/**
|
|
3
|
+
* Browser-based WebGL rendering context implementation
|
|
4
|
+
* Manages rendering to an HTML canvas element
|
|
5
|
+
*/
|
|
6
|
+
export declare class BrowserRenderingContext implements RenderingContext {
|
|
7
|
+
glContext: WebGLRenderingContext;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
isBrowser: boolean;
|
|
11
|
+
private canvas;
|
|
12
|
+
constructor(options: RenderingContextOptions);
|
|
13
|
+
resize(width: number, height: number): void;
|
|
14
|
+
getViewport(): {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
clear(color?: {
|
|
19
|
+
r: number;
|
|
20
|
+
g: number;
|
|
21
|
+
b: number;
|
|
22
|
+
a: number;
|
|
23
|
+
}): void;
|
|
24
|
+
present(): void;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the underlying canvas element (browser-specific)
|
|
28
|
+
*/
|
|
29
|
+
getCanvas(): HTMLCanvasElement;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=browser-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-context.d.ts","sourceRoot":"","sources":["../../../../src/platforms/browser/browser-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAC9D,SAAS,EAAE,qBAAqB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAQ;IAE1B,OAAO,CAAC,MAAM,CAAoB;gBAEtB,OAAO,EAAE,uBAAuB;IA0B5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQ3C,WAAW,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIhD,KAAK,CAAC,KAAK,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IASnE,OAAO,IAAI,IAAI;IAIf,OAAO,IAAI,IAAI;IAOf;;OAEG;IACH,SAAS,IAAI,iBAAiB;CAG/B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { IResourceLoader, ResourceLoadOptions, ResourceLoadResult } from '../../core/resource-loader';
|
|
2
|
+
/**
|
|
3
|
+
* Resource loader implementation for browser environments
|
|
4
|
+
* Uses the Fetch API to load resources from URLs
|
|
5
|
+
*/
|
|
6
|
+
export declare class BrowserResourceLoader implements IResourceLoader {
|
|
7
|
+
/**
|
|
8
|
+
* Base URL for resolving relative paths
|
|
9
|
+
*/
|
|
10
|
+
private baseUrl;
|
|
11
|
+
/**
|
|
12
|
+
* Default request timeout in milliseconds
|
|
13
|
+
*/
|
|
14
|
+
private defaultTimeout;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new browser resource loader
|
|
17
|
+
* @param baseUrl Optional base URL for resolving relative paths (defaults to current origin)
|
|
18
|
+
* @param timeout Default timeout for requests in milliseconds (default: 10000)
|
|
19
|
+
*/
|
|
20
|
+
constructor(baseUrl?: string, timeout?: number);
|
|
21
|
+
/**
|
|
22
|
+
* Get the current origin (protocol + host + port)
|
|
23
|
+
*/
|
|
24
|
+
private getCurrentOrigin;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a relative path against the base URL
|
|
27
|
+
* @param path Relative or absolute path
|
|
28
|
+
* @returns Resolved absolute URL
|
|
29
|
+
*/
|
|
30
|
+
private resolvePath;
|
|
31
|
+
/**
|
|
32
|
+
* Load a single resource from a URL
|
|
33
|
+
* @param path URL or relative path to the resource
|
|
34
|
+
* @param options Optional loading configuration
|
|
35
|
+
* @returns Promise resolving to the resource content
|
|
36
|
+
*/
|
|
37
|
+
load(path: string, options?: ResourceLoadOptions): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Load multiple resources in parallel
|
|
40
|
+
* @param paths Array of URLs or paths
|
|
41
|
+
* @param options Optional loading configuration
|
|
42
|
+
* @returns Promise resolving to array of load results
|
|
43
|
+
*/
|
|
44
|
+
loadMultiple(paths: string[], options?: ResourceLoadOptions): Promise<ResourceLoadResult[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Check if the path is valid for loading in the browser
|
|
47
|
+
* @param path URL or path to check
|
|
48
|
+
* @returns true if the path can be loaded
|
|
49
|
+
*/
|
|
50
|
+
canLoad(path: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Set a new base URL for resolving relative paths
|
|
53
|
+
* @param baseUrl New base URL
|
|
54
|
+
*/
|
|
55
|
+
setBaseUrl(baseUrl: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Get the current base URL
|
|
58
|
+
* @returns Current base URL
|
|
59
|
+
*/
|
|
60
|
+
getBaseUrl(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Set the default request timeout
|
|
63
|
+
* @param timeout Timeout in milliseconds
|
|
64
|
+
*/
|
|
65
|
+
setTimeout(timeout: number): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=browser-resource-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-resource-loader.d.ts","sourceRoot":"","sources":["../../../../src/platforms/browser/browser-resource-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IAC3D;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;OAEG;IACH,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;OAIG;gBACS,OAAO,GAAE,MAAW,EAAE,OAAO,GAAE,MAAc;IAKzD;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAyBnB;;;;;OAKG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IA8CxE;;;;;OAKG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAsBhC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAe9B;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAGlC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RenderingContext, RenderingContextOptions } from '../../rendering/rendering-context';
|
|
2
|
+
/**
|
|
3
|
+
* Node.js-based WebGL rendering context implementation
|
|
4
|
+
* Uses headless-gl (node-gl) for server-side rendering
|
|
5
|
+
*/
|
|
6
|
+
export declare class NodeRenderingContext implements RenderingContext {
|
|
7
|
+
glContext: WebGLRenderingContext;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
isBrowser: boolean;
|
|
11
|
+
constructor(options: RenderingContextOptions);
|
|
12
|
+
resize(width: number, height: number): void;
|
|
13
|
+
getViewport(): {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
clear(color?: {
|
|
18
|
+
r: number;
|
|
19
|
+
g: number;
|
|
20
|
+
b: number;
|
|
21
|
+
a: number;
|
|
22
|
+
}): void;
|
|
23
|
+
present(): void;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Read the current framebuffer contents as RGBA pixel data
|
|
27
|
+
* Used for capturing frames for display or saving
|
|
28
|
+
*/
|
|
29
|
+
readPixels(): Uint8Array;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=node-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-context.d.ts","sourceRoot":"","sources":["../../../../src/platforms/node/node-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,SAAS,EAAE,qBAAqB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAS;gBAEf,OAAO,EAAE,uBAAuB;IAiB5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAU3C,WAAW,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIhD,KAAK,CAAC,KAAK,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IASnE,OAAO,IAAI,IAAI;IAKf,OAAO,IAAI,IAAI;IAOf;;;OAGG;IACH,UAAU,IAAI,UAAU;CAazB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Stats } from 'fs';
|
|
2
|
+
import { IResourceLoader, ResourceLoadOptions, ResourceLoadResult } from '../../core/resource-loader';
|
|
3
|
+
/**
|
|
4
|
+
* Resource loader implementation for Node.js environments
|
|
5
|
+
* Uses fs.promises to load resources from the file system
|
|
6
|
+
*/
|
|
7
|
+
export declare class NodeResourceLoader implements IResourceLoader {
|
|
8
|
+
/**
|
|
9
|
+
* Base directory for resolving relative paths
|
|
10
|
+
*/
|
|
11
|
+
private baseDir;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new Node.js resource loader
|
|
14
|
+
* @param baseDir Optional base directory for resolving relative paths (defaults to current working directory)
|
|
15
|
+
*/
|
|
16
|
+
constructor(baseDir?: string);
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a relative path against the base directory
|
|
19
|
+
* @param filePath Relative or absolute file path
|
|
20
|
+
* @returns Resolved absolute file path
|
|
21
|
+
*/
|
|
22
|
+
private resolvePath;
|
|
23
|
+
/**
|
|
24
|
+
* Load a single resource from a file
|
|
25
|
+
* @param filePath File path (relative or absolute)
|
|
26
|
+
* @param options Optional loading configuration
|
|
27
|
+
* @returns Promise resolving to the file content
|
|
28
|
+
*/
|
|
29
|
+
load(filePath: string, options?: ResourceLoadOptions): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Load multiple resources in parallel
|
|
32
|
+
* @param filePaths Array of file paths
|
|
33
|
+
* @param options Optional loading configuration
|
|
34
|
+
* @returns Promise resolving to array of load results
|
|
35
|
+
*/
|
|
36
|
+
loadMultiple(filePaths: string[], options?: ResourceLoadOptions): Promise<ResourceLoadResult[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the path is valid for loading in Node.js
|
|
39
|
+
* @param filePath File path to check
|
|
40
|
+
* @returns true if the path can be loaded
|
|
41
|
+
*/
|
|
42
|
+
canLoad(filePath: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check if a file exists without loading it
|
|
45
|
+
* @param filePath File path to check
|
|
46
|
+
* @returns Promise resolving to true if file exists
|
|
47
|
+
*/
|
|
48
|
+
exists(filePath: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Get file statistics (size, modification time, etc.)
|
|
51
|
+
* @param filePath File path to check
|
|
52
|
+
* @returns Promise resolving to file stats
|
|
53
|
+
*/
|
|
54
|
+
getStats(filePath: string): Promise<Stats>;
|
|
55
|
+
/**
|
|
56
|
+
* Set a new base directory for resolving relative paths
|
|
57
|
+
* @param baseDir New base directory
|
|
58
|
+
*/
|
|
59
|
+
setBaseDir(baseDir: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get the current base directory
|
|
62
|
+
* @returns Current base directory
|
|
63
|
+
*/
|
|
64
|
+
getBaseDir(): string;
|
|
65
|
+
/**
|
|
66
|
+
* List all files in a directory
|
|
67
|
+
* @param dirPath Directory path to list
|
|
68
|
+
* @param recursive Whether to recursively list subdirectories (default: false)
|
|
69
|
+
* @returns Promise resolving to array of file paths
|
|
70
|
+
*/
|
|
71
|
+
listDirectory(dirPath: string, recursive?: boolean): Promise<string[]>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=node-resource-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-resource-loader.d.ts","sourceRoot":"","sources":["../../../../src/platforms/node/node-resource-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IACxD;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;;OAGG;gBACS,OAAO,GAAE,MAAsB;IAI3C;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAUnB;;;;;OAKG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuC5E;;;;;OAKG;IACG,YAAY,CAChB,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAsBhC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAYlC;;;;OAIG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUhD;;;;OAIG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAKhD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;OAKG;IACG,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC;CAkBrB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDL Window wrapper for displaying rendered content
|
|
3
|
+
* Handles window creation, event polling, and surface updates
|
|
4
|
+
*/
|
|
5
|
+
export declare class SDLWindow {
|
|
6
|
+
private window;
|
|
7
|
+
private width;
|
|
8
|
+
private height;
|
|
9
|
+
private title;
|
|
10
|
+
private closed;
|
|
11
|
+
constructor(width: number, height: number, title?: string);
|
|
12
|
+
/**
|
|
13
|
+
* Get window dimensions
|
|
14
|
+
*/
|
|
15
|
+
getDimensions(): {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Display pixel data in the window
|
|
21
|
+
* @param pixels Uint8Array of RGBA pixel data
|
|
22
|
+
*/
|
|
23
|
+
updatePixels(pixels: Uint8Array): void;
|
|
24
|
+
/**
|
|
25
|
+
* Register an event handler
|
|
26
|
+
*/
|
|
27
|
+
on(eventName: string, handler: Function): void;
|
|
28
|
+
/**
|
|
29
|
+
* Check if window is still open
|
|
30
|
+
*/
|
|
31
|
+
isOpen(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Cleanup and close window
|
|
34
|
+
*/
|
|
35
|
+
cleanup(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Destroy the window (alias for cleanup)
|
|
38
|
+
*/
|
|
39
|
+
destroy(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=sdl-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdl-window.d.ts","sourceRoot":"","sources":["../../../../src/platforms/node/sdl-window.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAkB;gBAEpB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAAwB;IA6B1E;;OAEG;IACH,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIlD;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAkBtC;;OAEG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI;IAkB9C;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACH,OAAO,IAAI,IAAI;IAcf;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.test.d.ts","sourceRoot":"","sources":["../../src/projection.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { GraphicsDevice } from './core/grahpic-device';
|
|
2
|
+
export type { RenderingContext, RenderingContextOptions, } from './rendering/rendering-context';
|
|
3
|
+
export { BrowserRenderingContext } from './platforms/browser/browser-context';
|
|
4
|
+
export { NodeRenderingContext } from './platforms/node/node-context';
|
|
5
|
+
export { RenderingContextFactory } from './rendering/rendering-context-factory';
|
|
6
|
+
export { Shader } from './core/shader';
|
|
7
|
+
export { Texture } from './core/texture';
|
|
8
|
+
export { VertexBuffer, IndexBuffer } from './core/buffer';
|
|
9
|
+
export { BatchRenderer, SpriteBatchRenderer } from './rendering/batch-renderer';
|
|
10
|
+
export type { QuadInstance, SpriteQuadInstance } from './rendering/batch-renderer';
|
|
11
|
+
export { Camera, Matrix4 } from './rendering/camera';
|
|
12
|
+
export type { IResourceLoader, ResourceLoadResult, ResourceLoadOptions, BatchLoadResult, } from './core/resource-loader';
|
|
13
|
+
export { BrowserResourceLoader, } from './platforms/browser/browser-resource-loader';
|
|
14
|
+
export { NodeResourceLoader } from './platforms/node/node-resource-loader';
|
|
15
|
+
export { ResourceLoaderFactory, Environment, createResourceLoader, } from './core/resource-loader-factory';
|
|
16
|
+
export type { ResourceLoaderFactoryOptions } from './core/resource-loader-factory';
|
|
17
|
+
export { ResourcePipeline, createResourcePipeline, } from './core/resource-pipeline';
|
|
18
|
+
export type { ShaderSource, NamedShaderSource, ResourcePipelineOptions, } from './core/resource-pipeline';
|
|
19
|
+
export { runBrowserResourceLoaderDemo } from './examples/resource-loader-demo';
|
|
20
|
+
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/public-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,YAAY,EACV,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAGhF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGnF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGrD,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,GACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC"}
|