bloody-engine 1.0.3 → 1.0.5

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 (62) hide show
  1. package/dist/node/index.js +400 -0
  2. package/dist/web/core/buffer.d.ts +58 -0
  3. package/dist/web/core/buffer.d.ts.map +1 -0
  4. package/dist/web/core/grahpic-device.d.ts +66 -0
  5. package/dist/web/core/grahpic-device.d.ts.map +1 -0
  6. package/dist/web/core/index.d.ts +8 -0
  7. package/dist/web/core/index.d.ts.map +1 -0
  8. package/dist/web/core/resource-loader-factory.d.ts +90 -0
  9. package/dist/web/core/resource-loader-factory.d.ts.map +1 -0
  10. package/dist/web/core/resource-loader.d.ts +71 -0
  11. package/dist/web/core/resource-loader.d.ts.map +1 -0
  12. package/dist/web/core/resource-pipeline.d.ts +139 -0
  13. package/dist/web/core/resource-pipeline.d.ts.map +1 -0
  14. package/dist/web/core/shader.d.ts +62 -0
  15. package/dist/web/core/shader.d.ts.map +1 -0
  16. package/dist/web/core/texture.d.ts +69 -0
  17. package/dist/web/core/texture.d.ts.map +1 -0
  18. package/dist/web/demo-node.d.ts +2 -0
  19. package/dist/web/demo-node.d.ts.map +1 -0
  20. package/dist/web/examples/batch-renderer-demo.d.ts +10 -0
  21. package/dist/web/examples/batch-renderer-demo.d.ts.map +1 -0
  22. package/dist/web/examples/projection-examples.d.ts +87 -0
  23. package/dist/web/examples/projection-examples.d.ts.map +1 -0
  24. package/dist/web/examples/resource-loader-demo.d.ts +14 -0
  25. package/dist/web/examples/resource-loader-demo.d.ts.map +1 -0
  26. package/dist/web/examples/shader-examples.d.ts +92 -0
  27. package/dist/web/examples/shader-examples.d.ts.map +1 -0
  28. package/dist/web/examples/sprite-batch-renderer-demo.d.ts +12 -0
  29. package/dist/web/examples/sprite-batch-renderer-demo.d.ts.map +1 -0
  30. package/dist/web/index.d.ts +7 -0
  31. package/dist/web/index.d.ts.map +1 -0
  32. package/dist/web/index.js +760 -474
  33. package/dist/web/index.umd.js +23 -23
  34. package/dist/web/platforms/browser/browser-context.d.ts +31 -0
  35. package/dist/web/platforms/browser/browser-context.d.ts.map +1 -0
  36. package/dist/web/platforms/browser/browser-resource-loader.d.ts +67 -0
  37. package/dist/web/platforms/browser/browser-resource-loader.d.ts.map +1 -0
  38. package/dist/web/platforms/node/node-context.d.ts +31 -0
  39. package/dist/web/platforms/node/node-context.d.ts.map +1 -0
  40. package/dist/web/platforms/node/node-resource-loader.d.ts +73 -0
  41. package/dist/web/platforms/node/node-resource-loader.d.ts.map +1 -0
  42. package/dist/web/platforms/node/sdl-window.d.ts +41 -0
  43. package/dist/web/platforms/node/sdl-window.d.ts.map +1 -0
  44. package/dist/web/projection.test.d.ts +5 -0
  45. package/dist/web/projection.test.d.ts.map +1 -0
  46. package/dist/web/public-api.d.ts +25 -0
  47. package/dist/web/public-api.d.ts.map +1 -0
  48. package/dist/web/rendering/batch-renderer.d.ts +273 -0
  49. package/dist/web/rendering/batch-renderer.d.ts.map +1 -0
  50. package/dist/web/rendering/camera.d.ts +153 -0
  51. package/dist/web/rendering/camera.d.ts.map +1 -0
  52. package/dist/web/rendering/projection.d.ts +108 -0
  53. package/dist/web/rendering/projection.d.ts.map +1 -0
  54. package/dist/web/rendering/rendering-context-factory.d.ts +24 -0
  55. package/dist/web/rendering/rendering-context-factory.d.ts.map +1 -0
  56. package/dist/web/rendering/rendering-context.d.ts +77 -0
  57. package/dist/web/rendering/rendering-context.d.ts.map +1 -0
  58. package/dist/web/rendering/vertex.d.ts +98 -0
  59. package/dist/web/rendering/vertex.d.ts.map +1 -0
  60. package/dist/web/scene/scene.d.ts +139 -0
  61. package/dist/web/scene/scene.d.ts.map +1 -0
  62. package/package.json +5 -4
@@ -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"}
@@ -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,7 @@
1
+ /**
2
+ * Bloody Engine - Main Entry Point
3
+ *
4
+ * Re-exports the public API for the engine
5
+ */
6
+ export * from './public-api';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC"}