Remove space to scale
parent
9c95672bee
commit
8b385c2172
|
|
@ -36,6 +36,11 @@ run the executable with the following command:
|
||||||
|
|
||||||
The models spin at a rate of 10 degrees per second.
|
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
|
# Readme Question
|
||||||
|
|
||||||
The `DrawBoundedModel` function takes a model and transformer lambda function
|
The `DrawBoundedModel` function takes a model and transformer lambda function
|
||||||
|
|
|
||||||
12
as2/as2.cpp
12
as2/as2.cpp
|
|
@ -6,8 +6,6 @@
|
||||||
#include <raylib-cpp.hpp>
|
#include <raylib-cpp.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
static bool scaleModel = false;
|
|
||||||
|
|
||||||
void DrawBoundedModel(raylib::Model &model, auto transformer) {
|
void DrawBoundedModel(raylib::Model &model, auto transformer) {
|
||||||
// store the original transform to apply a different transform to the
|
// store the original transform to apply a different transform to the
|
||||||
// model without affecting the next time we draw
|
// model without affecting the next time we draw
|
||||||
|
|
@ -17,12 +15,6 @@ void DrawBoundedModel(raylib::Model &model, auto transformer) {
|
||||||
// gives us
|
// gives us
|
||||||
raylib::Matrix transform = transformer(model.GetTransform());
|
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
|
// apply the transform that we got from the transformer to the model
|
||||||
model.SetTransform(transform);
|
model.SetTransform(transform);
|
||||||
|
|
||||||
|
|
@ -62,10 +54,6 @@ int main() {
|
||||||
window.ClearBackground(raylib::Color::Gray());
|
window.ClearBackground(raylib::Color::Gray());
|
||||||
camera.BeginMode();
|
camera.BeginMode();
|
||||||
|
|
||||||
if (raylib::Keyboard::IsKeyPressed(KEY_SPACE)) {
|
|
||||||
scaleModel = !scaleModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// in addition to the required transforms, the models will rotate 10
|
// in addition to the required transforms, the models will rotate 10
|
||||||
// degrees per second (extra credit), and the penguin is scaled by 30
|
// degrees per second (extra credit), and the penguin is scaled by 30
|
||||||
// eagle scaled by 10
|
// eagle scaled by 10
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue