implement mirror mode using rotation vector

This commit is contained in:
ohsqueezy 2023-12-07 21:53:15 -05:00
parent ec6165214b
commit f637c86529
2 changed files with 9 additions and 2 deletions

View File

@ -218,7 +218,7 @@
"text scale": 0.71,
"text foreground": [200.0, 200.0, 200.0, 255.0],
"text background": [60.0, 60.0, 60.0, 190.0],
"start text": "✶ PLAY ✶",
"start text": "✶ PLAY ✶",
"start translation": [0.0, -0.4],
"start alt texture": "resource/press_button_to_start.png",
"start alt translation": [0.0, -0.5],

View File

@ -1887,8 +1887,15 @@ void Cakefoot::update(float timestamp)
}
projection = glm::perspective(fov, window_box().aspect(), 0.1f, 100.0f);
/* Rotate X 180 if mirror mode is active */
float rotation_x = rotation.x;
if (view_index == 1)
{
rotation_x += glm::pi<float>();
}
/* Transformation that applies the rotation state of the entire scene */
glm::mat4 rotation_matrix = glm::rotate(glm::mat4(1), rotation.x, {0.0f, 1.0f, 0.0f}) * glm::rotate(glm::mat4(1), rotation.y, {1.0f, 0.0f, 0.0f});
glm::mat4 rotation_matrix = glm::rotate(glm::mat4(1), rotation_x, {0.0f, 1.0f, 0.0f}) * glm::rotate(glm::mat4(1), rotation.y, {1.0f, 0.0f, 0.0f});
/* Clear screen to configured color */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);