Advertisement
Guest User

list sync

a guest
Nov 2nd, 2021
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. //
  2. // .h
  3. //
  4.  
  5. // vertex buffer list
  6. // order: EnumId, Format, Name
  7. #define VB_LIST(V) \
  8.     V(Position,  DXGI_FORMAT_R32G32B32_FLOAT, "POSITION") \
  9.     V(Normal,    DXGI_FORMAT_R32G32B32_FLOAT, "NORMAL") \
  10.     V(TexCoords, DXGI_FORMAT_R32G32_FLOAT,    "TEXCOORD")
  11.  
  12. struct VertexBufferId
  13. {
  14.     enum Type
  15.     {
  16. #define VB_ITEM(EnumId, Format, Name) EnumId,
  17.         VB_LIST(VB_ITEM)
  18. #undef VB_ITEM
  19.         Count
  20.     };
  21. };
  22.  
  23. DXGI_FORMAT vbFormats[VertexBufferId::Count + 1];
  24. const char* vbNames[VertexBufferId::Count + 1];
  25.  
  26. //
  27. // .cpp
  28. //
  29.  
  30. // the +1 is to account for the macro expansion of the comma character
  31. // some old compilers will complain about it
  32. DXGI_FORMAT vbFormats[VertexBufferId::Count + 1] =
  33. {
  34. #define VB_ITEM(EnumId, Format, Name) Format,
  35.     VB_LIST(VB_ITEM)
  36. #undef VB_ITEM
  37.     DXGI_FORMAT_UNKNOWN
  38. };
  39.  
  40. const char* vbNames[VertexBufferId::Count + 1] =
  41. {
  42. #define VB_ITEM(EnumId, Format, Name) Name,
  43.     VB_LIST(VB_ITEM)
  44. #undef VB_ITEM
  45.     ""
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement