update volume shaders and add drawString3D function

This commit is contained in:
wyq 2022-07-21 08:25:09 +08:00
parent 8fc7ce5028
commit 4d5d7054e9
12 changed files with 244 additions and 261 deletions

View File

@ -23,7 +23,8 @@ import org.meteoinfo.geometry.shape.PointZ;
*/ */
public class ChartText3D extends ChartText { public class ChartText3D extends ChartText {
private double z; private double z;
private PointZ zdir = null; private PointZ zdir = null;
private boolean draw3D = false;
/** /**
* Get z coordinate value * Get z coordinate value
@ -89,6 +90,22 @@ public class ChartText3D extends ChartText {
} }
this.setZDir(x1, y1, z1); this.setZDir(x1, y1, z1);
} }
/**
* Get whether draw text at 3D location
* @return Boolean
*/
public boolean isDraw3D() {
return this.draw3D;
}
/**
* Set whether draw text at 3D location
* @param value Boolean
*/
public void setDraw3D(boolean value) {
this.draw3D = value;
}
/** /**
* Set point * Set point

View File

@ -1155,6 +1155,14 @@ public class Plot3DGL extends Plot implements GLEventListener {
this.graphics.remove(this.graphics.size() - 1); this.graphics.remove(this.graphics.size() - 1);
} }
/**
* Remove all graphics
*/
public void removeAllGraphics() {
this.graphics.clear();
this.renderMap.clear();
}
/** /**
* Set auto extent * Set auto extent
*/ */
@ -1257,7 +1265,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
//Draw text //Draw text
for (int m = 0; m < this.graphics.getNumGraphics(); m++) { /*for (int m = 0; m < this.graphics.getNumGraphics(); m++) {
Graphic graphic = this.graphics.get(m); Graphic graphic = this.graphics.get(m);
if (graphic.getNumGraphics() == 1) { if (graphic.getNumGraphics() == 1) {
Shape shape = graphic.getGraphicN(0).getShape(); Shape shape = graphic.getGraphicN(0).getShape();
@ -1272,7 +1280,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
} }
} }
} }*/
//Stop lighting //Stop lighting
if (this.lighting.isEnable()) { if (this.lighting.isEnable()) {
@ -2363,6 +2371,37 @@ public class Plot3DGL extends Plot implements GLEventListener {
return rect; return rect;
} }
Rectangle2D drawString3D(GL2 gl, ChartText3D text3D, float vx, float vy, float vz) {
return drawString3D(gl, text3D.getText(), text3D.getFont(), text3D.getColor(), vx, vy, vz);
}
Rectangle2D drawString3D(GL2 gl, String str, Font font, Color color, float vx, float vy, float vz) {
//Get screen coordinates
Vector2f coord = this.toScreen(vx, vy, vz);
float x = coord.x;
float y = coord.y;
//Rendering text string
TextRenderer textRenderer;
if (this.dpiScale == 1) {
textRenderer = new TextRenderer(font, true, true);
} else {
textRenderer = new TextRenderer(new Font(font.getFontName(), font.getStyle(),
(int)(font.getSize() * (1 + (this.dpiScale - 1) * 0.8))), true, true);
}
textRenderer.beginRendering(this.width, this.height, false);
//textRenderer.begin3DRendering();
textRenderer.setColor(color);
textRenderer.setSmoothing(true);
Rectangle2D rect = textRenderer.getBounds(str.subSequence(0, str.length()));
textRenderer.draw3D(str, x, y, vz, 1.0f);
//textRenderer.draw3D(str, vx, vy, vz, 1.0f);
textRenderer.endRendering();
//textRenderer.end3DRendering();
return rect;
}
void drawTitle() { void drawTitle() {
if (title != null) { if (title != null) {
//Rendering text string //Rendering text string
@ -2486,7 +2525,11 @@ public class Plot3DGL extends Plot implements GLEventListener {
this.drawPoint(gl, graphic); this.drawPoint(gl, graphic);
break; break;
case TEXT: case TEXT:
//this.drawText(gl, (ChartText3D) shape); if (this.clipPlane)
this.disableClipPlane(gl);
this.drawText(gl, (ChartText3D) shape);
if (this.clipPlane)
this.enableClipPlane(gl);
break; break;
case POLYLINE: case POLYLINE:
case POLYLINE_Z: case POLYLINE_Z:
@ -2543,7 +2586,16 @@ public class Plot3DGL extends Plot implements GLEventListener {
protected void drawText(GL2 gl, ChartText3D text) { protected void drawText(GL2 gl, ChartText3D text) {
Vector3f xyz = this.transform.transform((float) text.getX(), (float) text.getY(), (float) text.getZ()); Vector3f xyz = this.transform.transform((float) text.getX(), (float) text.getY(), (float) text.getZ());
this.drawString(gl, text, xyz.x, xyz.y, xyz.z, text.getXAlign(), text.getYAlign()); if (text.isDraw3D()) {
this.drawString3D(gl, text, xyz.x, xyz.y, xyz.z);
} else {
this.drawString(gl, text, xyz.x, xyz.y, xyz.z, text.getXAlign(), text.getYAlign());
}
}
protected void drawText3D(GL2 gl, ChartText3D text) {
Vector3f xyz = this.transform.transform((float) text.getX(), (float) text.getY(), (float) text.getZ());
this.drawString3D(gl, text, xyz.x, xyz.y, xyz.z);
} }
private void drawPoint(GL2 gl, Graphic graphic) { private void drawPoint(GL2 gl, Graphic graphic) {

View File

@ -323,7 +323,7 @@ public class VolumeRender extends JOGLGraphicRender {
gl.glBindTexture(GL_TEXTURE_3D, this.normalsTexture); gl.glBindTexture(GL_TEXTURE_3D, this.normalsTexture);
} }
gl.glDisable(GL_DEPTH_TEST); //gl.glDisable(GL_DEPTH_TEST);
gl.glDrawArrays(GL_TRIANGLES, 0, volume.getVertexNumber()); // Starting from vertex 0; 3 vertices total -> 1 triangle gl.glDrawArrays(GL_TRIANGLES, 0, volume.getVertexNumber()); // Starting from vertex 0; 3 vertices total -> 1 triangle
@ -335,7 +335,7 @@ public class VolumeRender extends JOGLGraphicRender {
gl.glBindTexture(GL_TEXTURE_3D, 0); gl.glBindTexture(GL_TEXTURE_3D, 0);
//Program.destroyAllPrograms(gl); //Program.destroyAllPrograms(gl);
gl.glUseProgram(0); gl.glUseProgram(0);
gl.glEnable(GL_DEPTH_TEST); //gl.glEnable(GL_DEPTH_TEST);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -5,6 +5,7 @@
#define mgl_FragColor gl_FragColor #define mgl_FragColor gl_FragColor
#endif #endif
uniform mat4 MVP;
uniform vec2 viewSize; uniform vec2 viewSize;
uniform mat4 iV; uniform mat4 iV;
uniform mat4 iP; uniform mat4 iP;
@ -16,91 +17,9 @@ uniform vec3 aabbMin;
uniform vec3 aabbMax; uniform vec3 aabbMax;
uniform bool orthographic; uniform bool orthographic;
uniform float brightness; uniform float brightness;
struct Ray { #include volumeBase.glsl
vec3 origin;
vec3 direction;
vec3 inv_direction;
int sign[3];
};
Ray makeRay(vec3 origin, vec3 direction) {
vec3 inv_direction = vec3(1.0) / direction;
int sign[3];
sign[0] = inv_direction.x < 0.0 ? 1 : 0;
sign[1] = inv_direction.y < 0.0 ? 1 : 0;
sign[2] = inv_direction.z < 0.0 ? 1 : 0;
return Ray(
origin,
direction,
inv_direction,
sign
);
}
Ray createRayOrthographic(vec2 uv)
{
float far = 5.0;
// Transform the camera origin to world space
vec4 origin = iP * vec4(uv, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, far, 1.0);
// Transform the direction from camera to world space and normalize
image = iV* image;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
Ray createRayPerspective(vec2 uv)
{
// Transform the camera origin to world space
vec4 origin = iP * vec4(0.0, 0.0, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, 1.0, 1.0);
// Transform the direction from camera to world space and normalize
image = iV * image;
image = image / image.w;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
void intersect(
in Ray ray, in vec3 aabb[2],
out float tmin, out float tmax
){
float tymin, tymax, tzmin, tzmax;
tmin = (aabb[ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tmax = (aabb[1-ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tymin = (aabb[ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tymax = (aabb[1-ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tzmin = (aabb[ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tzmax = (aabb[1-ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tmin = max(max(tmin, tymin), tzmin);
tmax = min(min(tmax, tymax), tzmax);
}
vec4 premultiplyAlpha(vec4 color)
{
//return vec4(color.rgb * color.a, color.a);
return color * color.a;
}
// GL_ONE_MINUS_DST_ALPHA, GL_ONE
void blendToBack(inout vec4 accum, vec4 color)
{
//accum = color * color.a * (1-accum.a) + accum;
accum = premultiplyAlpha(color) * (1.0 - accum.a) + accum;
}
void main(){ void main(){
vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0; vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0;
@ -131,7 +50,7 @@ void main(){
float px = 0.0; float px = 0.0;
vec4 pxColor = vec4(0.0, 0.0, 0.0, 0.0); vec4 pxColor = vec4(0.0, 0.0, 0.0, 0.0);
vec3 texCo = vec3(0.0, 0.0, 0.0); vec3 texCo = vec3(0.0, 0.0, 0.0);
float tt = tmin;
for(int count = 0; count < sampleCount; count++){ for(int count = 0; count < sampleCount; count++){
texCo = mix(end, start, float(count) / float(sampleCount));// - originOffset; texCo = mix(end, start, float(count) / float(sampleCount));// - originOffset;
@ -145,11 +64,19 @@ void main(){
//value = value + pxColor - pxColor * value.a; //value = value + pxColor - pxColor * value.a;
blendToBack(value, pxColor); blendToBack(value, pxColor);
if(value.a >= 0.95){ if (tt == tmin && pxColor.a > 0.01) {
value.a = 1.0; tt = tmax - float(count)/float(sampleCount)*(tmax - tmin);
}
if (value.a >= 0.95) {
break; break;
} }
} }
mgl_FragColor = value * brightness; mgl_FragColor = value * brightness;
gl_FragDepth = calculateDepth(ray.origin + ray.direction * tt);
if (value.a < 0.01) {
gl_FragDepth = 1.0;
}
} }

View File

@ -5,6 +5,7 @@
#define mgl_FragColor gl_FragColor #define mgl_FragColor gl_FragColor
#endif #endif
uniform mat4 MVP;
uniform vec2 viewSize; uniform vec2 viewSize;
uniform mat4 iV; uniform mat4 iV;
uniform mat4 iP; uniform mat4 iP;
@ -19,75 +20,7 @@ uniform bool orthographic;
uniform float brightness; uniform float brightness;
struct Ray { #include volumeBase.glsl
vec3 origin;
vec3 direction;
vec3 inv_direction;
int sign[3];
};
Ray makeRay(vec3 origin, vec3 direction) {
vec3 inv_direction = vec3(1.0) / direction;
int sign[3];
sign[0] = inv_direction.x < 0.0 ? 1 : 0;
sign[1] = inv_direction.y < 0.0 ? 1 : 0;
sign[2] = inv_direction.z < 0.0 ? 1 : 0;
return Ray(
origin,
direction,
inv_direction,
sign
);
}
Ray createRayOrthographic(vec2 uv)
{
float far = 5.0;
// Transform the camera origin to world space
vec4 origin = iP * vec4(uv, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, far, 1.0);
// Transform the direction from camera to world space and normalize
image = iV* image;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
Ray createRayPerspective(vec2 uv)
{
// Transform the camera origin to world space
vec4 origin = iP * vec4(0.0, 0.0, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, 1.0, 1.0);
// Transform the direction from camera to world space and normalize
image = iV * image;
image = image / image.w;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
void intersect(
in Ray ray, in vec3 aabb[2],
out float tmin, out float tmax
){
float tymin, tymax, tzmin, tzmax;
tmin = (aabb[ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tmax = (aabb[1-ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tymin = (aabb[ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tymax = (aabb[1-ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tzmin = (aabb[ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tzmax = (aabb[1-ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tmin = max(max(tmin, tymin), tzmin);
tmax = min(min(tmax, tymax), tzmax);
}
void main(){ void main(){
vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0; vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0;
@ -116,13 +49,20 @@ void main(){
float px = 0.0; float px = 0.0;
vec4 pxColor = vec4(0.0, 0.0, 0.0, 0.0); vec4 pxColor = vec4(0.0, 0.0, 0.0, 0.0);
vec3 texCo = vec3(0.0, 0.0, 0.0); vec3 texCo = vec3(0.0, 0.0, 0.0);
float tt = tmin;
float px0 = 0.0;
for(int count = 0; count < sampleCount; count++){ for(int count = 0; count < sampleCount; count++){
texCo = mix(start, end, float(count)/float(sampleCount));// - originOffset; texCo = mix(end, start, float(count)/float(sampleCount));// - originOffset;
px = max(px, texture3D(tex, texCo).r); px = max(px, texture3D(tex, texCo).r);
if (px > px0) {
tt = tmax - float(count)/float(sampleCount)*(tmax - tmin);
}
px0 = px;
if(px >= 0.99){ if(px >= 0.99){
break; break;
} }
@ -130,4 +70,9 @@ void main(){
pxColor = texture2D(colorMap, vec2(px, 0.0)); pxColor = texture2D(colorMap, vec2(px, 0.0));
mgl_FragColor = pxColor * brightness; mgl_FragColor = pxColor * brightness;
gl_FragDepth = calculateDepth(ray.origin + ray.direction * tt);
if (pxColor.a < 0.01) {
gl_FragDepth = 1.0;
}
} }

View File

@ -5,6 +5,7 @@
#define mgl_FragColor gl_FragColor #define mgl_FragColor gl_FragColor
#endif #endif
uniform mat4 MVP;
uniform vec2 viewSize; uniform vec2 viewSize;
uniform mat4 iV; uniform mat4 iV;
uniform mat4 iP; uniform mat4 iP;
@ -20,94 +21,13 @@ uniform bool orthographic;
uniform float brightness; uniform float brightness;
#include volumeBase.glsl
vec3 ambientLight = vec3(0.34, 0.32, 0.32); vec3 ambientLight = vec3(0.34, 0.32, 0.32);
vec3 directionalLight = vec3(0.5, 0.5, 0.5); vec3 directionalLight = vec3(0.5, 0.5, 0.5);
vec3 lightVector = normalize(vec3(-1.0, -1.0, 1.0)); vec3 lightVector = normalize(vec3(-1.0, -1.0, 1.0));
vec3 specularColor = vec3(0.5, 0.5, 0.5); vec3 specularColor = vec3(0.5, 0.5, 0.5);
struct Ray {
vec3 origin;
vec3 direction;
vec3 inv_direction;
int sign[3];
};
Ray makeRay(vec3 origin, vec3 direction) {
vec3 inv_direction = vec3(1.0) / direction;
int sign[3];
sign[0] = inv_direction.x < 0.0 ? 1 : 0;
sign[1] = inv_direction.y < 0.0 ? 1 : 0;
sign[2] = inv_direction.z < 0.0 ? 1 : 0;
return Ray(
origin,
direction,
inv_direction,
sign
);
}
Ray createRayOrthographic(vec2 uv)
{
float far = 5.0;
// Transform the camera origin to world space
vec4 origin = iP * vec4(uv, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, far, 1.0);
// Transform the direction from camera to world space and normalize
image = iV* image;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
Ray createRayPerspective(vec2 uv)
{
// Transform the camera origin to world space
vec4 origin = iP * vec4(0.0, 0.0, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, 1.0, 1.0);
// Transform the direction from camera to world space and normalize
image = iV * image;
image = image / image.w;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
void intersect(
in Ray ray, in vec3 aabb[2],
out float tmin, out float tmax
){
float tymin, tymax, tzmin, tzmax;
tmin = (aabb[ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tmax = (aabb[1-ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tymin = (aabb[ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tymax = (aabb[1-ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tzmin = (aabb[ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tzmax = (aabb[1-ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tmin = max(max(tmin, tymin), tzmin);
tmax = min(min(tmax, tymax), tzmax);
}
vec4 premultiplyAlpha(vec4 color)
{
//return vec4(color.rgb * color.a, color.a);
return color * color.a;
}
// GL_ONE_MINUS_DST_ALPHA, GL_ONE
void blendToBack(inout vec4 accum, vec4 color)
{
//accum = color * color.a * (1-accum.a) + accum;
accum = premultiplyAlpha(color) * (1.0 - accum.a) + accum;
}
void main(){ void main(){
vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0; vec2 vUV = 2.0 * (gl_FragCoord.xy + vec2(0.5, 0.5)) / viewSize - 1.0;
Ray ray; Ray ray;
@ -140,7 +60,7 @@ void main(){
vec3 texCo = vec3(0.0, 0.0, 0.0); vec3 texCo = vec3(0.0, 0.0, 0.0);
vec3 normal = vec3(0.0, 0.0, 0.0); vec3 normal = vec3(0.0, 0.0, 0.0);
vec4 zero = vec4(0.0); vec4 zero = vec4(0.0);
float tt = tmin;
for(int count = 0; count < sampleCount; count++){ for(int count = 0; count < sampleCount; count++){
texCo = mix(end, start, float(count)/float(sampleCount));// - originOffset; texCo = mix(end, start, float(count)/float(sampleCount));// - originOffset;
@ -173,10 +93,19 @@ void main(){
//value = value + pxColor - pxColor*value.a; //value = value + pxColor - pxColor*value.a;
blendToBack(value, pxColor); blendToBack(value, pxColor);
if (tt == tmin && pxColor.a > 0.01) {
tt = tmax - float(count)/float(sampleCount)*(tmax - tmin);
}
if(value.a >= 0.95){ if(value.a >= 0.95){
break; break;
} }
} }
mgl_FragColor = value * brightness; mgl_FragColor = value * brightness;
gl_FragDepth = calculateDepth(ray.origin + ray.direction * tt);
if (value.a < 0.01) {
gl_FragDepth = 1.0;
}
} }

View File

@ -0,0 +1,108 @@
struct Ray {
vec3 origin;
vec3 direction;
vec3 inv_direction;
int sign[3];
};
Ray makeRay(vec3 origin, vec3 direction) {
vec3 inv_direction = vec3(1.0) / direction;
int sign[3];
sign[0] = inv_direction.x < 0.0 ? 1 : 0;
sign[1] = inv_direction.y < 0.0 ? 1 : 0;
sign[2] = inv_direction.z < 0.0 ? 1 : 0;
return Ray(
origin,
direction,
inv_direction,
sign
);
}
Ray createRay(vec2 uv)
{
float far = 5.0;
// Transform the camera origin to world space
vec4 origin = iP * vec4(uv, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, far, 1.0);
// Transform the direction from camera to world space and normalize
image = iV* image;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
Ray createRayOrthographic(vec2 uv)
{
float far = 5.0;
// Transform the camera origin to world space
vec4 origin = iP * vec4(uv, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, far, 1.0);
// Transform the direction from camera to world space and normalize
image = iV* image;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
Ray createRayPerspective(vec2 uv)
{
// Transform the camera origin to world space
vec4 origin = iP * vec4(0.0, 0.0, 0.0, 1.0);
origin = iV * origin;
origin = origin / origin.w;
// Invert the perspective projection of the view-space position
vec4 image = iP * vec4(uv, 1.0, 1.0);
// Transform the direction from camera to world space and normalize
image = iV * image;
image = image / image.w;
vec4 direction = normalize(origin - image);
return makeRay(origin.xyz, direction.xyz);
}
void intersect(
in Ray ray, in vec3 aabb[2],
out float tmin, out float tmax
){
float tymin, tymax, tzmin, tzmax;
tmin = (aabb[ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tmax = (aabb[1-ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x;
tymin = (aabb[ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tymax = (aabb[1-ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y;
tzmin = (aabb[ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tzmax = (aabb[1-ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z;
tmin = max(max(tmin, tymin), tzmin);
tmax = min(min(tmax, tymax), tzmax);
}
vec4 premultiplyAlpha(vec4 color)
{
//return vec4(color.rgb * color.a, color.a);
return color * color.a;
}
// GL_ONE_MINUS_DST_ALPHA, GL_ONE
void blendToBack(inout vec4 accum, vec4 color)
{
//accum = color * color.a * (1-accum.a) + accum;
accum = premultiplyAlpha(color) * (1.0 - accum.a) + accum;
}
float calculateDepth(vec3 pos)
{
vec4 ndc = MVP * vec4(pos, 1.0);
ndc.xyz /= ndc.w;
return 0.5 * (gl_DepthRange.diff * ndc.z + (gl_DepthRange.near + gl_DepthRange.far));
//return ndc.z * 0.5 + 0.5;
}

View File

@ -67,7 +67,7 @@ import java.util.zip.ZipInputStream;
public static String getVersion(){ public static String getVersion(){
String version = GlobalUtil.class.getPackage().getImplementationVersion(); String version = GlobalUtil.class.getPackage().getImplementationVersion();
if (version == null || version.equals("")) { if (version == null || version.equals("")) {
version = "3.3.13"; version = "3.3.14";
} }
return version; return version;
} }

View File

@ -298,7 +298,7 @@ public class GraphicCollection extends Graphic implements Iterator {
/** /**
* Get graphic list size * Get graphic list size
* *
* @return Gaphic list size * @return Graphic list size
*/ */
public int size() { public int size() {
return this.graphics.size(); return this.graphics.size();

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile"> <MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\taylor"> <Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\toolbox\miml\regression"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamslice"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamslice"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
@ -16,17 +13,22 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\taylor"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\taylor"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\text"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
</Path> </Path>
<File> <File>
<OpenedFiles> <OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\geoshow\geoshow_proj_merc_image.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_streamslice.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\plot_cuace_3d_volume_specular.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\taylor\taylor_custom_std_max.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1.py"/>
</OpenedFiles> </OpenedFiles>
<RecentFiles> <RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\geoshow\geoshow_proj_merc_image.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_streamslice.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\plot_cuace_3d_volume_specular.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\taylor\taylor_custom_std_max.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1.py"/>
</RecentFiles> </RecentFiles>
</File> </File>
<Font> <Font>
@ -34,5 +36,5 @@
</Font> </Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/> <LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/> <Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/> <Startup MainFormLocation="-7,0" MainFormSize="1417,799"/>
</MeteoInfo> </MeteoInfo>

View File

@ -1653,6 +1653,9 @@ class Axes3D(Axes):
text.setZDir(zdir[0], zdir[1], zdir[2]) text.setZDir(zdir[0], zdir[1], zdir[2])
else: else:
text.setZDir(zdir) text.setZDir(zdir)
draw3D = kwargs.pop('draw3d', None)
if not draw3D is None:
text.setDraw3D(draw3D)
if isinstance(x, np.NDArray): if isinstance(x, np.NDArray):
graphic = GraphicFactory.createTexts3D(x._array, y._array, z._array, s._array, text) graphic = GraphicFactory.createTexts3D(x._array, y._array, z._array, s._array, text)