Exemplo n.º 1
0
bool DeferredShader::RenderSkyBox(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX &worldMatrix, XMMATRIX &viewMatrix,
	XMMATRIX& projectionMatrix, ID3D11ShaderResourceView* texture, int Startlocation)
{
	bool result;


	// Set the shader parameters that it will use for rendering.
	result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture);
	if (!result)
	{
		return false;
	}

	// Now render the prepared buffers with the shader.
	// Set the vertex and pixel shaders that will be used to render.
	deviceContext->VSSetShader(m_vertexShaderSkyBox, NULL, 0);
	deviceContext->PSSetShader(m_pixelShaderSkyBox, NULL, 0);

	// Set the sampler states in the pixel shader.
	deviceContext->PSSetSamplers(0, 1, &m_sampleStateWrap);

	// Render the geometry.
	deviceContext->DrawIndexed(indexCount, Startlocation, 0);

	return true;
}
bool ProjectionLightMapShaderClass::Render(
	ID3D11DeviceContext* deviceContext,
	int indexCount,
	XMMATRIX &worldMatrix,
	XMMATRIX &viewMatrix,
	XMMATRIX &projectionMatrix,
	ID3D11ShaderResourceView* texture,
	XMFLOAT4 &ambientColour,
	XMFLOAT4 &diffuseColour,
	XMFLOAT3 &lightPosition,
	XMMATRIX &projTexViewMatrix,
	XMMATRIX &projTexProjectionMatrix,
	ID3D11ShaderResourceView* projectionTexture){
	bool result;

	//set shader params
	result = SetShaderParameters(
		deviceContext,
		worldMatrix,
		viewMatrix,
		projectionMatrix,
		texture,
		ambientColour,
		diffuseColour,
		lightPosition,
		projTexViewMatrix,
		projTexProjectionMatrix,
		projectionTexture);
	if (!result) return false;

	//render prepped buffers with shader
	RenderShader(deviceContext, indexCount);

	return true;
}
void FoliageShaderClass::Render(ID3D10Device* device, int vertexCount, int instanceCount, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture)
{
	SetShaderParameters(viewMatrix, projectionMatrix, texture);
	RenderShader(device, vertexCount, instanceCount);

	return;
}
	void MultiTextureShader::Render(Graphics* graphics)
	{
		SetShaderParameters(graphics);

		// render the buffers
		RenderShader(graphics);
	}
Exemplo n.º 5
0
HRESULT LightShader::RenderOrdinary(ID3D11DeviceContext* deviceContext,
						 int indexCount,
						 D3DXMATRIX worldMatrix,
						 D3DXMATRIX viewMatrix, 
						 D3DXMATRIX projectionMatrix)
{
	HRESULT result;

	// Set the shader parameters that it will use for rendering.
	result = SetShaderParameters(deviceContext,
		worldMatrix,
		viewMatrix, 
		projectionMatrix,
		false);
	if(FAILED(result)) { return result; }

	// Now render the prepared buffers with the shader.
	result = TextureShader::RenderOrdinary(deviceContext,
											indexCount,
											worldMatrix,
											viewMatrix, 
											projectionMatrix);
	if(FAILED(result)) { return result; }

	return result;
}
Exemplo n.º 6
0
void Sprite::Render()
{
    if (!ShouldDraw())
        return;

    UpdateTexture();

    SetBlendingMode(BlendingMode);

    // Assign our matrix.
    SetShaderParameters(ColorInvert, AffectedByLightning, Centered, false, BlackToTransparent);

    Mat4 Mat = GetMatrix();
    WindowFrame.SetUniform(U_MVP, &(Mat[0][0]));

    // Set the color.
    WindowFrame.SetUniform(U_COLOR, Red, Green, Blue, Alpha);

    SetTexturedQuadVBO(UvBuffer);
    DoQuadDraw();

    DrawLighten();

    FinalizeDraw();
}
Exemplo n.º 7
0
void Line::Render()
{
    Mat4 Identity;
    UpdateVBO();

    glDisable(GL_DEPTH_TEST);
    glBindTexture(GL_TEXTURE_2D, 0);

    // Set the color.
    SetShaderParameters(false, false, false, false, false, true);

    WindowFrame.SetUniform(U_COLOR, R, G, B, A);
    WindowFrame.SetUniform(U_MVP, &(Identity[0][0]));

    // Assign position attrib. pointer
    lnvbo->Bind();
    glVertexAttribPointer(WindowFrame.EnableAttribArray(A_POSITION), 2, GL_FLOAT, GL_FALSE, 0, 0);

    ColorBuffer->Bind();
    glVertexAttribPointer(WindowFrame.EnableAttribArray(A_COLOR), 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);

    glDrawArrays(GL_LINES, 0, 2);

    WindowFrame.DisableAttribArray(A_POSITION);
    WindowFrame.DisableAttribArray(A_COLOR);

    Image::ForceRebind();

    glEnable(GL_DEPTH_TEST);
}
Exemplo n.º 8
0
bool ParticleShaderClass::Render(
	ID3D11DeviceContext* deviceContext,
	int indexCount,
	D3DXMATRIX worldMatrix,
	D3DXMATRIX viewMatrix,
	D3DXMATRIX projectionMatrix,
	ID3D11ShaderResourceView* texture
	)
{
	bool result;

	result = SetShaderParameters( //set the shader parameters that it will use for rendering
		deviceContext,
		worldMatrix,
		viewMatrix,
		projectionMatrix,
		texture
		);
	if(!result)
	{
		return false;
	}

	RenderShader(deviceContext, indexCount); //render the prepared buffers with the shader

	return true;
}
Exemplo n.º 9
0
	void AlphaMapShader::Render(Graphics* graphics)
	{

		SetShaderParameters(graphics);

		RenderShader(graphics);
	}
Exemplo n.º 10
0
bool CSLightD::Render(ID3D11DeviceContext *devicecontext,int indexCount,XMMATRIX worldmat,XMMATRIX viewmat,XMMATRIX projmat,ID3D11ShaderResourceView *texture,XMFLOAT3 lightDir,XMFLOAT4 diffuseCol,XMFLOAT4 ambientCol)
{
	if(!SetShaderParameters(devicecontext,worldmat,viewmat,projmat,texture,lightDir,diffuseCol,ambientCol))
		return false;
	RenderShader(devicecontext,indexCount);
	return true;
}
Exemplo n.º 11
0
//------------------------------------------------------------------------------
/// Sets parameter values from configuration file.
void SetShaderParametersFromFile( GLuint program, const char* fileName )
{
	std::ifstream in( fileName );
	if( !in ) throw ShaderParameterException( std::string( "Cannot open file " ) + fileName );
	ShaderParameters params = ReadShaderParameters( in );
	SetShaderParameters( program, params );
}
Exemplo n.º 12
0
bool DXFrame::ShadersDLights::Render(ID3D11DeviceContext* deviceContext,
											int indexCount,
											D3DXMATRIX worldMatrix,
											D3DXMATRIX viewMatrix, 
											D3DXMATRIX projectionMatrix,
											ID3D11ShaderResourceView* texture,
											D3DXVECTOR3 lightDirection, 
											D3DXVECTOR4 diffuseColor)
{
	if (!SetShaderParameters(	deviceContext,
								worldMatrix,
								viewMatrix,
								projectionMatrix,
								texture,
								lightDirection,
								diffuseColor))
		return false;

	deviceContext->IASetInputLayout(m_Layout);
	deviceContext->VSSetShader(m_VertexShader, NULL, 0);
	deviceContext->PSSetShader(m_PixelShader, NULL, 0);
	deviceContext->PSSetSamplers(0, 1, &m_SampleState);
	deviceContext->DrawIndexed(indexCount, 0, 0);
	return true;
}
// Takes the required variables to set the shader parameters and render the buffers using the shader file
void LightShaderClass::Render(ID3D10Device* device, int indexCount, int vertexCount, int instanceCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, 
							  ID3D10ShaderResourceView** textureArray, D3DXVECTOR3 lightDirection, D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor, D3DXVECTOR3 cameraPosition,
								D3DXVECTOR4 specularColor, float specularPower){
	
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, textureArray, lightDirection, ambientColor, diffuseColor, cameraPosition, specularColor, specularPower);
	RenderShader(device, indexCount, vertexCount, instanceCount);
	return;
}
Exemplo n.º 14
0
bool ColorShader::Render(ID3D11DeviceContext *deviceContext, int indexCount, DirectX::XMMATRIX worldMatrix, DirectX::XMMATRIX viewMatrix, DirectX::XMMATRIX projectionMatrix)
{
	if (!SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix))
		return false;
	RenderShader(deviceContext, indexCount);

	return true;
}
bool TextureShaderClass::Render(HWND hwnd, ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX& worldMatrix, XMMATRIX& viewMatrix, XMMATRIX& projectionMatrix, ID3D11ShaderResourceView* texture, float blend, XMFLOAT4 hueColor, bool xFlip, bool yFlip){
	bool result = SetShaderParameters(hwnd, deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, blend, hueColor, xFlip, yFlip);
	if (!result){
		return false;
	}
	RenderShader(deviceContext, indexCount);
	return true;
}
Exemplo n.º 16
0
/*Render will first set the parameters inside the shader using the SetShaderParameters function. 
Once the parameters are set it then calls RenderShader to draw using the HLSL shader.*/
void Shader::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix)
{
	// Set the shader parameters that it will use for rendering.
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix);

	// Now render the prepared buffers with the shader.
	RenderShader(device, indexCount);
}
Exemplo n.º 17
0
void ColorShader::Render(ID3D11DeviceContext* deviceContext, int indexCount,
						 XMFLOAT4X4 worldMatrix, XMFLOAT4X4 viewMatrix, XMFLOAT4X4 projectionMatrix)
{
	SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix);

	RenderShader(deviceContext, indexCount);

	return;
}
Exemplo n.º 18
0
void LightShader::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, 
						 D3DXVECTOR3 mEyePos, Light lightVar, int lightType){

	// Set the shader parameters that it will use for rendering.
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, mEyePos, lightVar, lightType);

	// Now render the prepared buffers with the shader.
	RenderShader(device, indexCount);
}
Exemplo n.º 19
0
void TextureShaderClass::Render(ID3D10Device* device, int indexCount, 
								D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, 
								ID3D10ShaderResourceView* texture) {
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture);

	RenderShader(device, indexCount);

	return;
}
Exemplo n.º 20
0
bool FontShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, D3DXVECTOR4 pixelColor)
{
	if(!SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor))
		return false;

	RenderShader(deviceContext, indexCount);

	return true;
}
Exemplo n.º 21
0
//////////////////////////////////////////////////////////////////////////////////////////
//			Affichage																	//
//////////////////////////////////////////////////////////////////////////////////////////
void CFontShader::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
			     D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture, D3DXVECTOR4 pixelColor)
{
	// Set the shader parameters that it will use for rendering.
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor);
	// Now render the prepared buffers with the shader.
	RenderShader(device, indexCount);

	return;
}
Exemplo n.º 22
0
bool LightShader::Update(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.
	SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor);

	// Now render the prepared buffers with the shader.
	RenderShader(deviceContext, indexCount);
	return true;
}
void TransparentDepthShaderClass::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture)
{
    // Set the shader parameters that it will use for rendering.
    SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture);

    // Now render the prepared buffers with the shader.
    RenderShader(device, indexCount);

    return;
}
Exemplo n.º 24
0
void LightShaderClass::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix,
	D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor, D3DXVECTOR3 lightDirection)
{
	// Set the shader parameters that it will use for rendering.
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix);

	// Now render the prepared buffers with the shader.
	RenderShader(device, indexCount);

	return;
}
void HorizontalBlurShaderClass::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
                                       D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture, float screenWidth)
{
    // Set the shader parameters that it will use for rendering.
    SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture, screenWidth);

    // Now render the prepared buffers with the shader.
    RenderShader(device, indexCount);

    return;
}
bool D3DTextureShader::Render(ID3D11DeviceContext* deviceContext, int indexCount, const XMMATRIX &worldMatrix, const XMMATRIX &viewMatrix, 
								const XMMATRIX &projectionMatrix, ID3D11ShaderResourceView* texture)
{
	// Set the shader parameters that it will use for rendering.
	bool result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture);
	if(!result)
		return false;

	RenderShader(deviceContext, indexCount);

	return true;
}
void RefractionShaderClass::Render(ID3D10Device* device, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
								   D3DXMATRIX projectionMatrix, ID3D10ShaderResourceView* texture, D3DXVECTOR3 lightDirection,
								   D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor, D3DXVECTOR4 clipPlane)
{
	// Set the shader parameters that it will use for rendering.
	SetShaderParameters(worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, clipPlane);

	// Now render the prepared buffers with the shader.
	RenderShader(device, indexCount);

	return;
}
Exemplo n.º 28
0
bool XM_CALLCONV FogFX::Render(ID3D11DeviceContext* immediateContext, int indexCount, XMMATRIX world, XMMATRIX view, XMMATRIX projection, ID3D11ShaderResourceView* texture, float fogStart, float fogEnd)
{
	bool result;

	result = SetShaderParameters(immediateContext, world, view, projection, texture, fogStart, fogEnd);

	if (FAILED(result))
		return false;

	Draw(immediateContext, indexCount);

	return true;
}
Exemplo n.º 29
0
	bool ModelMaterial::Render(ID3D11DeviceContext* a_pDeviceContext, int a_nIndexCount, XMFLOAT4X4 a_mWorldMatrix, XMFLOAT4X4 a_mViewMatrix, XMFLOAT4X4 a_mProjectionMatrix)
	{
		bool result;

		result = SetShaderParameters(a_pDeviceContext, a_mWorldMatrix, a_mViewMatrix, a_mProjectionMatrix);
		if(!result)
		{
			return false;
		}

		RenderShader(a_pDeviceContext, a_nIndexCount);

		return true;
	}
Exemplo n.º 30
0
bool ColorShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX 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;
}