@myned-ai/gsplat-flame-avatar-renderer 1.0.6 → 1.0.7

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 (64) hide show
  1. package/README.md +30 -0
  2. package/dist/gsplat-flame-avatar-renderer.cjs.js +38 -33
  3. package/dist/gsplat-flame-avatar-renderer.cjs.min.js +1 -1
  4. package/dist/gsplat-flame-avatar-renderer.cjs.min.js.map +1 -1
  5. package/dist/gsplat-flame-avatar-renderer.esm.js +38 -33
  6. package/dist/gsplat-flame-avatar-renderer.esm.min.js +1 -1
  7. package/dist/gsplat-flame-avatar-renderer.esm.min.js.map +1 -1
  8. package/package.json +5 -2
  9. package/src/api/index.js +0 -7
  10. package/src/buffers/SplatBuffer.js +0 -1394
  11. package/src/buffers/SplatBufferGenerator.js +0 -41
  12. package/src/buffers/SplatPartitioner.js +0 -110
  13. package/src/buffers/UncompressedSplatArray.js +0 -106
  14. package/src/buffers/index.js +0 -11
  15. package/src/core/SplatGeometry.js +0 -48
  16. package/src/core/SplatMesh.js +0 -2627
  17. package/src/core/SplatScene.js +0 -43
  18. package/src/core/SplatTree.js +0 -200
  19. package/src/core/Viewer.js +0 -2746
  20. package/src/core/index.js +0 -13
  21. package/src/enums/EngineConstants.js +0 -58
  22. package/src/enums/LogLevel.js +0 -13
  23. package/src/enums/RenderMode.js +0 -11
  24. package/src/enums/SceneFormat.js +0 -21
  25. package/src/enums/SceneRevealMode.js +0 -11
  26. package/src/enums/SplatRenderMode.js +0 -10
  27. package/src/enums/index.js +0 -13
  28. package/src/errors/ApplicationError.js +0 -185
  29. package/src/errors/index.js +0 -17
  30. package/src/flame/FlameAnimator.js +0 -496
  31. package/src/flame/FlameConstants.js +0 -21
  32. package/src/flame/FlameTextureManager.js +0 -293
  33. package/src/flame/index.js +0 -22
  34. package/src/flame/utils.js +0 -50
  35. package/src/index.js +0 -39
  36. package/src/loaders/DirectLoadError.js +0 -14
  37. package/src/loaders/INRIAV1PlyParser.js +0 -223
  38. package/src/loaders/PlyLoader.js +0 -519
  39. package/src/loaders/PlyParser.js +0 -19
  40. package/src/loaders/PlyParserUtils.js +0 -311
  41. package/src/loaders/index.js +0 -13
  42. package/src/materials/SplatMaterial.js +0 -1068
  43. package/src/materials/SplatMaterial2D.js +0 -358
  44. package/src/materials/SplatMaterial3D.js +0 -323
  45. package/src/materials/index.js +0 -11
  46. package/src/raycaster/Hit.js +0 -37
  47. package/src/raycaster/Ray.js +0 -123
  48. package/src/raycaster/Raycaster.js +0 -175
  49. package/src/raycaster/index.js +0 -10
  50. package/src/renderer/AnimationManager.js +0 -577
  51. package/src/renderer/AppConstants.js +0 -101
  52. package/src/renderer/GaussianSplatRenderer.js +0 -1146
  53. package/src/renderer/index.js +0 -24
  54. package/src/utils/BlobUrlManager.js +0 -294
  55. package/src/utils/EventEmitter.js +0 -349
  56. package/src/utils/LoaderUtils.js +0 -66
  57. package/src/utils/Logger.js +0 -171
  58. package/src/utils/ObjectPool.js +0 -248
  59. package/src/utils/RenderLoop.js +0 -306
  60. package/src/utils/Util.js +0 -416
  61. package/src/utils/ValidationUtils.js +0 -331
  62. package/src/utils/index.js +0 -18
  63. package/src/worker/SortWorker.js +0 -284
  64. package/src/worker/index.js +0 -8
package/src/core/index.js DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * gsplat-flame-avatar - Core Module
3
- * Core rendering engine components.
4
- *
5
- * Based on @mkkellogg/gaussian-splats-3d (MIT License)
6
- * Extended with FLAME avatar support.
7
- */
8
-
9
- export { SplatGeometry } from './SplatGeometry.js';
10
- export { SplatMesh } from './SplatMesh.js';
11
- export { SplatScene } from './SplatScene.js';
12
- export { SplatTree } from './SplatTree.js';
13
- export { Viewer } from './Viewer.js';
@@ -1,58 +0,0 @@
1
- /**
2
- * EngineConstants
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- *
7
- * Core constants for Gaussian Splat rendering.
8
- */
9
-
10
- export class Constants {
11
- static DefaultSplatSortDistanceMapPrecision = 16;
12
- static MemoryPageSize = 65536;
13
- static BytesPerFloat = 4;
14
- static BytesPerInt = 4;
15
- static MaxScenes = 32;
16
- static ProgressiveLoadSectionSize = 262144;
17
- static ProgressiveLoadSectionDelayDuration = 15;
18
- static SphericalHarmonics8BitCompressionRange = 3;
19
- }
20
-
21
- export const DefaultSphericalHarmonics8BitCompressionRange = Constants.SphericalHarmonics8BitCompressionRange;
22
-
23
- // SplatMesh constants
24
- export const COVARIANCES_ELEMENTS_PER_SPLAT = 6;
25
- export const CENTER_COLORS_ELEMENTS_PER_SPLAT = 4;
26
-
27
- export const COVARIANCES_ELEMENTS_PER_TEXEL_STORED = 4;
28
- export const COVARIANCES_ELEMENTS_PER_TEXEL_ALLOCATED = 4;
29
- export const COVARIANCES_ELEMENTS_PER_TEXEL_COMPRESSED_STORED = 6;
30
- export const COVARIANCES_ELEMENTS_PER_TEXEL_COMPRESSED_ALLOCATED = 8;
31
- export const SCALES_ROTATIONS_ELEMENTS_PER_TEXEL = 4;
32
- export const CENTER_COLORS_ELEMENTS_PER_TEXEL = 4;
33
- export const SCENE_INDEXES_ELEMENTS_PER_TEXEL = 1;
34
-
35
- export const SCENE_FADEIN_RATE_FAST = 0.012;
36
- export const SCENE_FADEIN_RATE_GRADUAL = 0.003;
37
-
38
- // Viewer constants
39
- export const THREE_CAMERA_FOV = 50;
40
- export const MINIMUM_DISTANCE_TO_NEW_FOCAL_POINT = 0.5;
41
- export const CONSECUTIVE_RENDERED_FRAMES_FOR_FPS_CALCULATION = 60;
42
- export const MIN_SPLAT_COUNT_TO_SHOW_SPLAT_TREE_LOADING_SPINNER = 1500000;
43
- export const FOCUS_MARKER_FADE_IN_SPEED = 0.4;
44
- export const FOCUS_MARKER_FADE_OUT_SPEED = 0.12;
45
-
46
- // Internal load types for loaders
47
- export const InternalLoadType = {
48
- DirectToSplatBuffer: 0,
49
- DirectToSplatArray: 1,
50
- DownloadBeforeProcessing: 2
51
- };
52
-
53
- // Loader status
54
- export const LoaderStatus = {
55
- 'Downloading': 0,
56
- 'Processing': 1,
57
- 'Done': 2
58
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * Log level enumeration for controlling verbosity
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- */
7
- export const LogLevel = {
8
- None: 0,
9
- Error: 1,
10
- Warning: 2,
11
- Info: 3,
12
- Debug: 4
13
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * Render mode enumeration
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- */
7
- export const RenderMode = {
8
- Always: 0,
9
- OnChange: 1,
10
- Never: 2
11
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * Scene format enumeration for supported file types
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- *
7
- * Simplified for FLAME avatar usage - only PLY format is supported.
8
- */
9
- export const SceneFormat = {
10
- 'Ply': 0
11
- };
12
-
13
- /**
14
- * Determine scene format from file path
15
- * @param {string} path - File path
16
- * @returns {number|null} Scene format or null if unknown
17
- */
18
- export const sceneFormatFromPath = (path) => {
19
- if (path.endsWith('.ply')) return SceneFormat.Ply;
20
- return null;
21
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * Scene reveal mode enumeration
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- */
7
- export const SceneRevealMode = {
8
- Default: 0,
9
- Gradual: 1,
10
- Instant: 2
11
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Splat render mode enumeration
3
- *
4
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
5
- * https://github.com/mkkellogg/GaussianSplats3D
6
- */
7
- export const SplatRenderMode = {
8
- ThreeD: 0,
9
- TwoD: 1
10
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * gsplat-flame-avatar - Enums Module
3
- * Constants and enumerations for rendering configuration.
4
- *
5
- * Derived from @mkkellogg/gaussian-splats-3d (MIT License)
6
- */
7
-
8
- export * from './LogLevel.js';
9
- export * from './RenderMode.js';
10
- export * from './SceneFormat.js';
11
- export * from './SceneRevealMode.js';
12
- export * from './SplatRenderMode.js';
13
- export * from './EngineConstants.js';
@@ -1,185 +0,0 @@
1
- /**
2
- * ApplicationError - Base error class for all application errors
3
- *
4
- * Provides structured error handling with error codes and cause tracking.
5
- * All domain-specific errors should extend this class.
6
- *
7
- * @extends Error
8
- */
9
- export class ApplicationError extends Error {
10
- /**
11
- * Create an ApplicationError
12
- * @param {string} message - Human-readable error message
13
- * @param {string} code - Machine-readable error code for programmatic handling
14
- * @param {Error} [cause=null] - Original error that caused this error (for error chaining)
15
- */
16
- constructor(message, code, cause = null) {
17
- super(message);
18
- this.name = this.constructor.name;
19
- this.code = code;
20
- this.cause = cause;
21
-
22
- // Capture stack trace, excluding constructor call from it
23
- if (Error.captureStackTrace) {
24
- Error.captureStackTrace(this, this.constructor);
25
- }
26
- }
27
-
28
- /**
29
- * Convert error to JSON for logging/transmission
30
- * @returns {object} JSON representation of error
31
- */
32
- toJSON() {
33
- return {
34
- name: this.name,
35
- message: this.message,
36
- code: this.code,
37
- stack: this.stack,
38
- cause: this.cause ? {
39
- name: this.cause.name,
40
- message: this.cause.message
41
- } : null
42
- };
43
- }
44
- }
45
-
46
- /**
47
- * ValidationError - Thrown when input validation fails
48
- *
49
- * Used for invalid parameters, out-of-range values, or malformed data.
50
- *
51
- * @extends ApplicationError
52
- */
53
- export class ValidationError extends ApplicationError {
54
- /**
55
- * Create a ValidationError
56
- * @param {string} message - Validation failure description
57
- * @param {string} field - Name of the field that failed validation
58
- * @param {Error} [cause=null] - Original error that caused this validation failure
59
- */
60
- constructor(message, field, cause = null) {
61
- super(message, 'VALIDATION_ERROR', cause);
62
- this.field = field;
63
- }
64
- }
65
-
66
- /**
67
- * NetworkError - Thrown when network operations fail
68
- *
69
- * Used for fetch failures, timeouts, or HTTP error responses.
70
- *
71
- * @extends ApplicationError
72
- */
73
- export class NetworkError extends ApplicationError {
74
- /**
75
- * Create a NetworkError
76
- * @param {string} message - Network error description
77
- * @param {number} [statusCode=0] - HTTP status code (if applicable)
78
- * @param {Error} [cause=null] - Original error that caused this network failure
79
- */
80
- constructor(message, statusCode = 0, cause = null) {
81
- super(message, 'NETWORK_ERROR', cause);
82
- this.statusCode = statusCode;
83
- }
84
- }
85
-
86
- /**
87
- * AssetLoadError - Thrown when asset loading fails
88
- *
89
- * Used for failures loading models, textures, or other asset files.
90
- *
91
- * @extends ApplicationError
92
- */
93
- export class AssetLoadError extends ApplicationError {
94
- /**
95
- * Create an AssetLoadError
96
- * @param {string} message - Asset load failure description
97
- * @param {string} assetPath - Path to the asset that failed to load
98
- * @param {Error} [cause=null] - Original error that caused this load failure
99
- */
100
- constructor(message, assetPath, cause = null) {
101
- super(message, 'ASSET_LOAD_ERROR', cause);
102
- this.assetPath = assetPath;
103
- }
104
- }
105
-
106
- /**
107
- * ResourceDisposedError - Thrown when attempting to use a disposed resource
108
- *
109
- * Used to prevent use-after-dispose bugs.
110
- *
111
- * @extends ApplicationError
112
- */
113
- export class ResourceDisposedError extends ApplicationError {
114
- /**
115
- * Create a ResourceDisposedError
116
- * @param {string} resourceName - Name of the disposed resource
117
- */
118
- constructor(resourceName) {
119
- super(
120
- `Cannot use ${resourceName}: resource has been disposed`,
121
- 'RESOURCE_DISPOSED_ERROR'
122
- );
123
- this.resourceName = resourceName;
124
- }
125
- }
126
-
127
- /**
128
- * InitializationError - Thrown when initialization fails
129
- *
130
- * Used when required setup steps fail or prerequisites are not met.
131
- *
132
- * @extends ApplicationError
133
- */
134
- export class InitializationError extends ApplicationError {
135
- /**
136
- * Create an InitializationError
137
- * @param {string} message - Initialization failure description
138
- * @param {string} component - Name of component that failed to initialize
139
- * @param {Error} [cause=null] - Original error that caused this initialization failure
140
- */
141
- constructor(message, component, cause = null) {
142
- super(message, 'INITIALIZATION_ERROR', cause);
143
- this.component = component;
144
- }
145
- }
146
-
147
- /**
148
- * ParseError - Thrown when parsing data fails
149
- *
150
- * Used for malformed file formats, invalid JSON, or corrupt data.
151
- *
152
- * @extends ApplicationError
153
- */
154
- export class ParseError extends ApplicationError {
155
- /**
156
- * Create a ParseError
157
- * @param {string} message - Parse failure description
158
- * @param {string} dataType - Type of data being parsed (e.g., 'JSON', 'PLY', 'GLB')
159
- * @param {Error} [cause=null] - Original error that caused this parse failure
160
- */
161
- constructor(message, dataType, cause = null) {
162
- super(message, 'PARSE_ERROR', cause);
163
- this.dataType = dataType;
164
- }
165
- }
166
-
167
- /**
168
- * ConfigurationError - Thrown when configuration is invalid
169
- *
170
- * Used for invalid settings, missing required configuration, or conflicting options.
171
- *
172
- * @extends ApplicationError
173
- */
174
- export class ConfigurationError extends ApplicationError {
175
- /**
176
- * Create a ConfigurationError
177
- * @param {string} message - Configuration error description
178
- * @param {string} configKey - Configuration key that is invalid
179
- * @param {Error} [cause=null] - Original error
180
- */
181
- constructor(message, configKey, cause = null) {
182
- super(message, 'CONFIGURATION_ERROR', cause);
183
- this.configKey = configKey;
184
- }
185
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Error classes for structured error handling
3
- *
4
- * This module exports all custom error classes used throughout the application.
5
- * All errors extend ApplicationError for consistent error handling.
6
- */
7
-
8
- export {
9
- ApplicationError,
10
- ValidationError,
11
- NetworkError,
12
- AssetLoadError,
13
- ResourceDisposedError,
14
- InitializationError,
15
- ParseError,
16
- ConfigurationError
17
- } from './ApplicationError.js';