当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECT3DDEVICE8::DrawPrimitiveUP方法代码示例

本文整理汇总了C++中LPDIRECT3DDEVICE8::DrawPrimitiveUP方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE8::DrawPrimitiveUP方法的具体用法?C++ LPDIRECT3DDEVICE8::DrawPrimitiveUP怎么用?C++ LPDIRECT3DDEVICE8::DrawPrimitiveUP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECT3DDEVICE8的用法示例。


在下文中一共展示了LPDIRECT3DDEVICE8::DrawPrimitiveUP方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BlitRect

void BlitRect(LPDIRECT3DDEVICE8 lpDevice,
			  LPDIRECT3DTEXTURE8 lpSrc,
              RECT* destRect,
			  D3DXVECTOR4* srcTextureCoodRect,
              D3DCOLOR col,float z)
{
    // calculate rhw
	static float inc = 0.05f;
    static float rhw=1.0f; ///(z*990.0f+10.0f);
	if ((rhw<=0) || (rhw>=1))
		inc = - inc;

	rhw += inc;
	
    // set up rectangle
    D3DTLVERTEX verts[4];

    verts[0]=D3DTLVERTEX(D3DXVECTOR3(destRect->left-0.5f,  destRect->top-0.5f,    z),rhw,col,srcTextureCoodRect->x,srcTextureCoodRect->y); 
    verts[1]=D3DTLVERTEX(D3DXVECTOR3(destRect->right-0.5f, destRect->top-0.5f,    z),rhw,col,srcTextureCoodRect->z,srcTextureCoodRect->y);
    verts[2]=D3DTLVERTEX(D3DXVECTOR3(destRect->right-0.5f, destRect->bottom-0.5f,  z),rhw,col,srcTextureCoodRect->z,srcTextureCoodRect->w); 
    verts[3]=D3DTLVERTEX(D3DXVECTOR3(destRect->left-0.5f,  destRect->bottom-0.5f, z),rhw,col,srcTextureCoodRect->x,srcTextureCoodRect->w);

    // set the texture
    lpDevice->SetTexture(0,lpSrc);

    // configure shader for vertex type
    lpDevice->SetVertexShader(D3DFVF_TLVERTEX);

    // draw the rectangle

	//lpDevice->SetTextureStageState(0, D3DTSS_MINFILTER , D3DTEXF_POINT);

    lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN,2,verts,sizeof(D3DTLVERTEX));
}
开发者ID:MartinMReed,项目名称:XenDLL,代码行数:34,代码来源:blit.cpp

示例2:

void RageDisplay_D3D::DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts )
{
	g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
	SendCurrentMatrices();
	g_pd3dDevice->DrawPrimitiveUP(
		D3DPT_TRIANGLELIST, // PrimitiveType
		iNumVerts/3, // PrimitiveCount,
		v, // pVertexStreamZeroData,
		sizeof(RageSpriteVertex)
	);
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:11,代码来源:RageDisplay_D3D.cpp

示例3: XBUtil_RenderSpline

//-----------------------------------------------------------------------------
// Name: XBUtil_RenderSpline()
// Desc: For debugging purposes, visually renders a spline.
//-----------------------------------------------------------------------------
VOID XBUtil_RenderSpline( LPDIRECT3DDEVICE8 pd3dDevice, const D3DXVECTOR3* pSpline, 
                          DWORD dwNumSplinePts, DWORD dwColor, BOOL bRenderAxes )
{
    pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
    pd3dDevice->SetVertexShader( D3DFVF_XYZ );

    for( FLOAT u = 0; u < dwNumSplinePts; u += 1.0f )
    {
        D3DXVECTOR3 p[2];
        D3DXVECTOR3 vTangent, vSide, vUp;

        XBUtil_GetSplinePoint( pSpline, dwNumSplinePts, u+0, &p[0], &vTangent );
        XBUtil_GetSplinePoint( pSpline, dwNumSplinePts, u+1, &p[1], NULL );

        D3DXVec3Normalize( &vTangent, &vTangent );
        D3DXVECTOR3 v1( 0, 1, 0 );
        D3DXVec3Cross( &vSide, &v1, &vTangent );
        D3DXVec3Cross( &vUp, &vTangent, &vSide );

        pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
        pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST, 1, p, sizeof(D3DXVECTOR3) );

        if( bRenderAxes )
        {
            p[1] = p[0] + vTangent/4;
            pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xffff0000 );
            pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST, 1, p, sizeof(D3DXVECTOR3) );

            p[1] = p[0] + vSide/4;
            pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xff00ff00 );
            pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST, 1, p, sizeof(D3DXVECTOR3) );

            p[1] = p[0] + vUp/4;
            pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xffffffff );
            pd3dDevice->DrawPrimitiveUP( D3DPT_LINELIST, 1, p, sizeof(D3DXVECTOR3) );
        }
    }
}
开发者ID:dpaladin,项目名称:openbor,代码行数:44,代码来源:xbutil.cpp

示例4: RenderGradientBackground

void RenderGradientBackground()
{
    // clear textures
    g_pd3dDevice->SetTexture( 0, NULL );
    g_pd3dDevice->SetTexture( 1, NULL );
    d3dSetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_DISABLE );
    d3dSetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );

    // don't write to z-buffer
    d3dSetRenderState( D3DRS_ZENABLE, FALSE );

    g_pd3dDevice->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
    g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, g_BGVertices, sizeof(BG_VERTEX) );

    return;
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例5: render_bg

void render_bg(LPDIRECT3DDEVICE8 pd3dDevice, LPDIRECT3DTEXTURE8 bg)
{
    // Render the secondary color surface to the screen
    struct VERTEX { D3DXVECTOR4 p; FLOAT tu, tv; 
	};
    VERTEX v[4];
    v[0].p = D3DXVECTOR4(   0 - 0.5f,   0 - 0.5f, 0, 0 );  v[0].tu =   0; v[0].tv =   0;
    v[1].p = D3DXVECTOR4( 640 - 0.5f,   0 - 0.5f, 0, 0 );  v[1].tu = 640; v[1].tv =   0;
    v[2].p = D3DXVECTOR4( 640 - 0.5f, 480 - 0.5f, 0, 0 );  v[2].tu = 640; v[2].tv = 480;
    v[3].p = D3DXVECTOR4(   0 - 0.5f, 480 - 0.5f, 0, 0 );  v[3].tu =   0; v[3].tv = 480;
	pd3dDevice->SetVertexShader( D3DFVF_XYZRHW|D3DFVF_TEX1);

    pd3dDevice->SetTexture( 0, bg);
	pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0);

	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);

	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU,  D3DTADDRESS_CLAMP );
    pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV,  D3DTADDRESS_CLAMP );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER , D3DTEXF_LINEAR);
	pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER , D3DTEXF_LINEAR);

	pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xff202020);

	pd3dDevice->SetRenderState( D3DRS_ZENABLE,   FALSE );
    pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
	pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
/*
	int i=0;

//	for(int i=32;i>0;i=i-3)
	{
    v[0].tu =   0+i; v[0].tv =   0+i;
    v[1].tu = 640-i; v[1].tv =   0+i;
    v[2].tu = 640-i; v[2].tv = 480-i;
    v[3].tu =   0+i; v[3].tv = 480-i;
*/
    WRAP(pd3dDevice->DrawPrimitiveUP( D3DPT_QUADLIST, 1, v, 6*sizeof(FLOAT) ));

	pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, -1);

    pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE);
}
开发者ID:imclab,项目名称:doomsday,代码行数:47,代码来源:ifspoints.cpp


注:本文中的LPDIRECT3DDEVICE8::DrawPrimitiveUP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。