GraphicsCode Flashcards

(14 cards)

1
Q

Step One

Create Variables/Handles/Meshes/Etc

A

Create Variables/Handles/Meshes/Etc

IDirect3DDevice9* Device = 0;//declare interface
ID3DXMesh* Objects[3] = { 0,0,0 };//create an array of meshes)
D3DXMATRIX ObjectWorldMatrices[3];//create an array of matrices
HINSTANCE hinstance_app;//create a handle

bool red = true, clockwise = false, teapot = true;

int choice = 0; //location in array
int x = 1; //direction of rotation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Step Two

Set up

A

In the Setup() function

Create the objects
example:
D3DXCreateTeapot(Device, Objects[0], 0);

Set object positions
example:
D3DXMatrixTranslation(&ObjectWorldMatrices[0], 0, 0, 0);

Set render state(so you can see the rotation)
Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Step Three

Clean up

A

In the Cleanup() function

for (int i = 0; i (Objects[i]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Step Four

Display()

A

pass in timeDelta

bool Display(float timeDelta)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Step Five

in the if(Device) statement

Variables

A

Create Local Variables (a lot of the variables you will need are in the starter)

        D3DXVECTOR3 right(0, 0, 1); //x axis vector
        D3DXMATRIX V, localRotate;
change the position variable to look like:
        D3DXVECTOR3 position(0.0f, cameraHeight, -10.0f);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Step Six

in the if(Device) statement
Clockwise

A
//clockwise is a bool variable - this is placed after the 
//        Device->SetTransform(D3DTS_VIEW, &V); statement

if (clockwise)
{
//computer pos for next frame
angle += 2 * timeDelta * x;
if (angle >= 6.28) // 2 * pi; 2 * 3.14159
angle = 0;
else if (angle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Step Seven

in the if(Device) statement
Counter Clockwise

A
//clockwise is a bool variable - this is placed after the 
//        Device->SetTransform(D3DTS_VIEW, &V); statement

if (counterclockwise)
{
//computer pos for next frame
angle += 2 * timeDelta * x;
if (angle >= 6.28) // 2 * pi; 2 * 3.14159
angle = 0;
else if (angle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Step Eight

in the if(Device) statement

Set Colors

A
//the colors are bool variables 
//placed after 		Device->BeginScene();
example:

if (red)
{
Device->SetMaterial(&d3d::RED_MTRL);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Step Nine

in the if(Device) statement

Set the Local Object Matrices

A

Device->SetTransform(D3DTS_WORLD, &ObjLocalMatrices[choice]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Step Ten

in the if(Device) statement

Draw the objects

A

Objects[choice]->DrawSubset(0);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Step Eleven

in the CALLBACK function

A
case WM_COMMAND:
    {
        switch (LOWORD(wParam))
        {
            case MENU_COLOR_RED:
            red = true;
            yellow = false, green = false, blue = false;
            break;
        case MENU_TEAPOT:
        choice = 0;
        break;

        case MENU_CLOCKWISE:
        clockwise = true, counterclockwise = false;
        x=-1;
        break;

        default:
        break;
    }
}break;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Step Twelve

WINAPI

A

set show cursor to true

ShowCursor(true);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Step Thirteen

Resource.rc

A

include “resource.h”

MainMenu MENU DISCARDABLE
{
POPUP "&Color" 
{
	MENUITEM"&Red", MENU_COLOR_RED
        MENUITEM"&Blue", MENU_COLOR_BLUE
}
}
follow the same format for shape and rotation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Step Fourteen

Resource.h

A

define MENU_COLOR_RED 3100

follow the same format for all menu items

How well did you know this?
1
Not at all
2
3
4
5
Perfectly