@Override public <T0, T1> void cameraMakeViewPMatrix( final JCameraContext ctx, final PMatrix4x4FType<T0, T1> m) { JCameraViewMatrix.makeViewPMatrix( ctx, m, this.cameraGetPosition(), this.cameraGetRight(), this.cameraGetUp(), this.cameraGetForward()); }
/** * Construct a new immutable {@code JCameraFPSStyleSnapshot} instance. * @param cameraGetAngleAroundHorizontal The value for the {@code cameraGetAngleAroundHorizontal} attribute * @param cameraGetAngleAroundVertical The value for the {@code cameraGetAngleAroundVertical} attribute * @param cameraGetRight The value for the {@code cameraGetRight} attribute * @param cameraGetUp The value for the {@code cameraGetUp} attribute * @param cameraGetForward The value for the {@code cameraGetForward} attribute * @param cameraGetPosition The value for the {@code cameraGetPosition} attribute * @return An immutable JCameraFPSStyleSnapshot instance */ public static JCameraFPSStyleSnapshot of(double cameraGetAngleAroundHorizontal, double cameraGetAngleAroundVertical, Vector3D cameraGetRight, Vector3D cameraGetUp, Vector3D cameraGetForward, Vector3D cameraGetPosition) { return new JCameraFPSStyleSnapshot(cameraGetAngleAroundHorizontal, cameraGetAngleAroundVertical, cameraGetRight, cameraGetUp, cameraGetForward, cameraGetPosition); }
x.cameraGetForward(), y.cameraGetForward(), a); Vectors3D.interpolateLinear(x.cameraGetUp(), y.cameraGetUp(), a); final Vector3D r_r = Vectors3D.interpolateLinear(x.cameraGetRight(), y.cameraGetRight(), a); final Vector3D r_p = Vectors3D.interpolateLinear( x.cameraGetPosition(), y.cameraGetPosition(), a); x.cameraGetAngleAroundHorizontal(), y.cameraGetAngleAroundHorizontal(), a); final double r_v = InterpolationD.interpolateLinear( x.cameraGetAngleAroundVertical(), y.cameraGetAngleAroundVertical(), a); return JCameraFPSStyleSnapshot.builder() .setCameraGetRight(r_r) .setCameraGetUp(r_u)
snap.cameraGetAngleAroundHorizontal(), c.cameraGetAngleAroundHorizontal(), 0.0); Assert.assertEquals( snap.cameraGetAngleAroundVertical(), c.cameraGetAngleAroundVertical(), 0.0); this.compareVector(snap.cameraGetForward(), c.cameraGetForward()); this.compareVector(snap.cameraGetRight(), c.cameraGetRight()); this.compareVector(snap.cameraGetUp(), c.cameraGetUp()); this.compareVector(snap.cameraGetPosition(), c.cameraGetPosition()); MatrixI4x4F.newFromReadable(m); snap.cameraMakeViewMatrix(ctx, snap_m); snap.cameraMakeViewPMatrix(ctx, snap_pm); final JCameraFPSStyleSnapshot snap3 = snap.cameraMakeSnapshot();
/** * Creates an immutable copy of a {@link JCameraFPSStyleSnapshotType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable JCameraFPSStyleSnapshot instance */ public static JCameraFPSStyleSnapshot copyOf(JCameraFPSStyleSnapshotType instance) { if (instance instanceof JCameraFPSStyleSnapshot) { return (JCameraFPSStyleSnapshot) instance; } return JCameraFPSStyleSnapshot.builder() .from(instance) .build(); }
/** * @param c A camera * * @return A snapshot of the given camera */ public static JCameraFPSStyleSnapshot of( final JCameraFPSStyleReadableType c) { return JCameraFPSStyleSnapshot.builder() .setCameraGetRight(c.cameraGetRight()) .setCameraGetUp(c.cameraGetUp()) .setCameraGetForward(c.cameraGetForward()) .setCameraGetPosition(c.cameraGetPosition()) .setCameraGetAngleAroundHorizontal(c.cameraGetAngleAroundHorizontal()) .setCameraGetAngleAroundVertical(c.cameraGetAngleAroundVertical()) .build(); } }
@Override public void cameraMakeViewMatrix( final JCameraContext ctx, final Matrix4x4FType m) { JCameraViewMatrix.makeViewMatrix( ctx, m, this.cameraGetPosition(), this.cameraGetRight(), this.cameraGetUp(), this.cameraGetForward()); }
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetUp() cameraGetUp} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetUp * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetUp(Vector3D value) { if (this.cameraGetUp == value) return this; Vector3D newValue = Objects.requireNonNull(value, "cameraGetUp"); return new JCameraFPSStyleSnapshot( this, this.cameraGetAngleAroundHorizontal, this.cameraGetAngleAroundVertical, this.cameraGetRight, newValue, this.cameraGetForward, this.cameraGetPosition); }
x.cameraGetForward(), y.cameraGetForward(), a); final VectorI3F r_u = VectorI3F.interpolateLinear(x.cameraGetUp(), y.cameraGetUp(), a); final VectorI3F r_r = VectorI3F.interpolateLinear(x.cameraGetRight(), y.cameraGetRight(), a); final VectorI3F r_p = VectorI3F.interpolateLinear( x.cameraGetPosition(), y.cameraGetPosition(), a); final float r_h = y.angle_around_vertical, a); return new JCameraFPSStyleSnapshot(r_f, r_r, r_u, r_h, r_v, r_p);
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetForward() cameraGetForward} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetForward * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetForward(Vector3D value) { if (this.cameraGetForward == value) return this; Vector3D newValue = Objects.requireNonNull(value, "cameraGetForward"); return new JCameraFPSStyleSnapshot( this, this.cameraGetAngleAroundHorizontal, this.cameraGetAngleAroundVertical, this.cameraGetRight, this.cameraGetUp, newValue, this.cameraGetPosition); }
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetPosition() cameraGetPosition} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetPosition * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetPosition(Vector3D value) { if (this.cameraGetPosition == value) return this; Vector3D newValue = Objects.requireNonNull(value, "cameraGetPosition"); return new JCameraFPSStyleSnapshot( this, this.cameraGetAngleAroundHorizontal, this.cameraGetAngleAroundVertical, this.cameraGetRight, this.cameraGetUp, this.cameraGetForward, newValue); }
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetRight() cameraGetRight} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetRight * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetRight(Vector3D value) { if (this.cameraGetRight == value) return this; Vector3D newValue = Objects.requireNonNull(value, "cameraGetRight"); return new JCameraFPSStyleSnapshot( this, this.cameraGetAngleAroundHorizontal, this.cameraGetAngleAroundVertical, newValue, this.cameraGetUp, this.cameraGetForward, this.cameraGetPosition); }
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetAngleAroundHorizontal() cameraGetAngleAroundHorizontal} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetAngleAroundHorizontal * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetAngleAroundHorizontal(double value) { if (Double.doubleToLongBits(this.cameraGetAngleAroundHorizontal) == Double.doubleToLongBits(value)) return this; return new JCameraFPSStyleSnapshot( this, value, this.cameraGetAngleAroundVertical, this.cameraGetRight, this.cameraGetUp, this.cameraGetForward, this.cameraGetPosition); }
/** * Copy the current immutable object by setting a value for the {@link JCameraFPSStyleSnapshotType#cameraGetAngleAroundVertical() cameraGetAngleAroundVertical} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for cameraGetAngleAroundVertical * @return A modified copy of the {@code this} object */ public final JCameraFPSStyleSnapshot withCameraGetAngleAroundVertical(double value) { if (Double.doubleToLongBits(this.cameraGetAngleAroundVertical) == Double.doubleToLongBits(value)) return this; return new JCameraFPSStyleSnapshot( this, this.cameraGetAngleAroundHorizontal, value, this.cameraGetRight, this.cameraGetUp, this.cameraGetForward, this.cameraGetPosition); }
/** * Builds a new {@link JCameraFPSStyleSnapshot JCameraFPSStyleSnapshot}. * @return An immutable instance of JCameraFPSStyleSnapshot * @throws java.lang.IllegalStateException if any required attributes are missing */ public JCameraFPSStyleSnapshot build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new JCameraFPSStyleSnapshot( null, cameraGetAngleAroundHorizontal, cameraGetAngleAroundVertical, cameraGetRight, cameraGetUp, cameraGetForward, cameraGetPosition); }
@Override public JCameraFPSStyleSnapshot cameraMakeSnapshot() { this.deriveVectors(); return new JCameraFPSStyleSnapshot( new VectorI3F(this.derived_forward), new VectorI3F(this.derived_right), new VectorI3F(this.derived_up), this.input_angle_around_horizontal, this.input_angle_around_vertical, new VectorI3F(this.input_position)); }