程序代写代做代考 Learning objectives:

Learning objectives:
CGT 215 Lab 5
Learning Functions and Operators
• Learn about operators and how to use them.
• Learn how to design your own parametric functions and how to call them.
• Understand the concept of reusability in programming by designing functions.
• Practice software design approach of breaking the task on independent units.
Description:
• Create a way to track time.
• Create a function to draw a hovering tree using time.
• Create two other parametric functions to draw forests using the hovering tree.
• Call them from the renderFrame() function’s respective scenes.
Introduction:
For general tips on how to operate the framework refer to Lab 04.
This time around we are given a more advanced version of drawBasicPine(x,y,z) and drawBasicMaple(x,y,z). Unlike their counterparts in lab4, we can now set all 3 of their coordinates.
Outline:
Your task is to create a way to keep track of the current time using a global variable. (the counter can start at 0 at the beginning and increase every time you call renderFrame() for instance).
Then use the current time value to draw hovering tree scenes as described below.
Expected functions:
Scene 1:
void drawHoveringTree(double x, double z, float currentTime, bool isPine);
• When isPine is true, draws a basicPine, otherwise draws basicMaple.
• x and z are the respective x,z coordinates of the basicPine or basicMaple.
• currentTime is used to make the tree hover up and down along y by about 10 units.
• The pines hover in opposite direction to the maples (when one rises the other descends)
• Use the sin() function as a component of the y coordinate to achieve repeated smooth
motion.

As time moves forward (x-axis) sin(x) gives us a nice smooth wave pattern (y-axis).
To demonstrate that your function works, draw a pine and a maple hovering side by side in Scene 1. Be sure to display them through calling twice with different parameters to achieve that look.

Scene 2:
void drawHoveringForest(int rows, int columns, float currentTime);
• Draws the trees using drawHoveringTree() as specified before.
• Rows and columns specify the size of the forest grid.
• The trees are alternating in a chess board pattern between pines and non-pines.
• The pattern should persist even when different size is given.
• currentTime is passed onto the trees to make them hover.
In Scene 2 draw a 7×6 grid of trees. The dimensions of this grid must be the parameters of the function. Only call the drawHoveringForest() function once. (So do not put it inside a for loop. It should be self-contained and draw the whole forest in one go.)

Scene 3:
void drawInteractiveForest(float currentTime);
• Draws the forest using drawHoveringForest() as specified before.
• Keeps track of the current size.
• Lets the user press A and D to change the number of columns.
• Lets the user press W and S to change the number of rows.
In Scene 3 show a 5×5 grid of trees just like before, but allow input to be read and to change the sizes. This will require persistent memory, similar to how the current scene and time are being tracked.
The size of the forest has changed to 2×7 after pressing ‘SSSDD’