/** * writes a pixel given the coordinates vector and the color. * @param vector the cooredinates where to write the pixel * @param color the color to write */ public void setPixel(Vector3f vector, ColorRGBA color) { int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[0], uvs, EnvMapUtils.FixSeamsMethod.Stretch); raster.setSlice(face); raster.setPixel((int) uvs.x, (int) uvs.y, color); } /**
/** * writes a pixel given the coordinates vector, the mip level and the color. * @param vector the cooredinates where to write the pixel * @param mipLevel the miplevel to write to * @param color the color to write */ public void setPixel(Vector3f vector, int mipLevel, ColorRGBA color) { if (mipMapRaster == null) { throw new IllegalArgumentException("This cube map has no mip maps"); } int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[mipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(mipLevel); mipMapRaster.setPixel((int) uvs.x, (int) uvs.y, color); }
/** * Reads a pixel from the cube map given the coordinate vector * @param vector the direction vector to fetch the texel * @param store the color in which to store the pixel color read. * @return the color of the pixel read. */ public ColorRGBA getPixel(Vector3f vector, ColorRGBA store) { if (store == null) { store = new ColorRGBA(); } int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[0], uvs, EnvMapUtils.FixSeamsMethod.Stretch); raster.setSlice(face); return raster.getPixel((int) uvs.x, (int) uvs.y, store); }
float ratio = mipLevel - lowerMipLevel; int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[lowerMipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(lowerMipLevel); mipMapRaster.getPixel((int) uvs.x, (int) uvs.y, store); face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[higherMipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(higherMipLevel);
/** * writes a pixel given the coordinates vector and the color. * @param vector the cooredinates where to write the pixel * @param color the color to write */ public void setPixel(Vector3f vector, ColorRGBA color) { int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[0], uvs, EnvMapUtils.FixSeamsMethod.Stretch); raster.setSlice(face); raster.setPixel((int) uvs.x, (int) uvs.y, color); } /**
/** * writes a pixel given the coordinates vector, the mip level and the color. * @param vector the cooredinates where to write the pixel * @param mipLevel the miplevel to write to * @param color the color to write */ public void setPixel(Vector3f vector, int mipLevel, ColorRGBA color) { if (mipMapRaster == null) { throw new IllegalArgumentException("This cube map has no mip maps"); } int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[mipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(mipLevel); mipMapRaster.setPixel((int) uvs.x, (int) uvs.y, color); }
/** * Reads a pixel from the cube map given the coordinate vector * @param vector the direction vector to fetch the texel * @param store the color in which to store the pixel color read. * @return the color of the pixel read. */ public ColorRGBA getPixel(Vector3f vector, ColorRGBA store) { if (store == null) { store = new ColorRGBA(); } int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[0], uvs, EnvMapUtils.FixSeamsMethod.Stretch); raster.setSlice(face); return raster.getPixel((int) uvs.x, (int) uvs.y, store); }
float ratio = mipLevel - lowerMipLevel; int face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[lowerMipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(lowerMipLevel); mipMapRaster.getPixel((int) uvs.x, (int) uvs.y, store); face = EnvMapUtils.getCubemapFaceTexCoordFromVector(vector, sizes[higherMipLevel], uvs, EnvMapUtils.FixSeamsMethod.Stretch); mipMapRaster.setSlice(face); mipMapRaster.setMipLevel(higherMipLevel);