本文整理汇总了Java中com.jme3.texture.image.ImageRaster.create方法的典型用法代码示例。如果您正苦于以下问题:Java ImageRaster.create方法的具体用法?Java ImageRaster.create怎么用?Java ImageRaster.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.texture.image.ImageRaster
的用法示例。
在下文中一共展示了ImageRaster.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTexture
import com.jme3.texture.image.ImageRaster; //导入方法依赖的package包/类
private void updateTexture() {
for (int i=0; i<textures.length; ++i) {
ImageRaster raster = ImageRaster.create(textures[i].getImage());
for (Channel c : channels) {
if (c.textureIndex == i) {
c.updateTexture(raster);
}
}
}
}
示例2: getColor
import com.jme3.texture.image.ImageRaster; //导入方法依赖的package包/类
public static ColorRGBA getColor( Geometry geom, Vector3f pt, int index, Tweed tweed ) {
MatParam param = geom.getMaterial().getParam( "DiffuseMap" );
ImageRaster ir = ImageRaster.create( tweed.getAssetManager().loadTexture( ((Texture2D)param.getValue()).getName() ).getImage() );
Mesh mesh = geom.getMesh();
// geom.getMaterial().getMaterialDef().
VertexBuffer pb = mesh.getBuffer(Type.Position);
VertexBuffer tb = mesh.getBuffer( Type.TexCoord );
IndexBuffer ib = mesh.getIndicesAsList();
Vector2f uva = new Vector2f(), uvb = new Vector2f(), uvc = new Vector2f();
Vector3f la = new Vector3f(), lb = new Vector3f(), lc = new Vector3f();
if (pb != null && pb.getFormat() == Format.Float && pb.getNumComponents() == 3) {
FloatBuffer fpb = (FloatBuffer) pb.getData();
FloatBuffer ftb = (FloatBuffer) tb.getData();
// aquire triangle's vertex indices
int vertIndex = index * 3;
int va = ib.get(vertIndex);
int vb = ib.get(vertIndex+1);
int vc = ib.get(vertIndex+2);
BufferUtils.populateFromBuffer( la, fpb, va );
BufferUtils.populateFromBuffer( lb, fpb, vb );
BufferUtils.populateFromBuffer( lc, fpb, vc );
BufferUtils.populateFromBuffer( uva, ftb, va );
BufferUtils.populateFromBuffer( uvb, ftb, vb );
BufferUtils.populateFromBuffer( uvc, ftb, vc );
// PaintThing.debug.put(1, new Line ( la.x, la.z, lb.x, lb.z) );
// PaintThing.debug.put(2, new Line ( lb.x, lb.z, lc.x, lc.z) );
// PaintThing.debug.put(3, new Line ( lc.x, lc.z, la.x, la.z) );
float[] bary = barycentric( pt, la, lb, lc );
int x = (int)( ( uva.x * bary[0] + uvb.x * bary[1] + uvc.x * bary[2] ) * ir.getWidth ()) ,
y = (int)( ( uva.y * bary[0] + uvb.y * bary[1] + uvc.y * bary[2] ) * ir.getHeight()) ;
ColorRGBA out = ir.getPixel( x, y );//ir.getHeight() - y -1 );
// for (Pair<Vector3f, Vector2f> pair : new Pair[]{ new Pair( la, uva), new Pair (lb, uvb), new Pair (lc, uvc)}) {
//
// int xx = (int)(pair.second().x * ir.getWidth () ),
// yy = (int)(pair.second().y * ir.getHeight() );
//
// System.out.println("xx "+xx+" yy "+ yy );
//
// ColorRGBA o = ir.getPixel(
// xx,
// yy );
//
// PaintThing.debug.put(1, new ColPt( pair.first().x, pair.first().z, o.r, o.g, o.b ));
// }
// System.out.println("<< "+ ((Texture2D)param.getValue()).getName());
// System.out.println( x + " " + y + " :: " + bary[ 0 ] + " " + bary[ 1 ] + " " + bary[ 2 ] +
// " --> " + out.r + "," + out.g + "," + out.b );
return out;
}else{
throw new UnsupportedOperationException("Position buffer not set or has incompatible format");
}
}
示例3: setEmitterShape
import com.jme3.texture.image.ImageRaster; //导入方法依赖的package包/类
public void setEmitterShape(Texture texture) {
emitterShape = texture;
ir = ImageRaster.create(emitterShape.getImage());
}
示例4: getImageRaster
import com.jme3.texture.image.ImageRaster; //导入方法依赖的package包/类
protected ImageRaster getImageRaster() {
return ImageRaster.create(colorImage);
}