rhodonite 0.5.6 → 0.6.2
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/VERSION-FILE +2 -2
- package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +0 -1
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +0 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +0 -1
- package/dist/esm/foundation/core/Component.d.ts +3 -5
- package/dist/esm/foundation/core/ComponentRepository.d.ts +9 -14
- package/dist/esm/foundation/core/EntityRepository.d.ts +12 -15
- package/dist/esm/foundation/core/MemoryManager.d.ts +5 -1
- package/dist/esm/foundation/definitions/TextureParameter.d.ts +2 -0
- package/dist/esm/foundation/exporter/Gltf2Exporter.d.ts +0 -1
- package/dist/esm/foundation/gizmos/Gizmo.d.ts +0 -2
- package/dist/esm/foundation/importer/Gltf1Importer.d.ts +25 -27
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +23 -25
- package/dist/esm/foundation/importer/GltfImporter.d.ts +24 -26
- package/dist/esm/foundation/importer/ModelConverter.d.ts +46 -52
- package/dist/esm/foundation/importer/VRMImporter.d.ts +2 -4
- package/dist/esm/foundation/system/System.d.ts +31 -19
- package/dist/esm/foundation/textures/AbstractTexture.d.ts +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture.d.ts +1 -1
- package/dist/esm/foundation/textures/VideoTexture.d.ts +1 -0
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.js +695 -601
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +50 -3
- package/dist/esm/xr/WebXRSystem.d.ts +4 -7
- package/package.json +1 -1
package/VERSION-FILE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
v0.
|
|
2
|
-
|
|
1
|
+
v0.6.2-0-g88c15a0c
|
|
2
|
+
refactor!/entity-repository
|
|
@@ -22,7 +22,6 @@ export default class AnimationComponent extends Component {
|
|
|
22
22
|
};
|
|
23
23
|
private static __animationGlobalInfo;
|
|
24
24
|
private static __pubsub;
|
|
25
|
-
private static __componentRepository;
|
|
26
25
|
constructor(entityUid: EntityUID, componentSid: ComponentSID, entityRepository: EntityRepository);
|
|
27
26
|
$create(): void;
|
|
28
27
|
$logic(): void;
|
|
@@ -14,7 +14,6 @@ export default class LightComponent extends Component {
|
|
|
14
14
|
spotCutoff: number;
|
|
15
15
|
range: number;
|
|
16
16
|
private __sceneGraphComponent?;
|
|
17
|
-
private static __componentRepository;
|
|
18
17
|
private static __globalDataRepository;
|
|
19
18
|
private static __tmp_vec4;
|
|
20
19
|
private static __lightPositions;
|
|
@@ -19,7 +19,6 @@ export default class MeshRendererComponent extends Component {
|
|
|
19
19
|
specularCubeMapContribution: number;
|
|
20
20
|
rotationOfCubeMap: number;
|
|
21
21
|
private static __webglResourceRepository?;
|
|
22
|
-
private static __componentRepository;
|
|
23
22
|
private static __instanceIDBufferUid;
|
|
24
23
|
private static __webglRenderingStrategy?;
|
|
25
24
|
private static __instanceIdAccessor?;
|
|
@@ -7,7 +7,6 @@ import { ComponentTypeEnum } from '../../foundation/definitions/ComponentType';
|
|
|
7
7
|
import { CompositionTypeEnum } from '../../foundation/definitions/CompositionType';
|
|
8
8
|
import { ProcessStageEnum } from '../definitions/ProcessStage';
|
|
9
9
|
import { ProcessApproachEnum } from '../definitions/ProcessApproach';
|
|
10
|
-
import ComponentRepository from './ComponentRepository';
|
|
11
10
|
import WebGLStrategy from '../../webgl/WebGLStrategy';
|
|
12
11
|
import RenderPass from '../renderer/RenderPass';
|
|
13
12
|
import RnObject from './RnObject';
|
|
@@ -83,7 +82,7 @@ export default class Component extends RnObject {
|
|
|
83
82
|
* Get true or false whether the specified ProcessStage exists in Component.
|
|
84
83
|
* @returns true or false
|
|
85
84
|
*/
|
|
86
|
-
static doesTheProcessStageMethodExist(componentType: typeof Component, processStage: ProcessStageEnum
|
|
85
|
+
static doesTheProcessStageMethodExist(componentType: typeof Component, processStage: ProcessStageEnum): boolean;
|
|
87
86
|
/**
|
|
88
87
|
* Get true or false whether the specified ProcessStage exists in Component.
|
|
89
88
|
*/
|
|
@@ -92,11 +91,10 @@ export default class Component extends RnObject {
|
|
|
92
91
|
* Process the components
|
|
93
92
|
* @param param0 params
|
|
94
93
|
*/
|
|
95
|
-
static process({ componentType, processStage, processApproach,
|
|
94
|
+
static process({ componentType, processStage, processApproach, strategy, renderPass, renderPassTickCount, }: {
|
|
96
95
|
componentType: typeof Component;
|
|
97
96
|
processStage: ProcessStageEnum;
|
|
98
97
|
processApproach: ProcessApproachEnum;
|
|
99
|
-
componentRepository: ComponentRepository;
|
|
100
98
|
strategy: WebGLStrategy;
|
|
101
99
|
renderPass?: RenderPass;
|
|
102
100
|
renderPassTickCount: Count;
|
|
@@ -104,7 +102,7 @@ export default class Component extends RnObject {
|
|
|
104
102
|
/**
|
|
105
103
|
* Update all components at each process stage.
|
|
106
104
|
*/
|
|
107
|
-
static updateComponentsOfEachProcessStage(componentClass: typeof Component, processStage: ProcessStageEnum,
|
|
105
|
+
static updateComponentsOfEachProcessStage(componentClass: typeof Component, processStage: ProcessStageEnum, renderPass?: RenderPass): void;
|
|
108
106
|
/**
|
|
109
107
|
* get byte length of sum of member fields in the component class
|
|
110
108
|
*/
|
|
@@ -5,17 +5,12 @@ import { ComponentTID, ComponentSID, EntityUID } from '../../types/CommonTypes';
|
|
|
5
5
|
* The class that generates and manages all kinds of components.
|
|
6
6
|
*/
|
|
7
7
|
export default class ComponentRepository {
|
|
8
|
-
private static
|
|
9
|
-
private
|
|
10
|
-
private __components;
|
|
8
|
+
private static __component_sid_count_map;
|
|
9
|
+
private static __components;
|
|
11
10
|
static __componentClasses: Map<ComponentTID, typeof Component>;
|
|
12
11
|
constructor();
|
|
13
12
|
static registerComponentClass(componentClass: typeof Component): void;
|
|
14
13
|
static unregisterComponentClass(componentTID: ComponentTID): void;
|
|
15
|
-
/**
|
|
16
|
-
* Gets the singleton instance of the ComponentRepository.
|
|
17
|
-
*/
|
|
18
|
-
static getInstance(): ComponentRepository;
|
|
19
14
|
/**
|
|
20
15
|
* Gets the class object of the component corresponding to specified ComponentTID.
|
|
21
16
|
* @param componentTid The componentTID to get the class object.
|
|
@@ -27,39 +22,39 @@ export default class ComponentRepository {
|
|
|
27
22
|
* @param entityUid The entityUID of the entity.
|
|
28
23
|
* @param entityRepository the reference of the entityRepository.
|
|
29
24
|
*/
|
|
30
|
-
createComponent(componentTid: ComponentTID, entityUid: EntityUID, entityRepository: EntityRepository): Component;
|
|
25
|
+
static createComponent(componentTid: ComponentTID, entityUid: EntityUID, entityRepository: EntityRepository): Component;
|
|
31
26
|
/**
|
|
32
27
|
* Get the instance of the component corresponding to the component class and componentSID.
|
|
33
28
|
* @param componentClass The class object to get the component.
|
|
34
29
|
* @param componentSid The componentSID to get the component.
|
|
35
30
|
*/
|
|
36
|
-
getComponent(componentClass: typeof Component, componentSid: ComponentSID): Component | undefined;
|
|
31
|
+
static getComponent(componentClass: typeof Component, componentSid: ComponentSID): Component | undefined;
|
|
37
32
|
/**
|
|
38
33
|
* Get the instance of the component corresponding to the componentTID and componentSID.
|
|
39
34
|
* @param componentTid The componentTID to get the component.
|
|
40
35
|
* @param componentSid The componentSID to get the component.
|
|
41
36
|
*/
|
|
42
|
-
getComponentFromComponentTID(componentTid: ComponentTID, componentSid: ComponentSID): Component | undefined;
|
|
37
|
+
static getComponentFromComponentTID(componentTid: ComponentTID, componentSid: ComponentSID): Component | undefined;
|
|
43
38
|
/**
|
|
44
39
|
* @private
|
|
45
40
|
* Gets an array of components corresponding to the class object of the component.
|
|
46
41
|
* @param componentClass The class object of the component.
|
|
47
42
|
*/
|
|
48
|
-
_getComponents(componentClass: typeof Component): Array<Component> | undefined;
|
|
43
|
+
static _getComponents(componentClass: typeof Component): Array<Component> | undefined;
|
|
49
44
|
/**
|
|
50
45
|
* @private
|
|
51
46
|
* Gets an array of components corresponding to the class object of the component (dead components included).
|
|
52
47
|
* @param componentClass The class object of the component.
|
|
53
48
|
*/
|
|
54
|
-
_getComponentsIncludingDead(componentClass: typeof Component): Array<Component> | undefined;
|
|
49
|
+
static _getComponentsIncludingDead(componentClass: typeof Component): Array<Component> | undefined;
|
|
55
50
|
static getMemoryBeginIndex(componentTid: ComponentTID): number;
|
|
56
51
|
/**
|
|
57
52
|
* Gets an array of components corresponding to the class object of the component.
|
|
58
53
|
* @param componentType The class object of the component.
|
|
59
54
|
*/
|
|
60
|
-
getComponentsWithType(componentType: typeof Component): Array<Component>;
|
|
55
|
+
static getComponentsWithType(componentType: typeof Component): Array<Component>;
|
|
61
56
|
/**
|
|
62
57
|
* Gets all componentTIDs.
|
|
63
58
|
*/
|
|
64
|
-
getComponentTIDs(): Array<ComponentTID>;
|
|
59
|
+
static getComponentTIDs(): Array<ComponentTID>;
|
|
65
60
|
}
|
|
@@ -6,18 +6,15 @@ import { ComponentToComponentMethods } from '../components/ComponentTypes';
|
|
|
6
6
|
* The class that generates and manages entities.
|
|
7
7
|
*/
|
|
8
8
|
export default class EntityRepository {
|
|
9
|
-
private __entity_uid_count;
|
|
10
|
-
private __entities;
|
|
11
|
-
|
|
12
|
-
private __componentRepository;
|
|
13
|
-
_components: Array<Map<ComponentTID, Component>>;
|
|
9
|
+
private static __entity_uid_count;
|
|
10
|
+
private static __entities;
|
|
11
|
+
static _components: Array<Map<ComponentTID, Component>>;
|
|
14
12
|
private constructor();
|
|
15
|
-
static getInstance(): EntityRepository;
|
|
16
13
|
/**
|
|
17
14
|
* Creates an entity
|
|
18
15
|
*/
|
|
19
|
-
createEntity(): IEntity;
|
|
20
|
-
addComponentToEntity<ComponentType extends typeof Component, EntityType extends IEntity>(componentClass: ComponentType, entity: EntityType): EntityType & ComponentToComponentMethods<ComponentType>;
|
|
16
|
+
static createEntity(): IEntity;
|
|
17
|
+
static addComponentToEntity<ComponentType extends typeof Component, EntityType extends IEntity>(componentClass: ComponentType, entity: EntityType): EntityType & ComponentToComponentMethods<ComponentType>;
|
|
21
18
|
/**
|
|
22
19
|
* Remove components from the entity.
|
|
23
20
|
* Note: the returned entity's type will be IEntity (most basic type).
|
|
@@ -25,36 +22,36 @@ export default class EntityRepository {
|
|
|
25
22
|
* @param componentClass The class object of the component to remove.
|
|
26
23
|
* @param entityUid The entityUID of the entity.
|
|
27
24
|
*/
|
|
28
|
-
removeComponentFromEntity(componentClass: typeof Component, entity: IEntity): IEntity;
|
|
25
|
+
static removeComponentFromEntity(componentClass: typeof Component, entity: IEntity): IEntity;
|
|
29
26
|
/**
|
|
30
27
|
* Gets the entity corresponding to the entityUID.
|
|
31
28
|
* @param entityUid The entityUID of the entity.
|
|
32
29
|
*/
|
|
33
|
-
getEntity(entityUid: EntityUID): IEntity;
|
|
30
|
+
static getEntity(entityUid: EntityUID): IEntity;
|
|
34
31
|
/**
|
|
35
32
|
* Gets the specified component from the entity.
|
|
36
33
|
* @param entityUid The entity to get the component from.
|
|
37
34
|
* @param componentType The class object of the component to get.
|
|
38
35
|
*/
|
|
39
|
-
getComponentOfEntity(entityUid: EntityUID, componentType: typeof Component): Component | null;
|
|
36
|
+
static getComponentOfEntity(entityUid: EntityUID, componentType: typeof Component): Component | null;
|
|
40
37
|
/**
|
|
41
38
|
* Search entities by the given tags.
|
|
42
39
|
* @param tags The tags to search
|
|
43
40
|
*/
|
|
44
|
-
searchByTags(tags: RnTags): IEntity[];
|
|
41
|
+
static searchByTags(tags: RnTags): IEntity[];
|
|
45
42
|
/**
|
|
46
43
|
* Gets entity by the unique name.
|
|
47
44
|
* @param uniqueName The unique name of the entity.
|
|
48
45
|
*/
|
|
49
|
-
getEntityByUniqueName(uniqueName: string): IEntity | undefined;
|
|
46
|
+
static getEntityByUniqueName(uniqueName: string): IEntity | undefined;
|
|
50
47
|
/**
|
|
51
48
|
* @private
|
|
52
49
|
* Gets all entities.
|
|
53
50
|
*/
|
|
54
|
-
_getEntities(): IEntity[];
|
|
51
|
+
static _getEntities(): IEntity[];
|
|
55
52
|
/**
|
|
56
53
|
* Gets the number of all entities.
|
|
57
54
|
*/
|
|
58
|
-
getEntitiesNumber(): number;
|
|
55
|
+
static getEntitiesNumber(): number;
|
|
59
56
|
}
|
|
60
57
|
export declare function applyMixins(derivedCtor: IEntity, baseCtor: any): void;
|
|
@@ -15,7 +15,11 @@ export default class MemoryManager {
|
|
|
15
15
|
private __buffersOnDemand;
|
|
16
16
|
private __memorySizeRatios;
|
|
17
17
|
private constructor();
|
|
18
|
-
static createInstanceIfNotCreated(cpuGeneric
|
|
18
|
+
static createInstanceIfNotCreated({ cpuGeneric, gpuInstanceData, gpuVertexData, }: {
|
|
19
|
+
cpuGeneric: number;
|
|
20
|
+
gpuInstanceData: number;
|
|
21
|
+
gpuVertexData: number;
|
|
22
|
+
}): MemoryManager;
|
|
19
23
|
private __makeMultipleOf4byteSize;
|
|
20
24
|
static getInstance(): MemoryManager;
|
|
21
25
|
private __createBuffer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EnumIO } from '../misc/EnumIO';
|
|
2
2
|
export declare type TextureParameterEnum = EnumIO;
|
|
3
3
|
declare function from(index: number): TextureParameterEnum;
|
|
4
|
+
declare function migrateToWebGL1InternalFormat(tp: TextureParameterEnum): TextureParameterEnum;
|
|
4
5
|
export declare const TextureParameter: Readonly<{
|
|
5
6
|
Nearest: EnumIO;
|
|
6
7
|
Linear: EnumIO;
|
|
@@ -33,5 +34,6 @@ export declare const TextureParameter: Readonly<{
|
|
|
33
34
|
Depth24Stencil8: EnumIO;
|
|
34
35
|
Depth32FStencil8: EnumIO;
|
|
35
36
|
from: typeof from;
|
|
37
|
+
migrateToWebGL1InternalFormat: typeof migrateToWebGL1InternalFormat;
|
|
36
38
|
}>;
|
|
37
39
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import RnObject from '../core/RnObject';
|
|
2
|
-
import EntityRepository from '../core/EntityRepository';
|
|
3
2
|
import { ISceneGraphEntity, IMeshEntity } from '../helpers/EntityHelper';
|
|
4
3
|
/**
|
|
5
4
|
* Abstract Gizmo class
|
|
6
5
|
*/
|
|
7
6
|
export default abstract class Gizmo extends RnObject {
|
|
8
|
-
protected __entityRepository: EntityRepository;
|
|
9
7
|
/**
|
|
10
8
|
* The top entity of this gizmo group.
|
|
11
9
|
* A programmer who implements a gizmo class has to make this entity
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RnM2, RnM2Material, GltfFileBuffers, GltfLoadOption } from '../../types/RnM2';
|
|
2
2
|
import { glTF1 } from '../../types/glTF1';
|
|
3
3
|
export default class Gltf1Importer {
|
|
4
|
-
private static __instance;
|
|
5
4
|
private constructor();
|
|
6
5
|
/**
|
|
7
6
|
* the method to load glTF1 file.
|
|
@@ -9,8 +8,8 @@ export default class Gltf1Importer {
|
|
|
9
8
|
* @param options - options for loading process
|
|
10
9
|
* @returns a glTF2 based JSON pre-processed
|
|
11
10
|
*/
|
|
12
|
-
import(uri: string, options?: GltfLoadOption): Promise<RnM2>;
|
|
13
|
-
importGltfOrGlbFromFile(uri: string, options?: GltfLoadOption): Promise<RnM2 | undefined>;
|
|
11
|
+
static import(uri: string, options?: GltfLoadOption): Promise<RnM2>;
|
|
12
|
+
static importGltfOrGlbFromFile(uri: string, options?: GltfLoadOption): Promise<RnM2 | undefined>;
|
|
14
13
|
/**
|
|
15
14
|
* Import glTF1 array buffer.
|
|
16
15
|
* @param arrayBuffer .gltf/.glb file in ArrayBuffer
|
|
@@ -19,28 +18,27 @@ export default class Gltf1Importer {
|
|
|
19
18
|
* @param uri .gltf file's uri (Optional)
|
|
20
19
|
* @returns a glTF2 based JSON pre-processed
|
|
21
20
|
*/
|
|
22
|
-
importGltfOrGlbFromArrayBuffers(arrayBuffer: ArrayBuffer, otherFiles: GltfFileBuffers, options?: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
23
|
-
_getOptions(defaultOptions: GltfLoadOption, json: glTF1, options: GltfLoadOption): GltfLoadOption;
|
|
24
|
-
importGlb(arrayBuffer: ArrayBuffer, files: GltfFileBuffers, options: GltfLoadOption): Promise<RnM2>;
|
|
25
|
-
importGltf(gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
26
|
-
_loadInner(gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, uint8array?: Uint8Array, basePath?: string): Promise<(glTF1 | void)[][]>;
|
|
27
|
-
_loadJsonContent(gltfJson: glTF1): void;
|
|
28
|
-
private _convertToGltf2LikeStructure;
|
|
29
|
-
private __createProperty;
|
|
30
|
-
_loadDependenciesOfScenes(gltfJson: glTF1): void;
|
|
31
|
-
_loadDependenciesOfNodes(gltfJson: glTF1): void;
|
|
32
|
-
_loadDependenciesOfMeshes(gltfJson: glTF1): void;
|
|
33
|
-
_isKHRMaterialsCommon(materialJson: RnM2Material): boolean;
|
|
34
|
-
_loadDependenciesOfMaterials(gltfJson: glTF1): void;
|
|
35
|
-
_loadDependenciesOfTextures(gltfJson: glTF1): void;
|
|
36
|
-
_loadDependenciesOfJoints(gltfJson: glTF1): void;
|
|
37
|
-
_loadDependenciesOfAnimations(gltfJson: glTF1): void;
|
|
38
|
-
_loadDependenciesOfAccessors(gltfJson: glTF1): void;
|
|
39
|
-
_loadDependenciesOfBufferViews(gltfJson: glTF1): void;
|
|
40
|
-
_mergeExtendedJson(gltfJson: glTF1, extendedData: ArrayBuffer | string | object): void;
|
|
41
|
-
_loadResources(uint8Array: Uint8Array, gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, basePath?: string): Promise<(glTF1 | void)[]>;
|
|
42
|
-
private __containsFileName;
|
|
43
|
-
private __getFullPathOfFileName;
|
|
44
|
-
private __loadImageUri;
|
|
45
|
-
static getInstance(): Gltf1Importer;
|
|
21
|
+
static importGltfOrGlbFromArrayBuffers(arrayBuffer: ArrayBuffer, otherFiles: GltfFileBuffers, options?: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
22
|
+
static _getOptions(defaultOptions: GltfLoadOption, json: glTF1, options: GltfLoadOption): GltfLoadOption;
|
|
23
|
+
static importGlb(arrayBuffer: ArrayBuffer, files: GltfFileBuffers, options: GltfLoadOption): Promise<RnM2>;
|
|
24
|
+
static importGltf(gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
25
|
+
static _loadInner(gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, uint8array?: Uint8Array, basePath?: string): Promise<(glTF1 | void)[][]>;
|
|
26
|
+
static _loadJsonContent(gltfJson: glTF1): void;
|
|
27
|
+
private static _convertToGltf2LikeStructure;
|
|
28
|
+
private static __createProperty;
|
|
29
|
+
static _loadDependenciesOfScenes(gltfJson: glTF1): void;
|
|
30
|
+
static _loadDependenciesOfNodes(gltfJson: glTF1): void;
|
|
31
|
+
static _loadDependenciesOfMeshes(gltfJson: glTF1): void;
|
|
32
|
+
static _isKHRMaterialsCommon(materialJson: RnM2Material): boolean;
|
|
33
|
+
static _loadDependenciesOfMaterials(gltfJson: glTF1): void;
|
|
34
|
+
static _loadDependenciesOfTextures(gltfJson: glTF1): void;
|
|
35
|
+
static _loadDependenciesOfJoints(gltfJson: glTF1): void;
|
|
36
|
+
static _loadDependenciesOfAnimations(gltfJson: glTF1): void;
|
|
37
|
+
static _loadDependenciesOfAccessors(gltfJson: glTF1): void;
|
|
38
|
+
static _loadDependenciesOfBufferViews(gltfJson: glTF1): void;
|
|
39
|
+
static _mergeExtendedJson(gltfJson: glTF1, extendedData: ArrayBuffer | string | object): void;
|
|
40
|
+
static _loadResources(uint8Array: Uint8Array, gltfJson: glTF1, files: GltfFileBuffers, options: GltfLoadOption, basePath?: string): Promise<(glTF1 | void)[]>;
|
|
41
|
+
private static __containsFileName;
|
|
42
|
+
private static __getFullPathOfFileName;
|
|
43
|
+
private static __loadImageUri;
|
|
46
44
|
}
|
|
@@ -3,7 +3,6 @@ import { RnM2, GltfLoadOption, GltfFileBuffers } from '../../types/RnM2';
|
|
|
3
3
|
* The glTF2 Importer class.
|
|
4
4
|
*/
|
|
5
5
|
export default class Gltf2Importer {
|
|
6
|
-
private static __instance;
|
|
7
6
|
private constructor();
|
|
8
7
|
/**
|
|
9
8
|
* Import glTF2 file
|
|
@@ -11,8 +10,8 @@ export default class Gltf2Importer {
|
|
|
11
10
|
* @param options - options for loading process
|
|
12
11
|
* @returns a glTF2 based JSON pre-processed
|
|
13
12
|
*/
|
|
14
|
-
import(uri: string, options?: GltfLoadOption): Promise<RnM2 | undefined>;
|
|
15
|
-
importGltfOrGlbFromFile(uri: string, options?: GltfLoadOption): Promise<void | RnM2 | undefined>;
|
|
13
|
+
static import(uri: string, options?: GltfLoadOption): Promise<RnM2 | undefined>;
|
|
14
|
+
static importGltfOrGlbFromFile(uri: string, options?: GltfLoadOption): Promise<void | RnM2 | undefined>;
|
|
16
15
|
/**
|
|
17
16
|
* Import glTF2 array buffer.
|
|
18
17
|
* @param arrayBuffer .gltf/.glb file in ArrayBuffer
|
|
@@ -21,26 +20,25 @@ export default class Gltf2Importer {
|
|
|
21
20
|
* @param uri .gltf file's uri (Optional)
|
|
22
21
|
* @returns a glTF2 based JSON pre-processed
|
|
23
22
|
*/
|
|
24
|
-
importGltfOrGlbFromArrayBuffers(arrayBuffer: ArrayBuffer, otherFiles: GltfFileBuffers, options?: GltfLoadOption, uri?: string): Promise<RnM2 | undefined>;
|
|
25
|
-
_getOptions(defaultOptions: GltfLoadOption, json: RnM2, options: GltfLoadOption): GltfLoadOption;
|
|
26
|
-
importGlb(arrayBuffer: ArrayBuffer, files: GltfFileBuffers, options: GltfLoadOption): Promise<RnM2>;
|
|
27
|
-
importGltf(gltfJson: RnM2, fileArrayBuffers: GltfFileBuffers, options: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
28
|
-
_loadInner(gltfJson: RnM2, files: GltfFileBuffers, options: GltfLoadOption, uint8array?: Uint8Array, basePath?: string): Promise<(void | unknown[])[]>;
|
|
29
|
-
_loadJsonContent(gltfJson: RnM2): void;
|
|
30
|
-
_loadDependenciesOfScenes(gltfJson: RnM2): void;
|
|
31
|
-
_loadDependenciesOfNodes(gltfJson: RnM2): void;
|
|
32
|
-
_loadDependenciesOfMeshes(gltfJson: RnM2): void;
|
|
33
|
-
private _checkRnGltfLoaderOptionsExist;
|
|
34
|
-
_loadDependenciesOfMaterials(gltfJson: RnM2): void;
|
|
35
|
-
_loadDependenciesOfTextures(gltfJson: RnM2): void;
|
|
36
|
-
_loadDependenciesOfJoints(gltfJson: RnM2): void;
|
|
37
|
-
_loadDependenciesOfAnimations(gltfJson: RnM2): void;
|
|
38
|
-
_loadDependenciesOfAccessors(gltfJson: RnM2): void;
|
|
39
|
-
_loadDependenciesOfBufferViews(gltfJson: RnM2): void;
|
|
40
|
-
_mergeExtendedJson(gltfJson: RnM2, extendedData: ArrayBuffer | string | object): void;
|
|
41
|
-
_loadResources(uint8Array: Uint8Array, gltfJson: RnM2, files: GltfFileBuffers, options: GltfLoadOption, basePath?: string): Promise<void | unknown[]>;
|
|
42
|
-
private __containsFileName;
|
|
43
|
-
private __getFullPathOfFileName;
|
|
44
|
-
private __loadImageUri;
|
|
45
|
-
static getInstance(): Gltf2Importer;
|
|
23
|
+
static importGltfOrGlbFromArrayBuffers(arrayBuffer: ArrayBuffer, otherFiles: GltfFileBuffers, options?: GltfLoadOption, uri?: string): Promise<RnM2 | undefined>;
|
|
24
|
+
static _getOptions(defaultOptions: GltfLoadOption, json: RnM2, options: GltfLoadOption): GltfLoadOption;
|
|
25
|
+
static importGlb(arrayBuffer: ArrayBuffer, files: GltfFileBuffers, options: GltfLoadOption): Promise<RnM2>;
|
|
26
|
+
static importGltf(gltfJson: RnM2, fileArrayBuffers: GltfFileBuffers, options: GltfLoadOption, uri?: string): Promise<RnM2>;
|
|
27
|
+
static _loadInner(gltfJson: RnM2, files: GltfFileBuffers, options: GltfLoadOption, uint8array?: Uint8Array, basePath?: string): Promise<(void | unknown[])[]>;
|
|
28
|
+
static _loadJsonContent(gltfJson: RnM2): void;
|
|
29
|
+
static _loadDependenciesOfScenes(gltfJson: RnM2): void;
|
|
30
|
+
static _loadDependenciesOfNodes(gltfJson: RnM2): void;
|
|
31
|
+
static _loadDependenciesOfMeshes(gltfJson: RnM2): void;
|
|
32
|
+
private static _checkRnGltfLoaderOptionsExist;
|
|
33
|
+
static _loadDependenciesOfMaterials(gltfJson: RnM2): void;
|
|
34
|
+
static _loadDependenciesOfTextures(gltfJson: RnM2): void;
|
|
35
|
+
static _loadDependenciesOfJoints(gltfJson: RnM2): void;
|
|
36
|
+
static _loadDependenciesOfAnimations(gltfJson: RnM2): void;
|
|
37
|
+
static _loadDependenciesOfAccessors(gltfJson: RnM2): void;
|
|
38
|
+
static _loadDependenciesOfBufferViews(gltfJson: RnM2): void;
|
|
39
|
+
static _mergeExtendedJson(gltfJson: RnM2, extendedData: ArrayBuffer | string | object): void;
|
|
40
|
+
static _loadResources(uint8Array: Uint8Array, gltfJson: RnM2, files: GltfFileBuffers, options: GltfLoadOption, basePath?: string): Promise<void | unknown[]>;
|
|
41
|
+
private static __containsFileName;
|
|
42
|
+
private static __getFullPathOfFileName;
|
|
43
|
+
private static __loadImageUri;
|
|
46
44
|
}
|
|
@@ -7,14 +7,12 @@ import { ISceneGraphEntity } from '../helpers/EntityHelper';
|
|
|
7
7
|
* Importer class which can import GLTF and VRM.
|
|
8
8
|
*/
|
|
9
9
|
export default class GltfImporter {
|
|
10
|
-
private static __instance;
|
|
11
10
|
private constructor();
|
|
12
|
-
static getInstance(): GltfImporter;
|
|
13
11
|
/**
|
|
14
12
|
* For VRM file only
|
|
15
13
|
* Generate JSON.
|
|
16
14
|
*/
|
|
17
|
-
importJsonOfVRM(uri: string, options?: GltfLoadOption): Promise<VRM | undefined>;
|
|
15
|
+
static importJsonOfVRM(uri: string, options?: GltfLoadOption): Promise<VRM | undefined>;
|
|
18
16
|
/**
|
|
19
17
|
* Import GLTF or VRM file.
|
|
20
18
|
* @param uris uri or array of uri of glTF file
|
|
@@ -23,7 +21,7 @@ export default class GltfImporter {
|
|
|
23
21
|
* renderPasses[0]: model entities
|
|
24
22
|
* renderPasses[1]: model outlines
|
|
25
23
|
*/
|
|
26
|
-
import(uris: string | string[], options?: GltfLoadOption): Promise<Expression>;
|
|
24
|
+
static import(uris: string | string[], options?: GltfLoadOption): Promise<Expression>;
|
|
27
25
|
/**
|
|
28
26
|
* Import GLTF or VRM file.
|
|
29
27
|
* @param uris uri or array of uri of glTF file
|
|
@@ -32,26 +30,26 @@ export default class GltfImporter {
|
|
|
32
30
|
* renderPasses[0]: model entities
|
|
33
31
|
* renderPasses[1]: model outlines
|
|
34
32
|
*/
|
|
35
|
-
importFromArrayBuffers(files: GltfFileBuffers, options?: GltfLoadOption): Promise<Expression>;
|
|
36
|
-
private __initOptions;
|
|
37
|
-
private __setRenderPassesToExpression;
|
|
38
|
-
private __importMultipleModelsFromUri;
|
|
39
|
-
private __importMultipleModelsFromArrayBuffers;
|
|
40
|
-
private __isValidExtension;
|
|
41
|
-
private __importToRenderPassesFromUriPromise;
|
|
42
|
-
private __isGlb;
|
|
43
|
-
private __getGlbVersion;
|
|
44
|
-
private __getGltfVersion;
|
|
45
|
-
private __importToRenderPassesFromArrayBufferPromise;
|
|
46
|
-
private __getFileTypeFromFilePromise;
|
|
47
|
-
private __importVRM;
|
|
48
|
-
_getOptions(options?: GltfLoadOption): GltfLoadOption;
|
|
49
|
-
_readVRMHumanoidInfo(gltfModel: VRM, rootEntity?: ISceneGraphEntity): void;
|
|
50
|
-
_readSpringBone(rootEntity: ISceneGraphEntity, gltfModel: VRM): void;
|
|
51
|
-
private addPhysicsComponentRecursively;
|
|
52
|
-
_createTextures(gltfModel: RnM2): Texture[];
|
|
53
|
-
_existOutlineMaterial(extensionsVRM: any): boolean;
|
|
54
|
-
_initializeMaterialProperties(gltfModel: RnM2, texturesLength: number): void;
|
|
55
|
-
private __initializeMToonMaterialProperties;
|
|
56
|
-
private __initializeForUndefinedProperty;
|
|
33
|
+
static importFromArrayBuffers(files: GltfFileBuffers, options?: GltfLoadOption): Promise<Expression>;
|
|
34
|
+
private static __initOptions;
|
|
35
|
+
private static __setRenderPassesToExpression;
|
|
36
|
+
private static __importMultipleModelsFromUri;
|
|
37
|
+
private static __importMultipleModelsFromArrayBuffers;
|
|
38
|
+
private static __isValidExtension;
|
|
39
|
+
private static __importToRenderPassesFromUriPromise;
|
|
40
|
+
private static __isGlb;
|
|
41
|
+
private static __getGlbVersion;
|
|
42
|
+
private static __getGltfVersion;
|
|
43
|
+
private static __importToRenderPassesFromArrayBufferPromise;
|
|
44
|
+
private static __getFileTypeFromFilePromise;
|
|
45
|
+
private static __importVRM;
|
|
46
|
+
static _getOptions(options?: GltfLoadOption): GltfLoadOption;
|
|
47
|
+
static _readVRMHumanoidInfo(gltfModel: VRM, rootEntity?: ISceneGraphEntity): void;
|
|
48
|
+
static _readSpringBone(rootEntity: ISceneGraphEntity, gltfModel: VRM): void;
|
|
49
|
+
private static addPhysicsComponentRecursively;
|
|
50
|
+
static _createTextures(gltfModel: RnM2): Texture[];
|
|
51
|
+
static _existOutlineMaterial(extensionsVRM: any): boolean;
|
|
52
|
+
static _initializeMaterialProperties(gltfModel: RnM2, texturesLength: number): void;
|
|
53
|
+
private static __initializeMToonMaterialProperties;
|
|
54
|
+
private static __initializeForUndefinedProperty;
|
|
57
55
|
}
|
|
@@ -9,58 +9,52 @@ import { ISceneGraphEntity } from '../helpers/EntityHelper';
|
|
|
9
9
|
* A converter class from glTF2 model to Rhodonite Native data
|
|
10
10
|
*/
|
|
11
11
|
export default class ModelConverter {
|
|
12
|
-
private static __instance;
|
|
13
12
|
private constructor();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
static
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
convertToRhodoniteObject(gltfModel: RnM2): ISceneGraphEntity;
|
|
26
|
-
_setupCamera(gltfModel: RnM2): void;
|
|
27
|
-
private createRnBuffer;
|
|
28
|
-
_setupTransform(gltfModel: RnM2, groups: ISceneGraphEntity[]): void;
|
|
29
|
-
_setupHierarchy(gltfModel: RnM2, rnEntities: ISceneGraphEntity[]): void;
|
|
13
|
+
static _getDefaultShader(options: GltfLoadOption): null;
|
|
14
|
+
private static __generateGroupEntity;
|
|
15
|
+
private static addTags;
|
|
16
|
+
private static __generateMeshEntity;
|
|
17
|
+
private static __generateCameraEntity;
|
|
18
|
+
private static __generateLightEntity;
|
|
19
|
+
static convertToRhodoniteObject(gltfModel: RnM2): ISceneGraphEntity;
|
|
20
|
+
static _setupCamera(gltfModel: RnM2): void;
|
|
21
|
+
private static createRnBuffer;
|
|
22
|
+
static _setupTransform(gltfModel: RnM2, groups: ISceneGraphEntity[]): void;
|
|
23
|
+
static _setupHierarchy(gltfModel: RnM2, rnEntities: ISceneGraphEntity[]): void;
|
|
30
24
|
/**
|
|
31
25
|
* @private
|
|
32
26
|
*/
|
|
33
|
-
_setupAnimation(gltfModel: RnM2, rnEntities: ISceneGraphEntity[]): void;
|
|
34
|
-
_setupSkeleton(gltfModel: RnM2, rnEntities: ISceneGraphEntity[], rnBuffers: Buffer[]): void;
|
|
35
|
-
private __setupObjects;
|
|
36
|
-
private __isMorphing;
|
|
37
|
-
private __setupLight;
|
|
38
|
-
private __setupCamera;
|
|
39
|
-
private __setupMesh;
|
|
40
|
-
setSparseAccessor(accessor: RnM2Accessor, rnAccessor: Accessor): void;
|
|
27
|
+
static _setupAnimation(gltfModel: RnM2, rnEntities: ISceneGraphEntity[]): void;
|
|
28
|
+
static _setupSkeleton(gltfModel: RnM2, rnEntities: ISceneGraphEntity[], rnBuffers: Buffer[]): void;
|
|
29
|
+
private static __setupObjects;
|
|
30
|
+
private static __isMorphing;
|
|
31
|
+
private static __setupLight;
|
|
32
|
+
private static __setupCamera;
|
|
33
|
+
private static __setupMesh;
|
|
34
|
+
static setSparseAccessor(accessor: RnM2Accessor, rnAccessor: Accessor): void;
|
|
41
35
|
static setDefaultTextures(material: Material, gltfModel: RnM2): void;
|
|
42
|
-
private __setVRMMaterial;
|
|
43
|
-
private __generateAppropriateMaterial;
|
|
44
|
-
private __isLighting;
|
|
45
|
-
private __isSkinning;
|
|
46
|
-
private __useTangentAttribute;
|
|
47
|
-
private __useNormalTexture;
|
|
48
|
-
private __makeOutputSrgb;
|
|
49
|
-
private __getMaterialHash;
|
|
50
|
-
private __setupMaterial;
|
|
36
|
+
private static __setVRMMaterial;
|
|
37
|
+
private static __generateAppropriateMaterial;
|
|
38
|
+
private static __isLighting;
|
|
39
|
+
private static __isSkinning;
|
|
40
|
+
private static __useTangentAttribute;
|
|
41
|
+
private static __useNormalTexture;
|
|
42
|
+
private static __makeOutputSrgb;
|
|
43
|
+
private static __getMaterialHash;
|
|
44
|
+
private static __setupMaterial;
|
|
51
45
|
static _createTexture(texture: RnM2Texture, gltfModel: RnM2, { autoDetectTransparency }?: {
|
|
52
46
|
autoDetectTransparency?: boolean | undefined;
|
|
53
47
|
}): Texture;
|
|
54
48
|
private static __needResizeToPowerOfTwoOnWebGl1;
|
|
55
49
|
private static __sizeIsPowerOfTwo;
|
|
56
|
-
private __needParameterInitialization;
|
|
57
|
-
private _checkRnGltfLoaderOptionsExist;
|
|
58
|
-
private __rewrapWithTypedArray;
|
|
59
|
-
_checkBytesPerComponent(accessor: RnM2Accessor | RnM2SparseIndices): number;
|
|
60
|
-
_checkComponentNumber(accessor: RnM2Accessor): number;
|
|
61
|
-
_checkDataViewMethod(accessor: RnM2Accessor | RnM2SparseIndices): string;
|
|
50
|
+
private static __needParameterInitialization;
|
|
51
|
+
private static _checkRnGltfLoaderOptionsExist;
|
|
52
|
+
private static __rewrapWithTypedArray;
|
|
53
|
+
static _checkBytesPerComponent(accessor: RnM2Accessor | RnM2SparseIndices): number;
|
|
54
|
+
static _checkComponentNumber(accessor: RnM2Accessor): number;
|
|
55
|
+
static _checkDataViewMethod(accessor: RnM2Accessor | RnM2SparseIndices): string;
|
|
62
56
|
static _isSystemLittleEndian(): boolean;
|
|
63
|
-
_readBinaryFromAccessorAndSetItToAccessorExtras(accessor: RnM2Accessor): Float32Array;
|
|
57
|
+
static _readBinaryFromAccessorAndSetItToAccessorExtras(accessor: RnM2Accessor): Float32Array;
|
|
64
58
|
/**
|
|
65
59
|
* normalize values of TypedArray to Float32Array
|
|
66
60
|
* See: the last part of 3.11.Animation at https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#animations
|
|
@@ -68,8 +62,8 @@ export default class ModelConverter {
|
|
|
68
62
|
* @param numberArray
|
|
69
63
|
* @returns
|
|
70
64
|
*/
|
|
71
|
-
private __normalizeTypedArrayToFloat32Array;
|
|
72
|
-
private __addOffsetToIndices;
|
|
65
|
+
private static __normalizeTypedArrayToFloat32Array;
|
|
66
|
+
private static __addOffsetToIndices;
|
|
73
67
|
/**
|
|
74
68
|
* Take a Rn.Accessor from the Rn.Buffer
|
|
75
69
|
* from the information of the Gltf2Buffer, Gltf2BufferView, and Gltf2Accessor.
|
|
@@ -77,7 +71,7 @@ export default class ModelConverter {
|
|
|
77
71
|
* @param rnBuffer
|
|
78
72
|
* @returns
|
|
79
73
|
*/
|
|
80
|
-
private __getRnAccessor;
|
|
74
|
+
private static __getRnAccessor;
|
|
81
75
|
/**
|
|
82
76
|
* Take a Rn.BufferView and a Rn.Accessor from the Rn.Buffer
|
|
83
77
|
* from the information of the Gltf2Buffer, Gltf2BufferView, and Gltf2Accessor.
|
|
@@ -85,13 +79,13 @@ export default class ModelConverter {
|
|
|
85
79
|
* @param rnBuffer
|
|
86
80
|
* @returns
|
|
87
81
|
*/
|
|
88
|
-
private __getRnBufferViewAndRnAccessor;
|
|
89
|
-
private __copyRnAccessorAndBufferView;
|
|
90
|
-
private __takeRnBufferViewAndRnAccessorForDraco;
|
|
91
|
-
private __getRnBufferView;
|
|
92
|
-
private __getGeometryFromDracoBuffer;
|
|
93
|
-
__getIndicesFromDraco(draco: any, decoder: any, dracoGeometry: any, triangleStripDrawMode: boolean): Uint32Array | undefined;
|
|
94
|
-
private __decodeDraco;
|
|
82
|
+
private static __getRnBufferViewAndRnAccessor;
|
|
83
|
+
private static __copyRnAccessorAndBufferView;
|
|
84
|
+
private static __takeRnBufferViewAndRnAccessorForDraco;
|
|
85
|
+
private static __getRnBufferView;
|
|
86
|
+
private static __getGeometryFromDracoBuffer;
|
|
87
|
+
static __getIndicesFromDraco(draco: any, decoder: any, dracoGeometry: any, triangleStripDrawMode: boolean): Uint32Array | undefined;
|
|
88
|
+
private static __decodeDraco;
|
|
95
89
|
static _setupTextureTransform(textureJson: RnM2TextureInfo, rnMaterial: Material, textureTransformShaderSemantic: ShaderSemanticsEnum, textureRotationShaderSemantic: ShaderSemanticsEnum): void;
|
|
96
|
-
private __createBufferForDecompressedData;
|
|
90
|
+
private static __createBufferForDecompressedData;
|
|
97
91
|
}
|
|
@@ -4,12 +4,10 @@ import { ISceneGraphEntity } from '../helpers/EntityHelper';
|
|
|
4
4
|
* The VRM Importer class.
|
|
5
5
|
* This class will be integrated into GltfImporter.
|
|
6
6
|
*/
|
|
7
|
-
export default class
|
|
8
|
-
private static __instance;
|
|
7
|
+
export default class VrmImporter {
|
|
9
8
|
private constructor();
|
|
10
|
-
static getInstance(): VRMImporter;
|
|
11
9
|
/**
|
|
12
10
|
* Import VRM file.
|
|
13
11
|
*/
|
|
14
|
-
import(uri: string, options?: GltfLoadOption): Promise<ISceneGraphEntity[]>;
|
|
12
|
+
static import(uri: string, options?: GltfLoadOption): Promise<ISceneGraphEntity[]>;
|
|
15
13
|
}
|