当前位置: 首页>>代码示例>>Java>>正文


Java Texture.setWrap方法代码示例

本文整理汇总了Java中com.jme3.texture.Texture.setWrap方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.setWrap方法的具体用法?Java Texture.setWrap怎么用?Java Texture.setWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.texture.Texture的用法示例。


在下文中一共展示了Texture.setWrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addObject

import com.jme3.texture.Texture; //导入方法依赖的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: setDiffuse

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/**
 * Set a new diffuse texture to a level.
 *
 * @param texture the new texture.
 * @param layer   the layer.
 */
@FromAnyThread
public void setDiffuse(@Nullable final Texture texture, final int layer) {

    final Function<Integer, String> layerToDiffuseName = getLayerToDiffuseName();
    if (layerToDiffuseName == null) return;

    final Terrain terrain = getTerrain();
    final Material material = terrain.getMaterial();
    final String paramName = layerToDiffuseName.apply(layer);
    final MatParam matParam = material.getParam(paramName);
    final Texture current = matParam == null ? null : (Texture) matParam.getValue();

    if (texture != null) {
        texture.setWrap(Texture.WrapMode.Repeat);
    }

    final PropertyOperation<ChangeConsumer, Node, Texture> operation =
            new PropertyOperation<>(getTerrainNode(), TERRAIN_PARAM, texture, current);

    operation.setApplyHandler((node, newTexture) ->
            NodeUtils.visitGeometry(node, geometry -> updateTexture(newTexture, paramName, geometry)));

    final ModelChangeConsumer changeConsumer = editingComponent.getChangeConsumer();
    changeConsumer.execute(operation);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:TextureLayerSettings.java

示例3: setNormal

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/**
 * Set a new normal texture to a level.
 *
 * @param texture the normal texture.
 * @param layer   the layer.
 */
@FromAnyThread
public void setNormal(@Nullable final Texture texture, final int layer) {

    final Function<Integer, String> layerToNormalName = getLayerToNormalName();
    if (layerToNormalName == null) return;

    final Terrain terrain = getTerrain();
    final Material material = terrain.getMaterial();
    final String paramName = layerToNormalName.apply(layer);
    final MatParam matParam = material.getParam(paramName);
    final Texture current = matParam == null ? null : (Texture) matParam.getValue();

    if (texture != null) {
        texture.setWrap(Texture.WrapMode.Repeat);
    }

    final PropertyOperation<ChangeConsumer, Node, Texture> operation =
            new PropertyOperation<>(getTerrainNode(), TERRAIN_PARAM, texture, current);

    operation.setApplyHandler((node, newTexture) ->
            NodeUtils.visitGeometry(node, geometry -> updateTexture(newTexture, paramName, geometry)));

    final ModelChangeConsumer changeConsumer = editingComponent.getChangeConsumer();
    changeConsumer.execute(operation);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:TextureLayerSettings.java

示例4: initMaterials

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/** Initialize the materials used in this scene. */
public void initMaterials() {
  wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
  key.setGenerateMips(true);
  Texture tex = assetManager.loadTexture(key);
  wall_mat.setTexture("ColorMap", tex);

  stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
  key2.setGenerateMips(true);
  Texture tex2 = assetManager.loadTexture(key2);
  stone_mat.setTexture("ColorMap", tex2);

  floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png");
  key3.setGenerateMips(true);
  Texture tex3 = assetManager.loadTexture(key3);
  tex3.setWrap(WrapMode.Repeat);
  floor_mat.setTexture("ColorMap", tex3);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:HelloPhysics.java

示例5: initMaterial

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public void initMaterial() {
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
    key.setGenerateMips(true);
    Texture tex = assetManager.loadTexture(key);
    mat.setTexture("ColorMap", tex);

    mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
    key2.setGenerateMips(true);
    Texture tex2 = assetManager.loadTexture(key2);
    mat2.setTexture("ColorMap", tex2);

    mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png");
    key3.setGenerateMips(true);
    Texture tex3 = assetManager.loadTexture(key3);
    tex3.setWrap(WrapMode.Repeat);
    mat3.setTexture("ColorMap", tex3);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:TestBrickWall.java

示例6: setBgMap

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/**
 * Adds an background map to the Elements material
 * 
 * @param bgMap
 *            A String path to the background map
 */
public BaseElement setBgMap(String bgMap) {
	Texture bg = null;
	if (isAtlasTextureInUse()) {
		// TODO test
		throw new UnsupportedOperationException();
		// if (this.getElementTexture() != null)
		// alpha = getElementTexture();
		// else
		// alpha = screen.getAtlasTexture();
		// Vector2f alphaOffset =
		// getAtlasTextureOffset(screen.parseAtlasCoords(alphaMap));
		// mat.setVector2("OffsetAlphaTexCoord", alphaOffset);
	} else {
		bg = ToolKit.get().getApplication().getAssetManager().loadTexture(bgMap);
		bg.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
		bg.setMagFilter(Texture.MagFilter.Nearest);
		bg.setWrap(Texture.WrapMode.Repeat);
	}

	this.bgMap = bg;
	mat.setTexture("BgMap", bg);
	mat.setColor("BgMapColor", bgMapColor);
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:31,代码来源:BaseElement.java

示例7: createMaterial

import com.jme3.texture.Texture; //导入方法依赖的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

示例8: loadTerrain

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public void loadTerrain(TerrainDefinition terrainDefinition) {
    Texture grass = assetManager.loadTexture(terrainDefinition.tx1().path());
    grass.setWrap(Texture.WrapMode.Repeat);

    Texture water = assetManager.loadTexture(terrainDefinition.tx2().path());
    water.setWrap(Texture.WrapMode.Repeat);

    Texture land = assetManager.loadTexture(terrainDefinition.tx3().path());
    land.setWrap(Texture.WrapMode.Repeat);
    float scale = 100;
    Material mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    mat_terrain.setTexture("AlphaMap", assetManager.loadTexture("Maps/Adria/AdriaSmall_alpha.png"));
    mat_terrain.setTexture("DiffuseMap", texture(terrainDefinition.tx1().path()));
    mat_terrain.setFloat("DiffuseMap_0_scale", terrainDefinition.tx1().scale());  //playing with scales
    mat_terrain.setTexture("DiffuseMap_2", texture(terrainDefinition.tx2().path()));
    mat_terrain.setFloat("DiffuseMap_2_scale", terrainDefinition.tx2().scale());
    mat_terrain.setTexture("DiffuseMap_1", texture(terrainDefinition.tx3().path()));
    mat_terrain.setFloat("DiffuseMap_1_scale", terrainDefinition.tx3().scale());
    

    int patchSize = 17;
    terrain = terrainDefinition.heightMapPath().map(m -> assetManager.loadTexture(m)
            .getImage()).map(i -> new ImageBasedHeightMap(i, 10f))
            .map(hm -> {
                hm.load();
                return new TerrainQuad("Terrain", patchSize, hm.getSize()+1, hm.getHeightMap());
            }).map(tq -> {
                tq.setMaterial(mat_terrain);
                tq.setLocalScale(scale, 1f, scale); // 1pixel 1m * scale * m
                tq.addControl(new TerrainLodControl(tq, camera.testCamera()));
                tq.setShadowMode(RenderQueue.ShadowMode.Receive);
                setLocation(tq,99,512,2048,scale);
                rootNode.attachChild(tq);
                return tq;
            });
}
 
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:37,代码来源:TerrainManager.java

示例9: simpleInitApp

import com.jme3.texture.Texture; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    cam.setLocation(new Vector3f(68.45442f, 8.235511f, 7.9676695f));
    cam.setRotation(new Quaternion(0.046916496f, -0.69500375f, 0.045538206f, 0.7160271f));


    flyCam.setMoveSpeed(50);

    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    Texture diff = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg");
    diff.setWrap(Texture.WrapMode.Repeat);
    Texture norm = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall_normal.jpg");
    norm.setWrap(Texture.WrapMode.Repeat);
    mat.setTexture("DiffuseMap", diff);
    mat.setTexture("NormalMap", norm);
    mat.setFloat("Shininess", 2.0f);


    AmbientLight al = new AmbientLight();
    al.setColor(new ColorRGBA(1.8f, 1.8f, 1.8f, 1.0f));

    rootNode.addLight(al);

    model = (Geometry) assetManager.loadModel("Models/Sponza/Sponza.j3o");
    model.getMesh().scaleTextureCoordinates(new Vector2f(2, 2));

    model.setMaterial(mat);

    rootNode.attachChild(model);

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    SSAOFilter ssaoFilter = new SSAOFilter(12.940201f, 43.928635f, 0.32999992f, 0.6059958f);
    fpp.addFilter(ssaoFilter);
    SSAOUI ui = new SSAOUI(inputManager, ssaoFilter);

    viewPort.addProcessor(fpp);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:38,代码来源:TestSSAO.java

示例10: loadTexture

import com.jme3.texture.Texture; //导入方法依赖的package包/类
protected Texture loadTexture(String path){
    String[] split = path.trim().split("\\p{javaWhitespace}+");
    
    // will crash if path is an empty string
    path = split[split.length-1];
    
    String name = new File(path).getName();
    TextureKey key = new TextureKey(folderName + name);
    key.setGenerateMips(true);
    Texture texture = assetManager.loadTexture(key);
    if (texture != null){
        texture.setWrap(WrapMode.Repeat);
    }
    return texture;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:MTLLoader.java

示例11: createNewTexture

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public Texture createNewTexture(String texturePath) {
	Texture newTex = getApplication().getAssetManager().loadTexture(texturePath);
	newTex.setMinFilter(Texture.MinFilter.BilinearNearestMipMap);
	newTex.setMagFilter(Texture.MagFilter.Bilinear);
	newTex.setWrap(Texture.WrapMode.Clamp);
	return newTex;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:BaseScreen.java

示例12: setDiffuseTexture

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public final static void setDiffuseTexture(Terrain terrain, int layer, Texture texture) {
    texture.setWrap(Texture.WrapMode.Repeat);
    if (layer == 0)
        terrain.getMaterial().setTexture("DiffuseMap", texture);
    else
        terrain.getMaterial().setTexture("DiffuseMap_" + layer, texture);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:8,代码来源:TerrainUtils.java

示例13: setNormalTexture

import com.jme3.texture.Texture; //导入方法依赖的package包/类
/**
 * 设置法线贴图
 * @param terrain
 * @param layer
 * @param texture
 */
public final static void setNormalTexture(Terrain terrain, int layer, Texture texture) {
    texture.setWrap(Texture.WrapMode.Repeat);
    if (layer == 0) {
        terrain.getMaterial().setTexture("NormalMap", texture);
    } else {
        terrain.getMaterial().setTexture("NormalMap_" + layer, texture);
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:15,代码来源:TerrainUtils.java

示例14: updateTextures

import com.jme3.texture.Texture; //导入方法依赖的package包/类
public void updateTextures(){
	int index = 0;
	for (TerrainTexture tt : texturing) {
		String indexHint = index == 0? "" : "_" + index;
		Texture diffuse;
		double scale;
		if(tt == null){
			diffuse = RendererPlatform.getAssetManager().loadTexture("textures/trans.png");
			scale = 0;
		} else{
			try{
				diffuse = RendererPlatform.getAssetManager().loadTexture(tt.getDiffuse());
			} catch (Exception e) {
				LogUtil.warning("Diffuse map was not found : " + tt.getDiffuse() + " in TerrainTexture #"+index);
				diffuse = RendererPlatform.getAssetManager().loadTexture("textures/trans.png");
			}
			scale = tt.getScale();
			if(tt.getNormal() != null && !tt.getNormal().isEmpty()){
				Texture normal = RendererPlatform.getAssetManager().loadTexture(tt.getNormal());
				normal.setAnisotropicFilter(8);
				normal.setWrap(Texture.WrapMode.Repeat);
				setTexture("NormalMap" + indexHint, normal);
			}
		}
		diffuse.setWrap(Texture.WrapMode.Repeat);
		diffuse.setAnisotropicFilter(8);
		setTexture("DiffuseMap"+indexHint, diffuse);
		setFloat("DiffuseMap_" + index + "_scale", (float)scale);
		index++;
	}
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:32,代码来源:TerrainSplatTexture.java

示例15: configureTexture

import com.jme3.texture.Texture; //导入方法依赖的package包/类
protected void configureTexture(Material material, String key, final Texture tex) {
    tex.setWrap(Texture.WrapMode.Repeat);
    material.setTexture(key, tex);
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:5,代码来源:TestLoading.java


注:本文中的com.jme3.texture.Texture.setWrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。