Search in sources :

Example 1 with VisualAccess

use of au.gov.asd.tac.constellation.utilities.visual.VisualAccess in project constellation by constellation-app.

the class VertexFlagsTexturiser method createTexture.

public GLRenderableUpdateTask createTexture(final VisualAccess access) {
    final ByteBuffer flagsBuffer = Buffers.newDirectByteBuffer(access.getVertexCount());
    for (int i = 0; i < access.getVertexCount(); i++) {
        bufferFlagsInfo(i, flagsBuffer, access);
    }
    flagsBuffer.flip();
    return gl -> vertexFlagsTexture = new ByteTextureBuffer(gl, flagsBuffer);
}
Also used : GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) ByteTextureBuffer(au.gov.asd.tac.constellation.visual.opengl.utilities.ByteTextureBuffer) Buffers(com.jogamp.common.nio.Buffers) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) SceneBatcher(au.gov.asd.tac.constellation.visual.opengl.renderer.batcher.SceneBatcher) VisualChange(au.gov.asd.tac.constellation.utilities.visual.VisualChange) ByteBuffer(java.nio.ByteBuffer) ByteTextureBuffer(au.gov.asd.tac.constellation.visual.opengl.utilities.ByteTextureBuffer) ByteBuffer(java.nio.ByteBuffer)

Example 2 with VisualAccess

use of au.gov.asd.tac.constellation.utilities.visual.VisualAccess in project constellation by constellation-app.

the class ConnectionLabelBatcher method createBatch.

@Override
public GLRenderableUpdateTask createBatch(final VisualAccess access) throws InterruptedException {
    final ConnectionGlyphStream glyphStream = new ConnectionGlyphStream();
    fillLabels(access, glyphStream);
    return gl -> {
        labelBatch.initialise(glyphStream.getCurrentFloats().size() / FLOAT_BUFFER_WIDTH);
        labelBatch.buffer(gl, intsTarget, IntBuffer.wrap(glyphStream.getCurrentInts().rawArray()));
        labelBatch.buffer(gl, floatsTarget, FloatBuffer.wrap(glyphStream.getCurrentFloats().rawArray()));
        labelBatch.finalise(gl);
    };
}
Also used : GL3(com.jogamp.opengl.GL3) TextureUnits(au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits) SharedDrawable(au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable) FloatBuffer(java.nio.FloatBuffer) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ConnectionGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStream) LabelUtilities(au.gov.asd.tac.constellation.visual.opengl.utilities.LabelUtilities) IOException(java.io.IOException) ArrayList(java.util.ArrayList) GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) IntBuffer(java.nio.IntBuffer) VisualGraphDefaults(au.gov.asd.tac.constellation.graph.visual.framework.VisualGraphDefaults) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) ConnectionGlyphStreamContext(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStreamContext) GL(com.jogamp.opengl.GL) ConnectionGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStream)

Example 3 with VisualAccess

use of au.gov.asd.tac.constellation.utilities.visual.VisualAccess in project constellation by constellation-app.

the class ConnectionLabelBatcher method updateLabels.

public GLRenderableUpdateTask updateLabels(final VisualAccess access) throws InterruptedException {
    // We build the whole batch again - can't update labels in place at this stage.
    final ConnectionGlyphStream glyphStream = new ConnectionGlyphStream();
    fillLabels(access, glyphStream);
    return gl -> {
        labelBatch.dispose(gl);
        labelBatch.initialise(glyphStream.getCurrentFloats().size() / FLOAT_BUFFER_WIDTH);
        labelBatch.buffer(gl, intsTarget, IntBuffer.wrap(glyphStream.getCurrentInts().rawArray()));
        labelBatch.buffer(gl, floatsTarget, FloatBuffer.wrap(glyphStream.getCurrentFloats().rawArray()));
        labelBatch.finalise(gl);
    };
}
Also used : GL3(com.jogamp.opengl.GL3) TextureUnits(au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits) SharedDrawable(au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable) FloatBuffer(java.nio.FloatBuffer) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ConnectionGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStream) LabelUtilities(au.gov.asd.tac.constellation.visual.opengl.utilities.LabelUtilities) IOException(java.io.IOException) ArrayList(java.util.ArrayList) GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) IntBuffer(java.nio.IntBuffer) VisualGraphDefaults(au.gov.asd.tac.constellation.graph.visual.framework.VisualGraphDefaults) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) ConnectionGlyphStreamContext(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStreamContext) GL(com.jogamp.opengl.GL) ConnectionGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStream)

Example 4 with VisualAccess

use of au.gov.asd.tac.constellation.utilities.visual.VisualAccess in project constellation by constellation-app.

the class ConnectionLabelBatcher method setLabelColors.

public GLRenderableUpdateTask setLabelColors(final VisualAccess access) {
    final int numConnectionLabels = Math.min(LabelUtilities.MAX_LABELS_TO_DRAW, access.getConnectionAttributeLabelCount());
    for (int i = 0; i < numConnectionLabels; i++) {
        final ConstellationColor labelColor = access.getConnectionLabelColor(i);
        attributeLabelInfoReference.setRow(labelColor.getRed(), labelColor.getGreen(), labelColor.getBlue(), attributeLabelInfoReference.get(i, 3), i);
    }
    return gl -> attributeLabelInfo.set(attributeLabelInfoReference);
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) GL3(com.jogamp.opengl.GL3) TextureUnits(au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits) SharedDrawable(au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable) FloatBuffer(java.nio.FloatBuffer) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ConnectionGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStream) LabelUtilities(au.gov.asd.tac.constellation.visual.opengl.utilities.LabelUtilities) IOException(java.io.IOException) ArrayList(java.util.ArrayList) GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) IntBuffer(java.nio.IntBuffer) VisualGraphDefaults(au.gov.asd.tac.constellation.graph.visual.framework.VisualGraphDefaults) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) ConnectionGlyphStreamContext(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.ConnectionGlyphStreamContext) GL(com.jogamp.opengl.GL)

Example 5 with VisualAccess

use of au.gov.asd.tac.constellation.utilities.visual.VisualAccess in project constellation by constellation-app.

the class FpsBatcher method createBatch.

@Override
public GLRenderableUpdateTask createBatch(final VisualAccess access) {
    final FloatBuffer colorBuffer = Buffers.newDirectFloatBuffer(COLOR_BUFFER_WIDTH * 2);
    bufferColorInfo(0, colorBuffer, ConstellationColor.WHITE);
    bufferColorInfo(1, colorBuffer, ConstellationColor.WHITE);
    colorBuffer.flip();
    final IntBuffer iconBuffer = Buffers.newDirectIntBuffer(ICON_BUFFER_WIDTH * 2);
    bufferIconInfo(0, iconBuffer, 0, 0);
    bufferIconInfo(1, iconBuffer, 0, 0);
    iconBuffer.flip();
    return gl -> {
        batch.initialise(2);
        batch.buffer(gl, colorTarget, colorBuffer);
        batch.buffer(gl, iconTarget, iconBuffer);
        // Ensure that the icons for the digits are loaded into the texture
        for (int digit = 0; digit < 10; digit++) {
            GLTools.LOADED_ICON_HELPER.addIcon(Integer.toString(digit));
        }
        updateIconTexture(gl);
        batch.finalise(gl);
    };
}
Also used : Arrays(java.util.Arrays) GL3(com.jogamp.opengl.GL3) TextureUnits(au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits) SharedDrawable(au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable) FloatBuffer(java.nio.FloatBuffer) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) IOException(java.io.IOException) GL2ES3(com.jogamp.opengl.GL2ES3) GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) Buffers(com.jogamp.common.nio.Buffers) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) IntBuffer(java.nio.IntBuffer) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) GL(com.jogamp.opengl.GL) GLTools(au.gov.asd.tac.constellation.visual.opengl.utilities.GLTools) IntBuffer(java.nio.IntBuffer) FloatBuffer(java.nio.FloatBuffer)

Aggregations

VisualAccess (au.gov.asd.tac.constellation.utilities.visual.VisualAccess)18 GLRenderableUpdateTask (au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask)17 FloatBuffer (java.nio.FloatBuffer)16 Camera (au.gov.asd.tac.constellation.utilities.camera.Camera)15 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)15 GL3 (com.jogamp.opengl.GL3)15 IOException (java.io.IOException)15 IntBuffer (java.nio.IntBuffer)15 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)12 TextureUnits (au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits)12 SharedDrawable (au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable)12 GL (com.jogamp.opengl.GL)12 ArrayList (java.util.ArrayList)10 VisualChange (au.gov.asd.tac.constellation.utilities.visual.VisualChange)9 LabelUtilities (au.gov.asd.tac.constellation.visual.opengl.utilities.LabelUtilities)9 Buffers (com.jogamp.common.nio.Buffers)9 NodeGlyphStream (au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.NodeGlyphStream)5 NodeGlyphStreamContext (au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.NodeGlyphStreamContext)5 Collections (java.util.Collections)5 ByteBuffer (java.nio.ByteBuffer)4