home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 July & August
/
PCWorld_2006-07-08_cd.bin
/
temacd
/
planearcade
/
planearcade.exe
/
Tank3.bmp
/
debug.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2004-06-14
|
2KB
|
109 lines
#include "main.h"
//------------------------------------------------------------------
// Name: DebugDrawBox()
// Desc: Nakresli krabicu
//------------------------------------------------------------------
void DebugDrawBox(VECTOR3D Min,VECTOR3D Max)
{
VECTOR3D P[8];
//spodna plocha
P[0].X = Min.X;
P[0].Y = Min.Y;
P[0].Z = Min.Z;
P[1].X = Max.X;
P[1].Y = Min.Y;
P[1].Z = Min.Z;
P[2].X = Max.X;
P[2].Y = Min.Y;
P[2].Z = Max.Z;
P[3].X = Min.X;
P[3].Y = Min.Y;
P[3].Z = Max.Z;
//vrchna plocha
P[4].X = Min.X;
P[4].Y = Max.Y;
P[4].Z = Min.Z;
P[5].X = Max.X;
P[5].Y = Max.Y;
P[5].Z = Min.Z;
P[6].X = Max.X;
P[6].Y = Max.Y;
P[6].Z = Max.Z;
P[7].X = Min.X;
P[7].Y = Max.Y;
P[7].Z = Max.Z;
DebugDrawLine(P[0],P[1]);
DebugDrawLine(P[1],P[2]);
DebugDrawLine(P[2],P[3]);
DebugDrawLine(P[3],P[0]);
DebugDrawLine(P[0],P[4]);
DebugDrawLine(P[1],P[5]);
DebugDrawLine(P[2],P[6]);
DebugDrawLine(P[3],P[7]);
DebugDrawLine(P[4],P[5]);
DebugDrawLine(P[5],P[6]);
DebugDrawLine(P[6],P[7]);
DebugDrawLine(P[7],P[4]);
}
//------------------------------------------------------------------
// Name: DebugDrawLine()
// Desc: Nakresli Ciaru
//------------------------------------------------------------------
void DebugDrawLine(VECTOR3D Point1, VECTOR3D Point2)
{
//vertexi z ktorych sa bude vykreslova¥
CUSTOMVERTEXDEBUG *Vertex;
Vertex = new CUSTOMVERTEXDEBUG[2];
//nastavi na default
Engine.ResetToDefault();
g_pd3dDevice->SetTexture(0,NULL);
//vynuluje world maticu
D3DXMATRIXA16 NullMatrix;
D3DXMatrixIdentity(&NullMatrix);
g_pd3dDevice->SetTransform( D3DTS_WORLD, &NullMatrix);
Vertex[0].pos.x = Point1.X;
Vertex[0].pos.y = Point1.Y;
Vertex[0].pos.z = Point1.Z;
Vertex[0].color = 0xffffffff;
Vertex[1].pos.x = Point2.X;
Vertex[1].pos.y = Point2.Y;
Vertex[1].pos.z = Point2.Z;
Vertex[0].color = 0xffffffff;
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEXDEBUG );
g_pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST,1,(BYTE**)&Vertex[0], sizeof(CUSTOMVERTEXDEBUG));
if (Vertex != NULL)
delete [] Vertex;
//nastavi na default
Engine.ResetToDefault();
}