Skip to content

Commit

Permalink
ref: added gate and semaphore animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronimo97 committed Oct 8, 2024
1 parent 282800b commit 028b652
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@ public ModelTranslation(final VectorWrapper translation) {
}

public void translate(final RenderAnimationInfo info) {
if (!modelTranslation.equals(VectorWrapper.ZERO)) {
info.stack.translate(modelTranslation.getX(), modelTranslation.getY(),
modelTranslation.getZ()); // Modell verschieben
}
info.stack.translate(modelTranslation.getX() - 0.5f, modelTranslation.getY() - 0.5f,
modelTranslation.getZ() - 0.5f); // Modell verschieben

if (!quaternion.equals(Quaternion.ONE)) {
info.stack.mulPose(quaternion);
}
if (!translation.equals(VectorWrapper.ZERO)) {
info.stack.translate(translation.getX(), translation.getY(), translation.getZ());
}
if (!pivotTranslation.equals(VectorWrapper.ZERO)) {
info.stack.translate(pivotTranslation.getX(), pivotTranslation.getY(),
pivotTranslation.getZ()); // Pivot Punkt
}
info.stack.translate(pivotTranslation.getX(), pivotTranslation.getY(),
pivotTranslation.getZ()); // Pivot Punkt
}

public Quaternion getQuaternion() {
Expand Down
204 changes: 204 additions & 0 deletions src/main/resources/assets/opensignals/animations/railroadgate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"animations": {
"railroad_gate/barrier_base_top": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": -0.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": -0.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_1": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 0.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 0.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_2": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && (config(BARRIER_LENGTH.L1) || config(BARRIER_LENGTH.L2) || config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 1.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && (config(BARRIER_LENGTH.L1) || config(BARRIER_LENGTH.L2) || config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 1.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_3": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && (config(BARRIER_LENGTH.L2) || config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 2.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && (config(BARRIER_LENGTH.L2) || config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 2.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_4": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && (config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 3.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && (config(BARRIER_LENGTH.L3) || config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 3.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_5": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && (config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 4.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && (config(BARRIER_LENGTH.L4) || config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 4.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_6": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && (config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 5.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && (config(BARRIER_LENGTH.L5) || config(BARRIER_LENGTH.L6))",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 5.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
},
"railroad_gate/barrier_7": {
"translationX": 0.5,
"translationY": 1.1875,
"translationZ": 0,
"animationConfigs": [
{
"predicate": "config(BARRIER_OPEN.FALSE) && config(BARRIER_LENGTH.L6)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 0,
"pivotX": 6.5,
"pivotY": -0.1875,
"pivotZ": 0
},
{
"predicate": "config(BARRIER_OPEN.TRUE) && config(BARRIER_LENGTH.L6)",
"mode": "ROTATION",
"rotationAxis": "Z",
"rotation": 90,
"pivotX": 6.5,
"pivotY": -0.1875,
"pivotZ": 0
}
]
}
}
}

This file was deleted.

Loading

0 comments on commit 028b652

Please sign in to comment.