57 lines
1.4 KiB
GLSL
57 lines
1.4 KiB
GLSL
////////////////////////////////////////////////////////////////////////////////
|
|
// Filename: texture.vs
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/////////////
|
|
// GLOBALS //
|
|
/////////////
|
|
cbuffer MatrixBuffer
|
|
{
|
|
matrix worldMatrix;
|
|
matrix viewMatrix;
|
|
matrix projectionMatrix;
|
|
};
|
|
|
|
|
|
//////////////
|
|
// TYPEDEFS //
|
|
//////////////
|
|
struct VertexInputType
|
|
{
|
|
float4 position : POSITION;
|
|
float2 tex : TEXCOORD0;
|
|
float4 normal : NORMAL;
|
|
};
|
|
|
|
struct PixelInputType
|
|
{
|
|
float4 position : SV_POSITION;
|
|
float2 tex : TEXCOORD0;
|
|
float4 normal : NORMAL;
|
|
};
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Vertex Shader
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
PixelInputType TextureVertexShader(VertexInputType input)
|
|
{
|
|
PixelInputType output;
|
|
|
|
|
|
// Change the position vector to be 4 units for proper matrix calculations.
|
|
input.position.w = 1.0f;
|
|
|
|
// Calculate the position of the vertex against the world, view, and projection matrices.
|
|
output.position = mul(input.position, worldMatrix);
|
|
output.position = mul(output.position, viewMatrix);
|
|
output.position = mul(output.position, projectionMatrix);
|
|
//output.position = mul(projectionMatrix, output.position);
|
|
//output.position = input.position;
|
|
|
|
// Store the texture coordinates for the pixel shader.
|
|
output.tex = input.tex;
|
|
|
|
return output;
|
|
} |