|
@@ -142,7 +142,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* Lazy load a local engine with premultiplied alpha set to false
|
|
|
*/
|
|
|
_getLocalEngine(): Engine;
|
|
|
- private reorderIndicesBasedOnPrimitiveMode;
|
|
|
+ private reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);
|
|
|
/**
|
|
|
* Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is
|
|
|
* clock-wise during export to glTF
|
|
@@ -154,7 +154,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param byteOffset The offset to the binary data
|
|
|
* @param binaryWriter The binary data for the glTF file
|
|
|
*/
|
|
|
- private reorderVertexAttributeDataBasedOnPrimitiveMode;
|
|
|
+ private reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
|
/**
|
|
|
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
|
* clock-wise during export to glTF
|
|
@@ -166,7 +166,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param byteOffset The offset to the binary data
|
|
|
* @param binaryWriter The binary data for the glTF file
|
|
|
*/
|
|
|
- private reorderTriangleFillMode;
|
|
|
+ private reorderTriangleFillMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
|
/**
|
|
|
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
|
* clock-wise during export to glTF
|
|
@@ -178,7 +178,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param byteOffset The offset to the binary data
|
|
|
* @param binaryWriter The binary data for the glTF file
|
|
|
*/
|
|
|
- private reorderTriangleStripDrawMode;
|
|
|
+ private reorderTriangleStripDrawMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
|
/**
|
|
|
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
|
* clock-wise during export to glTF
|
|
@@ -190,7 +190,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param byteOffset The offset to the binary data
|
|
|
* @param binaryWriter The binary data for the glTF file
|
|
|
*/
|
|
|
- private reorderTriangleFanMode;
|
|
|
+ private reorderTriangleFanMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
|
/**
|
|
|
* Writes the vertex attribute data to binary
|
|
|
* @param vertices The vertices to write to the binary writer
|
|
@@ -199,7 +199,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param meshAttributeArray The vertex attribute data
|
|
|
* @param binaryWriter The writer containing the binary data
|
|
|
*/
|
|
|
- private writeVertexAttributeData;
|
|
|
+ private writeVertexAttributeData(vertices, byteOffset, vertexAttributeKind, meshAttributeArray, binaryWriter);
|
|
|
/**
|
|
|
* Writes mesh attribute data to a data buffer
|
|
|
* Returns the bytelength of the data
|
|
@@ -208,7 +208,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param binaryWriter The buffer to write the binary data to
|
|
|
* @param indices Used to specify the order of the vertex data
|
|
|
*/
|
|
|
- private writeAttributeData;
|
|
|
+ private writeAttributeData(vertexBufferKind, meshAttributeArray, byteStride, binaryWriter);
|
|
|
/**
|
|
|
* Generates glTF json data
|
|
|
* @param shouldUseGlb Indicates whether the json should be written for a glb file
|
|
@@ -216,7 +216,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)
|
|
|
* @returns json data as string
|
|
|
*/
|
|
|
- private generateJSON;
|
|
|
+ private generateJSON(shouldUseGlb, glTFPrefix?, prettyPrint?);
|
|
|
/**
|
|
|
* Generates data for .gltf and .bin files based on the glTF prefix string
|
|
|
* @param glTFPrefix Text to use when prefixing a glTF file
|
|
@@ -227,13 +227,13 @@ declare module BABYLON.GLTF2 {
|
|
|
* Creates a binary buffer for glTF
|
|
|
* @returns array buffer for binary data
|
|
|
*/
|
|
|
- private _generateBinaryAsync;
|
|
|
+ private _generateBinaryAsync();
|
|
|
/**
|
|
|
* Pads the number to a multiple of 4
|
|
|
* @param num number to pad
|
|
|
* @returns padded number
|
|
|
*/
|
|
|
- private _getPadding;
|
|
|
+ private _getPadding(num);
|
|
|
/**
|
|
|
* Generates a glb file from the json and binary data
|
|
|
* Returns an object with the glb file name as the key and data as the value
|
|
@@ -246,47 +246,47 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param node glTF Node for storing the transformation data
|
|
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
|
*/
|
|
|
- private setNodeTransformation;
|
|
|
- private getVertexBufferFromMesh;
|
|
|
+ private setNodeTransformation(node, babylonTransformNode);
|
|
|
+ private getVertexBufferFromMesh(attributeKind, bufferMesh);
|
|
|
/**
|
|
|
* Creates a bufferview based on the vertices type for the Babylon mesh
|
|
|
* @param kind Indicates the type of vertices data
|
|
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
|
*/
|
|
|
- private createBufferViewKind;
|
|
|
+ private createBufferViewKind(kind, babylonTransformNode, binaryWriter, byteStride);
|
|
|
/**
|
|
|
* The primitive mode of the Babylon mesh
|
|
|
* @param babylonMesh The BabylonJS mesh
|
|
|
*/
|
|
|
- private getMeshPrimitiveMode;
|
|
|
+ private getMeshPrimitiveMode(babylonMesh);
|
|
|
/**
|
|
|
* Sets the primitive mode of the glTF mesh primitive
|
|
|
* @param meshPrimitive glTF mesh primitive
|
|
|
* @param primitiveMode The primitive mode
|
|
|
*/
|
|
|
- private setPrimitiveMode;
|
|
|
+ private setPrimitiveMode(meshPrimitive, primitiveMode);
|
|
|
/**
|
|
|
* Sets the vertex attribute accessor based of the glTF mesh primitive
|
|
|
* @param meshPrimitive glTF mesh primitive
|
|
|
* @param attributeKind vertex attribute
|
|
|
* @returns boolean specifying if uv coordinates are present
|
|
|
*/
|
|
|
- private setAttributeKind;
|
|
|
+ private setAttributeKind(meshPrimitive, attributeKind);
|
|
|
/**
|
|
|
* Sets data for the primitive attributes of each submesh
|
|
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
|
* @param binaryWriter Buffer to write the attribute data to
|
|
|
*/
|
|
|
- private setPrimitiveAttributes;
|
|
|
+ private setPrimitiveAttributes(mesh, babylonTransformNode, binaryWriter);
|
|
|
/**
|
|
|
* Creates a glTF scene based on the array of meshes
|
|
|
* Returns the the total byte offset
|
|
|
* @param babylonScene Babylon scene to get the mesh data from
|
|
|
* @param binaryWriter Buffer to write binary data to
|
|
|
*/
|
|
|
- private createSceneAsync;
|
|
|
+ private createSceneAsync(babylonScene, binaryWriter);
|
|
|
/**
|
|
|
* Creates a mapping of Node unique id to node index and handles animations
|
|
|
* @param babylonScene Babylon Scene
|
|
@@ -295,14 +295,14 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param binaryWriter Buffer to write binary data to
|
|
|
* @returns Node mapping of unique id to index
|
|
|
*/
|
|
|
- private createNodeMapAndAnimations;
|
|
|
+ private createNodeMapAndAnimations(babylonScene, nodes, shouldExportTransformNode, binaryWriter);
|
|
|
/**
|
|
|
* Creates a glTF node from a Babylon mesh
|
|
|
* @param babylonMesh Source Babylon mesh
|
|
|
* @param binaryWriter Buffer for storing geometry data
|
|
|
* @returns glTF node
|
|
|
*/
|
|
|
- private createNode;
|
|
|
+ private createNode(babylonTransformNode, binaryWriter);
|
|
|
}
|
|
|
/**
|
|
|
* @hidden
|
|
@@ -331,7 +331,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* Resize the array buffer to the specified byte length
|
|
|
* @param byteLength
|
|
|
*/
|
|
|
- private resizeBuffer;
|
|
|
+ private resizeBuffer(byteLength);
|
|
|
/**
|
|
|
* Get an array buffer with the length of the byte offset
|
|
|
* @returns ArrayBuffer resized to the byte offset
|
|
@@ -429,7 +429,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param color2 second color to compare to
|
|
|
* @param epsilon threshold value
|
|
|
*/
|
|
|
- private static FuzzyEquals;
|
|
|
+ private static FuzzyEquals(color1, color2, epsilon);
|
|
|
/**
|
|
|
* Gets the materials from a Babylon scene and converts them to glTF materials
|
|
|
* @param scene babylonjs scene
|
|
@@ -503,7 +503,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param mimeType mimetype of the image
|
|
|
* @returns base64 image string
|
|
|
*/
|
|
|
- private _createBase64FromCanvasAsync;
|
|
|
+ private _createBase64FromCanvasAsync(buffer, width, height, mimeType);
|
|
|
/**
|
|
|
* Generates a white texture based on the specified width and height
|
|
|
* @param width width of the texture in pixels
|
|
@@ -511,7 +511,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param scene babylonjs scene
|
|
|
* @returns white texture
|
|
|
*/
|
|
|
- private _createWhiteTexture;
|
|
|
+ private _createWhiteTexture(width, height, scene);
|
|
|
/**
|
|
|
* Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null
|
|
|
* @param texture1 first texture to resize
|
|
@@ -519,14 +519,14 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param scene babylonjs scene
|
|
|
* @returns resized textures or null
|
|
|
*/
|
|
|
- private _resizeTexturesToSameDimensions;
|
|
|
+ private _resizeTexturesToSameDimensions(texture1, texture2, scene);
|
|
|
/**
|
|
|
* Converts an array of pixels to a Float32Array
|
|
|
* Throws an error if the pixel format is not supported
|
|
|
* @param pixels - array buffer containing pixel values
|
|
|
* @returns Float32 of pixels
|
|
|
*/
|
|
|
- private _convertPixelArrayToFloat32;
|
|
|
+ private _convertPixelArrayToFloat32(pixels);
|
|
|
/**
|
|
|
* Convert Specular Glossiness Textures to Metallic Roughness
|
|
|
* See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
|
|
@@ -537,25 +537,25 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param mimeType the mime type to use for the texture
|
|
|
* @returns pbr metallic roughness interface or null
|
|
|
*/
|
|
|
- private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync;
|
|
|
+ private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync(diffuseTexture, specularGlossinessTexture, factors, mimeType);
|
|
|
/**
|
|
|
* Converts specular glossiness material properties to metallic roughness
|
|
|
* @param specularGlossiness interface with specular glossiness material properties
|
|
|
* @returns interface with metallic roughness material properties
|
|
|
*/
|
|
|
- private _convertSpecularGlossinessToMetallicRoughness;
|
|
|
+ private _convertSpecularGlossinessToMetallicRoughness(specularGlossiness);
|
|
|
/**
|
|
|
* Calculates the surface reflectance, independent of lighting conditions
|
|
|
* @param color Color source to calculate brightness from
|
|
|
* @returns number representing the perceived brightness, or zero if color is undefined
|
|
|
*/
|
|
|
- private _getPerceivedBrightness;
|
|
|
+ private _getPerceivedBrightness(color);
|
|
|
/**
|
|
|
* Returns the maximum color component value
|
|
|
* @param color
|
|
|
* @returns maximum color component value, or zero if color is null or undefined
|
|
|
*/
|
|
|
- private _getMaxComponent;
|
|
|
+ private _getMaxComponent(color);
|
|
|
/**
|
|
|
* Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors
|
|
|
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
|
@@ -567,10 +567,10 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
|
* @returns glTF PBR Metallic Roughness factors
|
|
|
*/
|
|
|
- private _convertMetalRoughFactorsToMetallicRoughnessAsync;
|
|
|
- private _getGLTFTextureSampler;
|
|
|
- private _getGLTFTextureWrapMode;
|
|
|
- private _getGLTFTextureWrapModesSampler;
|
|
|
+ private _convertMetalRoughFactorsToMetallicRoughnessAsync(babylonPBRMaterial, mimeType, glTFPbrMetallicRoughness, hasTextureCoords);
|
|
|
+ private _getGLTFTextureSampler(texture);
|
|
|
+ private _getGLTFTextureWrapMode(wrapMode);
|
|
|
+ private _getGLTFTextureWrapModesSampler(texture);
|
|
|
/**
|
|
|
* Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
|
|
|
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
|
@@ -582,7 +582,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
|
* @returns glTF PBR Metallic Roughness factors
|
|
|
*/
|
|
|
- private _convertSpecGlossFactorsToMetallicRoughnessAsync;
|
|
|
+ private _convertSpecGlossFactorsToMetallicRoughnessAsync(babylonPBRMaterial, mimeType, glTFPbrMetallicRoughness, hasTextureCoords);
|
|
|
/**
|
|
|
* Converts a Babylon PBR Metallic Roughness Material to a glTF Material
|
|
|
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
|
@@ -594,8 +594,8 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
|
*/
|
|
|
_convertPBRMaterialAsync(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
|
|
|
- private setMetallicRoughnessPbrMaterial;
|
|
|
- private getPixelsFromTexture;
|
|
|
+ private setMetallicRoughnessPbrMaterial(metallicRoughness, babylonPBRMaterial, glTFMaterial, glTFPbrMetallicRoughness, mimeType, hasTextureCoords);
|
|
|
+ private getPixelsFromTexture(babylonTexture);
|
|
|
/**
|
|
|
* Extracts a texture from a Babylon texture into file data and glTF data
|
|
|
* @param babylonTexture Babylon texture to extract
|
|
@@ -605,7 +605,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param imageData map of image file name and data
|
|
|
* @return glTF texture info, or null if the texture format is not supported
|
|
|
*/
|
|
|
- private _exportTextureAsync;
|
|
|
+ private _exportTextureAsync(babylonTexture, mimeType);
|
|
|
/**
|
|
|
* Builds a texture from base64 string
|
|
|
* @param base64Texture base64 texture string
|
|
@@ -616,7 +616,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param imageData map of image data
|
|
|
* @returns glTF texture info, or null if the texture format is not supported
|
|
|
*/
|
|
|
- private _getTextureInfoFromBase64;
|
|
|
+ private _getTextureInfoFromBase64(base64Texture, baseTextureName, mimeType, texCoordIndex, samplerIndex);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -682,7 +682,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @returns nullable IAnimationData
|
|
|
*/
|
|
|
static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
|
|
|
- private static _DeduceAnimationInfo;
|
|
|
+ private static _DeduceAnimationInfo(animation);
|
|
|
/**
|
|
|
* @ignore
|
|
|
* Create node animations from the transform node animations
|
|
@@ -714,7 +714,7 @@ declare module BABYLON.GLTF2 {
|
|
|
static _CreateNodeAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
|
|
|
[key: number]: number;
|
|
|
}, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
|
|
|
- private static AddAnimation;
|
|
|
+ private static AddAnimation(name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, useQuaternion, animationSampleRate);
|
|
|
/**
|
|
|
* Create a baked animation
|
|
|
* @param babylonTransformNode BabylonJS mesh
|
|
@@ -728,9 +728,9 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param convertToRightHandedSystem converts the values to right-handed
|
|
|
* @param useQuaternion specifies if quaternions should be used
|
|
|
*/
|
|
|
- private static _CreateBakedAnimation;
|
|
|
- private static _ConvertFactorToVector3OrQuaternion;
|
|
|
- private static _SetInterpolatedValue;
|
|
|
+ private static _CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, convertToRightHandedSystem, useQuaternion);
|
|
|
+ private static _ConvertFactorToVector3OrQuaternion(factor, babylonTransformNode, animation, animationType, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
|
|
|
+ private static _SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);
|
|
|
/**
|
|
|
* Creates linear animation from the animation key frames
|
|
|
* @param babylonTransformNode BabylonJS mesh
|
|
@@ -742,7 +742,7 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
|
*/
|
|
|
- private static _CreateLinearOrStepAnimation;
|
|
|
+ private static _CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
|
|
|
/**
|
|
|
* Creates cubic spline animation from the animation key frames
|
|
|
* @param babylonTransformNode BabylonJS mesh
|
|
@@ -754,8 +754,8 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
|
*/
|
|
|
- private static _CreateCubicSplineAnimation;
|
|
|
- private static _GetBasePositionRotationOrScale;
|
|
|
+ private static _CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
|
|
|
+ private static _GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
|
|
|
/**
|
|
|
* Adds a key frame value
|
|
|
* @param keyFrame
|
|
@@ -766,14 +766,14 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param convertToRightHandedSystem
|
|
|
* @param useQuaternion
|
|
|
*/
|
|
|
- private static _AddKeyframeValue;
|
|
|
+ private static _AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);
|
|
|
/**
|
|
|
* Determine the interpolation based on the key frames
|
|
|
* @param keyFrames
|
|
|
* @param animationChannelTargetPath
|
|
|
* @param useQuaternion
|
|
|
*/
|
|
|
- private static _DeduceInterpolation;
|
|
|
+ private static _DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);
|
|
|
/**
|
|
|
* Adds an input tangent or output tangent to the output data
|
|
|
* If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
|
|
@@ -786,13 +786,13 @@ declare module BABYLON.GLTF2 {
|
|
|
* @param useQuaternion Specifies if quaternions are used
|
|
|
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
|
*/
|
|
|
- private static AddSplineTangent;
|
|
|
+ private static AddSplineTangent(babylonTransformNode, tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem);
|
|
|
/**
|
|
|
* Get the minimum and maximum key frames' frame values
|
|
|
* @param keyFrames animation key frames
|
|
|
* @returns the minimum and maximum key frame value
|
|
|
*/
|
|
|
- private static calculateMinMaxKeyFrames;
|
|
|
+ private static calculateMinMaxKeyFrames(keyFrames);
|
|
|
}
|
|
|
}
|
|
|
|