Remove space to scale

master
John Montagu, the 4th Earl of Sandvich 2026-02-15 23:40:32 -08:00
parent 9c95672bee
commit 8b385c2172
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 5 additions and 12 deletions

View File

@ -36,6 +36,11 @@ run the executable with the following command:
The models spin at a rate of 10 degrees per second.
# Controls
There are no specific controls for this program. The program will automatically
display the models with their transformations and bounding boxes.
# Readme Question
The `DrawBoundedModel` function takes a model and transformer lambda function

View File

@ -6,8 +6,6 @@
#include <raylib-cpp.hpp>
#include <iostream>
static bool scaleModel = false;
void DrawBoundedModel(raylib::Model &model, auto transformer) {
// store the original transform to apply a different transform to the
// model without affecting the next time we draw
@ -17,12 +15,6 @@ void DrawBoundedModel(raylib::Model &model, auto transformer) {
// gives us
raylib::Matrix transform = transformer(model.GetTransform());
// default scale doesn't render correctly, so scale the model by 10 if the
// spacebar is pressed
if (scaleModel) {
transform = transform.Scale(10);
}
// apply the transform that we got from the transformer to the model
model.SetTransform(transform);
@ -62,10 +54,6 @@ int main() {
window.ClearBackground(raylib::Color::Gray());
camera.BeginMode();
if (raylib::Keyboard::IsKeyPressed(KEY_SPACE)) {
scaleModel = !scaleModel;
}
// in addition to the required transforms, the models will rotate 10
// degrees per second (extra credit), and the penguin is scaled by 30
// eagle scaled by 10