Issue #1638 Made gl extensions more usable by other gl projects and topo resource more extendable.
Change-Id: Ia0fe27113f7d3e1ce86bcce231812b2e0bbe0f75 Former-commit-id: 483247738be16ae76bc2f9891f557960e7ade60e
This commit is contained in:
parent
5d3b2b98bb
commit
3379b100cb
16 changed files with 44 additions and 33 deletions
|
@ -21,6 +21,7 @@ Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.core.gl,
|
Export-Package: com.raytheon.viz.core.gl,
|
||||||
com.raytheon.viz.core.gl.dataformat,
|
com.raytheon.viz.core.gl.dataformat,
|
||||||
com.raytheon.viz.core.gl.ext,
|
com.raytheon.viz.core.gl.ext,
|
||||||
|
com.raytheon.viz.core.gl.ext.imaging,
|
||||||
com.raytheon.viz.core.gl.glsl,
|
com.raytheon.viz.core.gl.glsl,
|
||||||
com.raytheon.viz.core.gl.images
|
com.raytheon.viz.core.gl.images
|
||||||
Import-Package: com.raytheon.uf.common.status,
|
Import-Package: com.raytheon.uf.common.status,
|
||||||
|
|
|
@ -36,22 +36,22 @@
|
||||||
<extension
|
<extension
|
||||||
point="com.raytheon.uf.viz.core.graphicsExtension">
|
point="com.raytheon.uf.viz.core.graphicsExtension">
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLColormapShadedShapeExtension">
|
class="com.raytheon.viz.core.gl.ext.GLColormapShadedShapeExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension">
|
class="com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLMapMeshExtension">
|
class="com.raytheon.viz.core.gl.ext.GLMapMeshExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension">
|
class="com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension">
|
class="com.raytheon.viz.core.gl.ext.imaging.GLSingleColorImageExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLDefaultImagingExtension">
|
class="com.raytheon.viz.core.gl.ext.imaging.GLDefaultImagingExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicImageExtension">
|
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicImageExtension">
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.internal.ext;
|
package com.raytheon.viz.core.gl.ext;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.internal.ext;
|
package com.raytheon.viz.core.gl.ext;
|
||||||
|
|
||||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||||
import org.geotools.coverage.grid.GridGeometry2D;
|
import org.geotools.coverage.grid.GridGeometry2D;
|
|
@ -44,10 +44,10 @@ import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
|
||||||
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
|
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
|
||||||
import com.raytheon.viz.core.gl.dataformat.GLColorMapDataFormatFactory;
|
import com.raytheon.viz.core.gl.dataformat.GLColorMapDataFormatFactory;
|
||||||
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
|
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
|
||||||
|
import com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension;
|
||||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||||
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||||
import com.raytheon.viz.core.gl.internal.GLView2D;
|
import com.raytheon.viz.core.gl.internal.GLView2D;
|
||||||
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.ext;
|
package com.raytheon.viz.core.gl.ext.imaging;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.internal.ext;
|
package com.raytheon.viz.core.gl.ext.imaging;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
|
@ -17,12 +17,11 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.internal.ext;
|
package com.raytheon.viz.core.gl.ext.imaging;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension;
|
|
||||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.core.gl.internal.ext;
|
package com.raytheon.viz.core.gl.ext.imaging;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package com.raytheon.viz.core.gl.glsl;
|
||||||
|
|
||||||
import com.raytheon.viz.core.gl.GLCapabilities;
|
import com.raytheon.viz.core.gl.GLCapabilities;
|
||||||
import com.raytheon.viz.core.gl.IGLTarget;
|
import com.raytheon.viz.core.gl.IGLTarget;
|
||||||
import com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension;
|
import com.raytheon.viz.core.gl.ext.imaging.AbstractGLImagingExtension;
|
||||||
import com.raytheon.viz.core.gl.internal.GLTarget;
|
import com.raytheon.viz.core.gl.internal.GLTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -220,10 +220,12 @@ public class GLShaderProgram {
|
||||||
gl.glUniform1i(getUniformLocation(uniformName),
|
gl.glUniform1i(getUniformLocation(uniformName),
|
||||||
((Boolean) value) == true ? 1 : 0);
|
((Boolean) value) == true ? 1 : 0);
|
||||||
} else if (value instanceof int[]) {
|
} else if (value instanceof int[]) {
|
||||||
gl.glUniform1iv(getUniformLocation(uniformName), MAX_MULTIGRIDS,
|
int[] ints = (int[]) value;
|
||||||
|
gl.glUniform1iv(getUniformLocation(uniformName), ints.length,
|
||||||
(int[]) value, 0);
|
(int[]) value, 0);
|
||||||
} else if (value instanceof float[]) {
|
} else if (value instanceof float[]) {
|
||||||
gl.glUniform1fv(getUniformLocation(uniformName), MAX_MULTIGRIDS,
|
float[] floats = (float[]) value;
|
||||||
|
gl.glUniform1fv(getUniformLocation(uniformName), floats.length,
|
||||||
(float[]) value, 0);
|
(float[]) value, 0);
|
||||||
} else if (value instanceof RGB) {
|
} else if (value instanceof RGB) {
|
||||||
gl.glUniform3f(getUniformLocation(uniformName),
|
gl.glUniform3f(getUniformLocation(uniformName),
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||||
import com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension;
|
import com.raytheon.viz.core.gl.ext.imaging.GLSingleColorImageExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GL Image object that all non-zero values should be mapped to a single color
|
* GL Image object that all non-zero values should be mapped to a single color
|
||||||
|
|
|
@ -85,12 +85,12 @@ import com.raytheon.viz.core.gl.GLDisposalManager;
|
||||||
import com.raytheon.viz.core.gl.GLStats;
|
import com.raytheon.viz.core.gl.GLStats;
|
||||||
import com.raytheon.viz.core.gl.IGLFont;
|
import com.raytheon.viz.core.gl.IGLFont;
|
||||||
import com.raytheon.viz.core.gl.IGLTarget;
|
import com.raytheon.viz.core.gl.IGLTarget;
|
||||||
|
import com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension;
|
||||||
|
import com.raytheon.viz.core.gl.ext.imaging.GLDefaultImagingExtension;
|
||||||
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
|
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
|
||||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||||
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||||
import com.raytheon.viz.core.gl.images.GLImage;
|
import com.raytheon.viz.core.gl.images.GLImage;
|
||||||
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
|
||||||
import com.raytheon.viz.core.gl.internal.ext.GLDefaultImagingExtension;
|
|
||||||
import com.raytheon.viz.core.gl.objects.GLTextureObject;
|
import com.raytheon.viz.core.gl.objects.GLTextureObject;
|
||||||
import com.sun.opengl.util.Screenshot;
|
import com.sun.opengl.util.Screenshot;
|
||||||
import com.sun.opengl.util.j2d.TextRenderer;
|
import com.sun.opengl.util.j2d.TextRenderer;
|
||||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.core.style.StyleManager;
|
||||||
import com.raytheon.uf.viz.core.style.StyleManager.StyleType;
|
import com.raytheon.uf.viz.core.style.StyleManager.StyleType;
|
||||||
import com.raytheon.uf.viz.core.style.StyleRule;
|
import com.raytheon.uf.viz.core.style.StyleRule;
|
||||||
import com.raytheon.uf.viz.core.tile.TileSetRenderable;
|
import com.raytheon.uf.viz.core.tile.TileSetRenderable;
|
||||||
|
import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator;
|
||||||
import com.raytheon.viz.core.style.image.DataScale;
|
import com.raytheon.viz.core.style.image.DataScale;
|
||||||
import com.raytheon.viz.core.style.image.ImagePreferences;
|
import com.raytheon.viz.core.style.image.ImagePreferences;
|
||||||
import com.raytheon.viz.core.style.image.SamplePreferences;
|
import com.raytheon.viz.core.style.image.SamplePreferences;
|
||||||
|
@ -94,9 +95,9 @@ public class TopoResource extends
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private File dataFile;
|
protected File dataFile;
|
||||||
|
|
||||||
private TileSetRenderable topoTileSet;
|
protected TileSetRenderable topoTileSet;
|
||||||
|
|
||||||
protected TopoResource(TopoResourceData topoData,
|
protected TopoResource(TopoResourceData topoData,
|
||||||
LoadProperties loadProperties, File dataFile) throws VizException {
|
LoadProperties loadProperties, File dataFile) throws VizException {
|
||||||
|
@ -214,11 +215,14 @@ public class TopoResource extends
|
||||||
|
|
||||||
topoTileSet = new TileSetRenderable(
|
topoTileSet = new TileSetRenderable(
|
||||||
getCapability(ImagingCapability.class), getTopoGeometry(),
|
getCapability(ImagingCapability.class), getTopoGeometry(),
|
||||||
new TopoTileImageCreator(this, dataFile),
|
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
|
||||||
getNumberOfTopoLevels(), 512);
|
|
||||||
topoTileSet.project(descriptor.getGridGeometry());
|
topoTileSet.project(descriptor.getGridGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TileImageCreator getTopoTileImageCreator() {
|
||||||
|
return new TopoTileImageCreator(this, dataFile);
|
||||||
|
}
|
||||||
|
|
||||||
private int getNumberOfTopoLevels() throws VizException {
|
private int getNumberOfTopoLevels() throws VizException {
|
||||||
IDataStore ds = DataStoreFactory.getDataStore(dataFile);
|
IDataStore ds = DataStoreFactory.getDataStore(dataFile);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -52,7 +52,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
public class TopoResourceData extends AbstractResourceData {
|
public class TopoResourceData extends AbstractResourceData {
|
||||||
|
|
||||||
private static final String TOPO_DIR = "topo";
|
protected static final String TOPO_DIR = "topo";
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
private String topoFile = "srtm30.hdf";
|
private String topoFile = "srtm30.hdf";
|
||||||
|
@ -85,7 +85,7 @@ public class TopoResourceData extends AbstractResourceData {
|
||||||
public TopoResource construct(LoadProperties loadProperties,
|
public TopoResource construct(LoadProperties loadProperties,
|
||||||
IDescriptor descriptor) throws VizException {
|
IDescriptor descriptor) throws VizException {
|
||||||
return new TopoResource(this, loadProperties, new File(TOPO_DIR
|
return new TopoResource(this, loadProperties, new File(TOPO_DIR
|
||||||
+ IPathManager.SEPARATOR + topoFile));
|
+ IPathManager.SEPARATOR + getTopoFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTopoFile() {
|
public String getTopoFile() {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
||||||
import com.raytheon.uf.viz.core.IMesh;
|
import com.raytheon.uf.viz.core.IMesh;
|
||||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||||
|
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||||
import com.raytheon.uf.viz.core.data.prep.HDF5DataRetriever;
|
import com.raytheon.uf.viz.core.data.prep.HDF5DataRetriever;
|
||||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||||
|
@ -56,7 +57,7 @@ import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator;
|
||||||
|
|
||||||
public class TopoTileImageCreator implements TileImageCreator {
|
public class TopoTileImageCreator implements TileImageCreator {
|
||||||
|
|
||||||
private TopoResource resource;
|
protected TopoResource resource;
|
||||||
|
|
||||||
private File dataFile;
|
private File dataFile;
|
||||||
|
|
||||||
|
@ -76,15 +77,9 @@ public class TopoTileImageCreator implements TileImageCreator {
|
||||||
@Override
|
@Override
|
||||||
public DrawableImage createTileImage(IGraphicsTarget target, Tile tile,
|
public DrawableImage createTileImage(IGraphicsTarget target, Tile tile,
|
||||||
GeneralGridGeometry targetGeometry) throws VizException {
|
GeneralGridGeometry targetGeometry) throws VizException {
|
||||||
int level = tile.tileLevel;
|
|
||||||
String dataset = "/full";
|
|
||||||
if (level > 0) {
|
|
||||||
dataset = "/interpolated/" + level;
|
|
||||||
}
|
|
||||||
|
|
||||||
IColormappedImage image = target.getExtension(
|
IColormappedImage image = target.getExtension(
|
||||||
IColormappedImageExtension.class).initializeRaster(
|
IColormappedImageExtension.class).initializeRaster(
|
||||||
new HDF5DataRetriever(dataFile, dataset, tile.getRectangle()),
|
createColormapImageCallback(tile),
|
||||||
resource.getCapability(ColorMapCapability.class)
|
resource.getCapability(ColorMapCapability.class)
|
||||||
.getColorMapParameters());
|
.getColorMapParameters());
|
||||||
IMesh mesh = target.getExtension(IMapMeshExtension.class)
|
IMesh mesh = target.getExtension(IMapMeshExtension.class)
|
||||||
|
@ -92,4 +87,14 @@ public class TopoTileImageCreator implements TileImageCreator {
|
||||||
return new DrawableImage(image, new PixelCoverage(mesh),
|
return new DrawableImage(image, new PixelCoverage(mesh),
|
||||||
RasterMode.ASYNCHRONOUS);
|
RasterMode.ASYNCHRONOUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IColorMapDataRetrievalCallback createColormapImageCallback(
|
||||||
|
Tile tile) {
|
||||||
|
int level = tile.tileLevel;
|
||||||
|
String dataset = "/full";
|
||||||
|
if (level > 0) {
|
||||||
|
dataset = "/interpolated/" + level;
|
||||||
|
}
|
||||||
|
return new HDF5DataRetriever(dataFile, dataset, tile.getRectangle());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue