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


Java Texture2D.setWrap方法代码示例

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


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

示例1: setTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets new texture to this property.
 *
 * @param file the file to new texture.
 */
@FXThread
protected void setTexture(@Nullable final Path file) {

    if (file == null) {
        changed(null, getPropertyValue());
    } else {

        final EditorConfig config = EditorConfig.getInstance();
        final Path assetFile = notNull(getAssetFile(file));
        final TextureKey textureKey = new TextureKey(toAssetPath(assetFile));
        textureKey.setFlipY(config.isDefaultUseFlippedTexture());

        final AssetManager assetManager = EDITOR.getAssetManager();
        final Texture2D texture = (Texture2D) assetManager.loadTexture(textureKey);
        texture.setWrap(Texture.WrapMode.Repeat);

        changed(texture, getPropertyValue());
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:25,代码来源:Texture2DPropertyControl.java

示例2: applyChanges

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Apple new changes if need.
 *
 * @param varTable the var table.
 */
@FXThread
private void applyChanges(@NotNull final VarTable varTable) {

    final Texture2D texture = notNull(getPropertyValue());
    final TextureKey key = (TextureKey) texture.getKey();
    final boolean flipY = key.isFlipY();
    final Texture.WrapMode wrapS = texture.getWrap(Texture.WrapAxis.S);
    final Texture.WrapMode wrapT = texture.getWrap(Texture.WrapAxis.T);
    final Texture.MagFilter magFilter = texture.getMagFilter();
    final Texture.MinFilter minFilter = texture.getMinFilter();

    final boolean needFlipY = varTable.getBoolean(PROP_FLIP);
    final Texture.WrapMode needWrapS = varTable.getEnum(PROP_WRAP_MODE_S, Texture.WrapMode.class);
    final Texture.WrapMode needWrapT = varTable.getEnum(PROP_WRAP_MODE_T, Texture.WrapMode.class);
    final Texture.MagFilter needMagFilter = varTable.getEnum(PROP_MAG_FILTER, Texture.MagFilter.class);
    final Texture.MinFilter needMinFilter = varTable.getEnum(PROP_MIN_FILTER, Texture.MinFilter.class);

    if (flipY == needFlipY && wrapS == needWrapS && wrapT == needWrapT && magFilter == needMagFilter &&
            minFilter == needMinFilter) {
        return;
    }

    final TextureKey newKey = new TextureKey(key.getName());
    newKey.setFlipY(needFlipY);

    final AssetManager assetManager = EDITOR.getAssetManager();
    assetManager.deleteFromCache(key);

    final Texture2D loadedTexture = (Texture2D) assetManager.loadTexture(newKey);
    loadedTexture.setWrap(Texture.WrapAxis.S, needWrapS);
    loadedTexture.setWrap(Texture.WrapAxis.T, needWrapT);
    loadedTexture.setMagFilter(needMagFilter);
    loadedTexture.setMinFilter(needMinFilter);

    changed(loadedTexture, texture);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:42,代码来源:Texture2DPropertyControl.java

示例3: setFoamTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the foam texture
 * @param foamTexture
 */
public void setFoamTexture(Texture2D foamTexture) {
    this.foamTexture = foamTexture;
    foamTexture.setWrap(WrapMode.Repeat);
    if (material != null) {
        material.setTexture("FoamMap", foamTexture);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:WaterFilter.java

示例4: setHeightTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the height texture
 * @param heightTexture
 */
public void setHeightTexture(Texture2D heightTexture) {
    this.heightTexture = heightTexture;
    heightTexture.setWrap(WrapMode.Repeat);
    if (material != null) {
        material.setTexture("HeightMap", heightTexture);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:12,代码来源:WaterFilter.java

示例5: setNormalTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the normal Texture
 * @param normalTexture
 */
public void setNormalTexture(Texture2D normalTexture) {
    this.normalTexture = normalTexture;
    normalTexture.setWrap(WrapMode.Repeat);
    if (material != null) {
        material.setTexture("NormalMap", normalTexture);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:12,代码来源:WaterFilter.java

示例6: CelestialObjectSpatial

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public CelestialObjectSpatial(
		CelestialObjectComponent celestialBodyComponent,
		JmeResourceManager resourceManager,
		AssetManager assetManager) {
	super(
			celestialBodyComponent.getName(),
			(float)celestialBodyComponent.getOrder(),
			resourceManager,
			assetManager);
	
	setCullHint(Spatial.CullHint.Never);
	setQueueBucket(Bucket.Sky);
	
	texture = new Texture2D();
	texture.setMagFilter(Texture.MagFilter.Nearest);
	texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	texture.setAnisotropicFilter(0);
	texture.setWrap(Texture.WrapMode.EdgeClamp);
	
	material = new Material(assetManager, "/assets/shaders/sky/CelestialObject.j3md");
	material.setVector4("Color", new Vector4f(0.0f, 0.0f, 0.0f, 0.0f));
	material.setTexture("ColorMap", texture);
	material.setInt("ColorBlendMode", ShaderUtil.getColorBlendModeAsInteger(ColorBlendMode.NORMAL));
	material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
	material.getAdditionalRenderState().setDepthTest(false);
	
	quad = new Quad(1, 1);
	
	geometry = new Geometry();
	geometry.setMaterial(material);
	geometry.setMesh(quad);
	
	geometry.setLocalTranslation(
			10.0f,
			-(quad.getWidth() / 2),
			-(quad.getHeight() / 2));
	geometry.lookAt(new Vector3f(
			0,
			-(quad.getWidth() / 2),
			-(quad.getHeight() / 2)),
			Vector3f.UNIT_Y);
	
	attachChild(geometry);
	
	addControl(new CameraAttachingControl());
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:47,代码来源:CelestialObjectSpatial.java

示例7: readTextureImage

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
private void readTextureImage(){
        // texture image def
        String ln = scan.nextLine();
        String path = null;

        // find extension
        int extStart = ln.lastIndexOf(".");
        for (int i = extStart; i < ln.length(); i++){
            char c = ln.charAt(i);
            if (Character.isWhitespace(c)){
                // extension ends here
                path = ln.substring(0, i).trim();
                ln   = ln.substring(i+1).trim();
                break;
            }
        }
        if (path == null){
            path = ln.trim();
            ln = "";
        }

        Scanner lnScan = new Scanner(ln);
        String mips = null;
        String type = null;
        if (lnScan.hasNext()){
            // more params
            type = lnScan.next();
//            if (!lnScan.hasNext("\n") && lnScan.hasNext()){
//                mips = lnScan.next();
//                if (lnScan.hasNext()){
                    // even more params..
                    // will have to ignore
//                }
//            }
        }

        boolean genMips = true;
        boolean cubic = false;
        if (type != null && type.equals("0"))
            genMips = false;

        if (type != null && type.equals("cubic")){
            cubic = true;
        }

        TextureKey key = new TextureKey(folderName + path, false);
        key.setGenerateMips(genMips);
        key.setAsCube(cubic);

        Texture loadedTexture = assetManager.loadTexture(key);
        if (loadedTexture == null){
            ByteBuffer tempData = BufferUtils.createByteBuffer(3);
            tempData.put((byte)0xFF).put((byte)0x00).put((byte)0x00);
            texture = new Texture2D(new Image(Format.RGB8, 1,1,tempData));
            logger.log(Level.WARNING, "Using RED texture instead of {0}", path);
        }else{
            texture.setImage(loadedTexture.getImage());
            texture.setMinFilter(loadedTexture.getMinFilter());
            texture.setKey(loadedTexture.getKey());

            // XXX: Is this really neccessary?
            texture.setWrap(WrapMode.Repeat);
            if (texName != null){
                texture.setName(texName);
                texName = null;
            }else{
                texture.setName(key.getName());
            }
        }
        
        
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:73,代码来源:MaterialLoader.java

示例8: setHeightTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the height texture
 * @param heightTexture
 */
public void setHeightTexture(Texture2D heightTexture) {
    this.heightTexture = heightTexture;
    heightTexture.setWrap(WrapMode.Repeat);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:WaterFilter.java

示例9: setNormalTexture

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the normal Texture
 * @param normalTexture
 */
public void setNormalTexture(Texture2D normalTexture) {
    this.normalTexture = normalTexture;
    normalTexture.setWrap(WrapMode.Repeat);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:WaterFilter.java

示例10: loadTextures

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
protected void loadTextures(AssetManager manager) {
    normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/gradient_map.jpg");
    dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg");
    normalTexture.setWrap(WrapMode.Repeat);
    dudvTexture.setWrap(WrapMode.Repeat);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:SimpleWaterProcessor.java

示例11: loadTextures

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
protected void loadTextures(AssetManager manager) {
    normalTexture = (Texture2D) manager.loadTexture(AssetConstants.TEXTURE_SIMPLE_WATER_NORMAL);
    dudvTexture = (Texture2D) manager.loadTexture(AssetConstants.TEXTURE_SIMPLE_WATER_DUDV);
    normalTexture.setWrap(WrapMode.Repeat);
    dudvTexture.setWrap(WrapMode.Repeat);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:7,代码来源:VerySimpleWaterProcessor.java

示例12: setFoamMap

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public void setFoamMap(String foamTexture) {
    Texture2D foam = (Texture2D) manager.loadTexture(foamTexture);
    foam.setWrap(WrapMode.MirroredRepeat);
    material.setTexture("foamMap", foam);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:6,代码来源:VerySimpleWaterProcessor.java

示例13: loadTextures

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
protected void loadTextures(AssetManager manager) {
    normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/water_normalmap.png");
    dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg");
    normalTexture.setWrap(WrapMode.Repeat);
    dudvTexture.setWrap(WrapMode.Repeat);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:7,代码来源:SimpleWaterProcessor.java


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