home *** CD-ROM | disk | FTP | other *** search
/ Introduction to 3D Game …ogramming with DirectX 12 / Introduction-to-3D-Game-Programming-with-DirectX-12.ISO / Code.Textures / MyDemos / MyD3D12Project / Shaders / color.hlsl < prev   
Encoding:
Text File  |  2016-03-02  |  856 b   |  43 lines

  1. //***************************************************************************************
  2. // color.hlsl by Frank Luna (C) 2015 All Rights Reserved.
  3. //
  4. // Transforms and colors geometry.
  5. //***************************************************************************************
  6.  
  7. cbuffer cbPerObject : register(b0)
  8. {
  9.     float4x4 gWorldViewProj; 
  10. };
  11.  
  12. struct VertexIn
  13. {
  14.     float3 PosL  : POSITION;
  15.     float4 Color : COLOR;
  16. };
  17.  
  18. struct VertexOut
  19. {
  20.     float4 PosH  : SV_POSITION;
  21.     float4 Color : COLOR;
  22. };
  23.  
  24. VertexOut VS(VertexIn vin)
  25. {
  26.     VertexOut vout;
  27.     
  28.     // Transform to homogeneous clip space.
  29.     vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);
  30.     
  31.     // Just pass vertex color into the pixel shader.
  32.     vout.Color = vin.Color;
  33.     
  34.     return vout;
  35. }
  36.  
  37. float4 PS(VertexOut pin) : SV_Target
  38. {
  39.     return pin.Color;
  40. }
  41.  
  42.  
  43.