Class CubeMapWrapper

java.lang.Object
com.jme3.environment.util.CubeMapWrapper

public class CubeMapWrapper extends Object
Wraps a cube map and allows reading or writing pixels. It uses the ImageRaster class to tailor the read/write operations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a CubeMapWrapper for the given cube map Note that the cube map must be initialized, and the mipmaps sizes should be set if relevant for them to be readable/writable
  • Method Summary

    Modifier and Type
    Method
    Description
    getPixel(int x, int y, int face, int mipLevel, ColorRGBA store)
    Reads a pixel from the cube map given the 2D coordinates and the face and the mip level to read from
    getPixel(int x, int y, int face, ColorRGBA store)
    Reads a pixel from the cube map given the 2D coordinates and the face to read from
    getPixel(Vector3f vector, float mipLevel, ColorRGBA store)
    Reads a pixel from the cube map given the coordinate vector
    getPixel(Vector3f vector, ColorRGBA store)
    Reads a pixel from the cube map given the coordinate vector
    void
    initMipMaps(int nbMipMaps)
    Inits the mip maps of a cube map with the given number of mip maps
    void
    setPixel(int x, int y, int face, int mipLevel, ColorRGBA color)
    Writes a pixel given the 2-D coordinates, the mip level and the color
    void
    setPixel(int x, int y, int face, ColorRGBA color)
    Writes a pixel given the 2-D coordinates and the color
    void
    setPixel(Vector3f vector, int mipLevel, ColorRGBA color)
    writes a pixel given the coordinates vector, the mip level and the color.
    void
    setPixel(Vector3f vector, ColorRGBA color)
    writes a pixel given the coordinates vector and the color.

    Methods inherited from class java.lang.Object

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

    • CubeMapWrapper

      public CubeMapWrapper(TextureCubeMap cubeMap)
      Creates a CubeMapWrapper for the given cube map Note that the cube map must be initialized, and the mipmaps sizes should be set if relevant for them to be readable/writable
      Parameters:
      cubeMap - the cubemap to wrap.
  • Method Details

    • getPixel

      public ColorRGBA getPixel(Vector3f vector, ColorRGBA store)
      Reads a pixel from the cube map given the coordinate vector
      Parameters:
      vector - the direction vector to fetch the texel
      store - the color in which to store the pixel color read.
      Returns:
      the color of the pixel read.
    • getPixel

      public ColorRGBA getPixel(Vector3f vector, float mipLevel, ColorRGBA store)
      Reads a pixel from the cube map given the coordinate vector
      Parameters:
      vector - the direction vector to fetch the texel
      mipLevel - the mip level to read from
      store - the color in which to store the pixel color read.
      Returns:
      the color of the pixel read.
    • getPixel

      public ColorRGBA getPixel(int x, int y, int face, ColorRGBA store)
      Reads a pixel from the cube map given the 2D coordinates and the face to read from
      Parameters:
      x - the x tex coordinate (from 0 to width)
      y - the y tex coordinate (from 0 to height)
      face - the face to read from
      store - the color where the result is stored.
      Returns:
      the color read.
    • getPixel

      public ColorRGBA getPixel(int x, int y, int face, int mipLevel, ColorRGBA store)
      Reads a pixel from the cube map given the 2D coordinates and the face and the mip level to read from
      Parameters:
      x - the x tex coordinate (from 0 to width)
      y - the y tex coordinate (from 0 to height)
      face - the face to read from
      mipLevel - the miplevel to read from
      store - the color where the result is stored.
      Returns:
      the color read.
    • setPixel

      public void setPixel(Vector3f vector, ColorRGBA color)
      writes a pixel given the coordinates vector and the color.
      Parameters:
      vector - the coordinates where to write the pixel
      color - the color to write
    • setPixel

      public void setPixel(Vector3f vector, int mipLevel, ColorRGBA color)
      writes a pixel given the coordinates vector, the mip level and the color.
      Parameters:
      vector - the coordinates where to write the pixel
      mipLevel - the miplevel to write to
      color - the color to write
    • setPixel

      public void setPixel(int x, int y, int face, ColorRGBA color)
      Writes a pixel given the 2-D coordinates and the color
      Parameters:
      x - the x tex coord (from 0 to width)
      y - the y tex coord (from 0 to height)
      face - the face to write to
      color - the color to write
    • setPixel

      public void setPixel(int x, int y, int face, int mipLevel, ColorRGBA color)
      Writes a pixel given the 2-D coordinates, the mip level and the color
      Parameters:
      x - the x tex coord (from 0 to width)
      y - the y tex coord (from 0 to height)
      face - the face to write to
      mipLevel - the mip level to write to
      color - the color to write
    • initMipMaps

      public void initMipMaps(int nbMipMaps)
      Inits the mip maps of a cube map with the given number of mip maps
      Parameters:
      nbMipMaps - the number of mip maps to initialize