本文整理匯總了Java中com.jme3.material.Material.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java Material.setColor方法的具體用法?Java Material.setColor怎麽用?Java Material.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.material.Material
的用法示例。
在下文中一共展示了Material.setColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addObject
import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
protected Spatial addObject(Entity e) {
Vector3f loc = e.get(PhysicsPosition.class).getLocation();
Mesh mesh = MeshFactory.createSphere(0.25f);
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Orange);
TextureKey key = new TextureKey("Interface/grid-shaded.png");
key.setGenerateMips(true);
Texture texture = assetManager.loadTexture(key);
texture.setWrap(Texture.WrapMode.Repeat);
material.setTexture("ColorMap", texture);
Geometry geometry = new Geometry("PhysicsPosition: "+e.getId(), mesh);
geometry.setMaterial(material);
geometry.setLocalTranslation(loc);
rootNode.attachChild(geometry);
return geometry;
}
示例2: render
import com.jme3.material.Material; //導入方法依賴的package包/類
public void render( List<Prof> ofs, Tweed tweed, ColorRGBA col, Node n ) {
// Random randy = new Random(ofs.hashCode());
Material mat = new Material( tweed.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md" );
// ColorRGBA col = new ColorRGBA(
// randy.nextFloat(),
// 0.2f+ 0.5f * randy.nextFloat(),
// 0.5f+ 0.5f * randy.nextFloat(), 1);
mat.setColor( "Diffuse", col );
mat.setColor( "Ambient", col.mult( 0.1f ) );
mat.setBoolean( "UseMaterialColors", true );
for (Prof p : ofs) {
Geometry g = new Geometry();
g.setMesh( p.renderStrip( TweedSettings.settings.profileHSampleDist/2, null ) );
g.setMaterial( mat );
n.attachChild( g );
}
}
示例3: createGeometry
import com.jme3.material.Material; //導入方法依賴的package包/類
protected @NotNull Geometry createGeometry(@NotNull final ScenePresentable.PresentationType presentationType) {
final Material material = new Material(EDITOR.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Yellow);
material.getAdditionalRenderState().setWireframe(true);
Geometry geometry;
switch (presentationType) {
case SPHERE: {
geometry = new Geometry("Sphere", new Sphere(8, 8, 1));
break;
}
default: {
geometry = new Geometry("Box", new Box(1, 1, 1));
}
}
geometry.setMaterial(material);
return geometry;
}
示例4: createMaterial
import com.jme3.material.Material; //導入方法依賴的package包/類
private Material createMaterial(ColorRGBA color){
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", color);
TextureKey key = new TextureKey("Interface/grid-shaded.png");
key.setGenerateMips(true);
Texture texture = assetManager.loadTexture(key);
texture.setWrap(Texture.WrapMode.Repeat);
material.setTexture("ColorMap", texture);
return material;
}
示例5: addObject
import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
protected Node addObject(Entity e) {
Node capsule = new Node("ID: "+e.getId());
refreshMesh(capsule, e);
root.attachChild(capsule);
Material dummy = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
dummy.setColor("Color", ColorRGBA.White);
capsule.setMaterial(dummy);
return capsule;
}
示例6: addObject
import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
protected Geometry addObject(Entity e) {
Geometry geom = new Geometry("ID: "+e.getId(), getMesh(e));
//geom.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
Material dummy = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
dummy.setColor("Color", ColorRGBA.White);
geom.setMaterial(dummy);
root.attachChild(geom);
return geom;
}
示例7: simpleInitApp
import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
public void simpleInitApp() {
//init input
initCrossHairs();
this.cam.setLocation(new Vector3f(0, 6f, 6f));
cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
cam.setFrustumFar(15);
inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "shoot");
//init shadow
rootNode.setShadowMode(RenderQueue.ShadowMode.Off);
bsr = new BasicShadowRenderer(assetManager, 256);
bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
viewPort.addProcessor(bsr);
//init data
brickMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
brickMat.setColor("Color", ColorRGBA.Orange);
bulletMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
bulletMat.setColor("Color", ColorRGBA.Blue);
initFloor();
initWall();
//start view
boxes = new BoxView(entityData);
bullets = new BulletView(entityData);
boxes.start();
bullets.start();
}
示例8: initFloor
import com.jme3.material.Material; //導入方法依賴的package包/類
public void initFloor() {
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Brown);
EntityId floorEntity = entityData.createEntity();
entityData.setComponents(floorEntity,
new WarpPosition(new Vector3f(0, -0.1f, 0), Quaternion.DIRECTION_Z.clone()),
new RigidBody(false, 0),
new Friction(0.6f),
new BoxShape(new Vector3f(10f, 0.1f, 5f)),
new BoxComponent(new Vector3f(10f, 0.1f, 5f)),
new MaterialComponent(mat));
}
示例9: createPlayer
import com.jme3.material.Material; //導入方法依賴的package包/類
/**
* Create a new player.
* @param parentNode Parent of player. Should be root node.
* @param playerIdx Order of created player starting at 0.
* @return Spatial of new player.
*/
private Spatial createPlayer(Node parentNode, int playerIdx) {
// Currently a simple box is used for the player.
Box box = new Box(1, 1, 1);
Geometry player = new Geometry("PLAYER" + playerIdx, box);
Material mat = new Material(application.getAssetManager(),
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
player.setMaterial(mat);
// Move player in front of first course point.
Spatial[] coursePoints = coursePath.getCoursePoints();
if (coursePoints.length > 0) {
Spatial startPoint = coursePoints[0];
Vector3f forward = startPoint.getWorldRotation().mult(Vector3f.UNIT_Z);
player.move(forward.mult(PLAYER_START_DISTANCE));
}
// Attribute that this is a player.
player.setUserData(IS_PLAYER_ATTR, true);
// Add physics to player
CollisionShape shape = CollisionShapeFactory.createBoxShape(player);
GhostControl playerPhysics = new GhostControl(shape);
player.addControl(playerPhysics);
bullet.getPhysicsSpace().add(playerPhysics);
// Attach to root node and course path.
parentNode.attachChild(player);
coursePath.addPlayer(player);
return player;
}
示例10: createMaterial
import com.jme3.material.Material; //導入方法依賴的package包/類
/**
* Create material material.
*
* @param color the color
* @return the material
*/
@NotNull
protected Material createMaterial(@NotNull final ColorRGBA color) {
final Material material = new Material(EDITOR.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", color);
return material;
}
示例11: createColorMaterial
import com.jme3.material.Material; //導入方法依賴的package包/類
/**
* Create the material for presentation of selected models.
*/
@FromAnyThread
private @NotNull Material createColorMaterial(@NotNull final ColorRGBA color) {
final Material material = new Material(EDITOR.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.getAdditionalRenderState().setWireframe(true);
material.setColor("Color", color);
return material;
}
示例12: applyShadedMat
import com.jme3.material.Material; //導入方法依賴的package包/類
private static void applyShadedMat(Entity entity, Spatial spatial, AssetManager assetManager){
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setBoolean("UseMaterialColors",true);
mat.setColor("Diffuse", entity.get(ShadedColor.class).getDiffuse());
spatial.setMaterial(mat);
}
示例13: applyUnshadedMat
import com.jme3.material.Material; //導入方法依賴的package包/類
private static void applyUnshadedMat(Entity entity, Spatial spatial, AssetManager assetManager){
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", entity.get(UnshadedColor.class).getColor());
spatial.setMaterial(mat);
}
示例14: ScaleHandle
import com.jme3.material.Material; //導入方法依賴的package包/類
public ScaleHandle(Tweed tweed, Spatial target) {
super (tweed);
this.target = target;
// dir = rot.getRotationColumn(0);
Box handleOne = new Box( 0.5f, 0.5f, 0.5f );
g1 = new Geometry("h1", handleOne);
g1.setUserData(Tweed.CLICK, this);
Material mat1 = new Material(tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Magenta);
g1.setMaterial(mat1);
updateScale();
attachChild(g1);
}
示例15: RotHandle
import com.jme3.material.Material; //導入方法依賴的package包/類
public RotHandle(Tweed tweed, Spatial target) {
super (tweed);
this.target = target;
this.dir = new Vector3f(0,1,0);
Torus handleOne = new Torus(24, 8, 0.2f, 4f); //Box( 0.1f, 0.1f, 0.1f );
g1 = new Geometry("h1", handleOne);
g1.setUserData(Tweed.CLICK, this);
Material mat1 = new Material(tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor( "Color", ColorRGBA.Yellow );
g1.setMaterial(mat1);
updateScale();
attachChild(g1);
}