mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add location argument in model function
This commit is contained in:
parent
5aba94c0dd
commit
30430acf37
@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
public class Model extends TriMeshGraphic {
|
||||
|
||||
protected Vector3f location = new Vector3f();
|
||||
protected Vector3f angle = new Vector3f();
|
||||
protected float scale = 1;
|
||||
|
||||
@ -16,6 +17,31 @@ public class Model extends TriMeshGraphic {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get location
|
||||
* @return Location
|
||||
*/
|
||||
public Vector3f getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set location
|
||||
* @param value Location
|
||||
*/
|
||||
public void setLocation(Vector3f value) {
|
||||
location = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set location
|
||||
* @param value Location
|
||||
*/
|
||||
public void setLocation(List<Number> value) {
|
||||
location = new Vector3f(value.get(0).floatValue(), value.get(1).floatValue(),
|
||||
value.get(2).floatValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get angle
|
||||
* @return The angle
|
||||
|
||||
@ -161,7 +161,8 @@ public class ModelRender extends JOGLGraphicRender {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
Matrix4f modelView = new Matrix4f(this.modelViewMatrixR);
|
||||
modelView.scale(this.model.getScale());
|
||||
modelView.translate(this.transform.transform(model.getLocation()));
|
||||
modelView.scale(model.getScale());
|
||||
modelView.rotateXYZ(model.getRadians());
|
||||
gl.glLoadMatrixf(modelView.get(fb));
|
||||
|
||||
|
||||
@ -34,5 +34,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1361,797"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -1382,6 +1382,9 @@ class Axes3DGL(Axes3D):
|
||||
graphics = GraphicFactory.model(T._array, x._array, y._array, z._array,
|
||||
normal._array, ls)
|
||||
|
||||
location = kwargs.pop('location', None)
|
||||
if location is not None:
|
||||
graphics.setLocation(location)
|
||||
angle = kwargs.pop('angle', None)
|
||||
if angle is not None:
|
||||
graphics.setAngle(angle)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user