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


Java TextureState.setTexture方法代码示例

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

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

示例1: initializeTexture

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
/**
    * Initialize texture attributes.
    */
   private void initializeTexture () {

if (getRenderState(RenderState.RS_TEXTURE) == null) {
    TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
    ts.setTexture(texture);
    setRenderState(ts);
    setModelBound(new BoundingBox());
    updateModelBound();
}

       FloatBuffer tbuf = BufferUtils.createVector2Buffer(4);
       setTextureCoords(new TexCoords(tbuf));
tbuf.put(0).put(0);
tbuf.put(0).put(1);
tbuf.put(1).put(1);
tbuf.put(1).put(0);
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:21,代码来源:TexturedQuad.java


示例2: CaptureQuad

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
public CaptureQuad(String name, int camWidth, int camHeight, float frameRate) {
	super(name);
	try {
		image = new QtCaptureImage();
		image.initializeCamera(camWidth, camHeight, frameRate);
		tex = new Texture2D();
		tex.setMinificationFilter(MinificationFilter.Trilinear);
		tex.setMagnificationFilter(MagnificationFilter.Bilinear);
		tex.setImage(image);			
		tex.setApply(ApplyMode.Replace);
		TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
		ts.setEnabled(true);
		ts.setTexture(tex);
		setRenderState(ts);
		updateRenderState();
	} catch (Exception e) {
		e.printStackTrace();
	}
	start();
	// could, at this point, resize to fit height to current width?
}
 
开发者ID:ajclarkson,项目名称:ARMonkeyKit,代码行数:22,代码来源:CaptureQuad.java


示例3: loadVideo

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
private void loadVideo(URL videoResource) {		
	try {
		image = new JMFVideoImage(videoResource, true, JMFVideoImage.SCALE_MAXIMIZE);
		tex = new Texture2D();			
		tex.setMinificationFilter(MinificationFilter.Trilinear);
		tex.setMagnificationFilter(MagnificationFilter.Bilinear);
		tex.setImage(image);			
		tex.setApply(ApplyMode.Replace);
		TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
		ts.setEnabled(true);
		ts.setTexture(tex);
		setRenderState(ts);
		updateRenderState();
	} catch (Exception e) {
		e.printStackTrace();
	}
	start();
	// could, at this point, resize to fit height to current width?
}
 
开发者ID:ajclarkson,项目名称:ARMonkeyKit,代码行数:20,代码来源:VideoQuad.java


示例4: setTexture

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
/**
 * Specify a new texture for this object.
 */
public void setTexture(Texture texture) {
    TextureState ts = (TextureState) quad.getRenderState(RenderState.RS_TEXTURE);
    if (ts == null) {
        ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        quad.setRenderState(ts);
    }
    ts.setTexture(texture);
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:12,代码来源:FrameTexRect.java


示例5: setData

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
/**
    * Changes the data of the box so that its center is <code>center</code>
    * and it extends in the x, y, and z directions by the given extent. Note
    * that the actual sides will be 2x the given extent values because the box
    * extends in + & - from the center for each extent.
    * 
    * @param center The center of the box.
    * @param xExtent x extent of the box, in both directions.
    * @param yExtent y extent of the box, in both directions.
    * @param zExtent z extent of the box, in both directions.
    */
   public void setData(Vector3f center, float xExtent, float yExtent, float zExtent) {

       for (int i = 0; i < 6; i++) {
    if (faces[i] == null) {
	TriMesh mesh = new TriMesh();
	TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
	ts.setTexture(texture);
	mesh.setRenderState(ts);
	mesh.setModelBound(new BoundingBox());
	mesh.updateModelBound();
	faces[i] = mesh;
	attachChild(mesh);
    }
}

if (center != null) {
    this.center.set(center);
}

this.xExtent = xExtent;
this.yExtent = yExtent;
this.zExtent = zExtent;

setVertexData();
// TODO: setColorData();
setNormalData();
setTextureData();
setIndexData();
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:41,代码来源:TexturedBox.java


示例6: setTexture

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
/**
    * Specify a new texture.
    */
   public void setTexture (Texture texture) {
this.texture = texture;
       for (int i = 0; i < 6; i++) {
    if (faces[i] != null) {
	TextureState ts = (TextureState) faces[i].getRenderState(RenderState.RS_TEXTURE);
	ts.setTexture(texture);
    }
}
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:13,代码来源:TexturedBox.java


示例7: setFloorTexture

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
public void setFloorTexture(String pathToTexture) {
    TextureState ts = display.getRenderer().createTextureState();
    Texture texture =
            TextureManager.loadTexture(
            SimulationGameState.class.getClassLoader().getResource(
            pathToTexture),
            Texture.MinificationFilter.Trilinear,
            Texture.MagnificationFilter.Bilinear);
    texture.setWrap(Texture.WrapMode.Repeat);
    ts.setTexture(texture);
    ts.setEnabled(true);
    floorQuad.setRenderState(ts);
}
 
开发者ID:CST-Group,项目名称:ws3d,代码行数:14,代码来源:SimulationGameState.java


示例8: getLoadedTextureID

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
@Override
public int getLoadedTextureID(TextureTypeKey textureClass){
	keyMapLock.lock();
	try{
		Texture t = keyMap.get(textureClass);
		if(t == null)
			return 0;
		
		if(t.getTextureId()!=0)
			return t.getTextureId();
	
		//first, check if the texture is already loaded.
			TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
			ts.setTexture(t);
			ts.load();
					
			if (t.getTextureId()>0)		
				return t.getTextureId();
			
	

		return 0;
		

	}finally{
		keyMapLock.unlock();
	}
}
 
开发者ID:sambayless,项目名称:golems,代码行数:29,代码来源:SpatialTextureServer.java


示例9: getPixmap

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
private Pixmap getPixmap(Texture texture)
{
	TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
	ts.setTexture(texture);
	ts.apply();
	
	ITexture onTexture = new LWJGLTexture(texture.getTextureId(),64,64,64,64);
	return new Pixmap(onTexture,0,0,64,64);
}
 
开发者ID:sambayless,项目名称:golems,代码行数:10,代码来源:MainMenu.java


示例10: setTexture

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
/**
    * Specify a new texture.
    */
   public void setTexture (Texture texture) {
this.texture = texture;
TextureState ts = (TextureState) getRenderState(RenderState.RS_TEXTURE);
ts.setTexture(texture);
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:9,代码来源:TexturedQuad.java


示例11: TransitionButton

import com.jme.scene.state.TextureState; //导入方法依赖的package包/类
public TransitionButton(int width, int height, ColorRGBA colorInactive,
		ColorRGBA colorActive, ColorRGBA colorHover, Texture texture, Texture icon , float timeHover, float timeActive, float timeInactive) {
	super();
	super.setSize(width,height);	

	this.currentColor = new ColorRGBA();
	currentColor.set(colorInactive);
	
	buttonQuad = new Quad("button", 1, 1);
	buttonNode = new Node();
	buttonNode.attachChild(buttonQuad);
	buttonQuad.getLocalTranslation().set(1f/2f, 1f/2f,0);
	buttonQuad.updateGeometricState(0, true);
	
       TextureState buttonTexture =  DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
       buttonTexture.setTexture(texture,0);          
       
       if (icon != null)
       {
           icon.setApply(Texture.AM_DECAL);	       
	       buttonTexture.setTexture(icon, 1);
	       buttonQuad.copyTextureCoords(0, 0, 1); 
       }	      
       
       buttonQuad.setRenderState(buttonTexture);
       
       colorState = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
       colorState.setDiffuse(currentColor);
       colorState.setAmbient(currentColor);
       buttonQuad.setRenderState(colorState);
       
       buttonQuad.updateRenderState();
       
   
       ColorRGBA[] colors = new ColorRGBA[4];
       colors[INACTIVE_STATE] = colorInactive;
       colors[ACTIVE_STATE] = colorActive;
       colors[HOVER_STATE] = colorHover;
       colors[DEFAULT_STATE] = ColorRGBA.black;
       float[] times = new float[4];
       times[INACTIVE_STATE] = timeInactive;
       times[ACTIVE_STATE] = timeActive;
       times[HOVER_STATE] = timeHover;
       times[DEFAULT_STATE] = 0;
       controller  = new TransitionController(colors, times, colorState);
       
       
       addButtonListener(new ButtonListener()
       {

		
		public void buttonStateChange(ButtonState state) {
			switch(state)
			{
				case INACTIVE:
					controller.transition(INACTIVE_STATE);
				break;			
				case HOVER:		
					controller.transition(HOVER_STATE);			
				break;	
				case ANTI_HOVER:			
					controller.transition(INACTIVE_STATE);
				break;
				case ACTIVE:
					controller.transition(ACTIVE_STATE);
				break;
 
			}
		}
   	
       });
}
 
开发者ID:sambayless,项目名称:golems,代码行数:73,代码来源:TransitionButton.java



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