java.lang.Object
de.grogra.glsl.GLSLVolumeBuilder
- All Implemented Interfaces:
RenderState
Simple class that will gather Scene information about the extend of all
objects
- Author:
- Konni Hartmann
-
Field Summary
Fields inherited from interface de.grogra.imp3d.RenderState
CURRENT_HIGHLIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drawBox
(float halfWidth, float halfLength, float height, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawFrustum
(float height, float baseRadius, float topRadius, boolean baseClosed, boolean topClosed, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawFrustumIrregular
(float height, int sectorCount, float[] baseRadii, float[] topRadii, boolean baseClosed, boolean topclosed, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawLamella
(float halfWidth, float halfLength, float height, float a, float b, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
void
drawParallelogram
(float axis, Vector3f secondAxis, float scaleU, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
void
void
drawPointCloud
(float[] locations, float pointSize, Tuple3f color, int highlight, Matrix4d t) Draw a set of points.void
drawPolygons
(Polygonizable polygons, Object obj, boolean asNode, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawPrismRectangular
(float y, float xPos, float xNeg, float zPos, float zNeg, int highlight, boolean asWireframe, Matrix4d t) void
drawRectangle
(int x, int y, int w, int h, Tuple3f color) void
drawSphere
(float radius, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawSphereSegmentSolid
(float radius, float theta1, float theta2, float phi, Shader s, int highlight, boolean asWireframe, Matrix4d t) void
drawString
(int x, int y, String text, Font font, Tuple3f color) void
drawSupershape
(float a, float b, float m1, float n11, float n12, float n13, float m2, float n21, float n22, float n23, Shader s, int highlight, boolean asWireframe, Matrix4d t) Draw a supershape around the origin (0/0/0).void
drawTextBlock
(String caption, Font font, float depth, Shader s, int highlight, boolean asWireframe, Matrix4d t) float
estimateScaleAt
(Tuple3f point) void
fillRectangle
(int x, int y, int w, int h, Tuple3f color) void
finish()
Should be called after all renderables have been processed.int
float
getFontMetrics
(Font font) getPool()
double
boolean
getWindowPos
(Tuple3f location, Tuple2f out) Computes the window coordinates in pixels of a location in the current object coordinates.void
initSceneExtent
(GLDisplay disp) Initializes values for calculation of scene extend.boolean
-
Constructor Details
-
GLSLVolumeBuilder
public GLSLVolumeBuilder()
-
-
Method Details
-
finish
public void finish()Should be called after all renderables have been processed. If not, calculated scene information will be incorrect. -
initSceneExtent
Initializes values for calculation of scene extend. Should be called before nodes are processed by this class.- Parameters:
disp
- The Display using this class.
-
getRadius
public double getRadius()- Returns:
- The radius of a sphere containing all renderable nodes of the scene.
-
getCenter
- Returns:
- The center of a sphere containing all renderable nodes of the scene.
-
drawParallelogram
public void drawParallelogram(float axis, Vector3f secondAxis, float scaleU, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawParallelogram
in interfaceRenderState
-
drawSphere
- Specified by:
drawSphere
in interfaceRenderState
-
drawSphereSegmentSolid
public void drawSphereSegmentSolid(float radius, float theta1, float theta2, float phi, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawSphereSegmentSolid
in interfaceRenderState
-
drawTextBlock
public void drawTextBlock(String caption, Font font, float depth, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawTextBlock
in interfaceRenderState
-
drawSupershape
public void drawSupershape(float a, float b, float m1, float n11, float n12, float n13, float m2, float n21, float n22, float n23, Shader s, int highlight, boolean asWireframe, Matrix4d t) Description copied from interface:RenderState
Draw a supershape around the origin (0/0/0). An implementation of Johan Gielis's Superformula which was published in the American Journal of Botany 90(3): 333–338. 2003. INVITED SPECIAL PAPER A GENERIC GEOMETRIC TRANSFORMATION THAT UNIFIES A WIDE RANGE OF NATURAL AND ABSTRACT SHAPES- Specified by:
drawSupershape
in interfaceRenderState
- Parameters:
a
- , b length of curvest
- transformation of the point cloud
-
drawBox
public void drawBox(float halfWidth, float halfLength, float height, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawBox
in interfaceRenderState
-
drawLamella
public void drawLamella(float halfWidth, float halfLength, float height, float a, float b, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawLamella
in interfaceRenderState
a
- amplitudeb
- frequency
-
drawFrustum
public void drawFrustum(float height, float baseRadius, float topRadius, boolean baseClosed, boolean topClosed, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawFrustum
in interfaceRenderState
-
drawPolygons
public void drawPolygons(Polygonizable polygons, Object obj, boolean asNode, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawPolygons
in interfaceRenderState
-
needsData
public boolean needsData()- Returns:
- true, if the calculated scene extend needs to be updated.
-
getCurrentRadius
public float getCurrentRadius()- Returns:
- The radius of the last processed renderable node.
-
getCurrentVolume
- Returns:
- The Volume-Object for the last processed renderable.
This will also reset all information about this renderable to
default values. It should be called after
getCurrentRadius()
-
drawLine
- Specified by:
drawLine
in interfaceRenderState
-
drawPlane
- Specified by:
drawPlane
in interfaceRenderState
-
drawPoint
- Specified by:
drawPoint
in interfaceRenderState
-
drawPointCloud
public void drawPointCloud(float[] locations, float pointSize, Tuple3f color, int highlight, Matrix4d t) Description copied from interface:RenderState
Draw a set of points. The array locations contains a sequence of points given as triples of floats for x, y and z position of each point. If the same reference for the array location is passed in the implementation might assume that the contents of the array are the same as well. This is necessary for GLDisplay, for instance, to ensure a performant implementation. The class PointCloud ensures that this is the case.- Specified by:
drawPointCloud
in interfaceRenderState
- Parameters:
locations
- array containing a sequence (x,y,z) of pointspointSize
- size of the point on screencolor
- color of the pointt
- transformation of the point cloud
-
drawRectangle
- Specified by:
drawRectangle
in interfaceRenderState
-
drawString
- Specified by:
drawString
in interfaceRenderState
-
estimateScaleAt
- Specified by:
estimateScaleAt
in interfaceRenderState
-
fillRectangle
- Specified by:
fillRectangle
in interfaceRenderState
-
getCurrentHighlight
public int getCurrentHighlight()- Specified by:
getCurrentHighlight
in interfaceRenderState
-
getCurrentShader
- Specified by:
getCurrentShader
in interfaceRenderState
-
getFontMetrics
- Specified by:
getFontMetrics
in interfaceRenderState
-
getPool
- Specified by:
getPool
in interfaceRenderState
-
getRenderGraphState
- Specified by:
getRenderGraphState
in interfaceRenderState
-
getWindowPos
Description copied from interface:RenderState
Computes the window coordinates in pixels of a location in the current object coordinates.- Specified by:
getWindowPos
in interfaceRenderState
- Parameters:
location
- a location in local object coordinatesout
- the computed window coordinates are placed in here- Returns:
true
iff the window coordinates are valid (i.e., the location is in the clipping region)
-
drawFrustumIrregular
public void drawFrustumIrregular(float height, int sectorCount, float[] baseRadii, float[] topRadii, boolean baseClosed, boolean topclosed, float scaleV, Shader s, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawFrustumIrregular
in interfaceRenderState
-
drawPrismRectangular
public void drawPrismRectangular(float y, float xPos, float xNeg, float zPos, float zNeg, int highlight, boolean asWireframe, Matrix4d t) - Specified by:
drawPrismRectangular
in interfaceRenderState
-