Package com.jme.scene.shape

Examples of com.jme.scene.shape.Quad


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


        BufferedImage img = getImage(scales);

        float w = img.getWidth();
        float h = img.getHeight();
        float factor = height / h;
        Quad ret;

        if (imgWidth==w && imgHeight==h && imgFactor==factor) {
            // Reuse quad and texture
            ret = quad;
            TextureState texState = (TextureState) quad.getRenderState(StateType.Texture);
            Texture oldtex = texState.getTexture();
            // Not sure why this does not work, instead release the current texture and create a new one.
//            oldtex.setImage(TextureManager.loadImage(img, true));
//            texState.setTexture(oldtex);
            TextureManager.releaseTexture(oldtex);

            Texture tex = TextureManager.loadTexture(img, MinificationFilter.BilinearNoMipMaps, MagnificationFilter.Bilinear, true);

            texState.setTexture(tex);
            //end workaround
        } else {
            ret = new Quad("textLabel2d", w * factor, h * factor);
            TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
            Texture tex = TextureManager.loadTexture(img, MinificationFilter.BilinearNoMipMaps, MagnificationFilter.Bilinear, true);

            ts.setTexture(tex);
            ts.setEnabled(true);
            ret.setRenderState(ts);

            BlendState as = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
            as.setBlendEnabled(false);
            as.setReference(0.5f);
            as.setTestFunction(BlendState.TestFunction.GreaterThan);
            as.setTestEnabled(true);
            ret.setRenderState(as);

            ret.setLightCombineMode(LightCombineMode.Off);
            ret.updateRenderState();
            this.quad = ret;
            imgWidth = w;
            imgHeight = h;
            imgFactor = factor;
        }
View Full Code Here

    waterEffectRenderPass = new WaterRenderPass( cam, 1
        , false, true );
    //setting to default value just to show
    waterEffectRenderPass.setWaterPlane( new Plane( new Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ) );

    waterQuad = new Quad( "waterQuad", 1, 1 );
    FloatBuffer normBuf = waterQuad.getNormalBuffer( 0 );
    normBuf.clear();
    normBuf.put( 0 ).put( 1 ).put( 0 );
    normBuf.put( 0 ).put( 1 ).put( 0 );
    normBuf.put( 0 ).put( 1 ).put( 0 );
View Full Code Here

    debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );

    float quadWidth = display.getWidth() / 8;
    float quadHeight = display.getWidth() / 8;
       
    Quad debugQuad = new Quad( "reflectionQuad", quadWidth, quadHeight );
    debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
    debugQuad.setCullMode( SceneElement.CULL_NEVER );
    debugQuad.setLightCombineMode( LightState.OFF );
    TextureState ts = display.getRenderer().createTextureState();
    ts.setTexture( waterEffectRenderPass.getTextureReflect() );
    debugQuad.setRenderState( ts );
    debugQuad.updateRenderState();
    debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 1.0f, 1.0f );
    debugQuadsNode.attachChild( debugQuad );

    if( waterEffectRenderPass.getTextureRefract() != null ) {
      debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
      debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
      debugQuad.setCullMode( SceneElement.CULL_NEVER );
      debugQuad.setLightCombineMode( LightState.OFF );
      ts = display.getRenderer().createTextureState();
      ts.setTexture( waterEffectRenderPass.getTextureRefract() );
      debugQuad.setRenderState( ts );
      debugQuad.updateRenderState();
      debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 2.1f, 1.0f );
      debugQuadsNode.attachChild( debugQuad );
    }

        if( waterEffectRenderPass.getTextureDepth() != null ) {
            debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
            debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
            debugQuad.setCullMode( SceneElement.CULL_NEVER );
            debugQuad.setLightCombineMode( LightState.OFF );
            ts = display.getRenderer().createTextureState();
            ts.setTexture( waterEffectRenderPass.getTextureDepth() );
            debugQuad.setRenderState( ts );
            debugQuad.updateRenderState();
            debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 3.2f, 1.0f );
            debugQuadsNode.attachChild( debugQuad );
        }
    }
View Full Code Here

    //set equations to use z axis as up
    waterEffectRenderPass.setWaterPlane( new Plane( new Vector3f( 0.0f, 0.0f, 1.0f ), 0.0f ) );
    waterEffectRenderPass.setTangent( new Vector3f( 1.0f, 0.0f, 0.0f ) );
    waterEffectRenderPass.setBinormal( new Vector3f( 0.0f, 1.0f, 0.0f ) );

    waterQuad = new Quad( "waterQuad", 100, 100 );

    waterEffectRenderPass.setWaterEffectOnSpatial( waterQuad );
    rootNode.attachChild( waterQuad );

    createDebugQuads();
View Full Code Here

    debugQuadsNode = new Node( "quadNode" );
    debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );

    float quadWidth = display.getWidth() / 8;
    float quadHeight = display.getWidth() / 8;
    Quad debugQuad = new Quad( "reflectionQuad", quadWidth, quadHeight );
    debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
    debugQuad.setCullMode( SceneElement.CULL_NEVER );
    debugQuad.setLightCombineMode( LightState.OFF );
    TextureState ts = display.getRenderer().createTextureState();
    ts.setTexture( waterEffectRenderPass.getTextureReflect() );
    debugQuad.setRenderState( ts );
    debugQuad.updateRenderState();
    debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 1.0f, 1.0f );
    debugQuadsNode.attachChild( debugQuad );

    if( waterEffectRenderPass.getTextureRefract() != null ) {
      debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
      debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
      debugQuad.setCullMode( SceneElement.CULL_NEVER );
      debugQuad.setLightCombineMode( LightState.OFF );
      ts = display.getRenderer().createTextureState();
      ts.setTexture( waterEffectRenderPass.getTextureRefract() );
      debugQuad.setRenderState( ts );
      debugQuad.updateRenderState();
      debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 2.1f, 1.0f );
      debugQuadsNode.attachChild( debugQuad );
    }

        if( waterEffectRenderPass.getTextureDepth() != null ) {
            debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
            debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
            debugQuad.setCullMode( SceneElement.CULL_NEVER );
            debugQuad.setLightCombineMode( LightState.OFF );
            ts = display.getRenderer().createTextureState();
            ts.setTexture( waterEffectRenderPass.getTextureDepth() );
            debugQuad.setRenderState( ts );
            debugQuad.updateRenderState();
            debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 3.2f, 1.0f );
            debugQuadsNode.attachChild( debugQuad );
        }
  }
View Full Code Here

    public GeometryBatchCreator getCreator() {
        return creator;
    }

    public TriMesh createVegetationMesh(float scale, int turnNumber, short size) {
        Quad q = new Quad("triMeshVegQuad", 1, 1);
        q.setTextureCoords(VegetationManager.VEGETATION_QUAD_TEXCOORDS);

        creator = new GeometryBatchCreator();

        verticeSize = turnNumber * 4 * size;
        Random rand = new Random();
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected Spatial[] getSpatials() {
        if (quad == null) {
            quad = new Quad("FrameRect-Quad", width, height);
            quad.setModelBound(new BoundingBox());
            quad.updateModelBound();
        }
        return new Spatial[]{quad};
    }
View Full Code Here

TOP

Related Classes of com.jme.scene.shape.Quad

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.