Package gov.nasa.worldwind.render.airspaces

Examples of gov.nasa.worldwind.render.airspaces.Geometry


    @Override
    protected void doDrawOutline(DrawContext dc)
    {
        for (int i = 0; i < getFaceCount(); i++)
        {
            Geometry mesh = this.getCurrentShapeData().getMesh(i);

            // set to draw using GL_LINES
            mesh.setMode(Geometry.ELEMENT, GL.GL_LINES);

            // set up MODELVIEW matrix to properly position, orient and scale this shape
            setModelViewMatrix(dc);

            this.drawGeometry(dc, this.getCurrentShapeData(), i);

            // return render mode to GL_TRIANGLE
            mesh.setMode(Geometry.ELEMENT, GL.GL_TRIANGLES);
        }
    }
View Full Code Here


            if (!dc.isPickingMode() && mustApplyTexture(i) && this.getTexture(i).bind(
                dc)) // bind initiates retrieval
            {
                this.getTexture(i).applyInternalTransform(dc);

                Geometry mesh = this.getCurrentShapeData().getMesh(i);

                if (getOffsets(i, 0) != null)   // if texture offsets exist
                {
                    // apply offsets to texture coords to properly position and warp the texture
                    // TODO: should only do this when offsets have changed, e.g. during editing!
                    int bufferSize = mesh.getBuffer(Geometry.TEXTURE).limit();
                    FloatBuffer texCoords = (FloatBuffer) mesh.getBuffer(Geometry.TEXTURE);
                    FloatBuffer offsetCoords = Buffers.newDirectFloatBuffer(bufferSize);

                    for (int j = 0; j < bufferSize; j += 2)
                    {
                        float u = texCoords.get(j);
                        float v = texCoords.get(j + 1);

                        // bilinear interpolation of the uv corner offsets
                        float uOffset = -getOffsets(i, 0)[0] * (1 - u) * (v)
                            - getOffsets(i, 1)[0] * (u) * (v)
                            - getOffsets(i, 2)[0] * (1 - u) * (1 - v)
                            - getOffsets(i, 3)[0] * (u) * (1 - v)
                            + u;

                        float vOffset = -getOffsets(i, 0)[1] * (1 - u) * (v)
                            - getOffsets(i, 1)[1] * (u) * (v)
                            - getOffsets(i, 2)[1] * (1 - u) * (1 - v)
                            - getOffsets(i, 3)[1] * (u) * (1 - v)
                            + v;

                        offsetCoords.put(j, uOffset);
                        offsetCoords.put(j + 1, vOffset);
                    }

                    gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, offsetCoords.rewind());
                }
                else
                {
                    gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, mesh.getBuffer(Geometry.TEXTURE).rewind());
                }
                gl.glEnable(GL.GL_TEXTURE_2D);
                gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);

                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
View Full Code Here

     *
     * @throws IllegalArgumentException if the draw context is null or the element buffer is null
     */
    protected void drawGeometry(DrawContext dc, ShapeData shapeData, int index)
    {
        Geometry mesh = shapeData.getMesh(index);

        if (mesh.getBuffer(Geometry.ELEMENT) == null)
        {
            String message = "nullValue.ElementBufferIsNull";
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        int mode, count, type;
        Buffer elementBuffer;

        mode = mesh.getMode(Geometry.ELEMENT);
        count = mesh.getCount(Geometry.ELEMENT);
        type = mesh.getGLType(Geometry.ELEMENT);
        elementBuffer = mesh.getBuffer(Geometry.ELEMENT);

        this.drawGeometry(dc, mode, count, type, elementBuffer, shapeData, index);
    }
View Full Code Here

    public List<Intersection> intersectFace(Line line, int index, Matrix renderMatrix) throws InterruptedException
    {
        final Line localLine = new Line(line.getOrigin().subtract3(this.getCurrentShapeData().getReferencePoint()),
            line.getDirection());

        Geometry mesh = this.getCurrentShapeData().getMesh(index);
        // transform the vertices from local to world coords
        FloatBuffer vertices = computeTransformedVertices((FloatBuffer) mesh.getBuffer(Geometry.VERTEX),
            mesh.getCount(Geometry.VERTEX), renderMatrix);

        List<Intersection> intersections = Triangle.intersectTriangleTypes(localLine, vertices,
            (IntBuffer) mesh.getBuffer(Geometry.ELEMENT), GL.GL_TRIANGLES);

        if (intersections == null || intersections.size() == 0)
            return null;

        for (Intersection intersection : intersections)
View Full Code Here

TOP

Related Classes of gov.nasa.worldwind.render.airspaces.Geometry

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.