//************************************************************************************************************* void RenderScene(LPD3DXEFFECT effect, int what) { D3DXMATRIX inv; D3DXVECTOR4 uv(1, 1, 1, 1); D3DXVECTOR4 spec(1, 1, 1, 1); for( int i = 0; i < numobjects; ++i ) { SceneObject& obj = objects[i]; if( obj.behavior == what ) { D3DXMatrixInverse(&inv, 0, &obj.world); effect->SetMatrix("matWorld", &obj.world); effect->SetMatrix("matWorldInv", &inv); if( obj.type == FLOOR ) { uv.x = uv.y = 3; spec = D3DXVECTOR4(0.2f, 0.2f, 0.2f, 20.0f); effect->SetVector("uv", &uv); effect->SetVector("matSpecular", &spec); effect->CommitChanges(); device->SetTexture(0, texture2); box->DrawSubset(0); } else if( obj.type == CRATE ) { uv.x = uv.y = 1; spec = D3DXVECTOR4(0.2f, 0.2f, 0.2f, 20.0f); effect->SetVector("uv", &uv); effect->SetVector("matSpecular", &spec); effect->CommitChanges(); device->SetTexture(0, texture3); box->DrawSubset(0); } else if( obj.type == SKULL ) { uv.x = uv.y = 1; spec = D3DXVECTOR4(0.75f, 0.75f, 0.75f, 80.0f); effect->SetVector("uv", &uv); effect->SetVector("matSpecular", &spec); effect->CommitChanges(); device->SetTexture(0, texture1); skull->DrawSubset(0); } } } }
void DXDirectionalLight::BlurShadowMap(LPDIRECT3DDEVICE9 device, LPD3DXEFFECT effect) { if( !shadowmap || !blur || !blurdeclforpointfordirectional || !needsblur ) return; float blurvertices[36] = { -0.5f, -0.5f, 0, 1, 0, 0, (float)shadowsize - 0.5f, -0.5f, 0, 1, 1, 0, -0.5f, (float)shadowsize - 0.5f, 0, 1, 0, 1, -0.5f, (float)shadowsize - 0.5f, 0, 1, 0, 1, (float)shadowsize - 0.5f, -0.5f, 0, 1, 1, 0, (float)shadowsize - 0.5f, (float)shadowsize - 0.5f, 0, 1, 1, 1 }; LPDIRECT3DSURFACE9 surface = NULL; D3DXVECTOR4 texelsize(1.0f / shadowsize, 0, 0, 0); UINT stride = 6 * sizeof(float); device->SetVertexDeclaration(blurdeclforpointfordirectional); // x blur->GetSurfaceLevel(0, &surface); effect->SetVector("texelSize", &texelsize); effect->CommitChanges(); device->SetRenderTarget(0, surface); device->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0); device->SetTexture(0, shadowmap); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, blurvertices, stride); surface->Release(); std::swap(texelsize.x, texelsize.y); // y shadowmap->GetSurfaceLevel(0, &surface); effect->SetVector("texelSize", &texelsize); effect->CommitChanges(); device->SetRenderTarget(0, surface); device->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0); device->SetTexture(0, blur); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, blurvertices, stride); surface->Release(); if( shadowtype == Static ) needsblur = false; }
//************************************************************************************************************* void DownSample() { hdreffect->SetTechnique("downsample"); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); for( int i = 1; i < 5; ++i ) { device->SetRenderTarget(0, dssurfaces[i]); device->SetTexture(0, dstargets[i - 1]); texelsize.x = (float)(2 << i) / (float)screenwidth; texelsize.y = (float)(2 << i) / (float)screenheight; tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)screenwidth / ((float)(2 << i)) - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)screenheight / ((float)(2 << i)) - 0.5f; hdreffect->SetVector("texelsize", &texelsize); hdreffect->CommitChanges(); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); }
//************************************************************************************************************* void DrawShadowVolume(const ShadowCaster& caster) { extrude->SetMatrix("matWorld", &caster.world); extrude->CommitChanges(); device->SetVertexDeclaration(shadowdecl); device->SetStreamSource(0, caster.vertices, 0, sizeof(D3DXVECTOR4)); device->SetIndices(caster.indices); device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, caster.numvertices, 0, caster.numfaces); }
//************************************************************************************************************* void Star() { tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)screenwidth / 4.0f - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)screenheight / 4.0f - 0.5f; texelsize.x = 4.0f / (float)screenwidth; texelsize.y = 4.0f / (float)screenheight; hdreffect->SetTechnique("star"); hdreffect->SetVector("texelsize", &texelsize); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); for( int i = 0; i < 4; ++i ) { hdreffect->SetInt("stardir", i); for( int j = 0; j < 3; ++j ) { int ind = (j % 2); device->SetRenderTarget(0, starsurfaces[i][ind]); device->SetTexture(0, (j == 0 ? dstargets[1] : startargets[i][1 - ind])); hdreffect->SetInt("starpass", j); hdreffect->CommitChanges(); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } } hdreffect->EndPass(); hdreffect->End(); // combine star textures hdreffect->SetTechnique("starcombine"); device->SetRenderTarget(0, blursurfaces[1]); device->SetTexture(0, startargets[0][0]); device->SetTexture(1, startargets[1][0]); device->SetTexture(2, startargets[2][0]); device->SetTexture(3, startargets[3][0]); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); { device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); }
//************************************************************************************************************* void BlurTexture(LPDIRECT3DTEXTURE9 tex) { LPDIRECT3DSURFACE9 surface = NULL; LPDIRECT3DSURFACE9 blursurface = NULL; LPDIRECT3DTEXTURE9 blurtex = NULL; D3DXVECTOR4 texelsize(1.0f / SHADOWMAP_SIZE, 0, 0, 0); D3DSURFACE_DESC desc; tex->GetLevelDesc(0, &desc); if( desc.Format == D3DFMT_A8R8G8B8 ) blurtex = blurARGB8; // for convolution else blurtex = blurRGBA32F; // for others blurtex->GetSurfaceLevel(0, &blursurface); tex->GetSurfaceLevel(0, &surface); device->SetRenderTarget(0, blursurface); device->SetTexture(0, tex); device->SetVertexDeclaration(vertexdecl); boxblur5x5->SetVector("texelSize", &texelsize); boxblur5x5->Begin(NULL, 0); boxblur5x5->BeginPass(0); { device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &vertices[0], 6 * sizeof(float)); std::swap(texelsize.x, texelsize.y); boxblur5x5->SetVector("texelSize", &texelsize); boxblur5x5->CommitChanges(); device->SetRenderTarget(0, surface); device->SetTexture(0, blurtex); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &vertices[0], 6 * sizeof(float)); } boxblur5x5->EndPass(); boxblur5x5->End(); surface->Release(); blursurface->Release(); }
//--------------------------------------------------------------------------------------- // マテリアル設定(&コミット) //--------------------------------------------------------------------------------------- void SetMaterialShader(D3DMATERIAL9* pMaterial, LPDIRECT3DTEXTURE9 pTexture) { if (pMaterial) { g_pFX->SetVector(g_hDiffuse, (LPD3DXVECTOR4)&pMaterial->Diffuse); g_pFX->SetVector(g_hSpecular, (LPD3DXVECTOR4)&pMaterial->Specular); g_pFX->SetFloat(g_hPower, pMaterial->Power); g_pFX->SetVector(g_hAmbient, (LPD3DXVECTOR4)&pMaterial->Ambient); } if (pTexture) { g_pFX->SetTexture(g_hTexture, pTexture); g_pFX->SetBool(g_hTexEnable, TRUE); } else { g_pFX->SetBool(g_hTexEnable, FALSE); } g_pFX->CommitChanges(); }
//************************************************************************************************************* void DrawScene(LPD3DXEFFECT effect) { D3DXMATRIX world; D3DXMATRIX inv; D3DXVECTOR4 uv(3, 3, 0, 0); D3DXMatrixScaling(&world, 5, 0.1f, 5); D3DXMatrixInverse(&inv, NULL, &world); effect->SetMatrix("matWorld", &world); effect->SetMatrix("matWorldInv", &inv); effect->SetVector("uv", &uv); effect->Begin(0, 0); effect->BeginPass(0); { device->SetTexture(0, texture2); shadowreceiver->DrawSubset(0); if( !drawsilhouette ) { device->SetTexture(0, texture1); uv.x = uv.y = 1; effect->SetVector("uv", &uv); for( int i = 0; i < NUM_OBJECTS; ++i ) { D3DXMatrixInverse(&inv, NULL, &objects[i].world); effect->SetMatrix("matWorld", &objects[i].world); effect->SetMatrix("matWorldInv", &inv); effect->CommitChanges(); objects[i].object->DrawSubset(0); } } } effect->EndPass(); effect->End(); }
/* 일반 Object, Bone , Skined Mesh 전부 그리고음. */ void SkinnedMeshNode::Render() { HRESULT hr; m_pRscVetextBuffer->SetStreamSource(0,sizeof(BLEND_VERTEX)); m_pRscIndexBuffer->SetIndices(); LPD3DXEFFECT pEffect = Graphics::m_pInstance->GetEffect(); if (!m_updateMatrixPallete) { UpdateMatrixPallete(); } pEffect->SetTexture("Tex_MatrixPallete",m_pMatrixPalleteTexture->GetD3DTexture()); HR_V(pEffect->CommitChanges()); HR_V(Graphics::m_pDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, m_pRscVetextBuffer->GetVertexCount(), 0, m_pRscIndexBuffer->GetTriangleCount() )); }
//************************************************************************************************************* void Render(float alpha, float elapsedtime) { static float time = 0; D3DXMATRIX view, proj, vp; D3DXMATRIX world; D3DXMATRIX inv; D3DXVECTOR4 amblight(0.2f, 0.2f, 0.2f, 1); D3DXVECTOR4 intensity(0.8f, 0.8f, 0.8f, 1); D3DXVECTOR4 zero(0, 0, 0, 1); D3DXVECTOR3 lightpos(0, 0, -10); D3DXVECTOR3 eye(0, 0, -5.2f); D3DXVECTOR3 look(0, 0.5f, 0); D3DXVECTOR3 up(0, 1, 0); D3DXVECTOR3 p1, p2; D3DXVECTOR2 orient = cameraangle.smooth(alpha); D3DXVECTOR2 light = lightangle.smooth(alpha); time += elapsedtime; // setup light D3DXMatrixRotationYawPitchRoll(&view, light.x, light.y, 0); D3DXVec3TransformCoord(&lightpos, &lightpos, &view); // TODO: no need to calculate every frame for( int i = 0; i < NUM_OBJECTS; ++i ) { FindSilhouette(objects[i], (D3DXVECTOR3&)lightpos); ExtrudeSilhouette(objects[i], (D3DXVECTOR3&)lightpos); } // setup camera D3DXMatrixRotationYawPitchRoll(&view, orient.x, orient.y, 0); D3DXVec3TransformCoord(&eye, &eye, &view); D3DXMatrixLookAtLH(&view, &eye, &look, &up); D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI / 4, (float)screenwidth / (float)screenheight, 0.1f, 20); // put far plane to infinity proj._33 = 1; proj._43 = -0.1f; D3DXMatrixMultiply(&vp, &view, &proj); D3DXMatrixScaling(&world, 5, 0.1f, 5); // specular effect uniforms specular->SetMatrix("matViewProj", &vp); specular->SetVector("eyePos", (D3DXVECTOR4*)&eye); specular->SetVector("lightPos", (D3DXVECTOR4*)&lightpos); specular->SetVector("ambient", &zero); // it's a f**k-up specular->SetVector("lightColor", &intensity); // lazy to tonemap ambient->SetMatrix("matViewProj", &vp); ambient->SetVector("ambient", &amblight); if( SUCCEEDED(device->BeginScene()) ) { device->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0xff6694ed, 1.0f, 0); // STEP 1: z pass ambient->SetTechnique("ambientlight"); ambient->SetMatrix("matViewProj", &vp); DrawScene(ambient); // STEP 2: draw shadow with depth fail method device->SetRenderState(D3DRS_COLORWRITEENABLE, 0); device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); device->SetRenderState(D3DRS_STENCILENABLE, TRUE); device->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS); device->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); device->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP); device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_INCR); device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); extrude->SetTechnique("extrude"); extrude->SetMatrix("matViewProj", &vp); extrude->Begin(0, 0); extrude->BeginPass(0); { for( int i = 0; i < NUM_OBJECTS; ++i ) DrawShadowVolume(objects[i]); device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_DECR); device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); for( int i = 0; i < NUM_OBJECTS; ++i ) DrawShadowVolume(objects[i]); } extrude->EndPass(); extrude->End(); device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_ALPHA); // STEP 3: multipass lighting device->SetRenderState(D3DRS_ZENABLE, TRUE); device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP); device->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_GREATER); device->SetRenderState(D3DRS_STENCILREF, 1); DrawScene(specular); device->SetRenderState(D3DRS_STENCILENABLE, FALSE); device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); if( drawsilhouette ) { amblight = D3DXVECTOR4(1, 1, 0, 0.5f); // reuse whatever we can... extrude->SetVector("ambient", &amblight); extrude->Begin(0, 0); extrude->BeginPass(0); device->SetVertexDeclaration(shadowdecl); for( int i = 0; i < NUM_OBJECTS; ++i ) { const ShadowCaster& caster = objects[i]; D3DXVECTOR4* verts = (D3DXVECTOR4*)malloc(caster.silhouette.size() * 2 * sizeof(D3DXVECTOR4)); for( size_t j = 0; j < caster.silhouette.size(); ++j ) { const Edge& e = caster.silhouette[j]; verts[j * 2 + 0] = D3DXVECTOR4(e.v1, 1); verts[j * 2 + 1] = D3DXVECTOR4(e.v2, 1); } extrude->SetMatrix("matWorld", &caster.world); extrude->CommitChanges(); device->DrawPrimitiveUP(D3DPT_LINELIST, caster.silhouette.size(), verts, sizeof(D3DXVECTOR4)); free(verts); } extrude->EndPass(); extrude->End(); extrude->SetVector("ambient", &zero); } if( drawvolume ) { device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); amblight = D3DXVECTOR4(1, 1, 0, 0.5f); extrude->SetVector("ambient", &amblight); extrude->Begin(0, 0); extrude->BeginPass(0); for( int i = 0; i < NUM_OBJECTS; ++i ) DrawShadowVolume(objects[i]); extrude->EndPass(); extrude->End(); extrude->SetVector("ambient", &zero); device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); } // render text device->SetFVF(D3DFVF_XYZRHW|D3DFVF_TEX1); device->SetRenderState(D3DRS_ZENABLE, FALSE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); device->SetTexture(0, text); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, textvertices, 6 * sizeof(float)); device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); device->SetRenderState(D3DRS_ZENABLE, TRUE); device->SetTexture(0, 0); device->EndScene(); } device->Present(NULL, NULL, NULL, NULL); }
//************************************************************************************************************* void Blur() { device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER); device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER); // x hdreffect->SetTechnique("blurx"); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); for( int i = 0; i < 5; ++i ) { device->SetRenderTarget(0, blursurfaces[i]); device->SetTexture(0, dstargets[i]); texelsize.x = (float)(2 << i) / (float)screenwidth; texelsize.y = (float)(2 << i) / (float)screenheight; tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)screenwidth / ((float)(2 << i)) - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)screenheight / ((float)(2 << i)) - 0.5f; hdreffect->SetVector("texelsize", &texelsize); hdreffect->CommitChanges(); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); // y hdreffect->SetTechnique("blury"); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); for( int i = 0; i < 5; ++i ) { device->SetRenderTarget(0, dssurfaces[i]); device->SetTexture(0, blurtargets[i]); texelsize.x = (float)(2 << i) / (float)screenwidth; texelsize.y = (float)(2 << i) / (float)screenheight; tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)screenwidth / ((float)(2 << i)) - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)screenheight / ((float)(2 << i)) - 0.5f; hdreffect->SetVector("texelsize", &texelsize); hdreffect->CommitChanges(); device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); // combine device->SetRenderTarget(0, blursurfaces[0]); device->SetTexture(0, dstargets[0]); device->SetTexture(1, dstargets[1]); device->SetTexture(2, dstargets[2]); device->SetTexture(3, dstargets[3]); device->SetTexture(4, dstargets[4]); hdreffect->SetTechnique("blurcombine"); tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)screenwidth * 0.5f - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)screenheight * 0.5f - 0.5f; hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); { device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); }
//************************************************************************************************************* void MeasureLuminance() { // measure luminance into 64x64 texture device->SetRenderTarget(0, avglumsurfaces[0]); device->SetTexture(0, scenetarget); device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)64.0f - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)64.0f - 0.5f; texelsize.x = 1.0f / (float)screenwidth; texelsize.y = 1.0f / (float)screenheight; hdreffect->SetTechnique("avglum"); hdreffect->SetVector("texelsize", &texelsize); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); { device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); // sample luminance texture down to 4x4 texelsize.x = 1.0f / 64.0f; texelsize.y = 1.0f / 64.0f; hdreffect->SetTechnique("avglumdownsample"); hdreffect->SetVector("texelsize", &texelsize); hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); for( int i = 1; i < 3; ++i ) { device->SetRenderTarget(0, avglumsurfaces[i]); device->SetTexture(0, avglumtargets[i - 1]); tmpvert[6] = tmpvert[24] = tmpvert[30] = (float)(256 / (4 << (2 * i))) - 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = (float)(256 / (4 << (2 * i))) - 0.5f; device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); texelsize.x *= 4; texelsize.y *= 4; hdreffect->SetVector("texelsize", &texelsize); hdreffect->CommitChanges(); } hdreffect->EndPass(); hdreffect->End(); // calculate final luminance from 4x4 to 1x1 (apply exp function) device->SetRenderTarget(0, avglumsurfaces[3]); device->SetTexture(0, avglumtargets[2]); texelsize.x = 1.0f / 4.0f; texelsize.y = 1.0f / 4.0f; hdreffect->SetTechnique("avglumfinal"); hdreffect->SetVector("texelsize", &texelsize); tmpvert[6] = tmpvert[24] = tmpvert[30] = 0.5f; tmpvert[13] = tmpvert[19] = tmpvert[31] = 0.5f; hdreffect->Begin(NULL, 0); hdreffect->BeginPass(0); { device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, tmpvert, sizeof(D3DXVECTOR4) + sizeof(D3DXVECTOR2)); } hdreffect->EndPass(); hdreffect->End(); }