r3d_utils.odin 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* r3d_utils.odin -- R3D Utility Module.
  2. *
  3. * Copyright (c) 2025-2026 Le Juez Victor
  4. *
  5. * This software is provided 'as-is', without any express or implied warranty.
  6. * For conditions of distribution and use, see accompanying LICENSE file.
  7. */
  8. package r3d
  9. import rl "vendor:raylib"
  10. when ODIN_OS == .Windows {
  11. foreign import lib {
  12. "windows/libr3d.a",
  13. "system:raylib",
  14. "system:assimp",
  15. }
  16. } else when ODIN_OS == .Linux {
  17. foreign import lib {
  18. "linux/libr3d.a",
  19. "system:raylib",
  20. "system:assimp",
  21. }
  22. } else when ODIN_OS == .Darwin {
  23. foreign import lib {
  24. "darwin/libr3d.a",
  25. "system:raylib",
  26. "system:assimp",
  27. }
  28. }
  29. @(default_calling_convention="c", link_prefix="R3D_")
  30. foreign lib {
  31. /**
  32. * @brief Retrieves a default white texture.
  33. *
  34. * This texture is fully white (1,1,1,1), useful for default material properties.
  35. *
  36. * @return A white texture.
  37. */
  38. GetWhiteTexture :: proc() -> rl.Texture2D ---
  39. /**
  40. * @brief Retrieves a default black texture.
  41. *
  42. * This texture is fully black (0,0,0,1), useful for masking or default values.
  43. *
  44. * @return A black texture.
  45. */
  46. GetBlackTexture :: proc() -> rl.Texture2D ---
  47. /**
  48. * @brief Retrieves a default normal map texture.
  49. *
  50. * This texture represents a neutral normal map (0.5, 0.5, 1.0), which applies no normal variation.
  51. *
  52. * @return A neutral normal texture.
  53. */
  54. GetNormalTexture :: proc() -> rl.Texture2D ---
  55. /**
  56. * @brief Retrieves the buffer containing the scene's normal data.
  57. *
  58. * This texture stores octahedral-compressed normals using two 16-bit per-channel RG components.
  59. *
  60. * @note You can find the decoding functions in the embedded shaders, such as 'screen/lighting.fs.glsl'.
  61. *
  62. * @return The normal buffer texture.
  63. */
  64. GetBufferNormal :: proc() -> rl.Texture2D ---
  65. /**
  66. * @brief Retrieves the final depth buffer.
  67. *
  68. * This texture is an R16 texture containing a linear depth value
  69. * normalized between the near and far clipping planes.
  70. * It does not include a stencil buffer.
  71. *
  72. * The texture is intended for post-processing effects outside of R3D
  73. * that require access to linear depth information.
  74. *
  75. * @return The final depth buffer texture (R16, linear depth).
  76. */
  77. GetBufferDepth :: proc() -> rl.Texture2D ---
  78. /**
  79. * @brief Retrieves the view matrix.
  80. *
  81. * This matrix represents the camera's transformation from world space to view space.
  82. * It is updated at the last call to 'R3D_Begin'.
  83. *
  84. * @return The current view matrix.
  85. */
  86. GetMatrixView :: proc() -> rl.Matrix ---
  87. /**
  88. * @brief Retrieves the inverse view matrix.
  89. *
  90. * This matrix transforms coordinates from view space back to world space.
  91. * It is updated at the last call to 'R3D_Begin'.
  92. *
  93. * @return The current inverse view matrix.
  94. */
  95. GetMatrixInvView :: proc() -> rl.Matrix ---
  96. /**
  97. * @brief Retrieves the projection matrix.
  98. *
  99. * This matrix defines the transformation from view space to clip space.
  100. * It is updated at the last call to 'R3D_Begin'.
  101. *
  102. * @return The current projection matrix.
  103. */
  104. GetMatrixProjection :: proc() -> rl.Matrix ---
  105. /**
  106. * @brief Retrieves the inverse projection matrix.
  107. *
  108. * This matrix transforms coordinates from clip space back to view space.
  109. * It is updated at the last call to 'R3D_Begin'.
  110. *
  111. * @return The current inverse projection matrix.
  112. */
  113. GetMatrixInvProjection :: proc() -> rl.Matrix ---
  114. }