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


Java Material.setTexture方法代碼示例

本文整理匯總了Java中com.jme3.material.Material.setTexture方法的典型用法代碼示例。如果您正苦於以下問題:Java Material.setTexture方法的具體用法?Java Material.setTexture怎麽用?Java Material.setTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.material.Material的用法示例。


在下文中一共展示了Material.setTexture方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toMaterial

import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
public MaterialMap toMaterial(AssetManager am, Substance substance, String substance_assets_path) {
	Material mat=new Material(am,"Common/MatDefs/Light/PBRLighting.j3md");
	mat.setName(substance.get("name").toString());
	Map<Object,Object> textures=(Map<Object,Object>)substance.get("textures");
	if(textures!=null){
		for(Entry e:textures.entrySet()){
			String tx=e.getKey().toString();
			if(!e.getValue().toString().isEmpty()){
				tx=tx.substring(tx.lastIndexOf("_")+1);
				String p=substance_assets_path+e.getValue();
				LOGGER.log(Level.FINE,"Set "+tx+"="+p);
				mat.setTexture(tx,am.loadTexture(p));
			}
		}
	}
	MaterialMap map=new MaterialMap();
	map.material=mat;
	map.render_bucket=Bucket.Opaque;
	return map;
}
 
開發者ID:riccardobl,項目名稱:JMELink-SP,代碼行數:22,代碼來源:PBRSubstance.java

示例2: 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

示例3: toMaterial

import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
public MaterialMap toMaterial(AssetManager am, Substance substance, String substance_assets_path) {
	Material mat=new Material(am,"Common/MatDefs/Light/Lighting.j3md");
	mat.setName(substance.get("name").toString());
	Map<Object,Object> textures=(Map<Object,Object>)substance.get("textures");
	if(textures!=null){
		for(Entry e:textures.entrySet()){
			String tx=e.getKey().toString();
			if(!e.getValue().toString().isEmpty()){
				tx=tx.substring(tx.lastIndexOf("_")+1);
				String p=substance_assets_path+e.getValue();
				LOGGER.log(Level.FINE,"Set "+tx+"="+p);
				mat.setTexture(tx,am.loadTexture(p));
			}
		}
	}
	
	Map parameters=(Map)substance.get("parameters");
	if(parameters!=null){
		Number fresnel=(Number)parameters.get("fresnel_str");
		if(fresnel!=null) mat.setFloat("Shininess",fresnel.floatValue());
	}
	
	MaterialMap map=new MaterialMap();
	map.material=mat;
	map.render_bucket=Bucket.Opaque;
	return map;
	
}
 
開發者ID:riccardobl,項目名稱:JMELink-SP,代碼行數:30,代碼來源:PhongSubstance.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: initialize

import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
protected void initialize(Application application){
    chunkMaterial = new Material(getVictorum().getAssetManager(), "/Common/MatDefs/Misc/Unshaded.j3md");
    Texture textureAtlas = getVictorum().getAssetManager().loadTexture(new TextureKey("/atlas.png", false));
    textureAtlas.setMagFilter(Texture.MagFilter.Nearest);
    textureAtlas.setMinFilter(Texture.MinFilter.BilinearNearestMipMap);
    textureAtlas.setAnisotropicFilter(2);
    chunkMaterial.setTexture("ColorMap", textureAtlas);
    chunkMaterial.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
}
 
開發者ID:DA-CS-Lab,項目名稱:Victorum,代碼行數:11,代碼來源:WorldAppState.java

示例6: process

import com.jme3.material.Material; //導入方法依賴的package包/類
@Override
@FXThread
protected void process() {
    super.process();

    final NodeTree<?> nodeTree = getNodeTree();
    final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());
    final SceneLayer defaultLayer = getDefaultLayer(changeConsumer);

    final AssetManager assetManager = EDITOR.getAssetManager();

    final Material material = new Material(assetManager,"Common/MatDefs/Misc/Particle.j3md");
    material.setTexture("Texture", assetManager.loadTexture( "Effects/Explosion/flame.png"));

    final ParticleEmitter emitter = createParticleEmitter();
    emitter.setMaterial(material);
    emitter.setImagesX(2);
    emitter.setImagesY(2); // 2x2 texture animation
    emitter.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
    emitter.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
    emitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
    emitter.setStartSize(1.5f);
    emitter.setEndSize(0.1f);
    emitter.setGravity(0, 0, 0);
    emitter.setLowLife(1f);
    emitter.setHighLife(3f);
    emitter.getParticleInfluencer().setVelocityVariation(0.3f);
    emitter.setEnabled(true);

    if (defaultLayer != null) {
        SceneLayer.setLayer(defaultLayer, emitter);
    }

    final TreeNode<?> treeNode = getNode();
    final Node parent = (Node) treeNode.getElement();

    changeConsumer.execute(new AddChildOperation(emitter, parent));
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:39,代碼來源:CreateParticleEmitterAction.java

示例7: updateTexture

import com.jme3.material.Material; //導入方法依賴的package包/類
private void updateTexture(@Nullable final Texture texture, @NotNull final String paramName,
                           @NotNull final Geometry geometry) {

    final Material material = geometry.getMaterial();
    final MatParam matParam = material.getParam(paramName);
    if (matParam == null && texture == null) return;

    if (texture == null) {
        material.clearParam(matParam.getName());
    } else {
        material.setTexture(paramName, texture);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:14,代碼來源:TextureLayerSettings.java


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