se team 9 3d flyer cole hoosier ryan hannebaum leanne gray alex stampbach matt cook

59
SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Upload: bartholomew-barnett

Post on 28-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SE Team 93D Flyer

Cole HoosierRyan Hannebaum

Leanne GrayAlex Stampbach

Matt Cook

Page 2: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Project Statement

• GlobalFlyer allows a player to fly a Wright brothers-style airplane in 3D space using the OGRE graphic rendering engine and the FMOD sound system.

Page 3: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Presentation Outline

I. IntroductionII. Review of web page III. Project AccomplishmentsIV. Design (UML Diagrams)V. Source Code

A. LightingB. Sky, Fog, and TerrainC. PhysicsD. Mouse Controller

VI. User ManualVII. TestingVIII. Project DemonstrationIX. Conclusion

Page 4: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

GlobalFlyer Web Site

• http://seteam9.cis.ksu.edu/

Page 5: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Project Accomplishments

Page 6: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Time and Lines of Code

MinutesLOC*

*In final project

Cole 4,340 160

Matt 2,160 190

Alex 2,550 0

Ryan 1,920 9

Leanne 2,205 45

Total 13,175 404

Minutes of Work

Cole33%

Matt16%

Alex19%

Ryan15%

Leanne17%

Cole

Matt

Alex

Ryan

Leanne

Lines of Code

Cole30%

Matt54%

Ryan3%

Leanne13%

Page 7: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Effort Over the Semester

0

200

400

600

800

1000

1200

1400

1600T

ime

in m

inut

es

=Presentation during this time period

Page 8: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Task Effort vs. Estimated Time

0

500

1000

1500

2000

2500

Estimated

Actual

Page 9: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Design

Page 10: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

FrameStarted Sequence Diag

Page 11: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 12: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 13: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 14: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 15: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 16: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 17: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook
Page 18: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Source Code Explained

Page 19: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Lighting & Shadows

Page 20: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Lighting & Shadows

Page 21: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Sky, Fog and Terrain

Page 22: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Sky

• setSkyPlane(bool enable, const Plane& plane, const String& materialName, Real scale, Real tiling , bool drawFirst , Real bow, int xsegments , int ysegments);

• mSceneMgr->setSkyPlane( true, plane, "Examples/CloudySky", 500, 20, true, 0.5, 150, 150 );

Page 23: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Fog

• setFog(FogMode mode,

const ColourValue& colour,

Real expDensity,Real linearStart,

Real linearEnd)

• mSceneMgr->setFog( FOG_LINEAR, fadeColour, 0, 0, 7500 );

Page 24: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Terrain• # Heightmap-source specific settings• Heightmap.image=../new_media/terrain_s.png

• # If you use RAW, fill in the below too• # RAW-specific setting - size (horizontal/vertical)• #Heightmap.raw.size=257• # RAW-specific setting - bytes per pixel (1 = 8bit, 2=16bit)• #Heightmap.raw.bpp=2

• # How large is a page of tiles (in vertices)? Must be (2^n)+1• PageSize=257

• # How large is each tile? Must be (2^n)+1 and be smaller than PageSize• TileSize=17

• # The maximum error allowed when determining which LOD to use• MaxPixelError=3

• # The size of a terrain page, in world units• PageWorldX=15000• PageWorldZ=15000• # Maximum height of the terrain • MaxHeight=250

terrain_s.png

Page 25: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Physics Engine

Page 26: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Physics

• PhysicsEngine();• 9 Functions:

– void translateFromWorld( const Quaternion &quat, Vector3 *vec);– void translateToWorld( const Quaternion &quat, Vector3 *vec);– void applyForce( const Vector3 *dir, float time);– void applyDrag (const Quaternion &quat, const Vector3

*surface_areas, float coeff, float time);– void update(float time);– void getVelocity( Vector3 *result );– void setVelocity (const Vector3 *vel);– void getPosition (Vector3 *result );– void setPosition (const Vector3 *pos);

• 3 Values: Position, Velocity, and DragP

Page 27: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Translations:

– void translateFromWorld( const Quaternion &quat, Vector3 *vec);

– void translateToWorld( const Quaternion &quat, Vector3 *vec);

Multiplying a Vector3 by a Quaternion translates the Vector into the Quaternion’s orientation.

This is accomplished at the Vector’s location in space (away from the Origin) using complex math

Page 28: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Apply Forces:

• void applyForce( const Vector3 *dir, float time);• void applyDrag (const Quaternion &quat, const

Vector3 *surface_areas, float coeff, float time);

For our plane:time = time since last call to updatesurface area = 5, 20, 1coeff = 617.0

Page 29: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Get’s and Set’s

• void getVelocity( Vector3 *result );

• void setVelocity (const Vector3 *vel);

• void getPosition (Vector3 *result );

• void setPosition (const Vector3 *pos);

Page 30: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Example:

• One Force

• Two Forces

• Drag

Page 31: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Text:

• ResourceGroupManager – Holds Location of Font

• FontManager– Manages the Font– Creates a resource pointer “font”

• Font– Sets size, resolution, etc of font

Page 32: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Creating the Text Area

• OverlayManager– Contains OverlayContainer

• OverlayContainer “panel”– Has a size and a location– Contains a TextAreaOverlayElement

• TextAreaOverlayElement “textArea”– Has a size, location, font, and color

Page 33: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

So….

Panel

TextArea(font)

OverlayManager

Page 34: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Execution

• TextArea, and others, are created, and textArea is passed to sampleListener

• Every 10 frames, sampleListener updates the text areaCalls– OgreCharacter::GetPosit(Vector3 *pos)– OgreCharacter::GetVeloc(Vector3 *pos)– OgreCharacter::GetRelVeloc(Vector3 *pos)– OgreCharacter::GetDrag(Vector3 *pos)

• Displays Values

Page 35: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Physics Implementation in OgreCharacter

• Handled in the Update function:– OgreCharacter::update (Real elapsedTime,

InputReader *input)

• 4 forces– Propeler, Drag, Lift, Gravity

• 3 Directions of Turning– Pitch, Roll, Yaw (new)

Page 36: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

OgreCharacter keeps track of:

– Quaternion: world’s orientation– Vectors

• Position, Lift, Speed, Drag, Prop

– Constants• gravV = Vector3(0.0, -9.8, 0.0);• surface_areas = Vector3( 5, 20, 1);• LIFT_CONSTANT 206.0f• DRAG_CONSTANT 617.0f

Page 37: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Applying Forces

• While not Crashed– Apply Gravity

• Relative to world

– Apply Lift• In Plane’s y direction, relative to speed squared

– Apply Drag• Relative to velocity squared, and position

– Apply Propeller• In Plane’s z direction• 3.5 to 5

Page 38: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Turning

• Pitch– Turns up/down at 10 degree’s a frame

• Roll– Rotates Left/Right at 30 degree’s a frame

• Yaw– Turns Left/Right at 10 degree’s a frame

Page 39: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Constants

• Developed from Drag, Lift equations:– Lift = Coeff. * ρ *V^2 *1/2 * Area– Drag = -1/2 * ρ * v^2 * A * Coeff.

• Adjusted for Idle/Top Speeds– Lose lift at ~ 43.5

• Fine Tuned Through Testing:– Lift = 206– Drag = 617– Surface Area = 5,20,1

Page 40: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Mouse Listener

Page 41: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

MouseListener and MouseMotionListener

Our sample listener needs to extend these classes in order to receive mouse events. More information on these classes can be found at: http://www.ogre3d.org/docs/api/html/

Page 42: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Mouse Control

• Incorporation of MouseListener and MouseMotionListener

• Two classes changed:– class SampleListener– class SampleApplication

Page 43: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Class SampleListener

• SampleListener extends:– public ExampleFrameListener, – public MouseListener

// Extension added

– public MouseMotionListener// Extension added

class SampleListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener

Page 44: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SampleListener protected variables

• CEGUI::Renderer *mGUIRenderer; // cegui renderer

• bool mRMouseDown; // returns true if the mouse button is down

• SceneManager *mSceneMgr; // a pointer to the scene manager

Page 45: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SampleListener constructor

• Need to pass SampleListener constructor the scene manager and the renderer objects that we created– SampleListener(RenderWindow* win, Camera* cam,

SceneManager *sceneManager, CEGUI::Renderer *renderer)

• Need to add the mouse listeners so we can process the events for the mouse– mEventProcessor->addMouseListener( this );– mEventProcessor->addMouseMotionListener( this );

Page 46: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SampleListener public methods

• virtual void mousePressed(MouseEvent* e)

– // Right mouse button down– else if (e->getButtonID() & MouseEvent::BUTTON1_MASK)– {– mRMouseDown = true;– }

• If the right mouse is pushed we need to set the variable to true

Page 47: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SampleListener public methods

• virtual void mouseReleased(MouseEvent* e)

– // Right mouse released– else if (e->getButtonID() & MouseEvent::BUTTON1_MASK)– {– mRMouseDown = false;– }

• If the right mouse button is released we need to set the variable back to false

Page 48: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

SampleListener public methods

• virtual void mouseDragged (MouseEvent *e)– mouseMoved(e);– // Update CEGUI with the mouse motion– if ( mRMouseDown )– {– mCamera->yaw( -e->getRelX() * mRotateSpeed );– mCamera->pitch( -e->getRelY() * mRotateSpeed );– }

• If the mouse button is down then rotate the camera relative to the current position

• getRel() - Finds the distance since last time the method was called

Page 49: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Class SampleApplication

• Protected– CEGUI::OgreCEGUIRenderer *mGUIRenderer;– CEGUI::System *mGUISystem;

• ~SampleApplication()– delete mGUISystem;– delete mGUIRenderer;

Page 50: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Class SampleApplication

• void createScene(void)– mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow,

Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);

– mGUISystem = new CEGUI::System(mGUIRenderer);

// Declaration of the mGUI Renderer and System

Page 51: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Analysis

Estimated time for mouse implementation: 11 hoursActual time spent for mouse implementation: 12 hours

Page 52: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Explanation

• The task was more complex than initially determined– Ran into unseen linker errors

• Remedy– Needed to allocate more time to the task– Or needed another person working on the

task

Page 53: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

User Manual

• Gameplay

• Support references

• Software requirements

Page 54: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Testing of the GlobalFlyer

C1 (and C0) coverage

Page 55: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Testing Method

• Debugging output at the start of every block and other key places

• “If” blocks without a corresponding “else” block had one added

• During the course of testing, every decision was covered at least once

• For the final run, unlikely cases that required code modification were skipped

Page 56: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Covering the Cases

• Use all movement keys:– q, w, e, a, s, d, <space>

• Use all camera-selection keys:– F1, F2, F3

• Crash the plane and restart with F1

• Fly to/through the edge of the world

• Toggle SHOW_STATS in testing.h

Page 57: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Exceptions to Coverage

• All FMOD-related code was skipped– Rationale: This was inherited code that never

functioned properly this semester.– Plan: Correct the problems next semester and

commence testing at that point

Page 58: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Exceptions to Coverage

• ExtendedCamera::ExtendedCamera– Remove camera argument in

constructor at sample_application.cpp:73

if (camera == 0) {debug("ExtendedCamera::ExtendedCamera 2 (if)");mCamera = mSceneMgr->createCamera (mName);mOwnCamera = true;

}

Page 59: SE Team 9 3D Flyer Cole Hoosier Ryan Hannebaum Leanne Gray Alex Stampbach Matt Cook

Exceptions to Coverage

• SampleListener::update– showstats section: 3e

• Enable SHOW_STATS, and change bool to “false” for setTextArea sample_application.cpp:119

– mchar and mExCamera sections: 2e, 7e, 11e, 12e, 13e, 15e, 16e, 17e, 20e, 21e, 22e

• Remove calls to setCharacter and/or setExtendedCamera at sample_application.cpp:79-80