这篇教程C++ D3DXVECTOR4函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中D3DXVECTOR4函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DXVECTOR4函数的具体用法?C++ D3DXVECTOR4怎么用?C++ D3DXVECTOR4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了D3DXVECTOR4函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: memsetbool ParticleSystemClass::UpdateBuffers(ID3D11DeviceContext* deviceContext)//is called every frame and rebuilds the entire dynamic vertexbuffer with the updated position of all the particles in the particle system{ int index, i; HRESULT result; D3D11_MAPPED_SUBRESOURCE mappedResource; VertexType* verticesPtr; //initialize vertex array to zeroes at first memset(m_vertices, 0, (sizeof(VertexType) *m_vertexCount)); //build the vertex array from the particle list array. each particle is a quad of two tris index = 0; for(i=0; i<m_currentParticleCount; i++) { //bottom left m_vertices[index].position = D3DXVECTOR3(m_particleList[i].positionX - m_particleSize, m_particleList[i].positionY - m_particleSize, m_particleList[i].positionZ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(-m_particleList[i].positionX, -m_particleList[i].positionY, -m_particleList[i].positionZ)); D3DXVec3TransformCoord( &m_vertices[index].position, &m_vertices[index].position, &RotateParticle( D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ), m_vertices[index].position, m_particleList[i].m_rotationX, m_particleList[i].m_rotationY, m_particleList[i].m_rotationZ) ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ)); m_vertices[index].texture = D3DXVECTOR2(0.0f, 1.0f); m_vertices[index].color = D3DXVECTOR4(m_particleList[i].red, m_particleList[i].green, m_particleList[i].blue, 1.0f); index++; //top left m_vertices[index].position = D3DXVECTOR3(m_particleList[i].positionX - m_particleSize, m_particleList[i].positionY + m_particleSize, m_particleList[i].positionZ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(-m_particleList[i].positionX, -m_particleList[i].positionY, -m_particleList[i].positionZ)); D3DXVec3TransformCoord( &m_vertices[index].position, &m_vertices[index].position, &RotateParticle( D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ), m_vertices[index].position, m_particleList[i].m_rotationX, m_particleList[i].m_rotationY, m_particleList[i].m_rotationZ) ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ)); m_vertices[index].texture = D3DXVECTOR2(0.0f, 0.0f); m_vertices[index].color = D3DXVECTOR4(m_particleList[i].red, m_particleList[i].green, m_particleList[i].blue, 1.0f); index++; //bottom right m_vertices[index].position = D3DXVECTOR3(m_particleList[i].positionX + m_particleSize, m_particleList[i].positionY - m_particleSize, m_particleList[i].positionZ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(-m_particleList[i].positionX, -m_particleList[i].positionY, -m_particleList[i].positionZ)); D3DXVec3TransformCoord( &m_vertices[index].position, &m_vertices[index].position, &RotateParticle( D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ), m_vertices[index].position, m_particleList[i].m_rotationX, m_particleList[i].m_rotationY, m_particleList[i].m_rotationZ) ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ)); m_vertices[index].texture = D3DXVECTOR2(1.0f, 1.0f); m_vertices[index].color = D3DXVECTOR4(m_particleList[i].red, m_particleList[i].green, m_particleList[i].blue, 1.0f); index++; //bottom right m_vertices[index].position = D3DXVECTOR3(m_particleList[i].positionX + m_particleSize, m_particleList[i].positionY - m_particleSize, m_particleList[i].positionZ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(-m_particleList[i].positionX, -m_particleList[i].positionY, -m_particleList[i].positionZ)); D3DXVec3TransformCoord( &m_vertices[index].position, &m_vertices[index].position, &RotateParticle( D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ), m_vertices[index].position, m_particleList[i].m_rotationX, m_particleList[i].m_rotationY, m_particleList[i].m_rotationZ) ); m_vertices[index].position = m_vertices[index].position.operator+(D3DXVECTOR3(m_particleList[i].positionX, m_particleList[i].positionY, m_particleList[i].positionZ)); m_vertices[index].texture = D3DXVECTOR2(1.0f, 1.0f); m_vertices[index].color = D3DXVECTOR4(m_particleList[i].red, m_particleList[i].green, m_particleList[i].blue, 1.0f);//.........这里部分代码省略.........
开发者ID:NukePie,项目名称:Engine,代码行数:101,
示例2: slides_rendervoid slides_render(float t){ Sleep(10); if(slides_current_texture!=slides_texture) { if(slides_tex) { slides_tex->Release(); slides_tex=NULL; } slides_current_texture=slides_texture; CreateThread(NULL, 0, slides_decode, NULL, 0, NULL); } g_pd3dDevice->BeginScene(); g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0xff000000, 1.0f, 0L ); // Render the secondary color surface to the screen struct VERTEX { D3DXVECTOR4 p; FLOAT tu, tv; }; VERTEX v[4]; v[0].p = D3DXVECTOR4( SX( 0) - 0.5f, SY( 48) - 0.5f, 0, 1 ); v[0].tu = 0; v[0].tv = 0; v[1].p = D3DXVECTOR4( SX(640) - 0.5f, SY( 48) - 0.5f, 0, 1 ); v[1].tu = 1; v[1].tv = 0; v[2].p = D3DXVECTOR4( SX(640) - 0.5f, SY(432) - 0.5f, 0, 1 ); v[2].tu = 1; v[2].tv =1; v[3].p = D3DXVECTOR4( SX( 0) - 0.5f, SY(432) - 0.5f, 0, 1 ); v[3].tu = 0; v[3].tv = 1; m_pd3dDevice->SetFVF( D3DFVF_XYZRHW|D3DFVF_TEX1); m_pd3dDevice->SetTexture( 0, slides_tex ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_TFACTOR); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP ); m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP ); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER , D3DTEXF_LINEAR); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER , D3DTEXF_LINEAR); int color=CLAMP(fade)*255; m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, 0xff<<24|(0x010101*color)); m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ZERO ); m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE); if(slides_tex) WRAP(m_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, 2, v, 6*sizeof(FLOAT) )); m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE); m_pd3dDevice->SetTexture( 0, NULL ); g_pd3dDevice->EndScene(); // g_pd3dDevice->Present( NULL, NULL, NULL, NULL );}
开发者ID:Gargaj,项目名称:doomsday-w32,代码行数:66,
|