1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include <Framework.h>
#include "main.h"
#include "Game.h"
LPD3DXMESH mesh = NULL;
#define D3DFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE)
HRESULT CGame::Render(float stime)
{
D3DXMATRIX WorldMatrix;
D3DXMATRIX ViewMatrix;
D3DXMATRIX ProjectionMatrix;
D3DXMATRIX Translation;
D3DXMATRIX Scaling;
cd3d.GetDevice()->SetRenderState(D3DRS_LIGHTING,TRUE);
cd3d.GetDevice()->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
cd3d.GetDevice()->SetRenderState(D3DRS_DITHERENABLE,TRUE);
D3DXMatrixPerspectiveFovLH(&ProjectionMatrix,
D3DX_PI/4,
static_cast<float>(cwind.Getheight()) / static_cast<float>(cwind.GetWidth()),
1.0f,
100.0f);
cd3d.BeginRendering(0xB9A6B200);
D3DXMatrixTranslation(&Translation,3.0f,0.0f,0.0f);
D3DXMatrixScaling(&Scaling,10.0f,1.0f,1.0f);
WorldMatrix = Translation*Scaling;
cd3d.GetDevice()->SetTransform(D3DTS_WORLD, &WorldMatrix);
ccam.SetCamera(cd3d.GetDevice(),CamMat1,CamMat2,CamMat3,ViewMatrix);
cd3d.GetDevice()->SetTransform(D3DTS_PROJECTION, &ProjectionMatrix);
mesh->DrawSubset(0);
cd3d.EndRendering();
return 0;
}
CGame::CGame()
{
if(FAILED(D3DXLoadMeshFromX("Data/Men.x",D3DXMESH_MANAGED,cd3d.GetDevice(),NULL,NULL,NULL,NULL,&mesh)))
{
logb.Logging("Fehler beim laden des Mesh");
}
CamMat1=D3DXVECTOR3(0.0f,-40.0f,-40.0f);
CamMat2=D3DXVECTOR3(0.0f,0.0f,0.0f);
CamMat3=D3DXVECTOR3(0.0f,1.0f,0.0f);
cd3d.GetDevice()->SetFVF(D3DFVF);
}
CGame::~CGame()
{
SAFE_RELEASE(mesh);
}
HRESULT CGame::Move(float stime)
{
return 0;
}
|