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


Java Texture2D.setMinFilter方法代码示例

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


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

示例1: setFilterMode

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * Sets the filtering mode for shadow edges see {@link FilterMode} for more info
 * @param filterMode 
 */
public void setFilterMode(FilterMode filterMode) {
    if (filterMode == null) {
        throw new NullPointerException();
    }

    if (this.filterMode == filterMode) {
        return;
    }

    this.filterMode = filterMode;
    postshadowMat.setInt("FilterMode", filterMode.ordinal());
    postshadowMat.setFloat("PCFEdge", edgesThickness);
    if (compareMode == CompareMode.Hardware) {
        for (Texture2D shadowMap : shadowMaps) {
            if (filterMode == FilterMode.Bilinear) {
                shadowMap.setMagFilter(MagFilter.Bilinear);
                shadowMap.setMinFilter(MinFilter.BilinearNoMipMaps);
            } else {
                shadowMap.setMagFilter(MagFilter.Nearest);
                shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
            }
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:PssmShadowRenderer.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: setupOffscreenView

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public Texture setupOffscreenView(){
    Camera offCamera = new Camera(512, 512);

    offView = renderManager.createPreView("Offscreen View", offCamera);
    offView.setClearFlags(true, true, true);
    offView.setBackgroundColor(ColorRGBA.DarkGray);

    // create offscreen framebuffer
    FrameBuffer offBuffer = new FrameBuffer(512, 512, 1);

    //setup framebuffer's cam
    offCamera.setFrustumPerspective(45f, 1f, 1f, 1000f);
    offCamera.setLocation(new Vector3f(0f, 0f, -5f));
    offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

    //setup framebuffer's texture
    Texture2D offTex = new Texture2D(512, 512, Format.RGBA8);
    offTex.setMinFilter(Texture.MinFilter.Trilinear);
    offTex.setMagFilter(Texture.MagFilter.Bilinear);

    //setup framebuffer to use texture
    offBuffer.setDepthBuffer(Format.Depth);
    offBuffer.setColorTexture(offTex);
    
    //set viewport to render to offscreen framebuffer
    offView.setOutputFrameBuffer(offBuffer);

    // setup framebuffer's scene
    Box boxMesh = new Box(Vector3f.ZERO, 1,1,1);
    Material material = assetManager.loadMaterial("Interface/Logo/Logo.j3m");
    offBox = new Geometry("box", boxMesh);
    offBox.setMaterial(material);

    // attach the scene to the viewport to be rendered
    offView.attachScene(offBox);
    
    return offTex;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:TestRenderToTexture.java

示例4: simpleInitApp

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public void simpleInitApp() {
   ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
   niftyView.setClearFlags(true, true, true);
    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
                                                      inputManager,
                                                      audioRenderer,
                                                      niftyView);
    nifty = niftyDisplay.getNifty();
    nifty.fromXml("all/intro.xml", "start");
    niftyView.addProcessor(niftyDisplay);

    Texture2D depthTex = new Texture2D(1024, 768, Format.Depth);
    FrameBuffer fb = new FrameBuffer(1024, 768, 1);
    fb.setDepthTexture(depthTex);

    Texture2D tex = new Texture2D(1024, 768, Format.RGBA8);
    tex.setMinFilter(MinFilter.Trilinear);
    tex.setMagFilter(MagFilter.Bilinear);

    fb.setColorTexture(tex);
    niftyView.setClearFlags(true, true, true);
    niftyView.setOutputFrameBuffer(fb);

    Box b = new Box(Vector3f.ZERO, 1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", tex);
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:TestNiftyToMesh.java

示例5: RenderImageJme

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public RenderImageJme(String filename, boolean linear, NiftyJmeDisplay display){
    TextureKey key = new TextureKey(filename, true);

    key.setAnisotropy(0);
    key.setAsCube(false);
    key.setGenerateMips(false);
    
    texture = (Texture2D) display.getAssetManager().loadTexture(key);
    texture.setMagFilter(MagFilter.Bilinear);
    texture.setMinFilter(MinFilter.BilinearNoMipMaps);
    image = texture.getImage();

    width = image.getWidth();
    height = image.getHeight();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:RenderImageJme.java

示例6: setCompareMode

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
/**
 * sets the shadow compare mode see {@link CompareMode} for more info
 * @param compareMode 
 */
public void setCompareMode(CompareMode compareMode) {
    if (compareMode == null) {
        throw new NullPointerException();
    }

    if (this.compareMode == compareMode) {
        return;
    }

    this.compareMode = compareMode;
    for (Texture2D shadowMap : shadowMaps) {
        if (compareMode == CompareMode.Hardware) {
            shadowMap.setShadowCompareMode(ShadowCompareMode.LessOrEqual);
            if (filterMode == FilterMode.Bilinear) {
                shadowMap.setMagFilter(MagFilter.Bilinear);
                shadowMap.setMinFilter(MinFilter.BilinearNoMipMaps);
            } else {
                shadowMap.setMagFilter(MagFilter.Nearest);
                shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
            }
        } else {
            shadowMap.setShadowCompareMode(ShadowCompareMode.Off);
            shadowMap.setMagFilter(MagFilter.Nearest);
            shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
        }
    }
    postshadowMat.setBoolean("HardwareShadows", compareMode == CompareMode.Hardware);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:PssmShadowRenderer.java

示例7: SubScreenBridge

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public SubScreenBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	cam.setParallelProjection(true);
	cam.setFrustumPerspective(45, 90, 0, 1);
	
	vp = rm.createPreView("Offscreen View", cam);
	if (!ToolKit.isAndroid())	vp.setClearFlags(true, true, true);
	else						vp.setClearFlags(true, false, false);
	
	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
	
	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!ToolKit.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:29,代码来源:SubScreenBridge.java

示例8: SubScreenBridge

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public SubScreenBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	cam.setParallelProjection(true);
	cam.setFrustumPerspective(45, 90, 0, 1);
	
	vp = rm.createPreView("Offscreen View", cam);
	if (!Screen.isAndroid())	vp.setClearFlags(true, true, true);
	else						vp.setClearFlags(true, false, false);
	
	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
	
	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!Screen.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:29,代码来源:SubScreenBridge.java

示例9: RenderImageJme

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public RenderImageJme(String filename, boolean linear, NiftyJmeDisplay display){
    TextureKey key = new TextureKey(filename, true);

    key.setAnisotropy(0);
    key.setAsCube(false);
    key.setGenerateMips(false);
    
    texture = (Texture2D) display.getAssetManager().loadTexture(key);
    texture.setMagFilter(linear ? MagFilter.Bilinear : MagFilter.Nearest);
    texture.setMinFilter(linear ? MinFilter.BilinearNoMipMaps : MinFilter.NearestNoMipMaps);
    image = texture.getImage();

    width = image.getWidth();
    height = image.getHeight();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:16,代码来源:RenderImageJme.java

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

示例11: initialize

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp){
    if (!enabled)
        return;

    renderer = rm.getRenderer();
    renderManager = rm;
    viewPort = vp;

    // loadInitial()
    fsQuad = new Picture("HDR Fullscreen Quad");

    Format lumFmt = Format.Luminance8;
    scene64FB = new FrameBuffer(64, 64, 1);
    scene64 = new Texture2D(64, 64, lumFmt);
    scene64FB.setColorTexture(scene64);
    scene64.setMagFilter(fbMagFilter);
    scene64.setMinFilter(fbMinFilter);

    scene8FB = new FrameBuffer(8, 8, 1);
    scene8 = new Texture2D(8, 8, lumFmt);
    scene8FB.setColorTexture(scene8);
    scene8.setMagFilter(fbMagFilter);
    scene8.setMinFilter(fbMinFilter);

    scene1FB[0] = new FrameBuffer(1, 1, 1);
    scene1[0] = new Texture2D(1, 1, lumFmt);
    scene1FB[0].setColorTexture(scene1[0]);

    scene1FB[1] = new FrameBuffer(1, 1, 1);
    scene1[1] = new Texture2D(1, 1, lumFmt);
    scene1FB[1].setColorTexture(scene1[1]);

    // prepare tonemap shader
    tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
    tone.setFloat("A", 0.18f);
    tone.setFloat("White", 100);

    // load();
    int w = vp.getCamera().getWidth();
    int h = vp.getCamera().getHeight();
    reshape(vp, w, h);

    
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:45,代码来源:HDRRenderer.java

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

示例13: OSRBridge

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public OSRBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);

	vp = rm.createPreView("Offscreen View", cam);
	if (!ToolKit.isAndroid())
		vp.setClearFlags(true, true, true);
	else
		vp.setClearFlags(true, false, false);

	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);

	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!ToolKit.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);

	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);

	setSpatial(root);
	vp.attachScene(root);

	chaseCam = new ChaseCamera(cam, root) {
		@Override
		public void setDragToRotate(boolean dragToRotate) {
			this.dragToRotate = dragToRotate;
			this.canRotate = !dragToRotate;
		}
	};
	chaseCam.setDefaultDistance(5f);
	chaseCam.setMaxDistance(340f);
	chaseCam.setDefaultHorizontalRotation(90 * FastMath.DEG_TO_RAD);
	chaseCam.setDefaultVerticalRotation(0f);
	cam.setFrustumFar(36000f);
	float aspect = (float) cam.getWidth() / (float) cam.getHeight();
	cam.setFrustumPerspective(45f, aspect, 0.1f, cam.getFrustumFar());
	chaseCam.setUpVector(Vector3f.UNIT_Y);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:45,代码来源:OSRBridge.java

示例14: OSRBridge

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public OSRBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	
	vp = rm.createPreView("Offscreen View", cam);
	if (!Screen.isAndroid())	vp.setClearFlags(true, true, true);
	else						vp.setClearFlags(true, false, false);
	
	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
	
	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!Screen.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
	
	chaseCam = new ChaseCamera(cam, root) {
		@Override
		 public void setDragToRotate(boolean dragToRotate) {
			this.dragToRotate = dragToRotate;
			this.canRotate = !dragToRotate;
		}
	};
	chaseCam.setDefaultDistance(5f);
	chaseCam.setMaxDistance(340f);
	chaseCam.setDefaultHorizontalRotation(90*FastMath.DEG_TO_RAD);
	chaseCam.setDefaultVerticalRotation(0f);
	cam.setFrustumFar(36000f);
	float aspect = (float)cam.getWidth() / (float)cam.getHeight();
	cam.setFrustumPerspective( 45f, aspect, 0.1f, cam.getFrustumFar() );
	chaseCam.setUpVector(Vector3f.UNIT_Y);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:43,代码来源:OSRBridge.java

示例15: initialize

import com.jme3.texture.Texture2D; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp){
    if (!enabled)
        return;

    renderer = rm.getRenderer();
    renderManager = rm;
    viewPort = vp;

    // loadInitial()
    fsQuad = new Picture("HDR Fullscreen Quad");

    Format lumFmt = Format.RGB8;
    scene64FB = new FrameBuffer(64, 64, 1);
    scene64 = new Texture2D(64, 64, lumFmt);
    scene64FB.setColorTexture(scene64);
    scene64.setMagFilter(fbMagFilter);
    scene64.setMinFilter(fbMinFilter);

    scene8FB = new FrameBuffer(8, 8, 1);
    scene8 = new Texture2D(8, 8, lumFmt);
    scene8FB.setColorTexture(scene8);
    scene8.setMagFilter(fbMagFilter);
    scene8.setMinFilter(fbMinFilter);

    scene1FB[0] = new FrameBuffer(1, 1, 1);
    scene1[0] = new Texture2D(1, 1, lumFmt);
    scene1FB[0].setColorTexture(scene1[0]);

    scene1FB[1] = new FrameBuffer(1, 1, 1);
    scene1[1] = new Texture2D(1, 1, lumFmt);
    scene1FB[1].setColorTexture(scene1[1]);

    // prepare tonemap shader
    tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
    tone.setFloat("A", 0.18f);
    tone.setFloat("White", 100);

    // load();
    int w = vp.getCamera().getWidth();
    int h = vp.getCamera().getHeight();
    reshape(vp, w, h);

    
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:45,代码来源:HDRRenderer.java


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