com.jme3.texture.Image.hasMipmaps()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中com.jme3.texture.Image.hasMipmaps()方法的一些代码示例,展示了Image.hasMipmaps()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.hasMipmaps()方法的具体详情如下:
包路径:com.jme3.texture.Image
类名称:Image
方法名:hasMipmaps

Image.hasMipmaps介绍

[英]Returns whether the image data contains mipmaps.
[中]返回图像数据是否包含mipmap。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * @param multiSamples Set the number of samples to use for this image,
 * setting this to a value higher than 1 turns this image/texture
 * into a multisample texture (on OpenGL3.1 and higher).
 */
public void setMultiSamples(int multiSamples) {
  if (multiSamples <= 0)
    throw new IllegalArgumentException("multiSamples must be > 0");
  if (getData(0) != null)
    throw new IllegalArgumentException("Cannot upload data as multisample texture");
  if (hasMipmaps())
    throw new IllegalArgumentException("Multisample textures do not support mipmaps");
  this.multiSamples = multiSamples;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public String toString(){
  StringBuilder sb = new StringBuilder();
  sb.append(getClass().getSimpleName());
  sb.append("[size=").append(width).append("x").append(height);
  if (depth > 1)
    sb.append("x").append(depth);
  sb.append(", format=").append(format.name());
  if (hasMipmaps())
    sb.append(", mips");
  if (getId() >= 0)
    sb.append(", id=").append(id);
  sb.append("]");
  
  return sb.toString();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * @param minificationFilter
 *            the new MinificationFilterMode for this texture.
 * @throws IllegalArgumentException
 *             if minificationFilter is null
 */
public void setMinFilter(MinFilter minificationFilter) {
  if (minificationFilter == null) {
    throw new IllegalArgumentException(
        "minificationFilter can not be null.");
  }
  this.minificationFilter = minificationFilter;
  if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) {
    image.setNeedGeneratedMipmaps();
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the update needed flag, while also checking if mipmaps
 * need to be regenerated.
 */
@Override
public void setUpdateNeeded() {
  super.setUpdateNeeded();
  if (isGeneratedMipmapsRequired() && !hasMipmaps()) {
    // Mipmaps are no longer valid, since the image was changed.
    setMipmapsGenerated(false);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected static String formatMatParamTexture(MatParamTexture param) {
  StringBuilder ret = new StringBuilder();
  Texture tex = (Texture) param.getValue();
  TextureKey key;
  if (tex != null) {
    key = (TextureKey) tex.getKey();
    if (key != null && key.isFlipY()) {
      ret.append("Flip ");
    }
    ret.append(formatWrapMode(tex, Texture.WrapAxis.S));
    ret.append(formatWrapMode(tex, Texture.WrapAxis.T));
    ret.append(formatWrapMode(tex, Texture.WrapAxis.R));
    //Min and Mag filter
    Texture.MinFilter def = Texture.MinFilter.BilinearNoMipMaps;
    if (tex.getImage().hasMipmaps() || (key != null && key.isGenerateMips())) {
      def = Texture.MinFilter.Trilinear;
    }
    if (tex.getMinFilter() != def) {
      ret.append("Min").append(tex.getMinFilter().name()).append(" ");
    }
    if (tex.getMagFilter() != Texture.MagFilter.Bilinear) {
      ret.append("Mag").append(tex.getMagFilter().name()).append(" ");
    }
    ret.append("\"").append(key.getName()).append("\"");
  }
  return ret.toString();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (image.hasMipmaps()) {
  numberOfMipmapLevels = image.getMipMapSizes().length;
  if (image.hasMipmaps()) {
    imageSize = image.getMipMapSizes()[mipLevel];
  } else {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public MipMapImageRaster(Image image, int slice) {
  this.image = image;
  this.slice = slice;
  this.buffer = image.getData(slice);
  this.codec = ImageCodec.lookup(image.getFormat());
  if (image.hasMipmaps()) {
    int nbMipMap = image.getMipMapSizes().length;
    this.width = new int[nbMipMap];
    this.height = new int[nbMipMap];
    this.offsets = new int[nbMipMap];
    for (int i = 0; i < nbMipMap; i++) {
      width[i] = Math.max(1, image.getWidth() >> i);
      height[i] = Math.max(1, image.getHeight() >> i);
      if (i > 0) {
        offsets[i] = image.getMipMapSizes()[i - 1] + offsets[i - 1];
      }
    }
  } else {
    throw new IllegalArgumentException("Image must have MipMapSizes initialized.");
  }
  if (codec instanceof ByteAlignedImageCodec || codec instanceof ByteOffsetImageCodec) {
    this.temp = new byte[codec.bpp];
  } else {
    this.temp = null;
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * 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
 * @param cubeMap the cubemap to wrap.
 */
public CubeMapWrapper(TextureCubeMap cubeMap) {
  image = cubeMap.getImage();
  if (image.hasMipmaps()) {
    int nbMipMaps = image.getMipMapSizes().length;
    sizes = new int[nbMipMaps];
    mipMapRaster = new MipMapImageRaster(image, 0);
    for (int i = 0; i < nbMipMaps; i++) {
      sizes[i] = Math.max(1, image.getWidth() >> i);
    }
  } else {
    sizes = new int[1];
    sizes[0] = image.getWidth();
  }
  raster = new DefaultImageRaster(image, 0,0 , false);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (image.hasMipmaps()) {
  this.width  = Math.max(1, image.getWidth()  >> mipMapLevel);
  this.height = Math.max(1, image.getHeight() >> mipMapLevel);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (!sourceEnvMap.getImage().hasMipmaps() || sourceEnvMap.getImage().getMipMapSizes().length < nbMipMap) {
  throw new IllegalArgumentException("The input cube map must have at least " + nbMipMap + "mip maps");

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired()) {
  if (img.hasMipmaps()) {
if (img.isGeneratedMipmapsRequired() || img.hasMipmaps()) {
  throw new RendererException("Multisample textures do not support mipmaps");
if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired() && img.getData(0) != null) {
  glfbo.glGenerateMipmapEXT(target);
  img.setMipmapsGenerated(true);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (img.hasMipmaps() || texKey.isGenerateMips()) {
  tex.setMinFilter(Texture.MinFilter.Trilinear);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if(texVal.getImage().hasMipmaps() || texKey.isGenerateMips()){
  def = Texture.MinFilter.Trilinear;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

haveMips = image.isGeneratedMipmapsRequired() || image.hasMipmaps();

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * @param multiSamples Set the number of samples to use for this image,
 * setting this to a value higher than 1 turns this image/texture
 * into a multisample texture (on OpenGL3.1 and higher).
 */
public void setMultiSamples(int multiSamples) {
  if (multiSamples <= 0)
    throw new IllegalArgumentException("multiSamples must be > 0");
  if (getData(0) != null)
    throw new IllegalArgumentException("Cannot upload data as multisample texture");
  if (hasMipmaps())
    throw new IllegalArgumentException("Multisample textures do not support mipmaps");
  this.multiSamples = multiSamples;
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * @param multiSamples Set the number of samples to use for this image,
 * setting this to a value higher than 1 turns this image/texture
 * into a multisample texture (on OpenGL3.1 and higher).
 */
public void setMultiSamples(int multiSamples) {
  if (multiSamples <= 0)
    throw new IllegalArgumentException("multiSamples must be > 0");
  if (getData(0) != null)
    throw new IllegalArgumentException("Cannot upload data as multisample texture");
  if (hasMipmaps())
    throw new IllegalArgumentException("Multisample textures do not support mipmaps");
  this.multiSamples = multiSamples;
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
public String toString(){
  StringBuilder sb = new StringBuilder();
  sb.append(getClass().getSimpleName());
  sb.append("[size=").append(width).append("x").append(height);
  if (depth > 1)
    sb.append("x").append(depth);
  sb.append(", format=").append(format.name());
  if (hasMipmaps())
    sb.append(", mips");
  if (getId() >= 0)
    sb.append(", id=").append(id);
  sb.append("]");
  
  return sb.toString();
}

代码示例来源:origin: info.projectkyoto/mms-engine

@Override
public String toString(){
  StringBuilder sb = new StringBuilder();
  sb.append(getClass().getSimpleName());
  sb.append("[size=").append(width).append("x").append(height);
  if (depth > 1)
    sb.append("x").append(depth);
  sb.append(", format=").append(format.name());
  if (hasMipmaps())
    sb.append(", mips");
  if (getId() >= 0)
    sb.append(", id=").append(id);
  sb.append("]");
  
  return sb.toString();
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * @param minificationFilter
 *            the new MinificationFilterMode for this texture.
 * @throws IllegalArgumentException
 *             if minificationFilter is null
 */
public void setMinFilter(MinFilter minificationFilter) {
  if (minificationFilter == null) {
    throw new IllegalArgumentException(
        "minificationFilter can not be null.");
  }
  this.minificationFilter = minificationFilter;
  if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) {
    image.setNeedGeneratedMipmaps();
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Sets the update needed flag, while also checking if mipmaps
 * need to be regenerated.
 */
@Override
public void setUpdateNeeded() {
  super.setUpdateNeeded();
  if (isGeneratedMipmapsRequired() && !hasMipmaps()) {
    // Mipmaps are no longer valid, since the image was changed.
    setMipmapsGenerated(false);
  }
}

相关文章