mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
to version 3.5.7
This commit is contained in:
parent
cc40c304bb
commit
c781c42747
@ -398,9 +398,6 @@ public class MeshGraphic extends GraphicCollection3D {
|
||||
* @param vData Vertex position
|
||||
*/
|
||||
public void calculateNormalVectors(float[] vData) {
|
||||
if (this.vertexNormal != null)
|
||||
return;
|
||||
|
||||
int n = this.getVertexNumber();
|
||||
this.vertexNormal = new float[n * 3];
|
||||
Vector3f v, left, right, up, down;
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package org.meteoinfo.chart.graphic;
|
||||
|
||||
public class Model {
|
||||
protected TriMeshGraphic triMeshGraphic;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Model() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param triMeshGraphic Triangle mesh graphic
|
||||
*/
|
||||
public Model(TriMeshGraphic triMeshGraphic) {
|
||||
this.triMeshGraphic = triMeshGraphic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get triangle mesh graphic
|
||||
* @return Triangle mesh graphic
|
||||
*/
|
||||
public TriMeshGraphic getTriMeshGraphic() {
|
||||
return this.triMeshGraphic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set triangle mesh graphic
|
||||
* @param value Triangle mesh graphic
|
||||
*/
|
||||
public void setTriMeshGraphic(TriMeshGraphic value) {
|
||||
this.triMeshGraphic = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build triangle mesh graphic
|
||||
*/
|
||||
protected void buildTriMeshGraphic() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,6 @@ public class TriMeshGraphic extends GraphicCollection3D {
|
||||
public void setVertexPosition(float[] value) {
|
||||
vertexPosition = value;
|
||||
updateExtent();
|
||||
calculateNormalVectors(vertexPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,6 +100,14 @@ public class TriMeshGraphic extends GraphicCollection3D {
|
||||
return this.vertexIndices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vertex indices
|
||||
* @param value Vertex indices
|
||||
*/
|
||||
public void setVertexIndices(int[] value) {
|
||||
this.vertexIndices = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vertex color data
|
||||
* @return Vertex color data
|
||||
@ -117,6 +124,14 @@ public class TriMeshGraphic extends GraphicCollection3D {
|
||||
return vertexNormal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vertex normal
|
||||
* @param value Vertex normal
|
||||
*/
|
||||
public void setVertexNormal(float[] value) {
|
||||
this.vertexNormal = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether using interpolated coloring for each face
|
||||
* @return Boolean
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
package org.meteoinfo.chart.graphic.cylinder;
|
||||
|
||||
import com.jogamp.opengl.GL2;
|
||||
import org.joml.Vector2f;
|
||||
import org.joml.Vector3f;
|
||||
import org.meteoinfo.chart.graphic.Model;
|
||||
import org.meteoinfo.chart.graphic.TriMeshGraphic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Cylinder {
|
||||
public class Cylinder extends Model {
|
||||
private float baseRadius;
|
||||
private float topRadius;
|
||||
private float height;
|
||||
@ -44,6 +47,7 @@ public class Cylinder {
|
||||
this.smooth = smooth;
|
||||
|
||||
updateVertices();
|
||||
//buildTriMeshGraphic();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,6 +64,29 @@ public class Cylinder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildTriMeshGraphic() {
|
||||
this.triMeshGraphic = new TriMeshGraphic();
|
||||
int n = this.vertices.size();
|
||||
float[] vertexPosition = new float[n * 3];
|
||||
float[] vertexNormal = new float[n * 3];
|
||||
Vector3f v;
|
||||
for (int i = 0, j = 0; i < n; i++, j+=3) {
|
||||
v = this.vertices.get(i);
|
||||
vertexPosition[j] = v.x;
|
||||
vertexPosition[j + 1] = v.y;
|
||||
vertexPosition[j + 2] = v.z;
|
||||
v = this.normals.get(i);
|
||||
vertexNormal[j] = v.x;
|
||||
vertexNormal[j + 1] = v.y;
|
||||
vertexNormal[j + 2] = v.z;
|
||||
}
|
||||
int[] vertexIndices = this.indices.stream().mapToInt(Integer::intValue).toArray();
|
||||
this.triMeshGraphic.setVertexPosition(vertexPosition);
|
||||
this.triMeshGraphic.setVertexNormal(vertexNormal);
|
||||
this.triMeshGraphic.setVertexIndices(vertexIndices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base radius
|
||||
* @return Base radius
|
||||
@ -235,9 +262,7 @@ public class Cylinder {
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
interleavedVertices.add(vertices.get(i));
|
||||
|
||||
interleavedVertices.add(normals.get(i));
|
||||
|
||||
//interleavedVertices.add(texCoords.get(j));
|
||||
//interleavedVertices.add(texCoords.get(j+1));
|
||||
}
|
||||
@ -652,4 +677,12 @@ public class Cylinder {
|
||||
|
||||
return normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw cylinder
|
||||
* @param gl GL2 object
|
||||
*/
|
||||
public void draw(GL2 gl) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.meteoinfo.chart.graphic.pipe;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.meteoinfo.chart.jogl.Transform;
|
||||
import org.meteoinfo.geometry.shape.PointZ;
|
||||
import org.meteoinfo.geometry.shape.PolylineZShape;
|
||||
|
||||
@ -222,8 +222,6 @@ public class EarthGLPlot extends GLPlot {
|
||||
|
||||
gl.glPushMatrix();
|
||||
|
||||
Vector3f center = transform.getCenter();
|
||||
Vector3f scale = transform.getScale();
|
||||
this.modelViewMatrix = new Matrix4f();
|
||||
if (pitchAngle != 0) {
|
||||
float ss = getScale();
|
||||
@ -236,6 +234,10 @@ public class EarthGLPlot extends GLPlot {
|
||||
if (headAngle != 0) {
|
||||
modelViewMatrix.rotate((float) Math.toRadians(headAngle), 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
modelViewMatrixR = new Matrix4f(modelViewMatrix);
|
||||
|
||||
Vector3f center = transform.getCenter();
|
||||
Vector3f scale = transform.getScale();
|
||||
modelViewMatrix.scale(scale);
|
||||
modelViewMatrix.translate(center.negate());
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ public class GLPlot extends Plot {
|
||||
protected Matrix4f modelViewMatrix = new Matrix4f();
|
||||
protected Matrix4f projectionMatrix = new Matrix4f();
|
||||
protected Matrix4f viewProjMatrix = new Matrix4f();
|
||||
protected Matrix4f modelViewMatrixR = new Matrix4f();
|
||||
|
||||
protected float angleX;
|
||||
protected float angleY;
|
||||
@ -1230,14 +1231,16 @@ public class GLPlot extends Plot {
|
||||
|
||||
gl.glPushMatrix();
|
||||
|
||||
Vector3f center = transform.getCenter();
|
||||
Vector3f scale = transform.getScale();
|
||||
this.modelViewMatrix = new Matrix4f();
|
||||
modelViewMatrix.rotate((float) Math.toRadians(angleX), 1.0f, 0.0f, 0.0f);
|
||||
modelViewMatrix.rotate((float) Math.toRadians(angleY), 0.0f, 0.0f, 1.0f);
|
||||
if (headAngle != 0) {
|
||||
modelViewMatrix.rotate((float) Math.toRadians(headAngle), 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
modelViewMatrixR = new Matrix4f(modelViewMatrix);
|
||||
|
||||
Vector3f center = transform.getCenter();
|
||||
Vector3f scale = transform.getScale();
|
||||
modelViewMatrix.scale(scale);
|
||||
modelViewMatrix.translate(center.negate());
|
||||
|
||||
@ -2568,6 +2571,7 @@ public class GLPlot extends Plot {
|
||||
pointRender.setOrthographic(this.orthographic);
|
||||
pointRender.setLighting(this.lighting);
|
||||
pointRender.updateMatrix();
|
||||
pointRender.setRotateModelView(this.modelViewMatrixR);
|
||||
pointRender.draw();
|
||||
break;
|
||||
case POLYLINE_Z:
|
||||
@ -2580,6 +2584,7 @@ public class GLPlot extends Plot {
|
||||
pipeRender.setOrthographic(this.orthographic);
|
||||
pipeRender.setLighting(this.lighting);
|
||||
pipeRender.updateMatrix();
|
||||
pipeRender.setRotateModelView(this.modelViewMatrixR);
|
||||
pipeRender.draw();
|
||||
} else {
|
||||
if (!this.renderMap.containsKey(graphic)) {
|
||||
@ -2590,6 +2595,7 @@ public class GLPlot extends Plot {
|
||||
lineRender.setOrthographic(this.orthographic);
|
||||
lineRender.setLighting(this.lighting);
|
||||
lineRender.updateMatrix();
|
||||
lineRender.setRotateModelView(this.modelViewMatrixR);
|
||||
lineRender.draw();
|
||||
}
|
||||
break;
|
||||
@ -2602,6 +2608,7 @@ public class GLPlot extends Plot {
|
||||
quiverRender.setOrthographic(this.orthographic);
|
||||
quiverRender.setLighting(this.lighting);
|
||||
quiverRender.updateMatrix();
|
||||
quiverRender.setRotateModelView(this.modelViewMatrixR);
|
||||
quiverRender.draw();
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -93,6 +93,7 @@ public class SphericalTransform {
|
||||
vertexPosition[i+2] = vector3f.z;
|
||||
}
|
||||
surfaceGraphic.setVertexPosition(vertexPosition);
|
||||
surfaceGraphic.calculateNormalVectors(vertexPosition);
|
||||
surfaceGraphic.updateVertexTexture();
|
||||
return surfaceGraphic;
|
||||
} else if (graphic instanceof IsosurfaceGraphics) {
|
||||
@ -118,6 +119,7 @@ public class SphericalTransform {
|
||||
vertexData[i+2] = vector3f.z;
|
||||
}
|
||||
meshGraphic.setVertexPosition(vertexData);
|
||||
meshGraphic.calculateNormalVectors(vertexData);
|
||||
return meshGraphic;
|
||||
} else if (graphic instanceof ParticleGraphics) {
|
||||
ParticleGraphics particleGraphics = (ParticleGraphics) graphic;
|
||||
|
||||
@ -20,6 +20,7 @@ public abstract class JOGLGraphicRender implements GraphicRender {
|
||||
protected Matrix4f viewProjMatrix = new Matrix4f();
|
||||
protected Matrix4f modelViewMatrix = new Matrix4f();
|
||||
protected Matrix4f projectionMatrix = new Matrix4f();
|
||||
protected Matrix4f modelViewMatrixR = new Matrix4f();
|
||||
protected boolean useShader = false;
|
||||
protected Lighting lighting = new Lighting();
|
||||
protected float dpiScale = 1.0f;
|
||||
@ -139,4 +140,12 @@ public abstract class JOGLGraphicRender implements GraphicRender {
|
||||
viewProjMatrix = projectionMatrix.
|
||||
mul(modelViewMatrix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rotate model view matrix
|
||||
* @param value Rotate model view matrix
|
||||
*/
|
||||
public void setRotateModelView(Matrix4f value) {
|
||||
this.modelViewMatrixR = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.meteoinfo.chart.render.jogl;
|
||||
|
||||
import com.jogamp.common.nio.Buffers;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2;
|
||||
import com.jogamp.opengl.util.GLBuffers;
|
||||
@ -152,11 +153,31 @@ public class LineRender extends JOGLGraphicRender {
|
||||
return vertexPosition;
|
||||
}
|
||||
|
||||
private void updateVertexPosition() {
|
||||
vertexPosition = new float[this.vertexNum * 3];
|
||||
int i = 0;
|
||||
linePointNumbers = new ArrayList<>();
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PolylineZShape shape = (PolylineZShape) graphic.getShape();
|
||||
for (Polyline line : shape.getPolylines()) {
|
||||
List<PointZ> ps = (List<PointZ>) line.getPointList();
|
||||
linePointNumbers.add(ps.size());
|
||||
for (PointZ p : ps) {
|
||||
vertexPosition[i] = transform.transform_x((float) p.X);
|
||||
vertexPosition[i + 1] = transform.transform_y((float) p.Y);
|
||||
vertexPosition[i + 2] = transform.transform_z((float) p.Z);
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConeVertex() {
|
||||
List<Vector3f> vertexPositionList = new ArrayList<>();
|
||||
List<Vector3f> vertexNormalList = new ArrayList<>();
|
||||
List<Vector4f> vertexColorList = new ArrayList<>();
|
||||
List<Integer> vertexIndices = new ArrayList<>();
|
||||
Cylinder cylinder = null;
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PolylineZShape shape = (PolylineZShape) graphic.getShape();
|
||||
int pointNum = shape.getPointNum();
|
||||
@ -171,11 +192,13 @@ public class LineRender extends JOGLGraphicRender {
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
slb = (StreamlineBreak) cbc.get(i);
|
||||
Cylinder cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
}
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.lookAt(v2.sub(v1, new Vector3f()));
|
||||
matrix.translate(v2);
|
||||
@ -208,10 +231,12 @@ public class LineRender extends JOGLGraphicRender {
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
Cylinder cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
}
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.lookAt(v2.sub(v1, new Vector3f()));
|
||||
matrix.translate(v2);
|
||||
@ -362,6 +387,10 @@ public class LineRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (this.streamline) {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboCone.get(0));
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vboCone.get(1));
|
||||
|
||||
@ -381,6 +410,8 @@ public class LineRender extends JOGLGraphicRender {
|
||||
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
gl.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.meteoinfo.chart.render.jogl;
|
||||
|
||||
import com.jogamp.common.nio.Buffers;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2;
|
||||
import com.jogamp.opengl.util.GLBuffers;
|
||||
@ -33,6 +34,7 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
private int sizePosition;
|
||||
private int sizeColor;
|
||||
private int sizeNormal;
|
||||
private float[] vertexPosition;
|
||||
private float[] vertexColor;
|
||||
private int[] vertexIndices;
|
||||
private List<Integer> linePointNumbers;
|
||||
@ -129,26 +131,24 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
}
|
||||
}
|
||||
|
||||
private float[] getVertexPosition() {
|
||||
float[] vertexData = new float[this.vertexNum * 3];
|
||||
private void updateVertexPosition() {
|
||||
vertexPosition = new float[this.vertexNum * 3];
|
||||
int i = 0;
|
||||
linePointNumbers = new ArrayList<>();
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PipeShape shape = (PipeShape) graphic.getShape();
|
||||
//shape.transform(transform);
|
||||
shape.transform(transform);
|
||||
Pipe pipe = shape.getPipe();
|
||||
linePointNumbers.add(pipe.getVertexCount());
|
||||
for (int j = 0; j < pipe.getContourCount(); j++) {
|
||||
for (Vector3f vector3f : shape.getPipe().getContour(j)) {
|
||||
vertexData[i] = vector3f.x;
|
||||
vertexData[i + 1] = vector3f.y;
|
||||
vertexData[i + 2] = vector3f.z;
|
||||
vertexPosition[i] = vector3f.x;
|
||||
vertexPosition[i + 1] = vector3f.y;
|
||||
vertexPosition[i + 2] = vector3f.z;
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vertexData;
|
||||
}
|
||||
|
||||
private void updateVertexIndices() {
|
||||
@ -207,6 +207,7 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
List<Vector3f> vertexNormalList = new ArrayList<>();
|
||||
List<Vector4f> vertexColorList = new ArrayList<>();
|
||||
List<Integer> vertexIndices = new ArrayList<>();
|
||||
Cylinder cylinder = null;
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PolylineZShape shape = (PolylineZShape) graphic.getShape();
|
||||
int pointNum = shape.getPointNum();
|
||||
@ -221,11 +222,13 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
slb = (StreamlineBreak) cbc.get(i);
|
||||
Cylinder cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
}
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.lookAt(v2.sub(v1, new Vector3f()));
|
||||
matrix.translate(v2);
|
||||
@ -260,10 +263,12 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
Cylinder cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
}
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.lookAt(v2.sub(v1, new Vector3f()));
|
||||
matrix.translate(v2);
|
||||
@ -326,8 +331,8 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
super.setTransform((Transform) transform.clone());
|
||||
|
||||
if (updateBuffer) {
|
||||
float[] vertexData = this.getVertexPosition();
|
||||
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
|
||||
this.updateVertexPosition();
|
||||
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexPosition);
|
||||
sizePosition = vertexBuffer.capacity() * Float.BYTES;
|
||||
|
||||
float[] vertexNormal = this.getVertexNormal();
|
||||
@ -393,6 +398,10 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
if (useShader) { // not working now
|
||||
program.use(gl);
|
||||
setUniforms();
|
||||
@ -441,5 +450,7 @@ public class PipeRender extends JOGLGraphicRender{
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
gl.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.meteoinfo.chart.render.jogl;
|
||||
|
||||
import com.jogamp.common.nio.Buffers;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2;
|
||||
import com.jogamp.opengl.util.GLBuffers;
|
||||
@ -164,13 +165,18 @@ public class PointRender extends JOGLGraphicRender {
|
||||
List<Vector4f> vertexColorList = new ArrayList<>();
|
||||
List<Integer> vertexIndexList = new ArrayList<>();
|
||||
Vector3f vp;
|
||||
float size = -1;
|
||||
Sphere sphere = null;
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PointZShape shape = (PointZShape) graphic.getShape();
|
||||
PointZ p = (PointZ) shape.getPoint();
|
||||
PointBreak pb = (PointBreak) graphic.getLegend();
|
||||
Sphere sphere = new Sphere(pb.getSize() * sphereScale * dpiScale, 36, 18);
|
||||
//vp = transform.transform((float) p.X, (float) p.Y, (float) p.Z);
|
||||
vp = new Vector3f((float) p.X, (float) p.Y, (float) p.Z);
|
||||
if (size != pb.getSize()) {
|
||||
size = pb.getSize();
|
||||
sphere = new Sphere(size * sphereScale * dpiScale, 36, 18);
|
||||
}
|
||||
vp = transform.transform((float) p.X, (float) p.Y, (float) p.Z);
|
||||
//vp = new Vector3f((float) p.X, (float) p.Y, (float) p.Z);
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.translate(vp);
|
||||
List<Vector3f> vertices = sphere.getVertices();
|
||||
@ -224,13 +230,18 @@ public class PointRender extends JOGLGraphicRender {
|
||||
private void updateSphereVertexPosition() {
|
||||
List<Vector3f> vertexPositionList = new ArrayList<>();
|
||||
Vector3f vp;
|
||||
float size = -1;
|
||||
Sphere sphere = null;
|
||||
for (Graphic graphic : this.graphics.getGraphics()) {
|
||||
PointZShape shape = (PointZShape) graphic.getShape();
|
||||
PointZ p = (PointZ) shape.getPoint();
|
||||
PointBreak pb = (PointBreak) graphic.getLegend();
|
||||
Sphere sphere = new Sphere(pb.getSize() * sphereScale * dpiScale, 36, 18);
|
||||
//vp = transform.transform((float) p.X, (float) p.Y, (float) p.Z);
|
||||
vp = new Vector3f((float) p.X, (float) p.Y, (float) p.Z);
|
||||
if (size != pb.getSize()) {
|
||||
size = pb.getSize();
|
||||
sphere = new Sphere(size * sphereScale * dpiScale, 36, 18);
|
||||
}
|
||||
vp = transform.transform((float) p.X, (float) p.Y, (float) p.Z);
|
||||
//vp = new Vector3f((float) p.X, (float) p.Y, (float) p.Z);
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.translate(vp);
|
||||
List<Vector3f> vertices = sphere.getVertices();
|
||||
@ -264,9 +275,9 @@ public class PointRender extends JOGLGraphicRender {
|
||||
if (this.vertexPosition == null) {
|
||||
this.updateVertex();
|
||||
} else {
|
||||
//this.updateVertex();
|
||||
//this.updateVertexPosition();
|
||||
//this.updateSphereVertexNormal();
|
||||
if (this.sphere) {
|
||||
this.updateSphereVertexPosition();
|
||||
}
|
||||
}
|
||||
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(this.vertexPosition);
|
||||
sizePosition = vertexBuffer.capacity() * Float.BYTES;
|
||||
@ -326,6 +337,10 @@ public class PointRender extends JOGLGraphicRender {
|
||||
gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
|
||||
gl.glColorPointer(4, GL.GL_FLOAT, 0, sizePosition);
|
||||
if (this.sphere) {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vbo.get(1));
|
||||
|
||||
gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
|
||||
@ -339,6 +354,8 @@ public class PointRender extends JOGLGraphicRender {
|
||||
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
gl.glPopMatrix();
|
||||
} else {
|
||||
boolean lightEnabled = this.lighting.isEnable();
|
||||
if (lightEnabled) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.meteoinfo.chart.render.jogl;
|
||||
|
||||
import com.jogamp.common.nio.Buffers;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2;
|
||||
import com.jogamp.opengl.util.GLBuffers;
|
||||
@ -34,6 +35,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
private int sizePosition;
|
||||
private int sizeColor;
|
||||
private IntBuffer vboCone;
|
||||
private Cylinder arrow;
|
||||
private float[] coneVertexPosition;
|
||||
private float[] coneVertexNormal;
|
||||
private float[] coneVertexColor;
|
||||
@ -80,6 +82,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
List<Vector3f> vertexNormalList = new ArrayList<>();
|
||||
List<Vector4f> vertexColorList = new ArrayList<>();
|
||||
List<Integer> vertexIndices = new ArrayList<>();
|
||||
Cylinder cylinder = null;
|
||||
for (int i = 0, pi = 0, ci = 0; i < quiverNumber; i++, pi+=6, ci+=8) {
|
||||
Graphic graphic = graphics.getGraphicN(i);
|
||||
WindArrow3D shape = (WindArrow3D) graphic.getShape();
|
||||
@ -87,8 +90,8 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
PointZ sp = (PointZ) shape.getPoint();
|
||||
PointZ ep = (PointZ) shape.getEndPoint();
|
||||
|
||||
Vector3f v1 = new Vector3f((float) sp.X, (float) sp.Y, (float) sp.Z);
|
||||
Vector3f v2 = new Vector3f((float) ep.X, (float) ep.Y, (float) ep.Z);
|
||||
Vector3f v1 = transform.transform((float) sp.X, (float) sp.Y, (float) sp.Z);
|
||||
Vector3f v2 = transform.transform((float) ep.X, (float) ep.Y, (float) ep.Z);
|
||||
float[] color = pb.getColor().getRGBComponents(null);
|
||||
vertexPosition[pi] = v1.x;
|
||||
vertexPosition[pi + 1] = v1.y;
|
||||
@ -99,8 +102,10 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
System.arraycopy(color, 0, vertexColor, ci, 4);
|
||||
System.arraycopy(color, 0, vertexColor, ci + 4, 4);
|
||||
|
||||
Cylinder cylinder = new Cylinder(shape.getHeadWidth() * 0.02f,
|
||||
0, shape.getHeadLength() * 0.02f, 8, 1, true);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(shape.getHeadWidth() * 0.02f,
|
||||
0, shape.getHeadLength() * 0.02f, 8, 1, true);
|
||||
}
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.lookAt(v2.sub(v1, new Vector3f()));
|
||||
matrix.translate(v2);
|
||||
@ -166,9 +171,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
super.setTransform((Transform) transform.clone());
|
||||
|
||||
if (updateBuffer) {
|
||||
if (this.vertexPosition == null) {
|
||||
this.updateVertexArrays();
|
||||
}
|
||||
this.updateVertexArrays();
|
||||
|
||||
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexPosition);
|
||||
sizePosition = vertexBuffer.capacity() * Float.BYTES;
|
||||
@ -217,6 +220,10 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
if (useShader) { // not working now
|
||||
program.use(gl);
|
||||
setUniforms();
|
||||
@ -267,5 +274,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
gl.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ import java.util.zip.ZipInputStream;
|
||||
public static String getVersion(){
|
||||
String version = GlobalUtil.class.getPackage().getImplementationVersion();
|
||||
if (version == null || version.equals("")) {
|
||||
version = "3.5.6";
|
||||
version = "3.5.7";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -1,34 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\particles"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\slice"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\stem"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamslice"/>
|
||||
<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 OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamslice"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\stem"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\slice"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\particles"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\text"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\scatter_sphere.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\streamslice_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\bar3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_sphere_radius.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\contour.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\scatter_sphere.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\streamslice_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\bar3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_sphere_radius.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\contour.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -36,5 +32,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1341,810"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user