glTFLoaderUtils.d.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import type { IGLTFTechniqueParameter, IGLTFAccessor, IGLTFRuntime, IGLTFBufferView } from "./glTFLoaderInterfaces";
  2. import { EComponentType } from "./glTFLoaderInterfaces";
  3. import { Effect } from "@babylonjs/core/Materials/effect.js";
  4. import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.js";
  5. import type { Node } from "@babylonjs/core/node.js";
  6. import type { Scene } from "@babylonjs/core/scene.js";
  7. /**
  8. * Utils functions for GLTF
  9. * @internal
  10. * @deprecated
  11. */
  12. export declare class GLTFUtils {
  13. /**
  14. * Sets the given "parameter" matrix
  15. * @param scene the Scene object
  16. * @param source the source node where to pick the matrix
  17. * @param parameter the GLTF technique parameter
  18. * @param uniformName the name of the shader's uniform
  19. * @param shaderMaterial the shader material
  20. */
  21. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  22. /**
  23. * Sets the given "parameter" matrix
  24. * @param shaderMaterial the shader material
  25. * @param uniform the name of the shader's uniform
  26. * @param value the value of the uniform
  27. * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  28. * @returns true if set, else false
  29. */
  30. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  31. /**
  32. * Returns the wrap mode of the texture
  33. * @param mode the mode value
  34. * @returns the wrap mode (TEXTURE_WRAP_ADDRESSMODE, MIRROR_ADDRESSMODE or CLAMP_ADDRESSMODE)
  35. */
  36. static GetWrapMode(mode: number): number;
  37. /**
  38. * Returns the byte stride giving an accessor
  39. * @param accessor the GLTF accessor objet
  40. * @returns the byte stride
  41. */
  42. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  43. /**
  44. * Returns the texture filter mode giving a mode value
  45. * @param mode the filter mode value
  46. * @returns the filter mode (TODO - needs to be a type?)
  47. */
  48. static GetTextureFilterMode(mode: number): number;
  49. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  50. /**
  51. * Returns a buffer from its accessor
  52. * @param gltfRuntime the GLTF runtime
  53. * @param accessor the GLTF accessor
  54. * @returns an array buffer view
  55. */
  56. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  57. /**
  58. * Decodes a buffer view into a string
  59. * @param view the buffer view
  60. * @returns a string
  61. */
  62. static DecodeBufferToText(view: ArrayBufferView): string;
  63. /**
  64. * Returns the default material of gltf. Related to
  65. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  66. * @param scene the Babylon.js scene
  67. * @returns the default Babylon material
  68. */
  69. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  70. private static _DefaultMaterial;
  71. }