Upload
leslie-evans
View
216
Download
2
Embed Size (px)
Citation preview
Functional Decomposition 5
Lab 1 Activity 1 Step 3a
Set Project Properties Include Path to point to DX7SDK/include directory
Set Project Properties Library Path to point to DX7SDK/Lib
Build in Debug Mode and run.◦Notice abysmal performance◦Why is this the case?
Functional Decomposition9
Lab 1 Activity 1 Results – Single Threaded
Run 1 Run 2 Run 3 Average
47 FPS 48 FPS 47 FPS 47 FPS
Functional Decomposition 12
Lab 1 Activity 2 Steps 2-3 Declare Variable for Physics
///////////////////////////////////////////////////////////////////////////// ////// Lab 1 Activity 2: Declare Variable ////// ////// Declare variable pointer for the physics (Dynamics*) ////// Initialize to NULL ////// ///
/// ------------------------- INSERT CODE HERE ----------------------- ///Dynamics* pDynamics = NULL;
/// /////////////////////////////////////////////////////////////////////////////
Functional Decomposition 13
Lab 1 Activity 2 Steps 4-5 Get Physics Data
///////////////////////////////////////////////////////////////////////////// ////// Lab 1 Activity 2: Get Physics Data ////// ////// Call the GetDynamics function of the castle simulation class ////// (s_pCastleSimulation) ////// ///
/// ------------------------- INSERT CODE HERE ----------------------- ///pDynamics = s_pCastleSimulation->GetDynamics();
/// /////////////////////////////////////////////////////////////////////////////
Functional Decomposition 14
Lab 1 Activity 2 Steps 6-7 Replace with Variable
///////////////////////////////////////////////////////////////////////////// ////// Lab 1 Activity 2: Replace Dynamics ////// ////// Replace call to GetDynamics with the newly created variable ////// ///
/// ------------------------- INSERT CODE HERE ----------------------- ///s_pBugs->Update( s_pCastleSimulation->GetDynamics() );
/// /////////////////////////////////////////////////////////////////////////////pDynamics
Functional Decomposition 15
Lab 1 Activity 2 Steps 8-9 Get Insect Data
///////////////////////////////////////////////////////////////////////////// ////// Lab 1 Activity 2: Get Bug Data ////// ////// Call the GetInstances function of the bugs class (s_pBugs) ////// ///
/// ------------------------- INSERT CODE HERE ----------------------- ///s_pBugs->GetInstances( &pBugInstances );
/// /////////////////////////////////////////////////////////////////////////////
Functional Decomposition 16
Lab 1 Activity 2 Steps 10-12 Replace with Variable
///////////////////////////////////////////////////////////////////////////// ////// Lab 1 Activity 2: Replace Dynamics and Bugs ////// ////// Replace call to GetDynamics with the newly created variable ////// Remove the call to get bug information ////// ///
/// ------------------------- INSERT CODE HERE ----------------------- ///s_pBugs->GetInstances( &pBugInstances );s_pParticles->Update( s_pCastleSimulation->GetDynamics(), g_pCamera, pBugInstances, ( s_bPauseSimulation || s_bPauseParticles ) );
/// /////////////////////////////////////////////////////////////////////////////
pDynamics
Functional Decomposition 18
Lab 1 Activity 3 Implement Functional Decomposition
Physics
AI
Particles
Main Main
Functional Decomposition 19
Lab 1 Activity 3 Steps 1-3 Create Synchronization Events
s_hTickDoneEvent[n] = CreateEvent( NULL, TRUE, FALSE, NULL );
Functional Decomposition 20
Lab 1 Activity 3 Steps 4-6 Destroy Synchronization Events
WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE );
…
CloseHandle( s_hTickDoneEvent[n] );
Functional Decomposition 21
Lab 1 Activity 3 Steps 7-8 Wait for Threads
WaitForMultipleObjects( NUM_EVENTS, s_hTickDoneEvent, TRUE, INFINITE );
Functional Decomposition 22
Lab 1 Activity 3 Steps 9-12 Thread Functional Block
ResetEvent( s_hTickDoneEvent[n] );
QueueUserWorkItem( …ThreadProc, NULL, WT_EXECUTELONGFUNCTION );
Functional Decomposition 23
Lab 1 Activity 3 Steps 13-15 Implement Threaded Functional Block
s_pCastleSimulation->Tick();ors_pBugs->Tick();ors_pParticles->Tick();
SetEvent( s_hTickDoneEvent[n] );