Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

16
Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003

Transcript of Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Page 1: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Project 3

LandscapeMon, Oct 6, 2003Due Wed, Oct 15, 2003

Page 2: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Landscape

Read the handout.Download the files. Landscape.cpp. point3.h.

Run Landscape.exe.

Page 3: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Landscape

Your job is to write the functions that draw the trees and the fence. drawTrees() drawOneTree() drawFence() drawFenceSegment()

Page 4: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawTrees() Function

The drawTrees() function should set the modelview matrix for each individual tree and then call on drawOneTree() to draw the tree.

Page 5: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawOneTree() Function

The drawOneTree() function will draw a tree at the current location, as determined by the modelview matrix.A tree consists of a trunk and a crown of leaves.That is, a cylinder and a sphere, each properly positioned and colored.You may add fall colors if you wish.

Page 6: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawOneTree() Function

The functions drawSphere() and drawCylinder() are provided.You must first set the modelview matrix before drawing the trunk or the leaves.Otherwise, you will get this: BadTree.exe

Page 7: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFenceSegment() Function

It will be much easier to draw a fence if you first draw a segment of a fence.It consists of a post, two rails, and several pickets.

Page 8: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFenceSegment() Function

Use the functions drawPost(), drawRail(), and drawPicket(), which are provided.Use a for loop to draw the pickets.This unit segment will be used by drawFence() to draw the entire fence.

Page 9: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFenceSegment() Function

You must align the pieces carefully.The front face of the rail must be at the vertical centerline of the post.

Page 10: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFenceSegment() Function

The back face of the pickets must be flush with the front face of the rails.The posts and pickets must be separated by gaps.

Page 11: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFence() Function

To draw the fence, you should first set the modelview matrix so that the current position is the front left corner post of the fence.Then call on drawFenceSegment() repeatedly to draw the segments around the house.

Page 12: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

The drawFence() Function

Draw the proper number of fence segments in front of the house.Then turn 90 and draw the proper number of segments along the right side.Then do the back and the left side.

Page 13: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Global Constants

The program contains a large number of global constants that govern the sizes of various objects.Be sure to use them.In fact, they should make your work easier.

Page 14: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Suggestions

Experiment with drawing one object at a time at the center of the scene.FenceSegmentTest.exe

drawGround();// drawHouse();// drawTrees();// drawBushes();// drawFence();// drawSun();

glColor3f(1.0, 1.0, 1.0);drawFenceSegment();

Page 15: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Suggestions

Use a sheet of graph paper to sketch the fence segment to determine the proper transformations.

Post

Rail

Picket

Page 16: Project 3 Landscape Mon, Oct 6, 2003 Due Wed, Oct 15, 2003.

Suggestions

Reset the “look” point to special positions to verify that objects have been placed correctly.For example, the top of the left front corner post should be at

(-28, 3.3333, 25).Landscape.exe