Package jme3utilities

Class MyAsset

java.lang.Object
jme3utilities.MyAsset

public final class MyAsset extends Object
Utility methods for loading assets. Aside from test cases, all methods here should be public and static.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    asset path of the ShowNormals material definition with support for gamma correction
    static final String
    asset path to the multicolor wireframe material definition with support for alpha discard and non-default point shapes
    static final String
    asset path of the Particle material definition
    static final String
    asset path of the shaded material definition
    static final String
    asset path to the Unshaded material definition
    static final String
    asset path to the unicolor, default-shape wireframe material definition
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.jme3.math.Vector3f
    copyFaceDirection(int faceIndex)
    Copy the direction to the center of the specified face of a sky cube.
    static com.jme3.math.Vector3f
    copyUDirection(int faceIndex)
    Copy the direction of the first (+U) texture axis of the specified face of a sky cube.
    static com.jme3.math.Vector3f
    copyVDirection(int faceIndex)
    Copy the direction of the 2nd (+V) texture axis of the specified face of a sky cube.
    static com.jme3.material.Material
    createDebugMaterial(com.jme3.asset.AssetManager assetManager, float gamma)
    Create a material for debugging mesh normals.
    static com.jme3.material.Material
    createInvisibleMaterial(com.jme3.asset.AssetManager assetManager)
    Create an invisible material.
    static com.jme3.material.Material
    createMulticolor2Material(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture pointShape, float pointSize)
    Create a multicolor wireframe material with the specified point shape and point size.
    static com.jme3.material.Material
    createParticleMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
    Create a particle material with the specified Texture.
    static com.jme3.material.Material
    createShadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
    Create a non-shiny, single-sided shaded material with the specified color.
    static com.jme3.material.Material
    createShadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
    Create a non-shiny, single-sided shaded material with the specified diffuse texture.
    static com.jme3.material.Material
    createShinyMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
    Create a shiny, single-sided shaded material with the specified color.
    static com.jme3.scene.Node
    createStarMapQuads(com.jme3.asset.AssetManager assetManager, String name)
    Load a cube-mapped star map onto a cube formed by squares.
    static com.jme3.scene.Geometry
    createStarMapSphere(com.jme3.asset.AssetManager assetManager, String name, float radius)
    Load a cube-mapped star map onto a sky sphere with the specified radius.
    static com.jme3.material.Material
    createUnshadedMaterial(com.jme3.asset.AssetManager assetManager)
    Create a default unshaded material.
    static com.jme3.material.Material
    createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
    Create an unshaded material with the specified color.
    static com.jme3.material.Material
    createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
    Create an unshaded material with the specified colormap texture.
    static com.jme3.material.Material
    createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, String assetPath)
    Create an unshaded material with the colormap texture from the specified asset path.
    static com.jme3.material.Material
    createWireframeMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
    Create a unicolor wireframe material with default point shape and a point size of 1.
    static com.jme3.material.Material
    createWireframeMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color, float pointSize)
    Create a unicolor wireframe material with the default point shape and specified point size.
    static com.jme3.texture.Texture
    loadFace(com.jme3.asset.AssetManager assetManager, String mapName, String faceName, boolean flipY)
    Load the texture asset for a named face of a cubical star map.
    static com.jme3.texture.Texture
    loadTexture(com.jme3.asset.AssetManager assetManager, String assetPath, boolean generateMips)
    Load a non-flipped texture asset in edge-clamp mode.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • debugMaterialAssetPath

      public static final String debugMaterialAssetPath
      asset path of the ShowNormals material definition with support for gamma correction
      See Also:
    • multicolor2MaterialAssetPath

      public static final String multicolor2MaterialAssetPath
      asset path to the multicolor wireframe material definition with support for alpha discard and non-default point shapes
      See Also:
    • particleMaterialAssetPath

      public static final String particleMaterialAssetPath
      asset path of the Particle material definition
      See Also:
    • shadedMaterialAssetPath

      public static final String shadedMaterialAssetPath
      asset path of the shaded material definition
      See Also:
    • unshadedMaterialAssetPath

      public static final String unshadedMaterialAssetPath
      asset path to the Unshaded material definition
      See Also:
    • wireframeMaterialAssetPath

      public static final String wireframeMaterialAssetPath
      asset path to the unicolor, default-shape wireframe material definition
      See Also:
  • Method Details

    • copyFaceDirection

      public static com.jme3.math.Vector3f copyFaceDirection(int faceIndex)
      Copy the direction to the center of the specified face of a sky cube.
      Parameters:
      faceIndex - (≥0, <6)
      Returns:
      a new unit vector
    • copyUDirection

      public static com.jme3.math.Vector3f copyUDirection(int faceIndex)
      Copy the direction of the first (+U) texture axis of the specified face of a sky cube.
      Parameters:
      faceIndex - (≥0, <6)
      Returns:
      a new unit vector
    • copyVDirection

      public static com.jme3.math.Vector3f copyVDirection(int faceIndex)
      Copy the direction of the 2nd (+V) texture axis of the specified face of a sky cube.
      Parameters:
      faceIndex - (≥0, <6)
      Returns:
      a new unit vector
    • createDebugMaterial

      public static com.jme3.material.Material createDebugMaterial(com.jme3.asset.AssetManager assetManager, float gamma)
      Create a material for debugging mesh normals.
      Parameters:
      assetManager - (not null)
      gamma - 1 → no gamma correction, 2.2 → standard gamma correction (>0)
      Returns:
      a new instance
    • createInvisibleMaterial

      public static com.jme3.material.Material createInvisibleMaterial(com.jme3.asset.AssetManager assetManager)
      Create an invisible material.
      Parameters:
      assetManager - (not null)
      Returns:
      a new instance
    • createMulticolor2Material

      public static com.jme3.material.Material createMulticolor2Material(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture pointShape, float pointSize)
      Create a multicolor wireframe material with the specified point shape and point size. (Points are visible only with a point-mode mesh.)
      Parameters:
      assetManager - (not null)
      pointShape - shape texture (alias created) or null for default shape
      pointSize - in pixels (≥0, whole numbers recommended)
      Returns:
      a new instance
    • createParticleMaterial

      public static com.jme3.material.Material createParticleMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
      Create a particle material with the specified Texture.
      Parameters:
      assetManager - (not null)
      texture - (not null, alias created)
      Returns:
      a new instance
    • createShadedMaterial

      public static com.jme3.material.Material createShadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
      Create a non-shiny, single-sided shaded material with the specified color.
      Parameters:
      assetManager - (not null)
      color - ambient/diffuse color (not null, unaffected)
      Returns:
      a new instance (not null)
    • createShadedMaterial

      public static com.jme3.material.Material createShadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
      Create a non-shiny, single-sided shaded material with the specified diffuse texture.
      Parameters:
      assetManager - (not null)
      texture - (not null, alias created)
      Returns:
      a new instance
    • createShinyMaterial

      public static com.jme3.material.Material createShinyMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
      Create a shiny, single-sided shaded material with the specified color.
      Parameters:
      assetManager - (not null)
      color - ambient/diffuse color (not null, unaffected)
      Returns:
      a new instance
    • createStarMapQuads

      public static com.jme3.scene.Node createStarMapQuads(com.jme3.asset.AssetManager assetManager, String name)
      Load a cube-mapped star map onto a cube formed by squares.

      This method uses Unshaded.j3md materials, which can be translated, rotated, and scaled in the usual fashion.

      For the sky to be visible, its surface must lie between the near and far planes of the camera's frustum. This can usually be achieved by scaling the Node. The sky's surface ranges from 1.0 to 1.732 local units from the center.

      To avoid distortion, the camera must remain at the center of the sky. This can usually be achieved by translating the Node to the camera's location.

      Parameters:
      assetManager - (not null)
      name - name of the star map in the Textures/skies/star-maps asset folder (not null, not empty)
      Returns:
      a new instance
    • createStarMapSphere

      public static com.jme3.scene.Geometry createStarMapSphere(com.jme3.asset.AssetManager assetManager, String name, float radius)
      Load a cube-mapped star map onto a sky sphere with the specified radius.

      For the sky to be visible, its radius must fall between the near and far planes of the camera's frustum.

      Sky spheres use Sky.j3md materials. Translation and scaling of the geometry is ignored and rotations are applied in the shader. The effect of rotating a sky sphere is the inverse of rotating an ordinary geometry.

      Parameters:
      assetManager - (not null)
      name - name of the star map in the Textures/skies/star-maps asset folder (not null, not empty)
      radius - size of the sphere (>0)
      Returns:
      a new instance
    • createUnshadedMaterial

      public static com.jme3.material.Material createUnshadedMaterial(com.jme3.asset.AssetManager assetManager)
      Create a default unshaded material.
      Parameters:
      assetManager - (not null)
      Returns:
      a new instance
    • createUnshadedMaterial

      public static com.jme3.material.Material createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
      Create an unshaded material with the specified color.
      Parameters:
      assetManager - (not null)
      color - (not null, unaffected)
      Returns:
      a new instance
    • createUnshadedMaterial

      public static com.jme3.material.Material createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, String assetPath)
      Create an unshaded material with the colormap texture from the specified asset path.
      Parameters:
      assetManager - (not null)
      assetPath - to the texture asset (not null, not empty)
      Returns:
      a new instance
    • createUnshadedMaterial

      public static com.jme3.material.Material createUnshadedMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.texture.Texture texture)
      Create an unshaded material with the specified colormap texture.
      Parameters:
      assetManager - (not null)
      texture - (not null, alias created)
      Returns:
      a new instance
    • createWireframeMaterial

      public static com.jme3.material.Material createWireframeMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color)
      Create a unicolor wireframe material with default point shape and a point size of 1. (Points are visible only with a point-mode mesh.)
      Parameters:
      assetManager - (not null)
      color - (not null, unaffected)
      Returns:
      a new instance
    • createWireframeMaterial

      public static com.jme3.material.Material createWireframeMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color, float pointSize)
      Create a unicolor wireframe material with the default point shape and specified point size. (Points are visible only with a point-mode mesh.)
      Parameters:
      assetManager - (not null)
      color - (not null, unaffected)
      pointSize - in pixels (≥0, whole numbers recommended)
      Returns:
      a new instance
    • loadFace

      public static com.jme3.texture.Texture loadFace(com.jme3.asset.AssetManager assetManager, String mapName, String faceName, boolean flipY)
      Load the texture asset for a named face of a cubical star map.
      Parameters:
      assetManager - (not null)
      mapName - name of the star map folder (not null, not empty)
      faceName - name of the face (not null, not empty, e.g. "top3")
      flipY - true → flipped, false → not flipped
      Returns:
      texture which was loaded (not null)
    • loadTexture

      public static com.jme3.texture.Texture loadTexture(com.jme3.asset.AssetManager assetManager, String assetPath, boolean generateMips)
      Load a non-flipped texture asset in edge-clamp mode.
      Parameters:
      assetManager - (not null)
      assetPath - to the texture asset (not null, not empty)
      generateMips - true→generate mipmaps, false→don't generate them
      Returns:
      the texture that was loaded (not null)