本文整理汇总了Java中com.jme3.material.RenderState.BlendMode类的典型用法代码示例。如果您正苦于以下问题:Java BlendMode类的具体用法?Java BlendMode怎么用?Java BlendMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlendMode类属于com.jme3.material.RenderState包,在下文中一共展示了BlendMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCockpit
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Geometry getCockpit() {
Quad reticle = new Quad(
0.03f, 0.03f);
Geometry geom = new Geometry("reticle", reticle); // wrap shape into geometry
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create material
mat.setColor("Color", ColorRGBA.White);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
mat.setTexture("ColorMap", assetManager.loadTexture(
"Textures/circle-01.png"));
geom.setMaterial(mat);
geom.setQueueBucket(Bucket.Translucent);
geom.rotate(0, FastMath.PI, 0);
geom.setLocalTranslation(new Vector3f(0, 0.8f, 2.6f).add(0.015f, -0.015f, 0.7f));
return geom;
}
示例2: Sprite
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Sprite(final String name, final Texture texture, Vector2f size, final boolean transparent, final Vector3f rotation,
final Vector3f translation, final AssetManager assetManager) {
super(name, new Quad(size.getX(), size.getY()));
final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
setMaterial(material);
if (texture != null) {
setTexture(texture);
}
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
if (transparent) {
setQueueBucket(Bucket.Transparent);
} else {
setQueueBucket(Bucket.Opaque);
}
if (rotation != null) {
rotate(rotation.getX() * FastMath.DEG_TO_RAD, rotation.getY() * FastMath.DEG_TO_RAD, rotation.getZ()
* FastMath.DEG_TO_RAD);
}
if (translation != null) {
setLocalTranslation(translation);
}
}
示例3: createBox
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
private void createBox() {
//creating a transluscent box
box = new Geometry("box", new Box(new Vector3f(0, 0, 0), 50, 50, 50));
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
//mat.getAdditionalRenderState().setDepthWrite(false);
//mat.getAdditionalRenderState().setDepthTest(false);
box.setMaterial(mat);
box.setQueueBucket(Bucket.Translucent);
//creating a post view port
// ViewPort post=renderManager.createPostView("transpPost", cam);
// post.setClearFlags(false, true, true);
box.setLocalTranslation(-600, 0, 300);
//attaching the box to the post viewport
//Don't forget to updateGeometricState() the box in the simpleUpdate
// post.attachScene(box);
rootNode.attachChild(box);
}
示例4: checkMaterial
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
protected void checkMaterial(BaseScreen screen) {
if (mat == null) {
mat = new Material(ToolKit.get().getApplication().getAssetManager(), "icetone/shaders/Unshaded.j3md");
mat.setVector2("OffsetAlphaTexCoord", new Vector2f(0, 0));
mat.setFloat("GlobalAlpha", getAlphaValue());
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);
if (isAtlasTextureInUse()) {
mat.setBoolean("UseEffectTexCoords", true);
} else {
mat.setBoolean("UseEffectTexCoords", false);
}
mat.setColor("Color", defaultColor);
mat.setTexture("ColorMap", null);
}
}
示例5: setSpatial
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
@Override
public void setSpatial(Spatial spatial) {
super.setSpatial(spatial);
if(spatial == null) {
strGeom.removeFromParent();
return;
}
// This seems like a smart way to do this
strGeom = new Geometry("[email protected]"+spatial.getName(), str);
strGeom.setMaterial(mat);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
strGeom.setQueueBucket(Bucket.Transparent);
spatial.getParent().attachChild(strGeom);
}
示例6: makeUnshadedPlane
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Geometry makeUnshadedPlane(String name, float width, float height, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
// mat.setBoolean("UseAlpha", true);
// mat.setBoolean("HighQuality", false);
Geometry plane = new Geometry(name, new Quad(width, height));
plane.setMaterial(mat);
plane.setUserData("obj_shape", "plane");
plane.setUserData("obj_width", width);
plane.setUserData("obj_height", height);
plane.setUserData("obj_color", color);
return plane;
}
示例7: makeUnshadedArrow
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Geometry makeUnshadedArrow(String name, Vector3f extents, float lineWidth, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
Arrow arrow = new Arrow(extents);
arrow.setLineWidth(lineWidth);
Geometry line = new Geometry(name, arrow);
line.setMaterial(mat);
line.setUserData("obj_shape", "arrow");
line.setUserData("obj_extents", extents);
line.setUserData("obj_lineWidth", lineWidth);
line.setUserData("obj_color", color);
return line;
}
示例8: makeUnshadedWireSphere
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Geometry makeUnshadedWireSphere(String name, float radius, float lineWidth, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
WireSphere sphere = new WireSphere(radius);
sphere.setLineWidth(lineWidth);
Geometry g = new Geometry(name, sphere);
g.setMaterial(mat);
g.setUserData("obj_shape", "wireSphere");
g.setUserData("obj_radius", radius);
g.setUserData("obj_lineWidth", lineWidth);
g.setUserData("obj_color", color);
return g;
}
示例9: makeUnshadedWireBox
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
public Geometry makeUnshadedWireBox(String name, Vector3f extents, float lineWidth, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
WireBox box = new WireBox(extents.x, extents.y, extents.z);
box.setLineWidth(lineWidth);
Geometry g = new Geometry(name, box);
g.setMaterial(mat);
g.setUserData("obj_shape", "wireBox");
g.setUserData("obj_extents", extents);
g.setUserData("obj_lineWidth", lineWidth);
g.setUserData("obj_color", color);
return g;
}
示例10: setData
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
@Override
public void setData(EffectData data) {
super.setData(data);
emitterData = data.getAsObjectData("emitter");
emitAll = data.getAsBoolean("emitAll", emitAll);
randomColor = data.getAsBoolean("randomColor", randomColor);
inWorldSpace = data.getAsBoolean("inWorldSpace", inWorldSpace);
String tempBlendMode = data.getAsString("blendMode");
if (tempBlendMode != null) {
blendMode = BlendMode.valueOf(tempBlendMode);
}
String tempBucket = data.getAsString("queueBucket");
if (tempBucket != null) {
bucket = Bucket.valueOf(tempBucket);
}
}
示例11: getSprite
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
private Spatial getSprite(String spritePath){
if(spritePath.isEmpty()) {
return null;
}
if (!spritePrototypes.containsKey(spritePath)) {
try{
Geometry g = new Geometry("Sprite");
g.setMesh(new CenteredQuad(1, 1));
g.setMaterial(MaterialManager.getLightingTexture("textures/"+spritePath));
// g.getMaterial().setBoolean("UseAlpha",true);
g.setQueueBucket(Bucket.Transparent);
g.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
spritePrototypes.put(spritePath, g);
} catch (IllegalStateException e) {
LogUtil.warning("Texture not found : textures/" + spritePath);
return null;
}
}
return spritePrototypes.get(spritePath);
}
示例12: createMarker
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
private void createMarker() {
// collision marker
Sphere sphere = new Sphere(8, 8, 0.5f);
marker = new Geometry("Marker");
marker.setMesh(sphere);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(251f/255f, 130f/255f, 0f, 0.6f));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
marker.setMaterial(mat);
rootNode.attachChild(marker);
// surface normal marker
Arrow arrow = new Arrow(new Vector3f(0,1,0));
markerNormal = new Geometry("MarkerNormal");
markerNormal.setMesh(arrow);
markerNormal.setMaterial(mat);
rootNode.attachChild(markerNormal);
}
示例13: initializeGeometry
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
@Override
public void initializeGeometry(AssetManager assetManager)
{
this.assetManager = assetManager;
CenteredQuad quad = new CenteredQuad(100, 100);
geometry = new Geometry("quad_geom", quad);
material = new Material(assetManager, "multiplicity3/jme3csys/resources/shaders/Textured.j3md");
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
setTexture("multiplicity3/jme3csys/resources/placeholders/transparent_16.png");
geometry.setMaterial(material);
ItemMap.register(geometry, this);
log.fine("Attaching spatial geometry!");
attachChild(geometry);
}
示例14: initializeGeometry
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
@Override
public void initializeGeometry(AssetManager assetManager)
{
this.assetManager = assetManager;
quad = new CenteredQuad(100, 100);
bufferedImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
gfx = (Graphics2D) bufferedImage.getGraphics();
gfx.setColor(Color.white);
gfx.fillRect(0, 0, 100, 100);
quadGeometry = new Geometry("_quad_geom", quad);
// reminder of where to find j3md stuff: jme3/src/core-data
mat = new Material(this.assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
// Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
Image img = new AWTLoader().load(bufferedImage, true);
t = new Texture2D(img);
mat.setTexture("m_ColorMap", t);
quadGeometry.setMaterial(mat);
ItemMap.register(quadGeometry, this);
attachChild(quadGeometry);
}
示例15: initializeGeometry
import com.jme3.material.RenderState.BlendMode; //导入依赖的package包/类
@Override
public void initializeGeometry(AssetManager assetManager)
{
this.assetManager = assetManager;
quad = new CenteredQuad(100, 100);
quadGeometry = new Geometry("quad_geom", quad);
// reminder of where to find j3md stuff: jme3/src/core-data
// mat = new Material(assetManager,
// "Common/MatDefs/Misc/SimpleTextured.j3md");
mat = new Material(assetManager, "multiplicity3/jme3csys/resources/shaders/Textured.j3md");
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
setImage("multiplicity3/jme3csys/resources/placeholders/transparent_16.png");
// Texture tex = assetManager.loadTexture();
// mat.setTexture("m_ColorMap", tex);
quadGeometry.setMaterial(mat);
ItemMap.register(quadGeometry, this);
log.fine("Attaching image quad geometry!");
attachChild(quadGeometry);
}