Package com.jme.scene.state

Examples of com.jme.scene.state.TextureState


        lz.updateModelBound();
        axis.attachChild(lx);
        axis.attachChild(ly);
        axis.attachChild(lz);

        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

        this.setTextureCombineMode(TextureCombineMode.Off);
        this.setRenderState(ts);

        ZBufferState zs = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
View Full Code Here


        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        //jak se ty dve textury smichaji
        t01.setApply(ApplyMode.Combine);
        t02.setApply(ApplyMode.Combine);
      
        // jen na zkousku pootacim jednu z textur
        t01.setRotation(new Quaternion(new float[]{0.1f,0.5f,0.5f}));
        t01.setWrap(WrapMode.Repeat);
       
       
        //kdyz ma t01 a t02 ApplyMode combine, tak se da dale kombinovat za pomoci dalsiho milionu kombinaci
        /*t01.setCombineFuncRGB(CombinerFunctionRGB.Modulate);
        t01.setCombineSrc0RGB(CombinerSource.CurrentTexture);
        t01.setCombineOp0RGB(CombinerOperandRGB.SourceColor);
        t01.setCombineSrc1RGB(CombinerSource.PrimaryColor);
        t01.setCombineOp1RGB(CombinerOperandRGB.SourceColor);
        t01.setCombineScaleRGB(CombinerScale.One);

        t02.setCombineFuncRGB(CombinerFunctionRGB.AddSigned);
        t02.setCombineSrc0RGB(CombinerSource.CurrentTexture);
        t02.setCombineOp0RGB(CombinerOperandRGB.SourceColor);
        t02.setCombineSrc1RGB(CombinerSource.Previous);
        t02.setCombineOp1RGB(CombinerOperandRGB.SourceColor);
        t02.setCombineScaleRGB(CombinerScale.One);*/
       
        // prirazeni do jednotlivych "slotu" texture state
        ts.setTexture(t01, 0);
        ts.setTexture(t02, 1);
        // !dulezite. Texture state pripravuje koordinaty pouze pro "slot" 0. Takze je potreba prokopirovat do slotu 1
        box.copyTextureCoordinates(0, 1, 1f);

        // prirazeni boxu
        box.setRenderState(ts);
View Full Code Here

        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        //jak se ty dve textury smichaji
        t01.setApply(ApplyMode.Combine);
        t02.setApply(ApplyMode.Combine);
      
        // jen na zkousku pootacim jednu z textur
        t01.setRotation(new Quaternion(new float[]{0.1f,0.5f,0.5f}));
        t01.setWrap(WrapMode.Repeat);
       
       
        //kdyz ma t01 a t02 ApplyMode combine, tak se da dale kombinovat za pomoci dalsiho milionu kombinaci
        /*t01.setCombineFuncRGB(CombinerFunctionRGB.Modulate);
        t01.setCombineSrc0RGB(CombinerSource.CurrentTexture);
        t01.setCombineOp0RGB(CombinerOperandRGB.SourceColor);
        t01.setCombineSrc1RGB(CombinerSource.PrimaryColor);
        t01.setCombineOp1RGB(CombinerOperandRGB.SourceColor);
        t01.setCombineScaleRGB(CombinerScale.One);

        t02.setCombineFuncRGB(CombinerFunctionRGB.AddSigned);
        t02.setCombineSrc0RGB(CombinerSource.CurrentTexture);
        t02.setCombineOp0RGB(CombinerOperandRGB.SourceColor);
        t02.setCombineSrc1RGB(CombinerSource.Previous);
        t02.setCombineOp1RGB(CombinerOperandRGB.SourceColor);
        t02.setCombineScaleRGB(CombinerScale.One);*/
       
        // prirazeni do jednotlivych "slotu" texture state
        ts.setTexture(t01, 0);
        ts.setTexture(t02, 1);
        // !dulezite. Texture state pripravuje koordinaty pouze pro "slot" 0. Takze je potreba prokopirovat do slotu 1
        box.copyTextureCoordinates(0, 1, 1f);

        // prirazeni boxu
        box.setRenderState(ts);
View Full Code Here

        } else {
            GraphicsUtils.printRenderState(zs);
        }

        System.err.println("Texture State =");
        TextureState ts = (TextureState) spatial.getRenderState(RenderState.RS_TEXTURE);
        if (ts == null) {
            System.err.println("null");
        } else {
            GraphicsUtils.printRenderState(ts);
        }
View Full Code Here

    /**
     * Specify a new texture.
     */
    public void setTexture (Texture texture) {
  this.texture = texture;
  TextureState ts = (TextureState) getRenderState(RenderState.RS_TEXTURE);
  ts.setTexture(texture);
    }
View Full Code Here

     * 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();
  }

View Full Code Here

     * For debug: Print the contents of this object's render state.
     */
    public void printRenderState () {
  MaterialState ms = (MaterialState) getRenderState(RenderState.RS_MATERIAL);
  GraphicsUtils.printRenderState(ms);
  TextureState ts = (TextureState) getRenderState(RenderState.RS_TEXTURE);
  GraphicsUtils.printRenderState(ts);
    }   
View Full Code Here

    /**
     * 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);
    }
View Full Code Here

            if (geometryNode == null) {
                logger.severe("Cannot allocate geometry node for view!!");
                return;
            }
        }
        final TextureState ts = geometryNode.getTextureState();
        if (ts == null) {
            logger.warning("Trying to force texture id assignment while view texture state is null");
            return;
        }

        logger.info("texid alloc: ts.getTexture() = " + ts.getTexture());

        Texture tex = ts.getTexture();
        if (tex != null) {
            if (tex.getTextureId() != 0) {
                // Don't allocate a texture ID if one is already allocated. This can happen,
                // for example, when a new view is created which shows the same texture as
                // an existing view. One such case is Apps-in-HUD.
                return;
            }
        }

        if (inRenderLoop) {
            // We're already in the render loop
            ts.load();
        } else {
            // Not in render loop. Must do this inside the render loop.
            ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {
                public void update(Object arg0) {
                    // The JME magic - must be called from within the render loop
                    ts.load();
                }
           }, null, true)// Note: a rare case in which we must wait for the render updater to complete
        }

        /* For debug: Verify that ID was actually allocated
View Full Code Here

     
    /** Create a skybox to suround our world */
    Skybox sb = new Skybox("skybox", 500, 500, 500);
    URL monkeyLoc = HelloIntersection.class.getClassLoader().getResource(
        "data/texture/sky4stars-a_original.jpg");
    TextureState ts = display.getRenderer().createTextureState();
    ts.setTexture(TextureManager.loadTexture(monkeyLoc, Texture.MM_LINEAR,
        Texture.FM_LINEAR));
    sb.setRenderState(ts);

    // Attach the skybox to our root node, and force the rootnode to show
    // so that the skybox will always show
View Full Code Here

TOP

Related Classes of com.jme.scene.state.TextureState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.