Class GltfModelKey

java.lang.Object
com.jme3.asset.AssetKey<com.jme3.scene.Spatial>
com.jme3.asset.ModelKey
com.jme3.scene.plugins.gltf.GltfModelKey
All Implemented Interfaces:
com.jme3.export.Savable, Cloneable

public class GltfModelKey extends com.jme3.asset.ModelKey
An optional key to use when loading a glTF file It allows you to specify custom data loader, replacing the default ones. MaterialAdapters: Allows you to map glTF standard material model to a non-stock material. ExtensionLoaders: Allows you to provide or override a loader for a given glTF extension. ExtrasLoader: Allows you to load any extras, application specific data of the glTF file. For more information, please see glTF 2.0 specifications https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md Created by Nehon on 08/08/2017.
  • Constructor Details

    • GltfModelKey

      public GltfModelKey(String name)
    • GltfModelKey

      public GltfModelKey()
  • Method Details

    • setStrict

      public void setStrict(boolean strict)
      Set whether the loader should perform stricter consistency checks of the supported glTF extensions. When this is true (the default), the loader will cause an AssetLoadException when it encounters an asset that contains an extension in its extensionsRequired declaration that is not supported. When false, it will only log a SEVERE message.
      Parameters:
      strict - The flag
    • isStrict

      public boolean isStrict()
      Returns whether the loader should perform stricter consistency checks of the supported glTF extensions. When this is true (the default), the loader will cause an AssetLoadException when it encounters an asset that contains an extension in its extensionsRequired declaration that is not supported. When false, it will only log a SEVERE message.
      Returns:
      The flag
    • isMaterialAdaptersEnabled

      public boolean isMaterialAdaptersEnabled()
    • setMaterialAdaptersEnabled

      public void setMaterialAdaptersEnabled(boolean materialAdaptersEnabled)
      Enables or disables the legacy material adapter system. This should only be used in older projects for backward compatibility.
      Parameters:
      materialAdaptersEnabled - The value to set.
    • registerMaterialAdapter

      @Deprecated public void registerMaterialAdapter(String gltfMaterialName, MaterialAdapter adapter)
      Deprecated.
      This will be removed in a future version of the engine. To migrate, create a custom GltfMaterialFactory and register it with the GltfLoader.
      Registers a MaterialAdapter for the given materialName. The materialName must be "pbrMetallicRoughness" or any name from KHR_materials glTF Extension (for example "pbrSpecularGlossiness" for "KHR_materials_pbrSpecularGlossiness" extension)
      Parameters:
      gltfMaterialName - the name of the gltf material
      adapter - the material adapter
    • registerExtensionLoader

      public void registerExtensionLoader(String extensionName, ExtensionLoader loader)
      Registers an extension loader for the given extension name. For more information on extension please see glTF 2.0 extensions registry https://github.com/KhronosGroup/glTF/blob/master/extensions/README.md
      Parameters:
      extensionName - the name of the extension
      loader - the Extension loader
    • getAdapterForMaterial

      @Deprecated public MaterialAdapter getAdapterForMaterial(String gltfMaterialName)
      Deprecated.
    • getExtensionLoader

      public ExtensionLoader getExtensionLoader(String extensionName)
    • isKeepSkeletonPose

      public boolean isKeepSkeletonPose()
    • setKeepSkeletonPose

      public void setKeepSkeletonPose(boolean keepSkeletonPose)
    • getExtrasLoader

      public ExtrasLoader getExtrasLoader()
    • setExtrasLoader

      public void setExtrasLoader(ExtrasLoader extrasLoader)
      Sets the ExtrasLoader for reading any extra information from the gltf file.
      Parameters:
      extrasLoader - the desired loader
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class com.jme3.asset.AssetKey<com.jme3.scene.Spatial>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.jme3.asset.AssetKey<com.jme3.scene.Spatial>