All pastes #916799 Raw Edit

d3d

public text v1 · immutable
#916799 ·published 2008-02-24 22:45 UTC
rendered paste body
#define D3DHOOK_TEXTURES //comment this to disable texture hooking

DWORD dwOldZEnable;
const int MAX_SIZE = 4;
int	m_Stride;
bool FirstInit = false;

LPDIRECT3DTEXTURE9    texRed; 
LPDIRECT3DTEXTURE9    texBlue;
LPDIRECT3DTEXTURE9    texOrange;
LPDIRECT3DTEXTURE9    texPink;
LPDIRECT3DTEXTURE9    texGreen;


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, 0x00  
}; 
const BYTE bBlue[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,  
    0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 
};  
const BYTE bOrange[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,
	0x10, 0x80, 0xF0, 0xB0, 0x00, 0x01
}; 
const BYTE bGreen[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,
	0x20, 0xA0, 0x00, 0x01, 0xFF, 0xFF
};
const BYTE bPink[58] = 
{ 
	0x42, 0x4D, 0x3A, 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, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x80, 0x00, 0xFF, 0x01
};


HRESULT APIENTRY hkIDirect3DDevice9::BeginScene( ) 
{
	if( !FirstInit ) // just called once
	{
		D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bRed,	60,	&texRed);  
		D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bBlue,	60,	&texBlue);
		D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bPink,	58,	&texPink);
		D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bGreen,	60,	&texGreen);
		D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bOrange,	60,	&texOrange);

		FirstInit = true;
	}

	return m_pD3Ddev->BeginScene( );
}


HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
	if( show )
	{
		//========================================  MARINES  ================================================
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int mar_val = 0; mar_val <= MAX_SIZE-1; mar_val++ )
			{
				if( NumVertices == mar_AssaultNV[mar_val] && primCount == mar_AssaultPC[mar_val])
				{
					m_pD3Ddev->GetRenderState( D3DRS_ZENABLE, &dwOldZEnable ); 				
					m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );

					m_pD3Ddev->SetTexture( 0, texPink );//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, dwOldZEnable );
					m_pD3Ddev->SetTexture( 0, texGreen );//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int mar_val = 0; mar_val <= MAX_SIZE-1; mar_val++ )
			{
				if( NumVertices == mar_SpecOpsNV[mar_val] && primCount == mar_SpecOpsPC[mar_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texPink);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int mar_val = 0; mar_val <= MAX_SIZE-1; mar_val++ )
			{
				if( NumVertices == mar_HvyGunrNV[mar_val] && primCount == mar_HvyGunrPC[mar_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texPink);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int mar_val = 0; mar_val <= MAX_SIZE-1; mar_val++ )
			{
				if( NumVertices == mar_DemolNV[mar_val] && primCount == mar_DemolPC[mar_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texPink);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int mar_val = 0; mar_val <= MAX_SIZE-1; mar_val++ )
			{
				if( NumVertices == mar_SniperNV[mar_val] && primCount == mar_SniperPC[mar_val])
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texPink);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green				  
				}
			}
		}
		//========================================  OP FOR  ================================================
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int opf_val = 0; opf_val <= MAX_SIZE-1; opf_val++ )
			{
				if( NumVertices == opf_AssaultNV[opf_val] && primCount == opf_AssaultPC[opf_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int opf_val = 0; opf_val <= MAX_SIZE-1; opf_val++ )
			{
				if( NumVertices == opf_SpecOpsNV[opf_val] && primCount == opf_SpecOpsPC[opf_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int opf_val = 0; opf_val <= MAX_SIZE-1; opf_val++ )
			{
				if( NumVertices == opf_HvyGunrNV[opf_val] && primCount == opf_HvyGunrPC[opf_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int op_val = 0; op_val <= MAX_SIZE-1; op_val++ )
			{
				if( NumVertices == op_DemolNV[op_val] && primCount == op_DemolPC[op_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int op_val = 0; op_val <= MAX_SIZE-1; op_val++ )
			{
				if( NumVertices == op_SniperNV[op_val] && primCount == op_SniperPC[op_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green				  
				}
			}
		}
		//========================================  SpecNaz  ================================================
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int spe_val = 0; spe_val <= MAX_SIZE-1; spe_val++ )
			{
				if( NumVertices == spe_AssaultNV[spe_val] && primCount == spe_AssaultPC[spe_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texOrange);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int spe_val = 0; spe_val <= MAX_SIZE-1; spe_val++ )
			{
				if( NumVertices == spe_SpecOpsNV[spe_val] && primCount == spe_SpecOpsPC[spe_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texOrange);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int spe_val = 0; spe_val <= MAX_SIZE-1; spe_val++ )
			{
				if( NumVertices == spe_HvyGunrNV[spe_val] && primCount == spe_HvyGunrPC[spe_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texOrange);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int spet_val = 0; spet_val <= MAX_SIZE-1; spet_val++ )
			{
				if( NumVertices == spet_DemolNV[spet_val] && primCount == spet_DemolPC[spet_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texOrange);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green 	
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int spet_val = 0; spet_val <= MAX_SIZE-1; spet_val++ )
			{
				if( NumVertices == spet_SniperNV[spet_val] && primCount == spet_SniperPC[spet_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texOrange);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texGreen);//texture green				  
				}
			}
		}
		//==========================================  SAS  ==================================================
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_AssaultNV[sas_val] && primCount == sas_AssaultPC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_SpecOpsNV[sas_val] && primCount == sas_SpecOpsPC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_HvyGunrNV[sas_val] && primCount == sas_HvyGunrPC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green 			  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_DemolNV[sas_val] && primCount == sas_DemolPC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green 				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_SniperNV[sas_val] && primCount == sas_SniperPC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int sas_val = 0; sas_val <= MAX_SIZE-1; sas_val++ )
			{
				if( NumVertices == sas_Sniper2[sas_val] && primCount == sas_Sniper2PC[sas_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green				  
				}
			}
		}
		//========================================  ClayMores  ================================================
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int clay_val = 0; clay_val <= MAX_SIZE-1; clay_val++ )
			{
				if( NumVertices == clay_more1NV[clay_val] && primCount == clay_more1PC[clay_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green 				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int clay_val = 0; clay_val <= MAX_SIZE-1; clay_val++ )
			{
				if( NumVertices == clay_more2NV[clay_val] && primCount == clay_more2PC[clay_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green				  
				}
			}
		}
		if( m_Stride==32 && startIndex != 0 )
		{					
			for( int clay_val = 0; clay_val <= MAX_SIZE-1; clay_val++ )
			{
				if( NumVertices == clay_more3NV[clay_val] && primCount == clay_more3PC[clay_val] )
				{
					m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable); 				
					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

					m_pD3Ddev->SetTexture(0, texRed);//texture red
					m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);

					m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
					m_pD3Ddev->SetTexture(0, texBlue);//texture green				  
				}
			}
		}
	}

	return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}