Model.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (C) 2009-2020, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <shaders/glsl_cpp_common/Common.h>
  7. ANKI_BEGIN_NAMESPACE
  8. const U32 UV_CHANNEL_COUNT = 2;
  9. struct Vertex
  10. {
  11. U32 m_normal; // Packed in R10G10B10A2SNorm
  12. U32 m_tangent; // Packed in R10G10B10A2SNorm
  13. HVec2 m_uvs[UV_CHANNEL_COUNT];
  14. };
  15. const U32 SIZEOF_VERTEX = 4 * 4;
  16. struct Mesh
  17. {
  18. U64 m_indexBufferPtr; // Points to a buffer of U16
  19. U64 m_positionBufferPtr; // Points to a buffer of Vec3
  20. U64 m_vertexBufferPtr; // Points to a buffer of Vertex
  21. U32 m_indexCount;
  22. U32 m_vertexCount;
  23. };
  24. const U32 TEXTURE_CHANNEL_COUNT = 8;
  25. struct Material
  26. {
  27. U32 m_textureIds[TEXTURE_CHANNEL_COUNT];
  28. Vec3 m_diffuseColor;
  29. Vec3 m_specularColor;
  30. Vec3 m_emissiveColor;
  31. F32 m_roughness;
  32. F32 m_metallines;
  33. };
  34. struct ModelInstance
  35. {
  36. Mesh m_mesh;
  37. Material m_material;
  38. #if defined(__cplusplus)
  39. F32 m_worldTransform[12];
  40. #else
  41. Mat3x4 m_worldTransform;
  42. #endif
  43. Mat3 m_worldRotation;
  44. };
  45. ANKI_END_NAMESPACE