當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.setColor方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:18,代碼來源:ESDebugViewState.java

示例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 );
		}
	}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:23,代碼來源:ProfileGen.java

示例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;
    }
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:22,代碼來源:AbstractSceneEditor3DState.java

示例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;
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:11,代碼來源:ESDebugViewState.java

示例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;
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:11,代碼來源:CapsuleView.java

示例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;
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:11,代碼來源:ShapeContainer.java

示例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();
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:31,代碼來源:TestBrickWall.java

示例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));
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:13,代碼來源:TestBrickWall.java

示例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;
}
 
開發者ID:meoblast001,項目名稱:seally-racing,代碼行數:38,代碼來源:PlayerManager.java

示例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;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:15,代碼來源:AbstractEditingControl.java

示例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;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:11,代碼來源:AbstractSceneEditor3DState.java

示例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);
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:7,代碼來源:ShapeViewState.java

示例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);
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:6,代碼來源:ShapeViewState.java

示例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);

	}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:21,代碼來源:ScaleHandle.java

示例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);

}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:20,代碼來源:RotHandle.java


注:本文中的com.jme3.material.Material.setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。