Jump to content
  • Advertisement
Sign in to follow this  
kurlyak

Shader for DovphinVS (DirectX SDK)

This topic is 3431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Who knows what constants to bring in shader for mine примра SDK DolphinVS? My sample deduces any nonsense. In particular me constants of values of matrixes interest. D3DXMATRIX matWorld; D3DXMATRIX matView; D3DXMATRIX matProj; // MatrixWorld D3DXMatrixRotationY( &matWorld, 0.0f ); D3DXMatrixIdentity(&matWorld); p_d3d_Device->SetTransform( D3DTS_WORLD,&matWorld ); D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3 ( 0.0f, 0.0f,-8.0f ), &D3DXVECTOR3 ( 0.0f, 0.0f, 0.0f ), &D3DXVECTOR3 ( 0.0f, 1.0f, 0.0f ) ); // pDirect3DDevice->SetTransform( D3DTS_VIEW, &MatrixView ); D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/5, 1.0f, 1.0f, 100.0f ); // pDirect3DDevice->SetTransform( D3DTS_PROJECTION, &MatrixProjection ); p_d3d_Device->Clear(NULL, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, WATER_COLOR, 1.0f, 0); p_d3d_Device->BeginScene (); D3DXMATRIXA16 matViewTranspose, matProjTranspose; D3DXMatrixTranspose(&matViewTranspose, &matView); D3DXMatrixTranspose(&matProjTranspose, &matProj); // Some basic constants ??????????????????????? // Set the vertex shader constants p_d3d_Device->SetVertexShaderConstantF( 12, (float*)&matViewTranspose, 4 ); p_d3d_Device->SetVertexShaderConstantF( 28, (float*)&matProjTranspose, 4 ); // Render the seafloor p_d3d_Device->SetTexture( 0, m_pSeaFloorTexture ); p_d3d_Device->SetVertexDeclaration( m_pSeaFloorVertexDeclaration ); p_d3d_Device->SetVertexShader( m_pSeaFloorVertexShader ); p_d3d_Device->SetStreamSource( 0, m_pSeaFloorVB, 0, sizeof(D3DVERTEX) ); p_d3d_Device->SetIndices( m_pSeaFloorIB ); p_d3d_Device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, m_dwNumSeaFloorVertices, 0, m_dwNumSeaFloorFaces ); p_d3d_Device->EndScene (); p_d3d_Device->Present (NULL, NULL, NULL, NULL); Vertex Shader: vs.1.1 ;------------------------------------------------------------------------------ ; Constants specified by the app ; c0 = ( 0, 0, 0, 0 ) ; c1 = ( 1, 0.5, 2, 4 ) ; c4-c7 = world-view-projection matrix ; c8-c11 = world-view matrix ; c12-c15 = view matrix ; c20 = light direction ; c21 = material diffuse color * light diffuse color ; c22 = material ambient color ; c28 = projection matrix ; ; Vertex components (as specified in the vertex DECL) ; v0 = Position ; v3 = Normal ; v6 = Texcoords ;------------------------------------------------------------------------------ dcl_position0 v0 dcl_normal0 v3 dcl_texcoord0 v6 ;------------------------------------------------------------------------------ ; Vertex transformation ;------------------------------------------------------------------------------ ; Transform to view space (world matrix is identity) m4x4 r9, v0, c12 ; Transform to projection space m4x4 r10, r9, c28 ; Store output position mov oPos, r10 ;------------------------------------------------------------------------------ ; Texture coordinates ;------------------------------------------------------------------------------ ; Copy tex coords mov oT0.xy, v6

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!