hlslStructs.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. // The purpose of this file is to get all of our HLSL structures into one place.
  23. // Please use the structures here instead of redefining input and output structures
  24. // in each shader file. If structures are added, please adhere to the naming convention.
  25. //------------------------------------------------------------------------------
  26. // Vertex Input Structures
  27. //
  28. // These structures map to FVFs/Vertex Declarations in Torque. See gfxStructs.h
  29. //------------------------------------------------------------------------------
  30. // Notes
  31. //
  32. // Position should be specified as a float4. Right now our vertex structures in
  33. // the engine output float3s for position. This does NOT mean that the POSITION
  34. // binding should be float3, because it will assign 0 to the w coordinate, which
  35. // results in the vertex not getting translated when it is transformed.
  36. struct VertexIn_P
  37. {
  38. float4 pos : POSITION;
  39. };
  40. struct VertexIn_PT
  41. {
  42. float4 pos : POSITION;
  43. float2 uv0 : TEXCOORD0;
  44. };
  45. struct VertexIn_PTTT
  46. {
  47. float4 pos : POSITION;
  48. float2 uv0 : TEXCOORD0;
  49. float2 uv1 : TEXCOORD1;
  50. float2 uv2 : TEXCOORD2;
  51. };
  52. struct VertexIn_PC
  53. {
  54. float4 pos : POSITION;
  55. float4 color : DIFFUSE;
  56. };
  57. struct VertexIn_PNC
  58. {
  59. float4 pos : POSITION;
  60. float3 normal : NORMAL;
  61. float4 color : DIFFUSE;
  62. };
  63. struct VertexIn_PCT
  64. {
  65. float4 pos : POSITION;
  66. float4 color : DIFFUSE;
  67. float2 uv0 : TEXCOORD0;
  68. };
  69. struct VertexIn_PN
  70. {
  71. float4 pos : POSITION;
  72. float3 normal : NORMAL;
  73. };
  74. struct VertexIn_PNT
  75. {
  76. float4 pos : POSITION;
  77. float3 normal : NORMAL;
  78. float2 uv0 : TEXCOORD0;
  79. };
  80. struct VertexIn_PNTT
  81. {
  82. float4 pos : POSITION;
  83. float3 normal : NORMAL;
  84. float3 tangent : TANGENT;
  85. float2 uv0 : TEXCOORD0;
  86. };
  87. struct VertexIn_PNCT
  88. {
  89. float4 pos : POSITION;
  90. float3 normal : NORMAL;
  91. float4 color : DIFFUSE;
  92. float2 uv0 : TEXCOORD0;
  93. };
  94. struct VertexIn_PNTTTB
  95. {
  96. float4 pos : POSITION;
  97. float3 normal : NORMAL;
  98. float2 uv0 : TEXCOORD0;
  99. float2 uv1 : TEXCOORD1;
  100. float3 T : TEXCOORD2;
  101. float3 B : TEXCOORD3;
  102. };