rlgl.d 7.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. module rlgl;
  2. import raylib;
  3. extern (C) @nogc nothrow:
  4. //------------------------------------------------------------------------------------
  5. // Functions Declaration - Matrix operations
  6. //------------------------------------------------------------------------------------
  7. void rlMatrixMode(int mode); // Choose the current matrix to be transformed
  8. void rlPushMatrix(); // Push the current matrix to stack
  9. void rlPopMatrix(); // Pop lattest inserted matrix from stack
  10. void rlLoadIdentity(); // Reset current matrix to identity matrix
  11. void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix
  12. void rlRotatef(float angleDeg, float x, float y, float z); // Multiply the current matrix by a rotation matrix
  13. void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix
  14. void rlMultMatrixf(float *matf); // Multiply the current matrix by another matrix
  15. void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
  16. void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar);
  17. void rlViewport(int x, int y, int width, int height); // Set the viewport area
  18. //------------------------------------------------------------------------------------
  19. // Functions Declaration - Vertex level operations
  20. //------------------------------------------------------------------------------------
  21. void rlBegin(int mode); // Initialize drawing mode (how to organize vertex)
  22. void rlEnd(); // Finish vertex providing
  23. void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int
  24. void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float
  25. void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float
  26. void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float
  27. void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float
  28. void rlColor4ub(byte r, byte g, byte b, byte a); // Define one vertex (color) - 4 byte
  29. void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float
  30. void rlColor4f(float x, float y, float z, float w); // Define one vertex (color) - 4 float
  31. //------------------------------------------------------------------------------------
  32. // Functions Declaration - OpenGL equivalent functions (common to 1.1, 3.3+, ES2)
  33. // NOTE: This functions are used to completely abstract raylib code from OpenGL layer
  34. //------------------------------------------------------------------------------------
  35. void rlEnableTexture(uint id); // Enable texture usage
  36. void rlDisableTexture(); // Disable texture usage
  37. void rlTextureParameters(uint id, int param, int value); // Set texture parameters (filter, wrap)
  38. void rlEnableRenderTexture(uint id); // Enable render texture (fbo)
  39. void rlDisableRenderTexture(); // Disable render texture (fbo), return to default framebuffer
  40. void rlEnableDepthTest(); // Enable depth test
  41. void rlDisableDepthTest(); // Disable depth test
  42. void rlEnableBackfaceCulling(); // Enable backface culling
  43. void rlDisableBackfaceCulling(); // Disable backface culling
  44. void rlEnableScissorTest(); // Enable scissor test
  45. void rlDisableScissorTest(); // Disable scissor test
  46. void rlScissor(int x, int y, int width, int height); // Scissor test
  47. void rlEnableWireMode(); // Enable wire mode
  48. void rlDisableWireMode(); // Disable wire mode
  49. void rlDeleteTextures(uint id); // Delete OpenGL texture from GPU
  50. void rlDeleteRenderTextures(RenderTexture2D target); // Delete render textures (fbo) from GPU
  51. void rlDeleteShader(uint id); // Delete OpenGL shader program from GPU
  52. void rlDeleteVertexArrays(uint id); // Unload vertex data (VAO) from GPU memory
  53. void rlDeleteBuffers(uint id); // Unload vertex data (VBO) from GPU memory
  54. void rlClearColor(byte r, byte g, byte b, byte a); // Clear color buffer with color
  55. void rlClearScreenBuffers(); // Clear used screen buffers (color and depth)
  56. void rlUpdateBuffer(int bufferId, void *data, int dataSize); // Update GPU buffer with new data
  57. uint rlLoadAttribBuffer(uint vaoId, int shaderLoc, void *buffer, int size, bool dynamic); // Load a new attributes buffer
  58. //------------------------------------------------------------------------------------
  59. // Functions Declaration - rlgl functionality
  60. //------------------------------------------------------------------------------------
  61. void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
  62. void rlglClose(); // De-inititialize rlgl (buffers, shaders, textures)
  63. void rlglDraw(); // Update and draw default internal buffers
  64. int rlGetVersion(); // Returns current OpenGL version
  65. bool rlCheckBufferLimit(int vCount); // Check internal buffer overflow for a given number of vertex
  66. void rlSetDebugMarker(const char *text); // Set debug marker for analysis
  67. void rlLoadExtensions(void *loader); // Load OpenGL extensions
  68. Vector3 rlUnproject(Vector3 source, Matrix proj, Matrix view); // Get world coordinates from screen coordinates
  69. // Textures data management
  70. uint rlLoadTexture(void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU
  71. uint rlLoadTextureDepth(int width, int height, int bits, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo)
  72. uint rlLoadTextureCubemap(void *data, int size, int format); // Load texture cubemap
  73. void rlUpdateTexture(uint id, int width, int height, int format, const void *data); // Update GPU texture with new data
  74. void rlGetGlTextureFormats(int format, uint *glInternalFormat, uint *glFormat, uint *glType); // Get OpenGL internal formats
  75. void rlUnloadTexture(uint id); // Unload texture from GPU memory
  76. void rlGenerateMipmaps(Texture2D *texture); // Generate mipmap data for selected texture
  77. void *rlReadTexturePixels(Texture2D texture); // Read texture pixel data
  78. ubyte *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer)
  79. // Render texture management (fbo)
  80. RenderTexture2D rlLoadRenderTexture(int width, int height, int format, int depthBits, bool useDepthTexture); // Load a render texture (with color and depth attachments)
  81. void rlRenderTextureAttach(RenderTexture target, uint id, int attachType); // Attach texture/renderbuffer to an fbo
  82. bool rlRenderTextureComplete(RenderTexture target); // Verify render texture is complete
  83. // Vertex data management
  84. void rlLoadMesh(Mesh *mesh, bool dynamic); // Upload vertex data into GPU and provided VAO/VBO ids
  85. void rlUpdateMesh(Mesh mesh, int buffer, int num); // Update vertex or index data on GPU (upload new data to one buffer)
  86. void rlUpdateMeshAt(Mesh mesh, int buffer, int num, int index); // Update vertex or index data on GPU, at index
  87. void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
  88. void rlUnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU