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.
Files changed (63) hide show
  1. package/dist/web/batch-renderer.test.d.ts +12 -0
  2. package/dist/web/batch-renderer.test.d.ts.map +1 -0
  3. package/dist/web/core/buffer.d.ts +58 -0
  4. package/dist/web/core/buffer.d.ts.map +1 -0
  5. package/dist/web/core/grahpic-device.d.ts +66 -0
  6. package/dist/web/core/grahpic-device.d.ts.map +1 -0
  7. package/dist/web/core/index.d.ts +8 -0
  8. package/dist/web/core/index.d.ts.map +1 -0
  9. package/dist/web/core/resource-loader-factory.d.ts +90 -0
  10. package/dist/web/core/resource-loader-factory.d.ts.map +1 -0
  11. package/dist/web/core/resource-loader.d.ts +71 -0
  12. package/dist/web/core/resource-loader.d.ts.map +1 -0
  13. package/dist/web/core/resource-pipeline.d.ts +139 -0
  14. package/dist/web/core/resource-pipeline.d.ts.map +1 -0
  15. package/dist/web/core/shader.d.ts +62 -0
  16. package/dist/web/core/shader.d.ts.map +1 -0
  17. package/dist/web/core/texture.d.ts +69 -0
  18. package/dist/web/core/texture.d.ts.map +1 -0
  19. package/dist/web/demo-node.d.ts +2 -0
  20. package/dist/web/demo-node.d.ts.map +1 -0
  21. package/dist/web/examples/batch-renderer-demo.d.ts +10 -0
  22. package/dist/web/examples/batch-renderer-demo.d.ts.map +1 -0
  23. package/dist/web/examples/projection-examples.d.ts +87 -0
  24. package/dist/web/examples/projection-examples.d.ts.map +1 -0
  25. package/dist/web/examples/resource-loader-demo.d.ts +14 -0
  26. package/dist/web/examples/resource-loader-demo.d.ts.map +1 -0
  27. package/dist/web/examples/shader-examples.d.ts +92 -0
  28. package/dist/web/examples/shader-examples.d.ts.map +1 -0
  29. package/dist/web/examples/sprite-batch-renderer-demo.d.ts +12 -0
  30. package/dist/web/examples/sprite-batch-renderer-demo.d.ts.map +1 -0
  31. package/dist/web/index-node-batch.d.ts +10 -0
  32. package/dist/web/index-node-batch.d.ts.map +1 -0
  33. package/dist/web/index.d.ts +7 -0
  34. package/dist/web/index.d.ts.map +1 -0
  35. package/dist/web/platforms/browser/browser-context.d.ts +31 -0
  36. package/dist/web/platforms/browser/browser-context.d.ts.map +1 -0
  37. package/dist/web/platforms/browser/browser-resource-loader.d.ts +67 -0
  38. package/dist/web/platforms/browser/browser-resource-loader.d.ts.map +1 -0
  39. package/dist/web/platforms/node/node-context.d.ts +31 -0
  40. package/dist/web/platforms/node/node-context.d.ts.map +1 -0
  41. package/dist/web/platforms/node/node-resource-loader.d.ts +73 -0
  42. package/dist/web/platforms/node/node-resource-loader.d.ts.map +1 -0
  43. package/dist/web/platforms/node/sdl-window.d.ts +41 -0
  44. package/dist/web/platforms/node/sdl-window.d.ts.map +1 -0
  45. package/dist/web/projection.test.d.ts +5 -0
  46. package/dist/web/projection.test.d.ts.map +1 -0
  47. package/dist/web/public-api.d.ts +20 -0
  48. package/dist/web/public-api.d.ts.map +1 -0
  49. package/dist/web/rendering/batch-renderer.d.ts +273 -0
  50. package/dist/web/rendering/batch-renderer.d.ts.map +1 -0
  51. package/dist/web/rendering/camera.d.ts +153 -0
  52. package/dist/web/rendering/camera.d.ts.map +1 -0
  53. package/dist/web/rendering/projection.d.ts +108 -0
  54. package/dist/web/rendering/projection.d.ts.map +1 -0
  55. package/dist/web/rendering/rendering-context-factory.d.ts +24 -0
  56. package/dist/web/rendering/rendering-context-factory.d.ts.map +1 -0
  57. package/dist/web/rendering/rendering-context.d.ts +77 -0
  58. package/dist/web/rendering/rendering-context.d.ts.map +1 -0
  59. package/dist/web/rendering/vertex.d.ts +98 -0
  60. package/dist/web/rendering/vertex.d.ts.map +1 -0
  61. package/dist/web/scene/scene.d.ts +139 -0
  62. package/dist/web/scene/scene.d.ts.map +1 -0
  63. package/package.json +5 -4
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Batch Renderer Integration Test
3
+ *
4
+ * Verifies that the batch renderer:
5
+ * 1. Creates and initializes correctly
6
+ * 2. Accepts quad instances
7
+ * 3. Updates vertex buffer on frame updates
8
+ * 4. Renders without errors
9
+ * 5. Handles edge cases (empty batch, max capacity, etc.)
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=batch-renderer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-renderer.test.d.ts","sourceRoot":"","sources":["../../src/batch-renderer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Vertex Buffer abstraction
3
+ * Manages vertex data for rendering
4
+ */
5
+ export declare class VertexBuffer {
6
+ private buffer;
7
+ private gl;
8
+ private vertexCount;
9
+ private stride;
10
+ constructor(gl: WebGLRenderingContext, data: Float32Array, stride?: number);
11
+ /**
12
+ * Bind buffer for rendering
13
+ */
14
+ bind(): void;
15
+ /**
16
+ * Unbind buffer
17
+ */
18
+ unbind(): void;
19
+ /**
20
+ * Get vertex count
21
+ */
22
+ getVertexCount(): number;
23
+ /**
24
+ * Get stride
25
+ */
26
+ getStride(): number;
27
+ /**
28
+ * Clean up resources
29
+ */
30
+ dispose(): void;
31
+ }
32
+ /**
33
+ * Index Buffer abstraction
34
+ * Manages index data for indexed rendering
35
+ */
36
+ export declare class IndexBuffer {
37
+ private buffer;
38
+ private gl;
39
+ private indexCount;
40
+ constructor(gl: WebGLRenderingContext, data: Uint16Array);
41
+ /**
42
+ * Bind buffer for rendering
43
+ */
44
+ bind(): void;
45
+ /**
46
+ * Unbind buffer
47
+ */
48
+ unbind(): void;
49
+ /**
50
+ * Get index count
51
+ */
52
+ getIndexCount(): number;
53
+ /**
54
+ * Clean up resources
55
+ */
56
+ dispose(): void;
57
+ }
58
+ //# sourceMappingURL=buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/core/buffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,EAAE,CAAwB;IAClC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAS;gBAGrB,EAAE,EAAE,qBAAqB,EACzB,IAAI,EAAE,YAAY,EAClB,MAAM,GAAE,MAAU;IAoBpB;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,EAAE,CAAwB;IAClC,OAAO,CAAC,UAAU,CAAS;gBAEf,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,WAAW;IAgBxD;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,66 @@
1
+ import { RenderingContext } from '../rendering/rendering-context';
2
+ import { Shader } from './shader';
3
+ /**
4
+ * Graphics device that manages rendering context and WebGL operations
5
+ * Uses standardized RenderingContext interface, never directly references DOM
6
+ */
7
+ export declare class GraphicsDevice {
8
+ private context;
9
+ constructor(width: number, height: number);
10
+ /**
11
+ * Get the underlying WebGL rendering context
12
+ */
13
+ getGLContext(): WebGLRenderingContext;
14
+ /**
15
+ * Get the rendering context
16
+ */
17
+ getRenderingContext(): RenderingContext;
18
+ /**
19
+ * Get current width
20
+ */
21
+ getWidth(): number;
22
+ /**
23
+ * Get current height
24
+ */
25
+ getHeight(): number;
26
+ /**
27
+ * Get viewport dimensions
28
+ */
29
+ getViewport(): {
30
+ width: number;
31
+ height: number;
32
+ };
33
+ /**
34
+ * Check if running in browser
35
+ */
36
+ isBrowser(): boolean;
37
+ /**
38
+ * Resize the graphics device
39
+ */
40
+ resize(width: number, height: number): void;
41
+ /**
42
+ * Clear the rendering surface
43
+ */
44
+ clear(color?: {
45
+ r: number;
46
+ g: number;
47
+ b: number;
48
+ a: number;
49
+ }): void;
50
+ /**
51
+ * Present the rendered frame
52
+ */
53
+ present(): void;
54
+ /**
55
+ * Cleanup and release resources
56
+ */
57
+ dispose(): void;
58
+ /**
59
+ * Create a shader program
60
+ * @param vertexSource Vertex shader source code
61
+ * @param fragmentSource Fragment shader source code
62
+ * @returns Compiled and linked shader program
63
+ */
64
+ createShader(vertexSource: string, fragmentSource: string): Shader;
65
+ }
66
+ //# sourceMappingURL=grahpic-device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grahpic-device.d.ts","sourceRoot":"","sources":["../../../src/core/grahpic-device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAmB;gBAEtB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IASzC;;OAEG;IACH,YAAY,IAAI,qBAAqB;IAIrC;;OAEG;IACH,mBAAmB,IAAI,gBAAgB;IAIvC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,WAAW,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIhD;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI3C;;OAEG;IACH,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;IAInE;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;;;;OAKG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;CAQnE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Bloody Engine - Browser Entry Point
3
+ *
4
+ * Demo is disabled by default for npm package.
5
+ * To run the demo locally, uncomment the code below or run:
6
+ * npm run dev
7
+ */
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,90 @@
1
+ import { IResourceLoader } from './resource-loader';
2
+ /**
3
+ * Environment type enumeration
4
+ */
5
+ export declare enum Environment {
6
+ /** Browser environment (DOM APIs available) */
7
+ BROWSER = "browser",
8
+ /** Node.js environment (file system APIs available) */
9
+ NODE = "node",
10
+ /** Unknown environment */
11
+ UNKNOWN = "unknown"
12
+ }
13
+ /**
14
+ * Resource loader factory configuration
15
+ */
16
+ export interface ResourceLoaderFactoryOptions {
17
+ /**
18
+ * Force a specific environment (useful for testing)
19
+ * If not specified, the factory will auto-detect the environment
20
+ */
21
+ forceEnvironment?: Environment;
22
+ /**
23
+ * Base URL for browser resource loader
24
+ */
25
+ baseUrl?: string;
26
+ /**
27
+ * Request timeout for browser resource loader (in milliseconds)
28
+ */
29
+ timeout?: number;
30
+ /**
31
+ * Base directory for Node.js resource loader
32
+ */
33
+ baseDir?: string;
34
+ }
35
+ /**
36
+ * Factory class for creating resource loaders
37
+ * Automatically detects the runtime environment and creates the appropriate loader
38
+ */
39
+ export declare class ResourceLoaderFactory {
40
+ /**
41
+ * Detect the current runtime environment
42
+ * @returns The detected environment type
43
+ */
44
+ static detectEnvironment(): Environment;
45
+ /**
46
+ * Check if the current environment is a browser
47
+ * @returns true if running in a browser
48
+ */
49
+ static isBrowser(): boolean;
50
+ /**
51
+ * Check if the current environment is Node.js
52
+ * @returns true if running in Node.js
53
+ */
54
+ static isNode(): boolean;
55
+ /**
56
+ * Create a resource loader for the current environment
57
+ * @param options Optional factory configuration
58
+ * @returns A resource loader instance appropriate for the current platform
59
+ * @throws Error if the environment is not supported
60
+ */
61
+ static create(options?: ResourceLoaderFactoryOptions): Promise<IResourceLoader>;
62
+ /**
63
+ * Create a browser resource loader
64
+ * @param options Optional factory configuration
65
+ * @returns A browser resource loader instance
66
+ */
67
+ static createBrowserLoader(options?: ResourceLoaderFactoryOptions): Promise<IResourceLoader>;
68
+ /**
69
+ * Create a Node.js resource loader
70
+ * @param options Optional factory configuration
71
+ * @returns A Node.js resource loader instance
72
+ */
73
+ static createNodeLoader(options?: ResourceLoaderFactoryOptions): Promise<IResourceLoader>;
74
+ /**
75
+ * Create a resource loader with automatic fallback
76
+ * If the preferred loader is not available, falls back to the available loader
77
+ * @param preferredEnvironment Preferred environment
78
+ * @param options Optional factory configuration
79
+ * @returns A resource loader instance
80
+ */
81
+ static createWithFallback(preferredEnvironment: Environment, options?: ResourceLoaderFactoryOptions): Promise<IResourceLoader>;
82
+ }
83
+ /**
84
+ * Convenience function to create a resource loader
85
+ * Shortcut for ResourceLoaderFactory.create()
86
+ * @param options Optional factory configuration
87
+ * @returns A resource loader instance
88
+ */
89
+ export declare function createResourceLoader(options?: ResourceLoaderFactoryOptions): Promise<IResourceLoader>;
90
+ //# sourceMappingURL=resource-loader-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-loader-factory.d.ts","sourceRoot":"","sources":["../../../src/core/resource-loader-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,oBAAY,WAAW;IACrB,+CAA+C;IAC/C,OAAO,YAAY;IACnB,uDAAuD;IACvD,IAAI,SAAS;IACb,0BAA0B;IAC1B,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAE/B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC;;;OAGG;IACH,MAAM,CAAC,iBAAiB,IAAI,WAAW;IAsBvC;;;OAGG;IACH,MAAM,CAAC,SAAS,IAAI,OAAO;IAI3B;;;OAGG;IACH,MAAM,CAAC,MAAM,IAAI,OAAO;IAIxB;;;;;OAKG;WACU,MAAM,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,eAAe,CAAC;IAuBrF;;;;OAIG;WACU,mBAAmB,CAC9B,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;OAIG;WACU,gBAAgB,CAC3B,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;;;OAMG;WACU,kBAAkB,CAC7B,oBAAoB,EAAE,WAAW,EACjC,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,eAAe,CAAC;CAS5B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,eAAe,CAAC,CAE1B"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Resource Loader Abstraction Layer
3
+ * Provides a unified interface for loading resources (shaders, textures, etc.)
4
+ * across different platforms (Browser and Node.js)
5
+ */
6
+ /**
7
+ * Result of a resource loading operation
8
+ */
9
+ export interface ResourceLoadResult {
10
+ /** The loaded resource content */
11
+ data: string;
12
+ /** Path or URL that was loaded */
13
+ path: string;
14
+ /** Whether the load was successful */
15
+ success: boolean;
16
+ /** Error message if loading failed */
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Options for resource loading
21
+ */
22
+ export interface ResourceLoadOptions {
23
+ /** Character encoding (default: 'utf-8') */
24
+ encoding?: BufferEncoding;
25
+ /** Custom headers for browser requests */
26
+ headers?: Record<string, string>;
27
+ /** Request credentials mode for fetch ('same-origin', 'include', 'omit') */
28
+ credentials?: RequestCredentials;
29
+ }
30
+ /**
31
+ * Interface for loading resources (shaders, textures, etc.)
32
+ * Provides platform-agnostic API for resource loading
33
+ */
34
+ export interface IResourceLoader {
35
+ /**
36
+ * Load a single resource from a path or URL
37
+ * @param path File path (Node.js) or URL (browser)
38
+ * @param options Optional loading configuration
39
+ * @returns Promise resolving to the loaded resource content
40
+ */
41
+ load(path: string, options?: ResourceLoadOptions): Promise<string>;
42
+ /**
43
+ * Load multiple resources in parallel
44
+ * @param paths Array of file paths or URLs
45
+ * @param options Optional loading configuration
46
+ * @returns Promise resolving to array of loaded resources
47
+ */
48
+ loadMultiple(paths: string[], options?: ResourceLoadOptions): Promise<ResourceLoadResult[]>;
49
+ /**
50
+ * Check if this loader can handle the given path
51
+ * @param path File path or URL to check
52
+ * @returns true if the path is valid for this loader
53
+ */
54
+ canLoad(path: string): boolean;
55
+ }
56
+ /**
57
+ * Batch load result for loading multiple resources
58
+ */
59
+ export interface BatchLoadResult {
60
+ /** Successfully loaded resources indexed by path */
61
+ succeeded: Map<string, string>;
62
+ /** Failed resources indexed by path with error messages */
63
+ failed: Map<string, string>;
64
+ /** Total number of resources requested */
65
+ total: number;
66
+ /** Number of successfully loaded resources */
67
+ successCount: number;
68
+ /** Number of failed resources */
69
+ failureCount: number;
70
+ }
71
+ //# sourceMappingURL=resource-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-loader.d.ts","sourceRoot":"","sources":["../../../src/core/resource-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4EAA4E;IAC5E,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;OAKG;IACH,YAAY,CACV,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAEjC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,2DAA2D;IAC3D,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,139 @@
1
+ import { IResourceLoader, BatchLoadResult, ResourceLoadOptions } from './resource-loader';
2
+ /**
3
+ * Shader source code container
4
+ */
5
+ export interface ShaderSource {
6
+ /** Vertex shader source code */
7
+ vertex: string;
8
+ /** Fragment shader source code */
9
+ fragment: string;
10
+ }
11
+ /**
12
+ * Named shader source (for shader libraries)
13
+ */
14
+ export interface NamedShaderSource extends ShaderSource {
15
+ /** Shader identifier/name */
16
+ name: string;
17
+ }
18
+ /**
19
+ * Resource loading pipeline configuration
20
+ */
21
+ export interface ResourcePipelineOptions extends ResourceLoadOptions {
22
+ /** Maximum number of concurrent loads (default: 10) */
23
+ concurrency?: number;
24
+ /** Whether to cache loaded resources (default: true) */
25
+ cache?: boolean;
26
+ }
27
+ /**
28
+ * Resource Loading Pipeline
29
+ * High-level API for loading and managing resources with caching,
30
+ * batch operations, and shader-specific utilities
31
+ */
32
+ export declare class ResourcePipeline {
33
+ private loader;
34
+ private cache;
35
+ private concurrency;
36
+ /**
37
+ * Create a new resource loading pipeline
38
+ * @param loader Resource loader instance
39
+ * @param options Pipeline configuration options
40
+ */
41
+ constructor(loader: IResourceLoader, options?: ResourcePipelineOptions);
42
+ /**
43
+ * Load a single resource with caching support
44
+ * @param path Resource path or URL
45
+ * @param options Optional loading options
46
+ * @returns Promise resolving to the resource content
47
+ */
48
+ load(path: string, options?: ResourceLoadOptions): Promise<string>;
49
+ /**
50
+ * Load multiple resources with concurrency control
51
+ * @param paths Array of resource paths
52
+ * @param options Optional loading options
53
+ * @returns Promise resolving to batch load result
54
+ */
55
+ loadBatch(paths: string[], options?: ResourceLoadOptions): Promise<BatchLoadResult>;
56
+ /**
57
+ * Load a shader from separate vertex and fragment files
58
+ * @param vertexPath Path to vertex shader file
59
+ * @param fragmentPath Path to fragment shader file
60
+ * @param options Optional loading options
61
+ * @returns Promise resolving to shader source code
62
+ */
63
+ loadShader(vertexPath: string, fragmentPath: string, options?: ResourceLoadOptions): Promise<ShaderSource>;
64
+ /**
65
+ * Load multiple shaders
66
+ * @param shaders Array of shader definitions
67
+ * @param options Optional loading options
68
+ * @returns Promise resolving to array of named shader sources
69
+ */
70
+ loadShaders(shaders: Array<{
71
+ name: string;
72
+ vertex: string;
73
+ fragment: string;
74
+ }>, options?: ResourceLoadOptions): Promise<NamedShaderSource[]>;
75
+ /**
76
+ * Load resources from a manifest file
77
+ * @param manifestPath Path to JSON manifest file
78
+ * @param options Optional loading options
79
+ * @returns Promise resolving to batch load result
80
+ */
81
+ loadFromManifest(manifestPath: string, options?: ResourceLoadOptions): Promise<BatchLoadResult>;
82
+ /**
83
+ * Preload resources for faster access later
84
+ * @param paths Array of resource paths to preload
85
+ * @param options Optional loading options
86
+ * @returns Promise resolving when all resources are loaded
87
+ */
88
+ preload(paths: string[], options?: ResourceLoadOptions): Promise<void>;
89
+ /**
90
+ * Check if a resource is cached
91
+ * @param path Resource path
92
+ * @returns true if the resource is in the cache
93
+ */
94
+ isCached(path: string): boolean;
95
+ /**
96
+ * Get a resource from cache without loading
97
+ * @param path Resource path
98
+ * @returns Cached content or undefined if not cached
99
+ */
100
+ getCached(path: string): string | undefined;
101
+ /**
102
+ * Clear the resource cache
103
+ */
104
+ clearCache(): void;
105
+ /**
106
+ * Get cache statistics
107
+ * @returns Number of cached resources
108
+ */
109
+ getCacheSize(): number;
110
+ /**
111
+ * Enable caching
112
+ */
113
+ enableCache(): void;
114
+ /**
115
+ * Disable caching
116
+ */
117
+ disableCache(): void;
118
+ /**
119
+ * Set the maximum concurrency for batch operations
120
+ * @param concurrency Maximum concurrent loads
121
+ */
122
+ setConcurrency(concurrency: number): void;
123
+ /**
124
+ * Get the underlying resource loader
125
+ * @returns The resource loader instance
126
+ */
127
+ getLoader(): IResourceLoader;
128
+ }
129
+ /**
130
+ * Create a resource pipeline with automatic environment detection
131
+ * @param options Optional pipeline and loader configuration
132
+ * @returns A new resource pipeline instance
133
+ */
134
+ export declare function createResourcePipeline(options?: ResourcePipelineOptions & {
135
+ baseUrl?: string;
136
+ baseDir?: string;
137
+ timeout?: number;
138
+ }): Promise<ResourcePipeline>;
139
+ //# sourceMappingURL=resource-pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-pipeline.d.ts","sourceRoot":"","sources":["../../../src/core/resource-pipeline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEf,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA8CD;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;OAIG;gBACS,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,uBAAuB;IAMtE;;;;;OAKG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,CAAC;IAgBlB;;;;;OAKG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC;IA4B3B;;;;;;OAMG;IACG,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,YAAY,CAAC;IASxB;;;;;OAKG;IACG,WAAW,CACf,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,EACF,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAkB/B;;;;;OAKG;IACG,gBAAgB,CACpB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC;IAS3B;;;;;OAKG;IACG,OAAO,CACX,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI/B;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3C;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC;;;OAGG;IACH,SAAS,IAAI,eAAe;CAG7B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,CAAC,EAAE,uBAAuB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,OAAO,CAAC,gBAAgB,CAAC,CAW3B"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Shader abstraction layer
3
+ * Handles shader compilation and linking with automatic precision header injection
4
+ */
5
+ export declare class Shader {
6
+ private program;
7
+ private gl;
8
+ private vertexShader;
9
+ private fragmentShader;
10
+ /**
11
+ * Create a new shader program
12
+ * @param gl WebGL rendering context
13
+ * @param vertexSource Raw vertex shader source code
14
+ * @param fragmentSource Raw fragment shader source code
15
+ * @param isBrowser Whether running in browser environment (affects precision header)
16
+ */
17
+ constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string, isBrowser: boolean);
18
+ /**
19
+ * Inject precision header for ES and desktop OpenGL differences
20
+ * @param source Original shader source
21
+ * @param isBrowser Whether in browser (WebGL ES) or Node (desktop OpenGL)
22
+ * @returns Processed shader source with precision header
23
+ */
24
+ private injectPrecisionHeader;
25
+ /**
26
+ * Compile a single shader (vertex or fragment)
27
+ * @param source Shader source code
28
+ * @param type gl.VERTEX_SHADER or gl.FRAGMENT_SHADER
29
+ * @returns Compiled shader
30
+ */
31
+ private compileShader;
32
+ /**
33
+ * Link vertex and fragment shaders into a program
34
+ * @param vertexShader Compiled vertex shader
35
+ * @param fragmentShader Compiled fragment shader
36
+ * @returns Linked shader program
37
+ */
38
+ private linkProgram;
39
+ /**
40
+ * Get the compiled shader program
41
+ */
42
+ getProgram(): WebGLProgram;
43
+ /**
44
+ * Get uniform location by name
45
+ * @param name Uniform variable name
46
+ */
47
+ getUniformLocation(name: string): WebGLUniformLocation | null;
48
+ /**
49
+ * Get attribute location by name
50
+ * @param name Attribute variable name
51
+ */
52
+ getAttributeLocation(name: string): number;
53
+ /**
54
+ * Use this shader program
55
+ */
56
+ use(): void;
57
+ /**
58
+ * Clean up shader resources
59
+ */
60
+ dispose(): void;
61
+ }
62
+ //# sourceMappingURL=shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/core/shader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,EAAE,CAAwB;IAClC,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,cAAc,CAAc;IAEpC;;;;;;OAMG;gBAED,EAAE,EAAE,qBAAqB,EACzB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,OAAO;IA4BpB;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAwB7B;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAuBrB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IA0BnB;;OAEG;IACH,UAAU,IAAI,YAAY;IAI1B;;;OAGG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI;IAI7D;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI1C;;OAEG;IACH,GAAG,IAAI,IAAI;IAIX;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Texture abstraction layer
3
+ * Handles texture creation, loading, and binding across environments
4
+ */
5
+ export declare class Texture {
6
+ private texture;
7
+ private gl;
8
+ private width;
9
+ private height;
10
+ /**
11
+ * Create a texture from pixel data
12
+ * @param gl WebGL context
13
+ * @param width Texture width
14
+ * @param height Texture height
15
+ * @param data Pixel data (Uint8Array RGBA)
16
+ */
17
+ constructor(gl: WebGLRenderingContext, width: number, height: number, data?: Uint8Array);
18
+ /**
19
+ * Create a solid color texture
20
+ * @param gl WebGL context
21
+ * @param width Texture width
22
+ * @param height Texture height
23
+ * @param r Red (0-255)
24
+ * @param g Green (0-255)
25
+ * @param b Blue (0-255)
26
+ * @param a Alpha (0-255)
27
+ */
28
+ static createSolid(gl: WebGLRenderingContext, width: number, height: number, r: number, g: number, b: number, a?: number): Texture;
29
+ /**
30
+ * Create a checkerboard texture
31
+ * @param gl WebGL context
32
+ * @param width Texture width
33
+ * @param height Texture height
34
+ * @param squareSize Size of each square
35
+ */
36
+ static createCheckerboard(gl: WebGLRenderingContext, width: number, height: number, squareSize?: number): Texture;
37
+ /**
38
+ * Create a gradient texture
39
+ * @param gl WebGL context
40
+ * @param width Texture width
41
+ * @param height Texture height
42
+ */
43
+ static createGradient(gl: WebGLRenderingContext, width: number, height: number): Texture;
44
+ /**
45
+ * Bind this texture to a texture unit
46
+ * @param unit Texture unit (0-7 typically)
47
+ */
48
+ bind(unit?: number): void;
49
+ /**
50
+ * Unbind texture
51
+ */
52
+ unbind(): void;
53
+ /**
54
+ * Get the underlying WebGL texture
55
+ */
56
+ getHandle(): WebGLTexture;
57
+ /**
58
+ * Get texture dimensions
59
+ */
60
+ getDimensions(): {
61
+ width: number;
62
+ height: number;
63
+ };
64
+ /**
65
+ * Clean up texture resources
66
+ */
67
+ dispose(): void;
68
+ }
69
+ //# sourceMappingURL=texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/core/texture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,EAAE,CAAwB;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;;;OAMG;gBAED,EAAE,EAAE,qBAAqB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,UAAU;IAqDnB;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAChB,EAAE,EAAE,qBAAqB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,GAAE,MAAY,GACd,OAAO;IAeV;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,EAAE,EAAE,qBAAqB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAW,GACtB,OAAO;IAsBV;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CACnB,EAAE,EAAE,qBAAqB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO;IAkBV;;;OAGG;IACH,IAAI,CAAC,IAAI,GAAE,MAAU,GAAG,IAAI;IAK5B;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,SAAS,IAAI,YAAY;IAIzB;;OAEG;IACH,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAIlD;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=demo-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-node.d.ts","sourceRoot":"","sources":["../../src/demo-node.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Batch Renderer Demo - V1
3
+ *
4
+ * Demonstrates the simple 2D batch renderer with:
5
+ * - Multiple colored quads
6
+ * - Real-time updates using dynamic vertex buffer
7
+ * - Smooth animation with moving sprites
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=batch-renderer-demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-renderer-demo.d.ts","sourceRoot":"","sources":["../../../src/examples/batch-renderer-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}