Advanced C++ Programming Tutorial 2
In this tutorial we learn how to transform our shit. Move it around, make it bigger (no pills or pumps required), flip it and reverse it. And later on we make a camera system to scroll our shit in the world. You're gonna like it.
- Polyline drawing
- Trivial line clipping
- Flipping across an axis
- Screen coordinate transformation
- Camera scrolling
- Concatenating (combining) transforms
Video Timestamp Index
- Clipping (trivial implementation) 4:22
- For more advanced line clipping, you can use the Cohen-Sutherland line clipping algorithm
- Translation: moving your model on the screen 6:13
- Coordinate systems: screen vs. world (/math model) coordinates 7:09
- Implementing a Coordinate Transformer class 8:25
- - Essentially this is a "screen translator"; a structured way to apply transformations
- - analogy of an "assembly line", this will be developed into a Pipeline system
- Implementing a persistant
Entityclass to hold models 13:37
- Integrating Entity control in
Game::UpdateModel()(the game loop) 16:06
- Reasons for keeping a static model: avoid floating point calculation drift 16:30
- Scaling polylines 18:36
- Note: Rotations will be covered in a later tutorial
- Note: Scaling sprites requires more advanced techniques
- Scrolling with a Camera system 0:54
- Camera zooming (scaling transformation) 6:50
- Mind the order of the transformations (translation first, scaling second) 8:41
- Concatenating multiple transformations 9:46
- Implementation of concatenation using a
- Demo time 22:06
- Create random starfield in large rectangular region with randomized positions, sizes, and shapes. Stars should not overlap.
- Implement scrolling via mouse dragging.
- Process vertices in-place (don't use a buffered polyline copy).
- Only draw models that appear in the viewport.
- Animate the scale (size) and color of stars so that they pulsate.
The Homework solution is here.