本文整理汇总了C++中LPDIRECT3DDEVICE9::SetFVF方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE9::SetFVF方法的具体用法?C++ LPDIRECT3DDEVICE9::SetFVF怎么用?C++ LPDIRECT3DDEVICE9::SetFVF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE9
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE9::SetFVF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawFade
//============================================================
// 描画処理
//============================================================
void DrawFade(void){
LPDIRECT3DDEVICE9 pDevice = GetDevice();
//頂点フォーマット設定
pDevice->SetFVF(FVF_VERTEX_2D);
//テクスチャの設定
pDevice->SetTexture(0, g_pTextureFade);
//ポリゴン描画
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,
NUM_POLYGON,
&g_aFadeVertex[0],
sizeof(VERTEX_2D));
}
示例2: render
int gamePicture::render(LPDIRECT3DDEVICE9 d3dDevice)
{
struct RocketVertex *pVtx;
static float seedx = 0.0;
static float seedy = 0.0;
static float step = 3;
int i;
// float rad;
D3DXMATRIX matTransform, matScale, matTranslate, matRotation;
D3DXMatrixTranslation(&matTranslate, position.x, position.y, position.z);
D3DXMatrixScaling(&matScale, size.x,size.y,1);
//rad = D3DXToRadian(orient);
D3DXMatrixRotationZ(&matRotation, D3DXToRadian(orient));
matTransform = matScale * matRotation * matTranslate ;
// Obtain the vertex buffer and update the coordinates
// buffer may be in device memory.
if( FAILED(pVtxBuf->Lock( 0, sizeof(RocketVertex) * ROCKET_VTX/2, ( void** )&pVtx, 0 ) ) )
return E_FAIL;
// copy the records
memcpy( pVtx, vtx, sizeof(RocketVertex) * ROCKET_VTX/2 );
// update the coordinates
for (i = 0; i < ROCKET_VTX/2; i++) {
D3DXVec3TransformCoord(&pVtx[i].pos, &vtx[i].pos, &matTransform);
}
pVtxBuf->Unlock();
d3dDevice->SetStreamSource( 0, pVtxBuf, 0, sizeof(RocketVertex) );
d3dDevice->SetFVF(D3DFVF_VERTEX);
//d3dDevice->SetRenderState(D3DRS_COLORVERTEX, true);
d3dDevice->SetRenderState(D3DRS_FOGCOLOR , D3DBLEND_ZERO);
d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
//d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
//d3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
d3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, 2 );
d3dDevice->SetTexture(0, NULL);
// d3dDevice->DrawPrimitive( D3DPT_LINESTRIP, 0, 3);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return 0;
}
示例3: RenderQuad
VOID RenderQuad()
{
//// Disable lighting
g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE) ;
// Set texture
g_pd3dDevice->SetTexture(0, g_pTexture) ;
g_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(Vertex)) ;
g_pd3dDevice->SetFVF(Vertex_FVF) ;
// Draw quad
g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) ;
g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2) ;
}
示例4: Render
void ModelMesh::Render( LPDIRECT3DDEVICE9 device )
{
if( !IsLoaded() )
return;
device->SetRenderState( D3DRS_FILLMODE, m_d3d_fillmode);
device->SetRenderState( D3DRS_CULLMODE, m_d3d_cullmode );
device->SetStreamSource( 0, m_vb, 0, sizeof(ModelVertexStruct) );
device->SetFVF( ModelVertexStruct::FVF );
device->SetIndices( m_ib );
device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, m_vertex_size, 0, m_index_size / 3 );
}
示例5: RenderFrameDX9
// 使用DirectX 9來繪圖
void RenderFrameDX9(void)
{
LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
// 開始下繪圖指令
device->BeginScene();
// 設定資料格式
device->SetFVF(D3DFVF_XYZ|D3DFVF_TEX1);
//device->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x0, 1.0f, 0);
{
Matrix4x4 IdentityMatrix;
IdentityMatrix.Identity();
device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &IdentityMatrix);
device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &IdentityMatrix);
device->SetTransform(D3DTS_WORLD, (D3DMATRIX *) &IdentityMatrix);
device->SetTexture(0, g_pTexture0);
// ZBuffer測試條件設為永遠成立
device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
// 畫出矩形, 同時會清除ZBuffer
device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_FullScreenQuad, sizeof(Vertex_VT));
// ZBuffer測試條件設為小於
device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS);
}
{
device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix);
// 鏡頭座標系轉換矩陣
Matrix4x4 view_matrix = GutMatrixLookAtRH(g_eye, g_lookat, g_up);
device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &view_matrix);
device->SetTransform(D3DTS_WORLD, (D3DMATRIX *) &g_world_matrix);
device->SetTexture(0, g_pTexture1);
// 開啟混色功能
device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
// source_blend_factor = 1
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
// dest_blend_factor = 1
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
// 混色公式 = source_color * 1 + dest_color * 1
// 畫出矩形
device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Quad, sizeof(Vertex_VT));
// 關閉Alpha Test功能
device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
}
// 宣告所有的繪圖指令都下完了
device->EndScene();
// 把背景backbuffer的畫面呈現出來
device->Present( NULL, NULL, NULL, NULL );
}
示例6: RenderMesh
void CLcMdlSM::RenderMesh()
{
LPDIRECT3DDEVICE9 pDev = (LPDIRECT3DDEVICE9)LcDev_GetD3Device();
DWORD dMnLgt;
pDev->GetRenderState( D3DRS_LIGHTING, &dMnLgt);
pDev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
pDev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
pDev->SetRenderState(D3DRS_ALPHAREF, 0x40);
pDev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
pDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
pDev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
pDev->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pDev->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pDev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
PDTX pDXTex = (PDTX)m_pTex->GetPointer();
pDev->SetTexture(0, pDXTex);
pDev->SetFVF(VtxNDUV1::FVF);
pDev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0
, m_nVtx
, m_nIdx
, m_pIdx
, D3DFMT_INDEX16
, m_pVtx
, sizeof(VtxNDUV1)
);
LcD3D_SetWorldIdentity(pDev);
pDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
pDev->SetRenderState( D3DRS_LIGHTING, dMnLgt);
}
示例7: restore_objects
bool restore_objects()
{
if ( retry_count )
{
if ( --retry_count ) return false;
release_objects();
if ( lpdev->Reset( &dpp ) != D3D_OK ) return false;
}
retry_count = 0;
LPDIRECT3DSURFACE9 lpbb;
HRESULT hr;
if( SUCCEEDED( hr = lpdev->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, & lpbb ) ) ) {
lpbb->GetDesc( & d3dsd );
lpbb->Release();
}
lpdev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
lpdev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
lpdev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
lpdev->SetRenderState(D3DRS_LIGHTING, false);
lpdev->SetRenderState(D3DRS_ZENABLE, false);
lpdev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
lpdev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
lpdev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
lpdev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
lpdev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
if ( lpdev->CreateVertexBuffer( sizeof(d3dvertex) * 4, flags.v_usage, D3DFVF_XYZRHW | D3DFVF_TEX1, (D3DPOOL)flags.v_pool, &lpvbuf, NULL ) != D3D_OK )
return false;
update_filtering( 1 );
lpdev->SetRenderState( D3DRS_DITHERENABLE, TRUE );
if ( lpdev->CreateTexture( surface_width, surface_height, 1, flags.t_usage, D3DFMT_X8R8G8B8, (D3DPOOL)flags.t_pool, &lptex, NULL ) != D3D_OK )
return false;
return true;
}
示例8: Render
//랜더
void Render(int timeDelta)
{
//화면 청소
if (SUCCEEDED(g_pDevice->Clear(
0, //청소할 영역의 D3DRECT 배열 갯수 ( 전체 클리어 0 )
NULL, //청소할 영역의 D3DRECT 배열 포인터 ( 전체 클리어 NULL )
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, //청소될 버퍼 플레그 ( D3DCLEAR_TARGET 컬러버퍼, D3DCLEAR_ZBUFFER 깊이버퍼, D3DCLEAR_STENCIL 스텐실버퍼
D3DCOLOR_XRGB(150, 150, 150), //컬러버퍼를 청소하고 채워질 색상( 0xAARRGGBB )
1.0f, //깊이버퍼를 청소할값 ( 0 ~ 1 0 이 카메라에서 제일가까운 1 이 카메라에서 제일 먼 )
0 //스텐실 버퍼를 채울값
)))
{
//화면 청소가 성공적으로 이루어 졌다면... 랜더링 시작
g_pDevice->BeginScene();
g_pDevice->SetTransform(D3DTS_WORLD, (D3DXMATRIX*)&global->localTm);
g_pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
g_pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
g_pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
g_pDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, global->addressMode) ;
g_pDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, global->addressMode) ;
g_pDevice->SetMaterial(&global->mtrl);
g_pDevice->SetTexture(0, global->texture);
g_pDevice->SetStreamSource( 0, global->vb, 0, sizeof(Vertex) );
g_pDevice->SetIndices(global->ib);
g_pDevice->SetFVF( Vertex::FVF );
g_pDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, global->vtxSize, 0, global->faceSize);
switch (global->mode)
{
case sGlobal::RENDER_FACE_NORMAL:
g_pDevice->SetStreamSource( 0, global->fnvb, 0, sizeof(Vertex) );
g_pDevice->DrawPrimitive( D3DPT_LINELIST, 0, global->faceNormalVtxSize/2);
break;
case sGlobal::RENDER_VERTEX_NORMAL:
g_pDevice->SetStreamSource( 0, global->vnvb, 0, sizeof(Vertex) );
g_pDevice->DrawPrimitive( D3DPT_LINELIST, 0, global->vertexNormalVtxSize/2);
break;
}
//랜더링 끝
g_pDevice->EndScene();
//랜더링이 끝났으면 랜더링된 내용 화면으로 전송
g_pDevice->Present( NULL, NULL, NULL, NULL );
}
}
示例9: Render
//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
// Clear the backbuffer and the zbuffer
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, // | D3DCLEAR_STENCIL
D3DCOLOR_XRGB( 0, 0, 0 ), 1.0f, 0 );
// Begin the scene
if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
{
// Setup the materials and lights
SetupMaterials();
SetupLights();
// Setup the world, view, and projection matrices
SetupMatrices();
// Render the vertex buffer contents
g_pd3dDevice->SetStreamSource( 0, g_pVBCylinder, 0, sizeof( CUSTOMVERTEXCYLINDER ) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEXCYLINDER );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 * 52 - 2 );
// FUCK STENCILS ..|..
// Enable stencil testing
//g_pd3dDevice->SetRenderState( D3DRS_STENCILENABLE, TRUE );
//
// Specify the stencil comparison function
//g_pd3dDevice->SetRenderState( D3DRS_STENCILFUNC, D3DCMP_ALWAYS );
//g_pd3dDevice->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_INCR );
//g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
//g_pd3dDevice->SetRenderState( D3DRS_TWOSIDEDSTENCILMODE, TRUE );
// Set the comparison reference value
//g_pd3dDevice->SetRenderState( D3DRS_STENCILREF, 0x1 );
// Specify a stencil mask
//g_pd3dDevice->SetRenderState( D3DRS_STENCILMASK, 0xff00ffff );
//g_pd3dDevice->SetRenderState( D3DRS_STENCILWRITEMASK, 0x0000ffff );
//g_pd3dDevice->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_KEEP );
// Render all the text
RenderText();
// End the scene
g_pd3dDevice->EndScene();
}
// Present the backbuffer contents to the display
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
示例10: SetRS
void LayerAR::SetRS()
{
LPDIRECT3DDEVICE9 pDevice = EnvGetDevice();
pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
pDevice->SetFVF(MYFVF_PDT);
}
示例11: sizeof
VOID jcd3d::jcd3d_display(DWORD timeDelta)
{
if(lpd3dd)
{
lpd3dd->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0);
lpd3dd->BeginScene();
lpd3dd->SetStreamSource(0, lpquadvb, 0, sizeof(Vertex));
lpd3dd->SetFVF(Vertex::FVF);
lpd3dd->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
lpd3dd->EndScene();
lpd3dd->Present(NULL, NULL, NULL, NULL);
}
}
示例12: draw
void StaticPlane::draw() {
LPDIRECT3DDEVICE9 device = ShaderDevise::device();
device->SetFVF(D3DFVF_CUSTOMVERTEX);
D3DXMATRIX world, view = Camera::view(), proj = Camera::projection();
D3DXMatrixIdentity(&world);
device->SetTransform(D3DTS_WORLD, &world);
device->SetTransform(D3DTS_VIEW, &view);
device->SetTransform(D3DTS_PROJECTION, &proj);
device->SetStreamSource(0, vtx, 0, sizeof(CUSTOMVERTEX));
device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
示例13: Render
VOID Render()
{
if( !g_pd3dDevice ) return;
LPDIRECT3DDEVICE9 d = g_pd3dDevice;
d->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
if( SUCCEEDED( d->BeginScene() ) ) {
d->SetStreamSource( 0, g_pVertexBuff, 0, sizeof(CUSTOMVERTEX) ); // 정점버퍼를 디바이스에 바인딩함
d->SetFVF( D3DFVF_CUSTOMVERTEX ); // 디바이스에 정점포맷을 지정
d->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 ); // 정점버퍼의 폴리곤을 그림
d->EndScene();
}
d->Present( NULL, NULL, NULL, NULL );
}
示例14: render
VOID render(){
g_pDevice->Clear(0, NULL, D3DCLEAR_TARGET| D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(192,192,192), 1.0f, 0);
if(SUCCEEDED(g_pDevice->BeginScene())){
setupWorldMatrix();
setLight();
//Render to the back-buffer
g_pDevice->SetStreamSource(0, g_pVB, 0, sizeof(CUSTOMVERTEX));
g_pDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
g_pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2* 50 -2);
g_pDevice->EndScene();
}
g_pDevice->Present(NULL, NULL, NULL, NULL);
}
示例15: DrawProgressBar
void CHud::DrawProgressBar(LPDIRECT3DDEVICE9 pd3dDevice, int x, int y, int height, int width, float percent, SColor c, bool bDrawBack){
float left = (float) x,
right = (float) x + width,
top = (float) y ,
bottom = (float) y + height,
fraction = (percent * width) + left;
pd3dDevice->SetFVF( D3DFVF_XYZRHW|D3DFVF_DIFFUSE );
// Draw darkened area
DWORD color = D3DCOLOR_ARGB(alpha, c.r, c.g, c.b);
SVertex bverts[] =
{
{ left, bottom, 0.0f, 1.0f, color },
{ left, top, 0.0f, 1.0f, color },
{ fraction, top, 0.0f, 1.0f, color },
{ fraction, bottom, 0.0f, 1.0f, color },
{ left, bottom, 0.0f, 1.0f, color }
};
pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, bverts, sizeof(SVertex));
if (bDrawBack) {
// Draw faded area
color = D3DCOLOR_ARGB(alpha / 3, c.r, c.g, c.b);
SVertex cverts[] =
{
{ fraction, bottom, 0.0f, 1.0f, color },
{ fraction, top, 0.0f, 1.0f, color },
{ right, top, 0.0f, 1.0f, color },
{ right, bottom, 0.0f, 1.0f, color },
{ fraction, bottom, 0.0f, 1.0f, color }
};
pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, cverts, sizeof(SVertex));
}
// Draw border
DWORD tcolor = D3DCOLOR_ARGB(alpha, 255, 255, 255);
DWORD bcolor = D3DCOLOR_ARGB(alpha, 136, 136, 136);
SVertex verts[] =
{
{ left, bottom, 0.0f, 1.0f, tcolor },
{ left, top, 0.0f, 1.0f, tcolor },
{ right, top, 0.0f, 1.0f, tcolor },
{ right, top, 0.0f, 1.0f, bcolor },
{ right, bottom, 0.0f, 1.0f, bcolor },
{ left, bottom, 0.0f, 1.0f, bcolor }
};
pd3dDevice->DrawPrimitiveUP(D3DPT_LINESTRIP, 5, verts, sizeof(SVertex));
}