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


Java TextureState类代码示例

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


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

示例1: findTextures

import com.jme.scene.state.TextureState; //导入依赖的package包/类
void findTextures(Node root) {
        TreeScan.findNode(root, new ProcessNodeInterface() {

            public boolean processNode(Spatial node) {
                TextureState ts =
                        (TextureState) node.getRenderState(
                        TextureState.RS_TEXTURE);
                if (ts != null) {
                    Texture t = ts.getTexture();
                    if (t != null) {
//                        System.out.println("Texture "+t.getImageLocation());
                    }
                }
                return true;
            }
        });
    }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:18,代码来源:ImportSessionFrame.java

示例2: cleanupSceneGraph

import com.jme.scene.state.TextureState; //导入依赖的package包/类
@Override
    protected void cleanupSceneGraph(Entity entity) {
        RenderComponent rc = entity.getComponent(RenderComponent.class);
        if (rc!=null) {
            ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {

                public void update(Object arg0) {
                    TreeScan.findNode((Spatial) arg0, new ProcessNodeInterface() {
                        public boolean processNode(Spatial node) {
                            if (node instanceof Geometry) {
                                ((Geometry)node).clearBuffers();
                                TextureState ts = (TextureState) node.getRenderState(RenderState.RS_TEXTURE);
                                // deleteAll is too aggressive, it deletes other copies of the same texture
//                                if (ts!=null)
//                                    ts.deleteAll(false);
                            }
                            return true;
                        }
                    });
                }
            }, rc.getSceneRoot());
        }

        deployedModel = null;
    }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:26,代码来源:ModelRenderer.java

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

示例4: printRenderState

import com.jme.scene.state.TextureState; //导入依赖的package包/类
/**
 * Print the pertinent attributes of the given render state.
 */
public static void printRenderState(RenderState rs) {
    System.err.println();
    System.err.println("renderState = " + rs);
    if (rs == null) {
        return;
    }

    if (rs instanceof MaterialState) {
        printMaterialState((MaterialState) rs);
    } else if (rs instanceof LightState) {
        printLightState((LightState) rs);
    } else if (rs instanceof ZBufferState) {
        printZBufferState((ZBufferState) rs);
    } else if (rs instanceof TextureState) {
        printTextureState((TextureState) rs);
    } else {
        throw new RuntimeException("Unsupported render state: " + rs);
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:23,代码来源:GraphicsUtils.java

示例5: setText

import com.jme.scene.state.TextureState; //导入依赖的package包/类
public void setText(String text, Color foreground, Color background) {
    this.text = text;
    this.foreground = foreground;
    this.background = background;

    Quad oldQuad = quad;
    Quad updatedQuad = getQuad();

    if (updatedQuad!=oldQuad) {
        Node tmpParent = oldQuad.getParent();
        oldQuad.removeFromParent();
        TextureState texState = (TextureState) oldQuad.getRenderState(StateType.Texture);
        Texture tex = texState.getTexture();
        TextureManager.releaseTexture(tex);
        tmpParent.attachChild(updatedQuad);
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:18,代码来源:TextLabel2D.java

示例6: PerishableFood

import com.jme.scene.state.TextureState; //导入依赖的package包/类
public PerishableFood(int periodInSecs, double x, double y, Environment ev, MaterialState ms, TextureState ts){
    super(x,y,ev,ms);
    try {
        this.category = Constants.categoryPFOOD;
        this.subCategory = Constants.categoryPFOOD;
        this.ts = ts;
        this.validPeriod = periodInSecs;
        sf = new ThingShapeFactory("images/apple.3ds", this);
        shape = sf.getNode(0.03f);

        shape.setRenderState(ms);
        shape.setRenderState(ev.ls);
        shape.updateRenderState();
        perishable = true;
        stillValid = true;
        myLifeCycle();
    } catch (IOException ex) {
        log.severe("!!!!!PerishableFood: Erro ! ");
        ex.printStackTrace();
    }
}
 
开发者ID:CST-Group,项目名称:ws3d,代码行数:22,代码来源:PerishableFood.java

示例7: NonPerishableFood

import com.jme.scene.state.TextureState; //导入依赖的package包/类
public NonPerishableFood(double x, double y, Environment ev, MaterialState ms, TextureState ts){

        super(x,y,ev,ms);
        try {
            this.category = Constants.categoryNPFOOD;
            this.subCategory = Constants.categoryNPFOOD;
            this.ts = ts;
            sf = new ThingShapeFactory("images/nut.3ds", this);
            shape = sf.getNode(0);

            shape.setRenderState(ms);
            shape.setRenderState(ev.ls);
            //shape.setLocalTranslation(new Vector3f((float) ((getX2() + getX1()) / 20 - e.width / 20), depth, (float) (((getY2() + getY1()) / 20) - e.height / 20)));
            shape.updateRenderState();
            perishable = false;
            stillValid = true;
        } catch (IOException ex) {
            log.severe("!!!!!NonPerishableFood: Erro ! ");
            ex.printStackTrace();
        }
    }
 
开发者ID:CST-Group,项目名称:ws3d,代码行数:22,代码来源:NonPerishableFood.java

示例8: buildSpatial

import com.jme.scene.state.TextureState; //导入依赖的package包/类
@Override
protected Spatial buildSpatial() {
	Vector3f[] vertices = new Vector3f[2];
	vertices[0] = new Vector3f(0,0,0);
	vertices[1] = new Vector3f(1,0,0);
	
	Vector3f[] normals = new Vector3f[]{Vector3f.UNIT_Y,Vector3f.UNIT_Y};

	Vector2f[] textureCoords = new Vector2f[2];
	textureCoords[0] = new Vector2f(0,0);
	textureCoords[1] = new Vector2f(1,1);
	
	ColorRGBA[] colors = null;// new ColorRGBA[]{startColor,endColor};
	line = new Line("Grapple Beam",vertices,normals, colors,textureCoords);
	line.setLineWidth(4f);
	line.setCullMode(SceneElement.CULL_NEVER);
	line.updateRenderState();
	
	line.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
	line.setLightCombineMode(LightState.OFF);
	line.setTextureCombineMode(TextureState.REPLACE);
	line.setModelBound(new BoundingBox());
	return line;
}
 
开发者ID:sambayless,项目名称:golems,代码行数:25,代码来源:LineModel.java

示例9: FengGUISpatial

import com.jme.scene.state.TextureState; //导入依赖的package包/类
public FengGUISpatial(Display display) {
	super();
	this.display = display;
	this.setRenderQueueMode(Renderer.QUEUE_ORTHO);
	this.setCullMode(Spatial.CULL_NEVER);
	this.setLightCombineMode(LightState.OFF);
	
	
	Texture defTex = TextureState.getDefaultTexture().createSimpleClone();
	defTex.setScale(new Vector3f(1, 1, 1));
	defaultTextureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
	defaultTextureState.setTexture(defTex);
	
/*	for(RenderState defaultState:DisplaySystem.getDisplaySystem().getRenderer().defaultStateList)
	{
		if(defaultState.getType()== RenderState.RS_TEXTURE)
		{

			providedDefaultTextureState = (TextureState) defaultState;
			break;
		}
	}*/
}
 
开发者ID:sambayless,项目名称:golems,代码行数:24,代码来源:FengGUISpatial.java

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

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

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

示例13: populateTextureList

import com.jme.scene.state.TextureState; //导入依赖的package包/类
private void populateTextureList(Node bg) {
    final DefaultTableModel model =
            (DefaultTableModel) textureTable.getModel();
    while (model.getRowCount() != 0) {
        model.removeRow(0);
    }

    final String texturePath = texturePrefixTF.getText();
    final HashSet<String> textureSet = new HashSet();

    TreeScan.findNode(bg, Geometry.class, new ProcessNodeInterface() {

        public boolean processNode(Spatial node) {
            TextureState ts =
                    (TextureState) node.getRenderState(
                    TextureState.RS_TEXTURE);
            if (ts == null) {
                return true;
            }

            Texture t = ts.getTexture();
            if (t != null) {
                String tFile = t.getImageLocation();
                if (textureSet.add(tFile)) {
                    model.addRow(new Object[]{new String(tFile),
                                "not implemented",
                                "not implemented"});
                }
            }
            return true;
        }
    }, false, true);
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:34,代码来源:ModelImporterFrame.java

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

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


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