@galacean/engine-rhi-null 0.0.0-stage → 2.0.0-alpha.58

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2020 - present Ant Group
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ A subpackage of `@galacean/engine`.
package/dist/main.js ADDED
@@ -0,0 +1,261 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var engine = require('@galacean/engine');
6
+
7
+ function _set_prototype_of(o, p) {
8
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
9
+ o.__proto__ = p;
10
+
11
+ return o;
12
+ };
13
+
14
+ return _set_prototype_of(o, p);
15
+ }
16
+
17
+ function _inherits(subClass, superClass) {
18
+ if (typeof superClass !== "function" && superClass !== null) {
19
+ throw new TypeError("Super expression must either be null or a function");
20
+ }
21
+
22
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
23
+
24
+ if (superClass) _set_prototype_of(subClass, superClass);
25
+ }
26
+
27
+ /** Canvas dimensions without a display or DOM input target. */ var HeadlessCanvas = /*#__PURE__*/ function(Canvas) {
28
+ _inherits(HeadlessCanvas, Canvas);
29
+ function HeadlessCanvas(width, height) {
30
+ if (width === void 0) width = 1;
31
+ if (height === void 0) height = 1;
32
+ var _this;
33
+ _this = Canvas.call(this) || this;
34
+ _this.setResolution(width, height);
35
+ return _this;
36
+ }
37
+ var _proto = HeadlessCanvas.prototype;
38
+ /** Keep the explicit resolution because there is no display size to follow. */ _proto.setAutoResolution = function setAutoResolution() {};
39
+ /** @internal */ _proto._destroy = function _destroy() {};
40
+ _proto._onResolutionChanged = function _onResolutionChanged() {};
41
+ return HeadlessCanvas;
42
+ }(engine.Canvas);
43
+
44
+ function _defineProperties(target, props) {
45
+ for (var i = 0; i < props.length; i++) {
46
+ var descriptor = props[i];
47
+ descriptor.enumerable = descriptor.enumerable || false;
48
+ descriptor.configurable = true;
49
+
50
+ if ("value" in descriptor) descriptor.writable = true;
51
+
52
+ Object.defineProperty(target, descriptor.key, descriptor);
53
+ }
54
+ }
55
+ function _create_class(Constructor, protoProps, staticProps) {
56
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
57
+ if (staticProps) _defineProperties(Constructor, staticProps);
58
+
59
+ return Constructor;
60
+ }
61
+
62
+ /** Device buffer whose storage remains in host memory. */ var NullBuffer = /*#__PURE__*/ function() {
63
+ function NullBuffer(byteLength, data) {
64
+ this._data = new Uint8Array(byteLength);
65
+ if (data) this.setData(byteLength, data);
66
+ }
67
+ var _proto = NullBuffer.prototype;
68
+ _proto.bind = function bind() {};
69
+ _proto.setData = function setData(byteLength, data, bufferByteOffset, dataOffset, dataLength, options) {
70
+ if (bufferByteOffset === void 0) bufferByteOffset = 0;
71
+ if (dataOffset === void 0) dataOffset = 0;
72
+ if (options === void 0) options = engine.SetDataOptions.None;
73
+ if (options === engine.SetDataOptions.Discard || this._data.byteLength !== byteLength) this._data = new Uint8Array(byteLength);
74
+ var view = ArrayBuffer.isView(data);
75
+ var elementSize = view && "BYTES_PER_ELEMENT" in data ? Number(data.BYTES_PER_ELEMENT) : 1;
76
+ var byteOffset = dataOffset * elementSize;
77
+ // Match WebGL2 bufferSubData/getBufferSubData where a 0 length defaults to the remaining elements.
78
+ var length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;
79
+ this._data.set(new Uint8Array(view ? data.buffer : data, (view ? data.byteOffset : 0) + byteOffset, length), bufferByteOffset);
80
+ };
81
+ _proto.getData = function getData(data, bufferByteOffset, dataOffset, dataLength) {
82
+ if (bufferByteOffset === void 0) bufferByteOffset = 0;
83
+ if (dataOffset === void 0) dataOffset = 0;
84
+ var elementSize = "BYTES_PER_ELEMENT" in data ? Number(data.BYTES_PER_ELEMENT) : 1;
85
+ var byteOffset = dataOffset * elementSize;
86
+ var length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;
87
+ var destination = new Uint8Array(data.buffer, data.byteOffset + byteOffset, length);
88
+ destination.set(new Uint8Array(this._data.buffer, bufferByteOffset, length));
89
+ };
90
+ _proto.copyFromBuffer = function copyFromBuffer(source, sourceByteOffset, destinationByteOffset, byteLength) {
91
+ this._data.set(new Uint8Array(source._data.buffer, sourceByteOffset, byteLength), destinationByteOffset);
92
+ };
93
+ _proto.destroy = function destroy() {
94
+ this._data = null;
95
+ };
96
+ return NullBuffer;
97
+ }();
98
+
99
+ /** Texture metadata without rasterized pixels. */ var NullTexture = /*#__PURE__*/ function() {
100
+ function NullTexture() {}
101
+ var _proto = NullTexture.prototype;
102
+ _proto.destroy = function destroy() {};
103
+ _proto.generateMipmaps = function generateMipmaps() {};
104
+ _proto.setUseDepthCompareMode = function setUseDepthCompareMode() {};
105
+ _proto.getPixelBuffer = function getPixelBuffer() {
106
+ throw new Error("Pixel readback requires a graphics device.");
107
+ };
108
+ return NullTexture;
109
+ }();
110
+ var NullTexture2D = /*#__PURE__*/ function(NullTexture) {
111
+ _inherits(NullTexture2D, NullTexture);
112
+ function NullTexture2D() {
113
+ return NullTexture.apply(this, arguments) || this;
114
+ }
115
+ var _proto = NullTexture2D.prototype;
116
+ _proto.setPixelBuffer = function setPixelBuffer() {};
117
+ _proto.setImageSource = function setImageSource() {};
118
+ return NullTexture2D;
119
+ }(NullTexture);
120
+ var NullTexture2DArray = /*#__PURE__*/ function(NullTexture) {
121
+ _inherits(NullTexture2DArray, NullTexture);
122
+ function NullTexture2DArray() {
123
+ return NullTexture.apply(this, arguments) || this;
124
+ }
125
+ var _proto = NullTexture2DArray.prototype;
126
+ _proto.setPixelBuffer = function setPixelBuffer() {};
127
+ _proto.setImageSource = function setImageSource() {};
128
+ return NullTexture2DArray;
129
+ }(NullTexture);
130
+ var NullTextureCube = /*#__PURE__*/ function(NullTexture) {
131
+ _inherits(NullTextureCube, NullTexture);
132
+ function NullTextureCube() {
133
+ return NullTexture.apply(this, arguments) || this;
134
+ }
135
+ var _proto = NullTextureCube.prototype;
136
+ _proto.setPixelBuffer = function setPixelBuffer() {};
137
+ _proto.setImageSource = function setImageSource() {};
138
+ return NullTextureCube;
139
+ }(NullTexture);
140
+
141
+ /** Graphics resource adapter that never opens a GPU context. */ var NullGraphicDevice = /*#__PURE__*/ function() {
142
+ function NullGraphicDevice() {
143
+ this.supportsRendering = false;
144
+ this.isWebGL2 = false;
145
+ this.maxUniformBlockSize = 0;
146
+ this.canIUseMoreJoints = false;
147
+ this._options = {};
148
+ this.capability = {
149
+ maxTextureSize: 0,
150
+ maxAntiAliasing: 1,
151
+ maxVertexUniformVectors: 0,
152
+ canUseFloatTextureBlendShape: false,
153
+ isFragmentHighPrecision: false
154
+ };
155
+ this._currentBindShaderProgram = null;
156
+ this._enableGlobalDepthBias = false;
157
+ }
158
+ var _proto = NullGraphicDevice.prototype;
159
+ _proto.init = function init() {};
160
+ _proto.canIUse = function canIUse(capability) {
161
+ // Vertex storage and CPU particle simulation use these features without GPU execution.
162
+ return capability === engine.GLCapabilityType.elementIndexUint || capability === engine.GLCapabilityType.instancedArrays;
163
+ };
164
+ _proto.canIUseCompressedTextureInternalFormat = function canIUseCompressedTextureInternalFormat() {
165
+ return true;
166
+ };
167
+ _proto.supportsTextureFormat = function supportsTextureFormat() {
168
+ return true;
169
+ };
170
+ _proto.supportsRenderTargetColorFormat = function supportsRenderTargetColorFormat() {
171
+ return true;
172
+ };
173
+ _proto.createPlatformPrimitive = function createPlatformPrimitive() {
174
+ return {
175
+ draw: function draw() {},
176
+ destroy: function destroy() {}
177
+ };
178
+ };
179
+ _proto.createPlatformBuffer = function createPlatformBuffer(_type, byteLength, _usage, data) {
180
+ return new NullBuffer(byteLength, data);
181
+ };
182
+ _proto.createPlatformTexture2D = function createPlatformTexture2D() {
183
+ return new NullTexture2D();
184
+ };
185
+ _proto.createPlatformTexture2DArray = function createPlatformTexture2DArray() {
186
+ return new NullTexture2DArray();
187
+ };
188
+ _proto.createPlatformTextureCube = function createPlatformTextureCube() {
189
+ return new NullTextureCube();
190
+ };
191
+ _proto.createPlatformRenderTarget = function createPlatformRenderTarget() {
192
+ return {
193
+ activeRenderTarget: function activeRenderTarget() {},
194
+ blitRenderTarget: function blitRenderTarget() {},
195
+ destroy: function destroy() {}
196
+ };
197
+ };
198
+ _proto.createPlatformTransformFeedback = function createPlatformTransformFeedback() {
199
+ throw new Error("Transform feedback requires a graphics device.");
200
+ };
201
+ _proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
202
+ throw new Error("Transform feedback requires a graphics device.");
203
+ };
204
+ _proto.activeRenderTarget = function activeRenderTarget() {};
205
+ _proto.clearRenderTarget = function clearRenderTarget() {};
206
+ _proto.drawPrimitive = function drawPrimitive() {};
207
+ _proto.blitInternalRTByBlitFrameBuffer = function blitInternalRTByBlitFrameBuffer() {};
208
+ _proto.copyRenderTargetToSubTexture = function copyRenderTargetToSubTexture() {
209
+ throw new Error("Framebuffer copies require a graphics device.");
210
+ };
211
+ _proto.viewport = function viewport() {};
212
+ _proto.scissor = function scissor() {};
213
+ _proto.activeTexture = function activeTexture() {};
214
+ _proto.bindTexture = function bindTexture() {};
215
+ _proto.bindUniformBufferBase = function bindUniformBufferBase() {};
216
+ _proto.setGlobalDepthBias = function setGlobalDepthBias() {};
217
+ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {};
218
+ _proto.disableRasterizerDiscard = function disableRasterizerDiscard() {};
219
+ _proto.invalidateShaderProgramState = function invalidateShaderProgramState() {};
220
+ _proto.flush = function flush() {};
221
+ _proto.forceLoseDevice = function forceLoseDevice() {};
222
+ _proto.forceRestoreDevice = function forceRestoreDevice() {};
223
+ _proto.isContextLost = function isContextLost() {
224
+ return false;
225
+ };
226
+ _proto.resetState = function resetState() {};
227
+ _proto.destroy = function destroy() {};
228
+ _create_class(NullGraphicDevice, [
229
+ {
230
+ key: "gl",
231
+ get: function get() {
232
+ throw new Error("A WebGL context is unavailable on a null graphics device.");
233
+ }
234
+ }
235
+ ]);
236
+ return NullGraphicDevice;
237
+ }();
238
+
239
+ /** Engine simulation and resources without graphics or DOM input. */ var HeadlessEngine = /*#__PURE__*/ function(Engine) {
240
+ _inherits(HeadlessEngine, Engine);
241
+ function HeadlessEngine() {
242
+ return Engine.apply(this, arguments) || this;
243
+ }
244
+ /**
245
+ * Create a paused engine without opening a graphics device.
246
+ * @param configuration - Engine, loader and fixed canvas options
247
+ * @returns The initialized engine; call `update` or `run` to advance simulation
248
+ * @throws If `width` or `height` is not a positive finite number.
249
+ */ HeadlessEngine.create = function create(configuration) {
250
+ if (configuration === void 0) configuration = {};
251
+ var canvas = new HeadlessCanvas(configuration.width, configuration.height);
252
+ var engine = new HeadlessEngine(canvas, new NullGraphicDevice(), configuration);
253
+ return engine._initialize(configuration);
254
+ };
255
+ return HeadlessEngine;
256
+ }(engine.Engine);
257
+
258
+ exports.HeadlessCanvas = HeadlessCanvas;
259
+ exports.HeadlessEngine = HeadlessEngine;
260
+ exports.NullGraphicDevice = NullGraphicDevice;
261
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sources":["../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_set_prototype_of.js","../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_inherits.js","../src/HeadlessCanvas.ts","../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_create_class.js","../src/NullBuffer.ts","../src/NullTexture.ts","../src/NullGraphicDevice.ts","../src/HeadlessEngine.ts"],"sourcesContent":["function _set_prototype_of(o, p) {\n _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {\n o.__proto__ = p;\n\n return o;\n };\n\n return _set_prototype_of(o, p);\n}\nexport { _set_prototype_of as _ };\n","import { _ as _set_prototype_of } from \"./_set_prototype_of.js\";\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n\n if (superClass) _set_prototype_of(subClass, superClass);\n}\nexport { _inherits as _ };\n","import { Canvas } from \"@galacean/engine\";\n\n/** Canvas dimensions without a display or DOM input target. */\nexport class HeadlessCanvas extends Canvas {\n /**\n * Create a canvas with fixed dimensions.\n * @param width - Width in pixels\n * @param height - Height in pixels\n */\n constructor(width: number = 1, height: number = 1) {\n super();\n this.setResolution(width, height);\n }\n\n /** Keep the explicit resolution because there is no display size to follow. */\n override setAutoResolution(): void {}\n\n /** @internal */\n override _destroy(): void {}\n\n protected override _onResolutionChanged(): void {}\n}\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n\n if (\"value\" in descriptor) descriptor.writable = true;\n\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n\n return Constructor;\n}\nexport { _create_class as _ };\n","import { SetDataOptions, type IPlatformBuffer } from \"@galacean/engine\";\n\n/** Device buffer whose storage remains in host memory. */\nexport class NullBuffer implements IPlatformBuffer {\n private _data: Uint8Array;\n\n constructor(byteLength: number, data?: ArrayBuffer | ArrayBufferView) {\n this._data = new Uint8Array(byteLength);\n if (data) this.setData(byteLength, data);\n }\n\n bind(): void {}\n\n setData(\n byteLength: number,\n data: ArrayBuffer | ArrayBufferView,\n bufferByteOffset = 0,\n dataOffset = 0,\n dataLength?: number,\n options: SetDataOptions = SetDataOptions.None\n ): void {\n if (options === SetDataOptions.Discard || this._data.byteLength !== byteLength)\n this._data = new Uint8Array(byteLength);\n const view = ArrayBuffer.isView(data);\n const elementSize = view && \"BYTES_PER_ELEMENT\" in data ? Number(data.BYTES_PER_ELEMENT) : 1;\n const byteOffset = dataOffset * elementSize;\n // Match WebGL2 bufferSubData/getBufferSubData where a 0 length defaults to the remaining elements.\n const length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;\n this._data.set(\n new Uint8Array(view ? data.buffer : data, (view ? data.byteOffset : 0) + byteOffset, length),\n bufferByteOffset\n );\n }\n\n getData(data: ArrayBufferView, bufferByteOffset = 0, dataOffset = 0, dataLength?: number): void {\n const elementSize = \"BYTES_PER_ELEMENT\" in data ? Number(data.BYTES_PER_ELEMENT) : 1;\n const byteOffset = dataOffset * elementSize;\n const length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;\n const destination = new Uint8Array(data.buffer, data.byteOffset + byteOffset, length);\n destination.set(new Uint8Array(this._data.buffer, bufferByteOffset, length));\n }\n\n copyFromBuffer(\n source: NullBuffer,\n sourceByteOffset: number,\n destinationByteOffset: number,\n byteLength: number\n ): void {\n this._data.set(new Uint8Array(source._data.buffer, sourceByteOffset, byteLength), destinationByteOffset);\n }\n\n destroy(): void {\n this._data = null!;\n }\n}\n","import type {\n IPlatformTexture,\n IPlatformTexture2D,\n IPlatformTexture2DArray,\n IPlatformTextureCube,\n TextureFilterMode,\n TextureWrapMode,\n TextureDepthCompareFunction\n} from \"@galacean/engine\";\n\n/** Texture metadata without rasterized pixels. */\nclass NullTexture implements IPlatformTexture {\n wrapModeU: TextureWrapMode;\n wrapModeV: TextureWrapMode;\n filterMode: TextureFilterMode;\n anisoLevel: number;\n depthCompareFunction: TextureDepthCompareFunction;\n\n destroy(): void {}\n generateMipmaps(): void {}\n setUseDepthCompareMode(): void {}\n getPixelBuffer(): never {\n throw new Error(\"Pixel readback requires a graphics device.\");\n }\n}\n\nexport class NullTexture2D extends NullTexture implements IPlatformTexture2D {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n\nexport class NullTexture2DArray extends NullTexture implements IPlatformTexture2DArray {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n\nexport class NullTextureCube extends NullTexture implements IPlatformTextureCube {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n","import { GLCapabilityType } from \"@galacean/engine\";\nimport type {\n IHardwareRenderer,\n IPlatformRenderTarget,\n IPlatformTransformFeedback,\n IPlatformTransformFeedbackPrimitive,\n BufferBindFlag,\n BufferUsage\n} from \"@galacean/engine\";\nimport { NullBuffer } from \"./NullBuffer\";\nimport { NullTexture2D, NullTexture2DArray, NullTextureCube } from \"./NullTexture\";\n\n/** Graphics resource adapter that never opens a GPU context. */\nexport class NullGraphicDevice implements IHardwareRenderer {\n readonly supportsRendering = false;\n readonly isWebGL2 = false;\n readonly maxUniformBlockSize = 0;\n readonly canIUseMoreJoints = false;\n readonly _options = {};\n readonly capability = {\n maxTextureSize: 0,\n maxAntiAliasing: 1,\n maxVertexUniformVectors: 0,\n canUseFloatTextureBlendShape: false,\n isFragmentHighPrecision: false\n };\n _currentBindShaderProgram = null;\n _enableGlobalDepthBias = false;\n\n get gl(): never {\n throw new Error(\"A WebGL context is unavailable on a null graphics device.\");\n }\n\n init(): void {}\n\n canIUse(capability: GLCapabilityType): boolean {\n // Vertex storage and CPU particle simulation use these features without GPU execution.\n return capability === GLCapabilityType.elementIndexUint || capability === GLCapabilityType.instancedArrays;\n }\n\n canIUseCompressedTextureInternalFormat(): boolean {\n return true;\n }\n\n supportsTextureFormat(): boolean {\n return true;\n }\n\n supportsRenderTargetColorFormat(): boolean {\n return true;\n }\n createPlatformPrimitive() {\n return { draw() {}, destroy() {} };\n }\n createPlatformBuffer(\n _type: BufferBindFlag,\n byteLength: number,\n _usage?: BufferUsage,\n data?: ArrayBuffer | ArrayBufferView\n ): NullBuffer {\n return new NullBuffer(byteLength, data);\n }\n createPlatformTexture2D(): NullTexture2D {\n return new NullTexture2D();\n }\n createPlatformTexture2DArray(): NullTexture2DArray {\n return new NullTexture2DArray();\n }\n createPlatformTextureCube(): NullTextureCube {\n return new NullTextureCube();\n }\n createPlatformRenderTarget(): IPlatformRenderTarget {\n return { activeRenderTarget() {}, blitRenderTarget() {}, destroy() {} };\n }\n createPlatformTransformFeedback(): IPlatformTransformFeedback {\n throw new Error(\"Transform feedback requires a graphics device.\");\n }\n createPlatformTransformFeedbackPrimitive(): IPlatformTransformFeedbackPrimitive {\n throw new Error(\"Transform feedback requires a graphics device.\");\n }\n activeRenderTarget(): void {}\n clearRenderTarget(): void {}\n drawPrimitive(): void {}\n blitInternalRTByBlitFrameBuffer(): void {}\n copyRenderTargetToSubTexture(): never {\n throw new Error(\"Framebuffer copies require a graphics device.\");\n }\n viewport(): void {}\n scissor(): void {}\n activeTexture(): void {}\n bindTexture(): void {}\n bindUniformBufferBase(): void {}\n setGlobalDepthBias(): void {}\n enableRasterizerDiscard(): void {}\n disableRasterizerDiscard(): void {}\n invalidateShaderProgramState(): void {}\n flush(): void {}\n forceLoseDevice(): void {}\n forceRestoreDevice(): void {}\n isContextLost(): boolean {\n return false;\n }\n resetState(): void {}\n destroy(): void {}\n}\n","import { Engine, type EngineConfiguration } from \"@galacean/engine\";\nimport { HeadlessCanvas } from \"./HeadlessCanvas\";\nimport { NullGraphicDevice } from \"./NullGraphicDevice\";\n\n/** Engine simulation and resources without graphics or DOM input. */\nexport class HeadlessEngine extends Engine {\n /**\n * Create a paused engine without opening a graphics device.\n * @param configuration - Engine, loader and fixed canvas options\n * @returns The initialized engine; call `update` or `run` to advance simulation\n * @throws If `width` or `height` is not a positive finite number.\n */\n static create(configuration: HeadlessEngineConfiguration = {}): Promise<HeadlessEngine> {\n const canvas = new HeadlessCanvas(configuration.width, configuration.height);\n const engine = new HeadlessEngine(canvas, new NullGraphicDevice(), configuration);\n return engine._initialize(configuration);\n }\n}\n\n/** Options for an engine without graphics, XR or DOM input. */\nexport interface HeadlessEngineConfiguration extends Omit<EngineConfiguration, \"xrDevice\" | \"input\"> {\n /**\n * Fixed canvas width in pixels.\n * @defaultValue `1`\n */\n width?: number;\n /**\n * Fixed canvas height in pixels.\n * @defaultValue `1`\n */\n height?: number;\n}\n"],"names":["HeadlessCanvas","width","height","setResolution","setAutoResolution","_destroy","_onResolutionChanged","Canvas","NullBuffer","byteLength","data","_data","Uint8Array","setData","bind","bufferByteOffset","dataOffset","dataLength","options","SetDataOptions","None","Discard","view","ArrayBuffer","isView","elementSize","Number","BYTES_PER_ELEMENT","byteOffset","length","set","buffer","getData","destination","copyFromBuffer","source","sourceByteOffset","destinationByteOffset","destroy","NullTexture","generateMipmaps","setUseDepthCompareMode","getPixelBuffer","Error","NullTexture2D","setPixelBuffer","setImageSource","NullTexture2DArray","NullTextureCube","NullGraphicDevice","supportsRendering","isWebGL2","maxUniformBlockSize","canIUseMoreJoints","_options","capability","maxTextureSize","maxAntiAliasing","maxVertexUniformVectors","canUseFloatTextureBlendShape","isFragmentHighPrecision","_currentBindShaderProgram","_enableGlobalDepthBias","init","canIUse","GLCapabilityType","elementIndexUint","instancedArrays","canIUseCompressedTextureInternalFormat","supportsTextureFormat","supportsRenderTargetColorFormat","createPlatformPrimitive","draw","createPlatformBuffer","_type","_usage","createPlatformTexture2D","createPlatformTexture2DArray","createPlatformTextureCube","createPlatformRenderTarget","activeRenderTarget","blitRenderTarget","createPlatformTransformFeedback","createPlatformTransformFeedbackPrimitive","clearRenderTarget","drawPrimitive","blitInternalRTByBlitFrameBuffer","copyRenderTargetToSubTexture","viewport","scissor","activeTexture","bindTexture","bindUniformBufferBase","setGlobalDepthBias","enableRasterizerDiscard","disableRasterizerDiscard","invalidateShaderProgramState","flush","forceLoseDevice","forceRestoreDevice","isContextLost","resetState","gl","HeadlessEngine","create","configuration","canvas","engine","_initialize","Engine"],"mappings":";;;;;;AAAA,SAAS,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE;AACjC,IAAI,iBAAiB,GAAG,MAAM,CAAC,cAAc,IAAI,SAAS,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE;AAC/E,QAAQ,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;AACxB;AACA,QAAQ,OAAO,CAAC,CAAC;AACjB,KAAK,CAAC;AACN;AACA,IAAI,OAAO,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC;;ACNA,SAAS,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE;AACzC,IAAI,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,IAAI,EAAE;AACjE,QAAQ,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;AAClF,KAAK;AACL;AACA,IAAI,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,UAAU,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAA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AA,CAAOC,WAAW,CAACH,aAAAA,CAAAA,CAAAA;AAC5B,KAAA,CAAA;AAXWF,IAAAA,OAAAA,cAAAA,CAAAA;EAAuBM,aAYnC;;;;;;"}
package/dist/module.js ADDED
@@ -0,0 +1,255 @@
1
+ import { Canvas, SetDataOptions, GLCapabilityType, Engine } from '@galacean/engine';
2
+
3
+ function _set_prototype_of(o, p) {
4
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5
+ o.__proto__ = p;
6
+
7
+ return o;
8
+ };
9
+
10
+ return _set_prototype_of(o, p);
11
+ }
12
+
13
+ function _inherits(subClass, superClass) {
14
+ if (typeof superClass !== "function" && superClass !== null) {
15
+ throw new TypeError("Super expression must either be null or a function");
16
+ }
17
+
18
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
19
+
20
+ if (superClass) _set_prototype_of(subClass, superClass);
21
+ }
22
+
23
+ /** Canvas dimensions without a display or DOM input target. */ var HeadlessCanvas = /*#__PURE__*/ function(Canvas) {
24
+ _inherits(HeadlessCanvas, Canvas);
25
+ function HeadlessCanvas(width, height) {
26
+ if (width === void 0) width = 1;
27
+ if (height === void 0) height = 1;
28
+ var _this;
29
+ _this = Canvas.call(this) || this;
30
+ _this.setResolution(width, height);
31
+ return _this;
32
+ }
33
+ var _proto = HeadlessCanvas.prototype;
34
+ /** Keep the explicit resolution because there is no display size to follow. */ _proto.setAutoResolution = function setAutoResolution() {};
35
+ /** @internal */ _proto._destroy = function _destroy() {};
36
+ _proto._onResolutionChanged = function _onResolutionChanged() {};
37
+ return HeadlessCanvas;
38
+ }(Canvas);
39
+
40
+ function _defineProperties(target, props) {
41
+ for (var i = 0; i < props.length; i++) {
42
+ var descriptor = props[i];
43
+ descriptor.enumerable = descriptor.enumerable || false;
44
+ descriptor.configurable = true;
45
+
46
+ if ("value" in descriptor) descriptor.writable = true;
47
+
48
+ Object.defineProperty(target, descriptor.key, descriptor);
49
+ }
50
+ }
51
+ function _create_class(Constructor, protoProps, staticProps) {
52
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
53
+ if (staticProps) _defineProperties(Constructor, staticProps);
54
+
55
+ return Constructor;
56
+ }
57
+
58
+ /** Device buffer whose storage remains in host memory. */ var NullBuffer = /*#__PURE__*/ function() {
59
+ function NullBuffer(byteLength, data) {
60
+ this._data = new Uint8Array(byteLength);
61
+ if (data) this.setData(byteLength, data);
62
+ }
63
+ var _proto = NullBuffer.prototype;
64
+ _proto.bind = function bind() {};
65
+ _proto.setData = function setData(byteLength, data, bufferByteOffset, dataOffset, dataLength, options) {
66
+ if (bufferByteOffset === void 0) bufferByteOffset = 0;
67
+ if (dataOffset === void 0) dataOffset = 0;
68
+ if (options === void 0) options = SetDataOptions.None;
69
+ if (options === SetDataOptions.Discard || this._data.byteLength !== byteLength) this._data = new Uint8Array(byteLength);
70
+ var view = ArrayBuffer.isView(data);
71
+ var elementSize = view && "BYTES_PER_ELEMENT" in data ? Number(data.BYTES_PER_ELEMENT) : 1;
72
+ var byteOffset = dataOffset * elementSize;
73
+ // Match WebGL2 bufferSubData/getBufferSubData where a 0 length defaults to the remaining elements.
74
+ var length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;
75
+ this._data.set(new Uint8Array(view ? data.buffer : data, (view ? data.byteOffset : 0) + byteOffset, length), bufferByteOffset);
76
+ };
77
+ _proto.getData = function getData(data, bufferByteOffset, dataOffset, dataLength) {
78
+ if (bufferByteOffset === void 0) bufferByteOffset = 0;
79
+ if (dataOffset === void 0) dataOffset = 0;
80
+ var elementSize = "BYTES_PER_ELEMENT" in data ? Number(data.BYTES_PER_ELEMENT) : 1;
81
+ var byteOffset = dataOffset * elementSize;
82
+ var length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;
83
+ var destination = new Uint8Array(data.buffer, data.byteOffset + byteOffset, length);
84
+ destination.set(new Uint8Array(this._data.buffer, bufferByteOffset, length));
85
+ };
86
+ _proto.copyFromBuffer = function copyFromBuffer(source, sourceByteOffset, destinationByteOffset, byteLength) {
87
+ this._data.set(new Uint8Array(source._data.buffer, sourceByteOffset, byteLength), destinationByteOffset);
88
+ };
89
+ _proto.destroy = function destroy() {
90
+ this._data = null;
91
+ };
92
+ return NullBuffer;
93
+ }();
94
+
95
+ /** Texture metadata without rasterized pixels. */ var NullTexture = /*#__PURE__*/ function() {
96
+ function NullTexture() {}
97
+ var _proto = NullTexture.prototype;
98
+ _proto.destroy = function destroy() {};
99
+ _proto.generateMipmaps = function generateMipmaps() {};
100
+ _proto.setUseDepthCompareMode = function setUseDepthCompareMode() {};
101
+ _proto.getPixelBuffer = function getPixelBuffer() {
102
+ throw new Error("Pixel readback requires a graphics device.");
103
+ };
104
+ return NullTexture;
105
+ }();
106
+ var NullTexture2D = /*#__PURE__*/ function(NullTexture) {
107
+ _inherits(NullTexture2D, NullTexture);
108
+ function NullTexture2D() {
109
+ return NullTexture.apply(this, arguments) || this;
110
+ }
111
+ var _proto = NullTexture2D.prototype;
112
+ _proto.setPixelBuffer = function setPixelBuffer() {};
113
+ _proto.setImageSource = function setImageSource() {};
114
+ return NullTexture2D;
115
+ }(NullTexture);
116
+ var NullTexture2DArray = /*#__PURE__*/ function(NullTexture) {
117
+ _inherits(NullTexture2DArray, NullTexture);
118
+ function NullTexture2DArray() {
119
+ return NullTexture.apply(this, arguments) || this;
120
+ }
121
+ var _proto = NullTexture2DArray.prototype;
122
+ _proto.setPixelBuffer = function setPixelBuffer() {};
123
+ _proto.setImageSource = function setImageSource() {};
124
+ return NullTexture2DArray;
125
+ }(NullTexture);
126
+ var NullTextureCube = /*#__PURE__*/ function(NullTexture) {
127
+ _inherits(NullTextureCube, NullTexture);
128
+ function NullTextureCube() {
129
+ return NullTexture.apply(this, arguments) || this;
130
+ }
131
+ var _proto = NullTextureCube.prototype;
132
+ _proto.setPixelBuffer = function setPixelBuffer() {};
133
+ _proto.setImageSource = function setImageSource() {};
134
+ return NullTextureCube;
135
+ }(NullTexture);
136
+
137
+ /** Graphics resource adapter that never opens a GPU context. */ var NullGraphicDevice = /*#__PURE__*/ function() {
138
+ function NullGraphicDevice() {
139
+ this.supportsRendering = false;
140
+ this.isWebGL2 = false;
141
+ this.maxUniformBlockSize = 0;
142
+ this.canIUseMoreJoints = false;
143
+ this._options = {};
144
+ this.capability = {
145
+ maxTextureSize: 0,
146
+ maxAntiAliasing: 1,
147
+ maxVertexUniformVectors: 0,
148
+ canUseFloatTextureBlendShape: false,
149
+ isFragmentHighPrecision: false
150
+ };
151
+ this._currentBindShaderProgram = null;
152
+ this._enableGlobalDepthBias = false;
153
+ }
154
+ var _proto = NullGraphicDevice.prototype;
155
+ _proto.init = function init() {};
156
+ _proto.canIUse = function canIUse(capability) {
157
+ // Vertex storage and CPU particle simulation use these features without GPU execution.
158
+ return capability === GLCapabilityType.elementIndexUint || capability === GLCapabilityType.instancedArrays;
159
+ };
160
+ _proto.canIUseCompressedTextureInternalFormat = function canIUseCompressedTextureInternalFormat() {
161
+ return true;
162
+ };
163
+ _proto.supportsTextureFormat = function supportsTextureFormat() {
164
+ return true;
165
+ };
166
+ _proto.supportsRenderTargetColorFormat = function supportsRenderTargetColorFormat() {
167
+ return true;
168
+ };
169
+ _proto.createPlatformPrimitive = function createPlatformPrimitive() {
170
+ return {
171
+ draw: function draw() {},
172
+ destroy: function destroy() {}
173
+ };
174
+ };
175
+ _proto.createPlatformBuffer = function createPlatformBuffer(_type, byteLength, _usage, data) {
176
+ return new NullBuffer(byteLength, data);
177
+ };
178
+ _proto.createPlatformTexture2D = function createPlatformTexture2D() {
179
+ return new NullTexture2D();
180
+ };
181
+ _proto.createPlatformTexture2DArray = function createPlatformTexture2DArray() {
182
+ return new NullTexture2DArray();
183
+ };
184
+ _proto.createPlatformTextureCube = function createPlatformTextureCube() {
185
+ return new NullTextureCube();
186
+ };
187
+ _proto.createPlatformRenderTarget = function createPlatformRenderTarget() {
188
+ return {
189
+ activeRenderTarget: function activeRenderTarget() {},
190
+ blitRenderTarget: function blitRenderTarget() {},
191
+ destroy: function destroy() {}
192
+ };
193
+ };
194
+ _proto.createPlatformTransformFeedback = function createPlatformTransformFeedback() {
195
+ throw new Error("Transform feedback requires a graphics device.");
196
+ };
197
+ _proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
198
+ throw new Error("Transform feedback requires a graphics device.");
199
+ };
200
+ _proto.activeRenderTarget = function activeRenderTarget() {};
201
+ _proto.clearRenderTarget = function clearRenderTarget() {};
202
+ _proto.drawPrimitive = function drawPrimitive() {};
203
+ _proto.blitInternalRTByBlitFrameBuffer = function blitInternalRTByBlitFrameBuffer() {};
204
+ _proto.copyRenderTargetToSubTexture = function copyRenderTargetToSubTexture() {
205
+ throw new Error("Framebuffer copies require a graphics device.");
206
+ };
207
+ _proto.viewport = function viewport() {};
208
+ _proto.scissor = function scissor() {};
209
+ _proto.activeTexture = function activeTexture() {};
210
+ _proto.bindTexture = function bindTexture() {};
211
+ _proto.bindUniformBufferBase = function bindUniformBufferBase() {};
212
+ _proto.setGlobalDepthBias = function setGlobalDepthBias() {};
213
+ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {};
214
+ _proto.disableRasterizerDiscard = function disableRasterizerDiscard() {};
215
+ _proto.invalidateShaderProgramState = function invalidateShaderProgramState() {};
216
+ _proto.flush = function flush() {};
217
+ _proto.forceLoseDevice = function forceLoseDevice() {};
218
+ _proto.forceRestoreDevice = function forceRestoreDevice() {};
219
+ _proto.isContextLost = function isContextLost() {
220
+ return false;
221
+ };
222
+ _proto.resetState = function resetState() {};
223
+ _proto.destroy = function destroy() {};
224
+ _create_class(NullGraphicDevice, [
225
+ {
226
+ key: "gl",
227
+ get: function get() {
228
+ throw new Error("A WebGL context is unavailable on a null graphics device.");
229
+ }
230
+ }
231
+ ]);
232
+ return NullGraphicDevice;
233
+ }();
234
+
235
+ /** Engine simulation and resources without graphics or DOM input. */ var HeadlessEngine = /*#__PURE__*/ function(Engine) {
236
+ _inherits(HeadlessEngine, Engine);
237
+ function HeadlessEngine() {
238
+ return Engine.apply(this, arguments) || this;
239
+ }
240
+ /**
241
+ * Create a paused engine without opening a graphics device.
242
+ * @param configuration - Engine, loader and fixed canvas options
243
+ * @returns The initialized engine; call `update` or `run` to advance simulation
244
+ * @throws If `width` or `height` is not a positive finite number.
245
+ */ HeadlessEngine.create = function create(configuration) {
246
+ if (configuration === void 0) configuration = {};
247
+ var canvas = new HeadlessCanvas(configuration.width, configuration.height);
248
+ var engine = new HeadlessEngine(canvas, new NullGraphicDevice(), configuration);
249
+ return engine._initialize(configuration);
250
+ };
251
+ return HeadlessEngine;
252
+ }(Engine);
253
+
254
+ export { HeadlessCanvas, HeadlessEngine, NullGraphicDevice };
255
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sources":["../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_set_prototype_of.js","../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_inherits.js","../src/HeadlessCanvas.ts","../../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/esm/_create_class.js","../src/NullBuffer.ts","../src/NullTexture.ts","../src/NullGraphicDevice.ts","../src/HeadlessEngine.ts"],"sourcesContent":["function _set_prototype_of(o, p) {\n _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {\n o.__proto__ = p;\n\n return o;\n };\n\n return _set_prototype_of(o, p);\n}\nexport { _set_prototype_of as _ };\n","import { _ as _set_prototype_of } from \"./_set_prototype_of.js\";\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n\n if (superClass) _set_prototype_of(subClass, superClass);\n}\nexport { _inherits as _ };\n","import { Canvas } from \"@galacean/engine\";\n\n/** Canvas dimensions without a display or DOM input target. */\nexport class HeadlessCanvas extends Canvas {\n /**\n * Create a canvas with fixed dimensions.\n * @param width - Width in pixels\n * @param height - Height in pixels\n */\n constructor(width: number = 1, height: number = 1) {\n super();\n this.setResolution(width, height);\n }\n\n /** Keep the explicit resolution because there is no display size to follow. */\n override setAutoResolution(): void {}\n\n /** @internal */\n override _destroy(): void {}\n\n protected override _onResolutionChanged(): void {}\n}\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n\n if (\"value\" in descriptor) descriptor.writable = true;\n\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n\n return Constructor;\n}\nexport { _create_class as _ };\n","import { SetDataOptions, type IPlatformBuffer } from \"@galacean/engine\";\n\n/** Device buffer whose storage remains in host memory. */\nexport class NullBuffer implements IPlatformBuffer {\n private _data: Uint8Array;\n\n constructor(byteLength: number, data?: ArrayBuffer | ArrayBufferView) {\n this._data = new Uint8Array(byteLength);\n if (data) this.setData(byteLength, data);\n }\n\n bind(): void {}\n\n setData(\n byteLength: number,\n data: ArrayBuffer | ArrayBufferView,\n bufferByteOffset = 0,\n dataOffset = 0,\n dataLength?: number,\n options: SetDataOptions = SetDataOptions.None\n ): void {\n if (options === SetDataOptions.Discard || this._data.byteLength !== byteLength)\n this._data = new Uint8Array(byteLength);\n const view = ArrayBuffer.isView(data);\n const elementSize = view && \"BYTES_PER_ELEMENT\" in data ? Number(data.BYTES_PER_ELEMENT) : 1;\n const byteOffset = dataOffset * elementSize;\n // Match WebGL2 bufferSubData/getBufferSubData where a 0 length defaults to the remaining elements.\n const length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;\n this._data.set(\n new Uint8Array(view ? data.buffer : data, (view ? data.byteOffset : 0) + byteOffset, length),\n bufferByteOffset\n );\n }\n\n getData(data: ArrayBufferView, bufferByteOffset = 0, dataOffset = 0, dataLength?: number): void {\n const elementSize = \"BYTES_PER_ELEMENT\" in data ? Number(data.BYTES_PER_ELEMENT) : 1;\n const byteOffset = dataOffset * elementSize;\n const length = !dataLength ? data.byteLength - byteOffset : dataLength * elementSize;\n const destination = new Uint8Array(data.buffer, data.byteOffset + byteOffset, length);\n destination.set(new Uint8Array(this._data.buffer, bufferByteOffset, length));\n }\n\n copyFromBuffer(\n source: NullBuffer,\n sourceByteOffset: number,\n destinationByteOffset: number,\n byteLength: number\n ): void {\n this._data.set(new Uint8Array(source._data.buffer, sourceByteOffset, byteLength), destinationByteOffset);\n }\n\n destroy(): void {\n this._data = null!;\n }\n}\n","import type {\n IPlatformTexture,\n IPlatformTexture2D,\n IPlatformTexture2DArray,\n IPlatformTextureCube,\n TextureFilterMode,\n TextureWrapMode,\n TextureDepthCompareFunction\n} from \"@galacean/engine\";\n\n/** Texture metadata without rasterized pixels. */\nclass NullTexture implements IPlatformTexture {\n wrapModeU: TextureWrapMode;\n wrapModeV: TextureWrapMode;\n filterMode: TextureFilterMode;\n anisoLevel: number;\n depthCompareFunction: TextureDepthCompareFunction;\n\n destroy(): void {}\n generateMipmaps(): void {}\n setUseDepthCompareMode(): void {}\n getPixelBuffer(): never {\n throw new Error(\"Pixel readback requires a graphics device.\");\n }\n}\n\nexport class NullTexture2D extends NullTexture implements IPlatformTexture2D {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n\nexport class NullTexture2DArray extends NullTexture implements IPlatformTexture2DArray {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n\nexport class NullTextureCube extends NullTexture implements IPlatformTextureCube {\n setPixelBuffer(): void {}\n setImageSource(): void {}\n}\n","import { GLCapabilityType } from \"@galacean/engine\";\nimport type {\n IHardwareRenderer,\n IPlatformRenderTarget,\n IPlatformTransformFeedback,\n IPlatformTransformFeedbackPrimitive,\n BufferBindFlag,\n BufferUsage\n} from \"@galacean/engine\";\nimport { NullBuffer } from \"./NullBuffer\";\nimport { NullTexture2D, NullTexture2DArray, NullTextureCube } from \"./NullTexture\";\n\n/** Graphics resource adapter that never opens a GPU context. */\nexport class NullGraphicDevice implements IHardwareRenderer {\n readonly supportsRendering = false;\n readonly isWebGL2 = false;\n readonly maxUniformBlockSize = 0;\n readonly canIUseMoreJoints = false;\n readonly _options = {};\n readonly capability = {\n maxTextureSize: 0,\n maxAntiAliasing: 1,\n maxVertexUniformVectors: 0,\n canUseFloatTextureBlendShape: false,\n isFragmentHighPrecision: false\n };\n _currentBindShaderProgram = null;\n _enableGlobalDepthBias = false;\n\n get gl(): never {\n throw new Error(\"A WebGL context is unavailable on a null graphics device.\");\n }\n\n init(): void {}\n\n canIUse(capability: GLCapabilityType): boolean {\n // Vertex storage and CPU particle simulation use these features without GPU execution.\n return capability === GLCapabilityType.elementIndexUint || capability === GLCapabilityType.instancedArrays;\n }\n\n canIUseCompressedTextureInternalFormat(): boolean {\n return true;\n }\n\n supportsTextureFormat(): boolean {\n return true;\n }\n\n supportsRenderTargetColorFormat(): boolean {\n return true;\n }\n createPlatformPrimitive() {\n return { draw() {}, destroy() {} };\n }\n createPlatformBuffer(\n _type: BufferBindFlag,\n byteLength: number,\n _usage?: BufferUsage,\n data?: ArrayBuffer | ArrayBufferView\n ): NullBuffer {\n return new NullBuffer(byteLength, data);\n }\n createPlatformTexture2D(): NullTexture2D {\n return new NullTexture2D();\n }\n createPlatformTexture2DArray(): NullTexture2DArray {\n return new NullTexture2DArray();\n }\n createPlatformTextureCube(): NullTextureCube {\n return new NullTextureCube();\n }\n createPlatformRenderTarget(): IPlatformRenderTarget {\n return { activeRenderTarget() {}, blitRenderTarget() {}, destroy() {} };\n }\n createPlatformTransformFeedback(): IPlatformTransformFeedback {\n throw new Error(\"Transform feedback requires a graphics device.\");\n }\n createPlatformTransformFeedbackPrimitive(): IPlatformTransformFeedbackPrimitive {\n throw new Error(\"Transform feedback requires a graphics device.\");\n }\n activeRenderTarget(): void {}\n clearRenderTarget(): void {}\n drawPrimitive(): void {}\n blitInternalRTByBlitFrameBuffer(): void {}\n copyRenderTargetToSubTexture(): never {\n throw new Error(\"Framebuffer copies require a graphics device.\");\n }\n viewport(): void {}\n scissor(): void {}\n activeTexture(): void {}\n bindTexture(): void {}\n bindUniformBufferBase(): void {}\n setGlobalDepthBias(): void {}\n enableRasterizerDiscard(): void {}\n disableRasterizerDiscard(): void {}\n invalidateShaderProgramState(): void {}\n flush(): void {}\n forceLoseDevice(): void {}\n forceRestoreDevice(): void {}\n isContextLost(): boolean {\n return false;\n }\n resetState(): void {}\n destroy(): void {}\n}\n","import { Engine, type EngineConfiguration } from \"@galacean/engine\";\nimport { HeadlessCanvas } from \"./HeadlessCanvas\";\nimport { NullGraphicDevice } from \"./NullGraphicDevice\";\n\n/** Engine simulation and resources without graphics or DOM input. */\nexport class HeadlessEngine extends Engine {\n /**\n * Create a paused engine without opening a graphics device.\n * @param configuration - Engine, loader and fixed canvas options\n * @returns The initialized engine; call `update` or `run` to advance simulation\n * @throws If `width` or `height` is not a positive finite number.\n */\n static create(configuration: HeadlessEngineConfiguration = {}): Promise<HeadlessEngine> {\n const canvas = new HeadlessCanvas(configuration.width, configuration.height);\n const engine = new HeadlessEngine(canvas, new NullGraphicDevice(), configuration);\n return engine._initialize(configuration);\n }\n}\n\n/** Options for an engine without graphics, XR or DOM input. */\nexport interface HeadlessEngineConfiguration extends Omit<EngineConfiguration, \"xrDevice\" | \"input\"> {\n /**\n * Fixed canvas width in pixels.\n * @defaultValue `1`\n */\n width?: number;\n /**\n * Fixed canvas height in pixels.\n * @defaultValue `1`\n */\n height?: number;\n}\n"],"names":["HeadlessCanvas","width","height","setResolution","setAutoResolution","_destroy","_onResolutionChanged","Canvas","NullBuffer","byteLength","data","_data","Uint8Array","setData","bind","bufferByteOffset","dataOffset","dataLength","options","SetDataOptions","None","Discard","view","ArrayBuffer","isView","elementSize","Number","BYTES_PER_ELEMENT","byteOffset","length","set","buffer","getData","destination","copyFromBuffer","source","sourceByteOffset","destinationByteOffset","destroy","NullTexture","generateMipmaps","setUseDepthCompareMode","getPixelBuffer","Error","NullTexture2D","setPixelBuffer","setImageSource","NullTexture2DArray","NullTextureCube","NullGraphicDevice","supportsRendering","isWebGL2","maxUniformBlockSize","canIUseMoreJoints","_options","capability","maxTextureSize","maxAntiAliasing","maxVertexUniformVectors","canUseFloatTextureBlendShape","isFragmentHighPrecision","_currentBindShaderProgram","_enableGlobalDepthBias","init","canIUse","GLCapabilityType","elementIndexUint","instancedArrays","canIUseCompressedTextureInternalFormat","supportsTextureFormat","supportsRenderTargetColorFormat","createPlatformPrimitive","draw","createPlatformBuffer","_type","_usage","createPlatformTexture2D","createPlatformTexture2DArray","createPlatformTextureCube","createPlatformRenderTarget","activeRenderTarget","blitRenderTarget","createPlatformTransformFeedback","createPlatformTransformFeedbackPrimitive","clearRenderTarget","drawPrimitive","blitInternalRTByBlitFrameBuffer","copyRenderTargetToSubTexture","viewport","scissor","activeTexture","bindTexture","bindUniformBufferBase","setGlobalDepthBias","enableRasterizerDiscard","disableRasterizerDiscard","invalidateShaderProgramState","flush","forceLoseDevice","forceRestoreDevice","isContextLost","resetState","gl","HeadlessEngine","create","configuration","canvas","engine","_initialize","Engine"],"mappings":";;AAAA,SAAS,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE;AACjC,IAAI,iBAAiB,GAAG,MAAM,CAAC,cAAc,IAAI,SAAS,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE;AAC/E,QAAQ,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;AACxB;AACA,QAAQ,OAAO,CAAC,CAAC;AACjB,KAAK,CAAC;AACN;AACA,IAAI,OAAO,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC;;ACNA,SAAS,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE;AACzC,IAAI,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,IAAI,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AC1D,QAAA,IAAMC,SAAS,IAAI1G,cAAAA,CAAeyG,cAAcxG,KAAK,EAAEwG,cAAcvG,MAAM,CAAA,CAAA;AAC3E,QAAA,IAAMyG,MAAS,GAAA,IATNJ,cASyBG,CAAAA,MAAAA,EAAQ,IAAIzD,iBAAqBwD,EAAAA,EAAAA,aAAAA,CAAAA,CAAAA;QACnE,OAAOE,MAAAA,CAAOC,WAAW,CAACH,aAAAA,CAAAA,CAAAA;AAC5B,KAAA,CAAA;AAXWF,IAAAA,OAAAA,cAAAA,CAAAA;EAAuBM,MAYnC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@galacean/engine-rhi-null",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.0-alpha.58",
4
+ "repository": {
5
+ "url": "https://github.com/galacean/engine.git"
6
+ },
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org"
10
+ },
11
+ "license": "MIT",
12
+ "main": "dist/main.js",
13
+ "module": "dist/module.js",
14
+ "debug": "src/index.ts",
15
+ "types": "types/index.d.ts",
16
+ "files": [
17
+ "dist/**/*",
18
+ "types/**/*"
19
+ ],
20
+ "devDependencies": {
21
+ "@galacean/engine": "2.0.0-alpha.58"
22
+ },
23
+ "peerDependencies": {
24
+ "@galacean/engine": "2.0.0-alpha.58"
25
+ },
26
+ "scripts": {
27
+ "b:types": "tsc"
28
+ }
6
29
  }
@@ -0,0 +1,15 @@
1
+ import { Canvas } from "@galacean/engine";
2
+ /** Canvas dimensions without a display or DOM input target. */
3
+ export declare class HeadlessCanvas extends Canvas {
4
+ /**
5
+ * Create a canvas with fixed dimensions.
6
+ * @param width - Width in pixels
7
+ * @param height - Height in pixels
8
+ */
9
+ constructor(width?: number, height?: number);
10
+ /** Keep the explicit resolution because there is no display size to follow. */
11
+ setAutoResolution(): void;
12
+ /** @internal */
13
+ _destroy(): void;
14
+ protected _onResolutionChanged(): void;
15
+ }
@@ -0,0 +1,24 @@
1
+ import { Engine, type EngineConfiguration } from "@galacean/engine";
2
+ /** Engine simulation and resources without graphics or DOM input. */
3
+ export declare class HeadlessEngine extends Engine {
4
+ /**
5
+ * Create a paused engine without opening a graphics device.
6
+ * @param configuration - Engine, loader and fixed canvas options
7
+ * @returns The initialized engine; call `update` or `run` to advance simulation
8
+ * @throws If `width` or `height` is not a positive finite number.
9
+ */
10
+ static create(configuration?: HeadlessEngineConfiguration): Promise<HeadlessEngine>;
11
+ }
12
+ /** Options for an engine without graphics, XR or DOM input. */
13
+ export interface HeadlessEngineConfiguration extends Omit<EngineConfiguration, "xrDevice" | "input"> {
14
+ /**
15
+ * Fixed canvas width in pixels.
16
+ * @defaultValue `1`
17
+ */
18
+ width?: number;
19
+ /**
20
+ * Fixed canvas height in pixels.
21
+ * @defaultValue `1`
22
+ */
23
+ height?: number;
24
+ }
@@ -0,0 +1,11 @@
1
+ import { SetDataOptions, type IPlatformBuffer } from "@galacean/engine";
2
+ /** Device buffer whose storage remains in host memory. */
3
+ export declare class NullBuffer implements IPlatformBuffer {
4
+ private _data;
5
+ constructor(byteLength: number, data?: ArrayBuffer | ArrayBufferView);
6
+ bind(): void;
7
+ setData(byteLength: number, data: ArrayBuffer | ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number, options?: SetDataOptions): void;
8
+ getData(data: ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number): void;
9
+ copyFromBuffer(source: NullBuffer, sourceByteOffset: number, destinationByteOffset: number, byteLength: number): void;
10
+ destroy(): void;
11
+ }
@@ -0,0 +1,58 @@
1
+ import { GLCapabilityType } from "@galacean/engine";
2
+ import type { IHardwareRenderer, IPlatformRenderTarget, IPlatformTransformFeedback, IPlatformTransformFeedbackPrimitive, BufferBindFlag, BufferUsage } from "@galacean/engine";
3
+ import { NullBuffer } from "./NullBuffer";
4
+ import { NullTexture2D, NullTexture2DArray, NullTextureCube } from "./NullTexture";
5
+ /** Graphics resource adapter that never opens a GPU context. */
6
+ export declare class NullGraphicDevice implements IHardwareRenderer {
7
+ readonly supportsRendering = false;
8
+ readonly isWebGL2 = false;
9
+ readonly maxUniformBlockSize = 0;
10
+ readonly canIUseMoreJoints = false;
11
+ readonly _options: {};
12
+ readonly capability: {
13
+ maxTextureSize: number;
14
+ maxAntiAliasing: number;
15
+ maxVertexUniformVectors: number;
16
+ canUseFloatTextureBlendShape: boolean;
17
+ isFragmentHighPrecision: boolean;
18
+ };
19
+ _currentBindShaderProgram: null;
20
+ _enableGlobalDepthBias: boolean;
21
+ get gl(): never;
22
+ init(): void;
23
+ canIUse(capability: GLCapabilityType): boolean;
24
+ canIUseCompressedTextureInternalFormat(): boolean;
25
+ supportsTextureFormat(): boolean;
26
+ supportsRenderTargetColorFormat(): boolean;
27
+ createPlatformPrimitive(): {
28
+ draw(): void;
29
+ destroy(): void;
30
+ };
31
+ createPlatformBuffer(_type: BufferBindFlag, byteLength: number, _usage?: BufferUsage, data?: ArrayBuffer | ArrayBufferView): NullBuffer;
32
+ createPlatformTexture2D(): NullTexture2D;
33
+ createPlatformTexture2DArray(): NullTexture2DArray;
34
+ createPlatformTextureCube(): NullTextureCube;
35
+ createPlatformRenderTarget(): IPlatformRenderTarget;
36
+ createPlatformTransformFeedback(): IPlatformTransformFeedback;
37
+ createPlatformTransformFeedbackPrimitive(): IPlatformTransformFeedbackPrimitive;
38
+ activeRenderTarget(): void;
39
+ clearRenderTarget(): void;
40
+ drawPrimitive(): void;
41
+ blitInternalRTByBlitFrameBuffer(): void;
42
+ copyRenderTargetToSubTexture(): never;
43
+ viewport(): void;
44
+ scissor(): void;
45
+ activeTexture(): void;
46
+ bindTexture(): void;
47
+ bindUniformBufferBase(): void;
48
+ setGlobalDepthBias(): void;
49
+ enableRasterizerDiscard(): void;
50
+ disableRasterizerDiscard(): void;
51
+ invalidateShaderProgramState(): void;
52
+ flush(): void;
53
+ forceLoseDevice(): void;
54
+ forceRestoreDevice(): void;
55
+ isContextLost(): boolean;
56
+ resetState(): void;
57
+ destroy(): void;
58
+ }
@@ -0,0 +1,26 @@
1
+ import type { IPlatformTexture, IPlatformTexture2D, IPlatformTexture2DArray, IPlatformTextureCube, TextureFilterMode, TextureWrapMode, TextureDepthCompareFunction } from "@galacean/engine";
2
+ /** Texture metadata without rasterized pixels. */
3
+ declare class NullTexture implements IPlatformTexture {
4
+ wrapModeU: TextureWrapMode;
5
+ wrapModeV: TextureWrapMode;
6
+ filterMode: TextureFilterMode;
7
+ anisoLevel: number;
8
+ depthCompareFunction: TextureDepthCompareFunction;
9
+ destroy(): void;
10
+ generateMipmaps(): void;
11
+ setUseDepthCompareMode(): void;
12
+ getPixelBuffer(): never;
13
+ }
14
+ export declare class NullTexture2D extends NullTexture implements IPlatformTexture2D {
15
+ setPixelBuffer(): void;
16
+ setImageSource(): void;
17
+ }
18
+ export declare class NullTexture2DArray extends NullTexture implements IPlatformTexture2DArray {
19
+ setPixelBuffer(): void;
20
+ setImageSource(): void;
21
+ }
22
+ export declare class NullTextureCube extends NullTexture implements IPlatformTextureCube {
23
+ setPixelBuffer(): void;
24
+ setImageSource(): void;
25
+ }
26
+ export {};
@@ -0,0 +1,4 @@
1
+ export { HeadlessEngine } from "./HeadlessEngine";
2
+ export type { HeadlessEngineConfiguration } from "./HeadlessEngine";
3
+ export { HeadlessCanvas } from "./HeadlessCanvas";
4
+ export { NullGraphicDevice } from "./NullGraphicDevice";