Originally Posted by
»ÑøMÃ¥†ÃªÂ§Â«
D3D Chams Full tut
This tut will hopefully help u learn how to make d3d chams i will show yellow and red player chams.
open up starter kit and put this under your include files.
Quote:
int m_Stride;
bool onetime = true; // Boolean to only init textures once
LPDIRECT3DTEXTURE8 texRed; //texture
LPDIRECT3DTEXTURE8 texYellow; //texture
next put this
Quote:
const BYTE bRed[60] =
{
0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0x00, 0x00, 0x50};
const BYTE bGold[60] = //yellow
{
0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01 };
that will add the colors to the players. next u gotta do this
Quote:
HRESULT APIENTRY hkIDirect3DDevice8::BeginScene(void)
{
if(onetime)
{
//create our textures
onetime = false;
D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bRed,60,&texRed) ;
D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bGold,60,&texYel low);
}
return m_pD3Ddev->BeginScene();
}
next its time to do the cham code in the
hkIDirect3DDevice8:rawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
put this
Quote:
if(m_Stride == 80)
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);//Disable
m_pD3Ddev->SetTexture(0, texYellow);//behind wall color
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount); //return
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);//Re enable
m_pD3Ddev->SetTexture(0, texRed);//front of wall color
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
it should now look like this
Quote:
HRESULT APIENTRY hkIDirect3DDevice8:rawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
if(m_Stride == 80)
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);//Disable
m_pD3Ddev->SetTexture(0, texYellow);//behind wall color
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount); //return
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);//Re enable
m_pD3Ddev->SetTexture(0, texRed);//front of wall color
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
return m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount