bool LightShaderClass::render( ID3D11DeviceContext *aD3DDeviceContext, int aIndexCount, D3DXMATRIX aWorldMatrix, D3DXMATRIX aViewMatrix, D3DXMATRIX aProjectionMatrix, ID3D11ShaderResourceView *aShaderResourceView, D3DXVECTOR3 aLightDirection, D3DXVECTOR4 aAmbientColor, D3DXVECTOR4 aDiffuseColor ) { bool result; result = setShaderParameters( aD3DDeviceContext, aWorldMatrix, aViewMatrix, aProjectionMatrix, aShaderResourceView, aLightDirection, aAmbientColor, aDiffuseColor); if(!result) { return false; } renderShader(aD3DDeviceContext, aIndexCount); return true; }
bool DeferredShader::render(RenderParameters& renderParameters, FXMMATRIX& worldMatrix, FXMMATRIX& viewMatrix, FXMMATRIX& projectionMatrix) { renderShader(); setShaderParameters(renderParameters, worldMatrix, viewMatrix, projectionMatrix); return true; }
bool TextureShader::render(ID3D11DeviceContext *deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture) { if (!setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture)) { return false; } renderShader(deviceContext, indexCount); return true; }
bool LightShader::render(ID3D11DeviceContext *deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor) { if (!setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor)) { return false; } renderShader(deviceContext, indexCount); return true; }
bool LightShader::render(ID3D11DeviceContext *deviceContext, MeshLoader* mesh, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, DiffuseLight* light) { if (!setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, mesh, light->direction, light->diffuseColor, light->ambientColor)) { return false; } //renderShader(deviceContext, mesh->getIndexCount()); return true; }
bool vprColorShader::render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix) { // Set the shader parameters that it will use for rendering. if (!setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix)) { return false; } // Now render the prepared buffers with the shader. renderShader(deviceContext, indexCount); return true; }
bool vprLightShader::render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, D3DXVECTOR3 lightDirection, D3DXVECTOR4 diffuseColor) { // Set the shader parameters that it will use for rendering. if (!setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor)) { return false; } // Now render the prepared buffers with the shader. renderShader(deviceContext, indexCount); return true; }
bool ColorShaderClass::render( ID3D11DeviceContext *aD3DDeviceContext, int aIndexCount, D3DXMATRIX aWorldMatrix, D3DXMATRIX aViewMatrix, D3DXMATRIX aProjectionMatrix ) { bool result; result = setShaderParameters( aD3DDeviceContext, aWorldMatrix, aViewMatrix, aProjectionMatrix); if (!result) { return false; } renderShader(aD3DDeviceContext, aIndexCount); return true; }
bool FontShader::render(int i_indexCount, ID3D11ShaderResourceView* i_fontTexture, D3DXVECTOR4 i_fontColor) { bool result; // Set the shader parameters that it will use for rendering. result = setShaderParameters(i_fontTexture, i_fontColor); if (!result) { return false; } // Now render the prepared buffers with the shader. renderShader(i_indexCount); return true; }
int main( int argc, char *argv[] ) { // Print menu Menu(); // Initialize window system glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); glutInitWindowSize( 520, 390 ); // glutInitWindowSize( 640, 640 ); glutCreateWindow( "Craig McCulloch's CSC232 Lab 7" ); // Initialize graphics myInit(); // Resolves which OpenGL extensions are supported by hardware if( glewInit() != GLEW_OK ) { cerr << "Error reported by glewInit" << endl; exit(1); } // Create shader program shaderProgram1 = CreateProgram( "ADS_perFragment.vert", "ADS_perFragment.frag" ); setShaderParameters(); // shaderProgram1 = CreateProgram( "color.vert", // "color.frag" ); // // glUseProgram( shaderProgram1 ); // // Address location of shader uniform variable named “Ambient” // paramLocation[0] = glGetUniformLocation( shaderProgram1, "Color" ); // if( paramLocation[0] < 0 ) { // cerr << "Address location not found" << endl; // exit(1); // } // // // Set information for shader variable // glUniform4fv( paramLocation[0], 4, ctrlSpecularColor ); // Callbacks glutDisplayFunc( myDraw ); glutKeyboardFunc( keyboard ); glutSpecialFunc( specialKeyFunc ); // Event loop glutMainLoop(); return 0; }
bool ColorShaderClass::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix) { bool result; // Set the shader parameters that it will use for rendering. result = setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix); if (!result) { return false; } // Now render the prepared buffers with the shader. renderShader(deviceContext, indexCount); return true; }
bool LightShader::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX& worldMatrix, XMMATRIX& viewMatrix, XMMATRIX& projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT3& lightDirection, XMFLOAT4& diffuseColor) { bool result; // Set the shader parameters that it will use for rendering. result = setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor); if (!result) { return false; } // Now render the prepared buffers with the shader. renderShader(deviceContext, indexCount); return true; }
bool TextureShaderClass::render( ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture) { bool result; result = setShaderParameters( deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture); if(!result) { return false; } renderShader(deviceContext, indexCount); return true; }
/* ================ TransparentShader::render ================ */ void TransparentShader::render( ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture, float blend) { setShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture, blend); renderShader(device, indexCount); }
/* ================ ShadowShader::render ================ */ void ShadowShader::render( ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, D3DXMATRIX lightViewMatrix, D3DXMATRIX lightProjectionMatrix, ID3D10ShaderResourceView* texture, ID3D10ShaderResourceView* depthMapTexture, D3DXVECTOR3 lightPosition, D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor ) { setShaderParameters(device, indexCount, worldMatrix, viewMatrix, projectionMatrix, lightViewMatrix, lightProjectionMatrix, texture, depthMapTexture, lightPosition, ambientColor, diffuseColor ); renderShader(device, indexCount); }
/* ================ Shader::render ================ */ void Shader::render( ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, std::vector<ID3D11ShaderResourceView*> textureArray, D3DXVECTOR3 lightDirection, D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor, D3DXVECTOR3 cameraPosition, D3DXVECTOR4 specularColor, float specularPower, float specularIntensity) { setShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, textureArray, lightDirection, ambientColor, diffuseColor, cameraPosition, specularColor, specularPower, specularIntensity); renderShader(deviceContext, indexCount); }