use of com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture in project j6dof-flight-sim by chris-ali.
the class AirspeedIndicator method setGaugeValue.
@Override
public void setGaugeValue(Map<FlightDataType, Double> flightData) {
if (flightData != null) {
double airspeed = flightData.get(FlightDataType.IAS);
double rotationAngle = 0.0;
if (airspeed <= 200 && airspeed > 0) {
if (airspeed < 30)
// Change scale so that gauge points up at 0 kts
rotationAngle = -(2.0 * Math.PI / 200) * (airspeed / 3);
else
rotationAngle = -(2.0 * Math.PI / 200) * (airspeed - 20);
} else {
rotationAngle = -(2.0 * Math.PI / 200) * 180;
}
InterfaceTexture pointer = gaugeTextures.get(POINTER);
if (pointer != null)
pointer.setRotation((float) Math.toDegrees(rotationAngle));
}
}
use of com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture in project j6dof-flight-sim by chris-ali.
the class Altimeter method setGaugeValue.
@Override
public void setGaugeValue(Map<FlightDataType, Double> flightData) {
if (flightData != null) {
double altitude = flightData.get(FlightDataType.ALTITUDE);
double angleStep100ft = (2 * Math.PI) / 10.0, angleStep1000ft = angleStep100ft / 10.0, angleStep10000ft = angleStep1000ft / 10.0;
double angleRad100ft = -((altitude % 1000) / 100) * angleStep100ft, angleRad1000ft = -((altitude % 10000) / 100) * angleStep1000ft, angleRad10000ft = -((altitude % 100000) / 100) * angleStep10000ft;
InterfaceTexture pointer100ft = gaugeTextures.get(POINTER_100), pointer1000ft = gaugeTextures.get(POINTER_1000), pointer10000ft = gaugeTextures.get(POINTER_10000);
if (pointer100ft != null)
pointer100ft.setRotation((float) Math.toDegrees(angleRad100ft));
if (pointer1000ft != null)
pointer1000ft.setRotation((float) Math.toDegrees(angleRad1000ft));
if (pointer10000ft != null)
pointer10000ft.setRotation((float) Math.toDegrees(angleRad10000ft));
}
}
use of com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture in project j6dof-flight-sim by chris-ali.
the class DirectionalGyro method setGaugeValue.
@Override
public void setGaugeValue(Map<FlightDataType, Double> flightData) {
if (flightData != null) {
double heading = flightData.get(FlightDataType.HEADING);
double rotationAngle = (2.0 * Math.PI / 360.0) * (heading % 360);
InterfaceTexture pointer = gaugeTextures.get(CARD);
if (pointer != null)
pointer.setRotation((float) Math.toDegrees(rotationAngle));
}
}
use of com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture in project j6dof-flight-sim by chris-ali.
the class Tachometer method setGaugeValue.
@Override
public void setGaugeValue(Map<FlightDataType, Double> flightData) {
if (flightData != null) {
double rpmLeft = flightData.get(FlightDataType.RPM_1), rpmRight = flightData.get(FlightDataType.RPM_2);
double leftRotationAngle = Math.PI / 1.45, rightRotationAngle = Math.PI / 1.45;
if (rpmLeft <= 3500)
leftRotationAngle = -((1.8 * Math.PI / 4300) * rpmLeft) + Math.PI / 1.45;
else if (rpmLeft > 3500)
leftRotationAngle = -((1.8 * Math.PI / 4300) * 3500) + Math.PI / 1.45;
if (rpmRight <= 3500)
rightRotationAngle = -((1.8 * Math.PI / 4300) * rpmRight) + Math.PI / 1.45;
else if (rpmRight > 3500)
rightRotationAngle = -((1.8 * Math.PI / 4300) * 3500) + Math.PI / 1.45;
InterfaceTexture pointerLeft = gaugeTextures.get(POINTER_L), pointerRight = gaugeTextures.get(POINTER_R);
if (pointerLeft != null)
pointerLeft.setRotation((float) Math.toDegrees(leftRotationAngle));
if (pointerRight != null)
pointerRight.setRotation((float) Math.toDegrees(rightRotationAngle));
}
}
use of com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture in project j6dof-flight-sim by chris-ali.
the class TurnCoordinator method setGaugeValue.
@Override
public void setGaugeValue(Map<FlightDataType, Double> flightData) {
if (flightData != null) {
double slipAngle = flightData.get(FlightDataType.TURN_COORD);
double turnRate = flightData.get(FlightDataType.TURN_RATE);
Vector2f ballPosition = new Vector2f((float) slipAngle * 0.0625f + position.x, position.y);
double turnRateAngle = (turnRate > 12) ? -60 : (turnRate < -12) ? 60 : -turnRate * 5;
InterfaceTexture pointerBall = gaugeTextures.get(BALL), pointerAircraft = gaugeTextures.get(AIRCRAFT);
if (pointerBall != null)
pointerBall.setPosition(ballPosition);
if (pointerAircraft != null)
pointerAircraft.setRotation((float) turnRateAngle);
}
}
Aggregations