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
|
tbResult Render(float SecPassed)
{
tbMatrix Scaling;
tbMatrix RotationX;
tbMatrix RotationY;
tbMatrix RotationZ;
tbMatrix World;
tbMatrix Translation;
g_pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,63), 1.0f,0);
g_pD3DDevice->BeginScene();
if(static_cast<int>(Time / 3.0f) %3 == 0)
{
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
}
else if(static_cast<int>(Time / 3.0f) %3 == 1)
{
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MINFILTER, D3DTEXF_POINT);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MAGFILTER, D3DTEXF_POINT);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MIPFILTER, D3DTEXF_POINT);
}
else
{
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MAXANISOTROPY,Param.DeviceCaps.MaxAnisotropy);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
g_pD3DDevice->SetSamplerState(0,D3DSAMP_MIPFILTER, D3DTEXF_NONE);
}
for(int i=0; i<1024; ++i)
{
Scaling = tbMatrixScaling(tbVector3(Triangles[i].Size));
RotationX = tbMatrixRotationX(Triangles[i].Rotation.x);
RotationY = tbMatrixRotationY(Triangles[i].Rotation.y);
RotationZ = tbMatrixRotationZ(Triangles[i].Rotation.z);
Translation = tbMatrixTranslation(Triangles[i].Position);
World = Scaling * RotationX * RotationY * RotationZ * Translation;
g_pD3DDevice->SetTransform(D3DTS_WORLD, reinterpret_cast<D3DMATRIX*>(&World));
g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST,1,Triangles[i].Vertizies,sizeof(Vertex));
}
g_pD3DDevice->EndScene();
g_pD3DDevice->Present(NULL,NULL,NULL,NULL);
return TB_OK;
}
|