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


Java Texture2D類代碼示例

本文整理匯總了Java中com.jme.image.Texture2D的典型用法代碼示例。如果您正苦於以下問題:Java Texture2D類的具體用法?Java Texture2D怎麽用?Java Texture2D使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: CaptureQuad

import com.jme.image.Texture2D; //導入依賴的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

示例2: loadVideo

import com.jme.image.Texture2D; //導入依賴的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

示例3: SGChangeGeometryTextureSet

import com.jme.image.Texture2D; //導入依賴的package包/類
private SGChangeGeometryTextureSet (GeometryNode geometryNode, Texture2D texture,
                                    DrawingSurface surface) {
    super(SGChangeOp.GEOMETRY_TEXTURE_SET);
    this.geometryNode = geometryNode;
    this.texture = texture;
    this.surface = surface;
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:8,代碼來源:View2DEntity.java

示例4: setTexture

import com.jme.image.Texture2D; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public void setTexture(Texture2D texture) {
    super.setTexture(texture);
    quad.setTexture(texture);
    logger.fine("Last texture assigned to quad = " + texture);
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:8,代碼來源:GeometryNodeQuad.java

示例5: sgChangeGeometryTextureSet

import com.jme.image.Texture2D; //導入依賴的package包/類
private synchronized void sgChangeGeometryTextureSet(GeometryNode geometryNode, Texture2D texture,
                                                     DrawingSurface surface) {
    sgChanges.add(new SGChangeGeometryTextureSet(geometryNode, texture, surface));
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:5,代碼來源:View2DEntity.java

示例6: RobotCamera

import com.jme.image.Texture2D; //導入依賴的package包/類
/**
 * creates the missile cam.
 * @param x position of the total area of the display in ortho values
 * @param y position of the total area of the display in ortho values
 * @param width width of the environment display in ortho values
 * @param height height of the environment display in ortho values
 */
 public RobotCamera(final float x, final float y, final float width, final float height) {
//public RobotCamera(final float x, final float y) {
    
    createNoiseTextureState();
    
    tRenderer = disp.createTextureRenderer(
            240, 180, TextureRenderer.Target.Texture2D);
    //          60, 50, TextureRenderer.Target.Texture2D);
    
    robotCamNode = new CameraNode("Robot Camera Node", tRenderer.getCamera());
    //tRenderer.getCamera().setFrustumFar(100000);
   // tRenderer.getCamera().setFrustum(1.0f, 100000.0f, -0.55f, 1f, 0.4125f, -0.4125f);
    //tRenderer.getCamera().resize(240, 180);
    tRenderer.getCamera().setFrustumPerspective(45.0f,(float) width / (float) height, 1, 1000);
    tRenderer.getCamera().update();
    robotCamNode.setLocalTranslation(new Vector3f(0, 2.5f, -10));
    robotCamNode.updateGeometricState(0, true);
    robotCamNode.updateWorldData(0);

    monitorNode = new Node("Monitor Node");
    monitorQuad = new Quad("Monitor");
    monitorQuad.initialize(240, 180);
    monitorQuad.setLocalTranslation(x, y, 0);
    monitorQuad.setIsCollidable(true);
    
    Quad quad2 = new Quad("Monitor");
    quad2.initialize(250, 190);
    quad2.setLocalTranslation(x, y, 0);
    monitorNode.attachChild(quad2);
    monitorNode.attachChild(monitorQuad);

    // Ok, now lets create the Texture object that our scene will be rendered to.
    tRenderer.setBackgroundColor(new ColorRGBA(0f, 0f, 0f, 1f));
    fakeTex = new Texture2D();
    fakeTex.setRenderToTextureType(Texture.RenderToTextureType.RGBA);
    tRenderer.setupTexture(fakeTex);
    screenTextureState = disp.getRenderer().createTextureState();
    screenTextureState.setTexture(fakeTex);
    screenTextureState.setEnabled(true);
    monitorQuad.setRenderState(screenTextureState);
    
    monitorNode.updateGeometricState(0.0f, true);
    monitorNode.updateRenderState();
    monitorNode.setLightCombineMode(LightCombineMode.Off);
}
 
開發者ID:CST-Group,項目名稱:ws3d,代碼行數:53,代碼來源:RobotCamera.java

示例7: getTexture

import com.jme.image.Texture2D; //導入依賴的package包/類
/**
 * Return the texture containing the window contents.
 * Note: mostly used only for share-aware apps.
 */
public Texture2D getTexture() {
    return texture;
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:8,代碼來源:Window2D.java

示例8: setTexture

import com.jme.image.Texture2D; //導入依賴的package包/類
/**
 * Specify the texture to be displayed. In your subclass method you should make your geometry display
 * this texture. Must be called in a render loop safe way.
 */
public void setTexture(Texture2D texture) {
    this.texture = texture;
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:8,代碼來源:GeometryNode.java


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