use of au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask in project constellation by constellation-app.
the class NodeLabelBatcher method createBatch.
@Override
public GLRenderableUpdateTask createBatch(final VisualAccess access) throws InterruptedException {
final NodeGlyphStream topGlyphStream = new NodeGlyphStream();
final NodeGlyphStream bottomGlyphStream = new NodeGlyphStream();
fillTopLabels(access, topGlyphStream);
fillBottomLabels(access, bottomGlyphStream);
return gl -> {
topBatch.initialise(topGlyphStream.getCurrentFloats().size() / FLOAT_BUFFERS_WIDTH);
topBatch.buffer(gl, labelFloatsTarget, FloatBuffer.wrap(topGlyphStream.getCurrentFloats().rawArray()));
topBatch.buffer(gl, labelIntsTarget, IntBuffer.wrap(topGlyphStream.getCurrentInts().rawArray()));
topBatch.finalise(gl);
bottomBatch.initialise(bottomGlyphStream.getCurrentFloats().size() / FLOAT_BUFFERS_WIDTH);
bottomBatch.buffer(gl, labelFloatsTarget, FloatBuffer.wrap(bottomGlyphStream.getCurrentFloats().rawArray()));
bottomBatch.buffer(gl, labelIntsTarget, IntBuffer.wrap(bottomGlyphStream.getCurrentInts().rawArray()));
bottomBatch.finalise(gl);
};
}
use of au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask in project constellation by constellation-app.
the class NodeLabelBatcher method setTopLabelColors.
public GLRenderableUpdateTask setTopLabelColors(final VisualAccess access) {
final int numTopLabels = Math.min(LabelUtilities.MAX_LABELS_TO_DRAW, access.getTopLabelCount());
for (int i = 0; i < numTopLabels; i++) {
final ConstellationColor labelColor = access.getTopLabelColor(i);
labelTopInfoReference.setRow(labelColor.getRed(), labelColor.getGreen(), labelColor.getBlue(), labelTopInfoReference.get(i, 3), i);
}
return gl -> labelTopInfo.set(labelTopInfoReference);
}
use of au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask in project constellation by constellation-app.
the class SceneBatcher method updateIntBufferTask.
public static GLRenderableUpdateTask updateIntBufferTask(final VisualChange change, final VisualAccess access, final IntBufferOperation operation, final IntBufferConnection connector, final BufferDisconnection disconnector, final boolean[] updateMask) {
final int width = updateMask.length;
final int numChanges = change.getSize();
final IntBuffer updateBuffer = Buffers.newDirectIntBuffer(width * numChanges);
final int[] bufferUpdatePositions = new int[numChanges];
int updatePos = 0;
for (int i = 0; i < numChanges; i++) {
int pos = change.getElement(i);
final int updatedPosition = operation.buffer(pos, updateBuffer, access);
if (updatedPosition >= 0) {
bufferUpdatePositions[updatePos++] = updatedPosition;
}
}
final int numUpdates = updatePos;
updateBuffer.flip();
return gl -> {
final IntBuffer buffer = connector.connect(gl);
for (int i = 0; i < numUpdates; i++) {
buffer.position(bufferUpdatePositions[i] * width);
for (boolean update : updateMask) {
if (update) {
buffer.put(updateBuffer.get());
} else {
buffer.get();
}
}
}
disconnector.disconnect(gl);
};
}
use of au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask in project constellation by constellation-app.
the class SceneBatcher method updateFloatBufferTask.
public static GLRenderableUpdateTask updateFloatBufferTask(final VisualChange change, final VisualAccess access, final FloatBufferOperation operation, final FloatBufferConnection connector, final BufferDisconnection disconnector, final boolean[] updateMask) {
final int width = updateMask.length;
final int numChanges = change.getSize();
final FloatBuffer updateBuffer = Buffers.newDirectFloatBuffer(width * numChanges);
final int[] bufferUpdatePositions = new int[numChanges];
int updatePos = 0;
for (int i = 0; i < numChanges; i++) {
int pos = change.getElement(i);
final int updatedPosition = operation.buffer(pos, updateBuffer, access);
if (updatedPosition >= 0) {
bufferUpdatePositions[updatePos++] = updatedPosition;
}
}
final int numUpdates = updatePos;
updateBuffer.flip();
return gl -> {
final FloatBuffer buffer = connector.connect(gl);
for (int i = 0; i < numUpdates; i++) {
buffer.position(bufferUpdatePositions[i] * width);
for (boolean update : updateMask) {
if (update) {
buffer.put(updateBuffer.get());
} else {
buffer.get();
}
}
}
disconnector.disconnect(gl);
};
}
use of au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask in project constellation by constellation-app.
the class XyzTexturiser method createTexture.
public GLRenderableUpdateTask createTexture(final VisualAccess access) {
final FloatBuffer xyzBuffer = Buffers.newDirectFloatBuffer(XYZ_BUFFER_WIDTH * access.getVertexCount());
for (int i = 0; i < access.getVertexCount(); i++) {
bufferXyzInfo(i, xyzBuffer, access);
}
xyzBuffer.flip();
return gl -> xyzTexture = new FloatTextureBuffer(gl, xyzBuffer);
}
Aggregations