本文整理汇总了C++中LPDIRECT3DDEVICE7::GetLight方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE7::GetLight方法的具体用法?C++ LPDIRECT3DDEVICE7::GetLight怎么用?C++ LPDIRECT3DDEVICE7::GetLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE7
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE7::GetLight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderSquareShadow
void RenderSquareShadow(LPDIRECT3DDEVICE7 lpDevice,float x,float y,float z,float w,float h)
{
WORD wIndices[] = {
0,1,2,
3,2,1,
1,5,3,
3,5,7,
0,4,1,
1,4,5,
0,2,4,
4,2,6,
2,3,6,
6,3,7,
};
D3DLIGHT7 light;
lpDevice->GetLight(0,&light);
D3DVECTOR length=Normalize(light.dvDirection)*(-100);
D3DVERTEX v[8];
v[0] = D3DVERTEX( D3DVECTOR( x-w/2, y, z-h/2 ),D3DVECTOR(0,1,0), 0, 1 );
v[1] = D3DVERTEX( D3DVECTOR( x-w/2, y, z+h/2 ),D3DVECTOR(0,1,0), 0, 0 );
v[2] = D3DVERTEX( D3DVECTOR( x+w/2, y, z-h/2 ),D3DVECTOR(0,1,0), 1, 1 );
v[3] = D3DVERTEX( D3DVECTOR( x+w/2, y, z+h/2 ),D3DVECTOR(0,1,0), 1, 0 );
v[4] = D3DVERTEX( D3DVECTOR( x-w/2, y, z-h/2 )-length,D3DVECTOR(0,1,0), 0, 0 );
v[5] = D3DVERTEX( D3DVECTOR( x-w/2, y, z+h/2 )-length,D3DVECTOR(0,1,0), 0, 0 );
v[6] = D3DVERTEX( D3DVECTOR( x+w/2, y, z-h/2 )-length,D3DVECTOR(0,1,0), 0, 0 );
v[7] = D3DVERTEX( D3DVECTOR( x+w/2, y, z+h/2 )-length,D3DVECTOR(0,1,0), 0, 0 );
RenderShadow(lpDevice,v,8,wIndices,sizeof(wIndices)/sizeof(wIndices[0]));
}
示例2: RenderRoundShadow
// Runden Schatten malen
void RenderRoundShadow(LPDIRECT3DDEVICE7 lpDevice,float x,float y,float z,float r)
{
#define EDGES 12
static D3DVERTEX v[(EDGES+1)*2];
D3DLIGHT7 light;
lpDevice->GetLight(0,&light);
D3DVECTOR length=Normalize(light.dvDirection)*(-100.0f);
for (int i=0;i<=EDGES;i++)
{
v[i]=v[i+EDGES+1]=D3DVERTEX(D3DVECTOR(x+sinf(float(i)/float(EDGES)*g_PI*2.0f)*r,y,z+cosf(float(i)/float(EDGES)*g_PI*2.0f)*r),D3DVECTOR(0,1,0),0,0);
v[i+EDGES+1].x-=length.x;
v[i+EDGES+1].y-=length.y;
v[i+EDGES+1].z-=length.z;
}
static WORD wIndices[(EDGES-2)*3+EDGES*6];
const PWORD Cap=&wIndices[0];
const PWORD Side=&wIndices[(EDGES-2)*3];
for (i=0;i<EDGES-2;i++)
{
Cap[i*3]=0;
Cap[i*3+1]=i+1;
Cap[i*3+2]=i+2;
}
for (i=0;i<EDGES;i++)
{
Side[i*6+0]=i;
Side[i*6+1]=i+EDGES+2;
Side[i*6+2]=i+1;
Side[i*6+3]=i;
Side[i*6+4]=i+EDGES+1;
Side[i*6+5]=i+EDGES+2;
}
RenderShadow(lpDevice,v,EDGES*2+2,wIndices,sizeof(wIndices)/sizeof(wIndices[0]));
// RenderShadow(lpDevice,v,8,wIndices,(EDGES-2)*3);
}