From b8e87ac5ef5d39b3e221d7d583e59b7e67686786 Mon Sep 17 00:00:00 2001 From: Ben Parsons <9parsonsb@gmail.com> Date: Sat, 2 Oct 2021 21:41:05 +1000 Subject: [PATCH] Fixed-up comments on first ~500 lines --- Raylib-cs/Raylib.cs | 457 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 371 insertions(+), 86 deletions(-) diff --git a/Raylib-cs/Raylib.cs b/Raylib-cs/Raylib.cs index 47aca2b..8b8bfeb 100644 --- a/Raylib-cs/Raylib.cs +++ b/Raylib-cs/Raylib.cs @@ -5,7 +5,9 @@ using System.Security; namespace Raylib_cs { - /// Color type, RGBA (32bit) + /// + /// Color type, RGBA (32bit) + /// [StructLayout(LayoutKind.Sequential)] public struct Color { @@ -65,7 +67,9 @@ namespace Raylib_cs } } - /// Rectangle type + /// + /// Rectangle type + /// [StructLayout(LayoutKind.Sequential)] public struct Rectangle { @@ -83,83 +87,232 @@ namespace Raylib_cs } } - /// Image type, bpp always RGBA (32bit) - /// NOTE: Data stored in CPU memory (RAM) + /// + /// Image type, bpp always RGBA (32bit) + ///
+ /// NOTE: Data stored in CPU memory (RAM) + ///
[StructLayout(LayoutKind.Sequential)] public struct Image { - public IntPtr data; // Image raw data (void *) - public int width; // Image base width - public int height; // Image base height - public int mipmaps; // Mipmap levels, 1 by default - public PixelFormat format; // Data format (PixelFormat type) + /// + /// Image raw data (void *) + /// + public IntPtr data; + + /// + /// Image base width + /// + public int width; + + /// + /// Image base height + /// + public int height; + + /// + /// Mipmap levels, 1 by default + /// + public int mipmaps; + + /// + /// Data format (PixelFormat type) + /// + public PixelFormat format; } - /// Texture2D type - /// NOTE: Data stored in GPU memory + /// + /// Texture2D type + ///
+ /// NOTE: Data stored in GPU memory + ///
[StructLayout(LayoutKind.Sequential)] public struct Texture2D { - public uint id; // OpenGL texture id - public int width; // Texture base width - public int height; // Texture base height - public int mipmaps; // Mipmap levels, 1 by default - public PixelFormat format; // Data format (PixelFormat type) + /// + /// OpenGL texture id + /// + public uint id; + + /// + /// Texture base width + /// + public int width; + + /// + /// Texture base height + /// + public int height; + + /// + /// Mipmap levels, 1 by default + /// + public int mipmaps; + + /// + /// Data format (PixelFormat type) + /// + public PixelFormat format; } - /// RenderTexture2D type, for texture rendering + /// + /// RenderTexture2D type, for texture rendering + /// [StructLayout(LayoutKind.Sequential)] public struct RenderTexture2D { - public uint id; // OpenGL Framebuffer Object (FBO) id - public Texture2D texture; // Color buffer attachment texture - public Texture2D depth; // Depth buffer attachment texture + /// + /// OpenGL Framebuffer Object (FBO) id + /// + public uint id; + + /// + /// Color buffer attachment texture + /// + public Texture2D texture; + + /// + /// Depth buffer attachment texture + /// + public Texture2D depth; } - /// N-Patch layout info + /// + /// N-Patch layout info + /// [StructLayout(LayoutKind.Sequential)] public struct NPatchInfo { - public Rectangle sourceRec; // Region in the texture - public int left; // left border offset - public int top; // top border offset - public int right; // right border offset - public int bottom; // bottom border offset - public NPatchLayout layout; // layout of the n-patch: 3x3, 1x3 or 3x1 + /// + /// Region in the texture + /// + public Rectangle sourceRec; + + /// + /// left border offset + /// + public int left; + + /// + /// top border offset + /// + public int top; + + /// + /// right border offset + /// + public int right; + + /// + /// bottom border offset + /// + public int bottom; + + /// + /// layout of the n-patch: 3x3, 1x3 or 3x1 + /// + public NPatchLayout layout; } - /// Font character info + /// + /// Font character info + /// [StructLayout(LayoutKind.Sequential)] public struct CharInfo { - public int value; // Character value (Unicode) - public int offsetX; // Character offset X when drawing - public int offsetY; // Character offset Y when drawing - public int advanceX; // Character advance position X - public Image image; // Character image data + /// + /// Character value (Unicode) + /// + public int value; + + /// + /// Character offset X when drawing + /// + public int offsetX; + + /// + /// Character offset Y when drawing + /// + public int offsetY; + + /// + /// Character advance position X + /// + public int advanceX; + + /// + /// Character image data + /// + public Image image; } - /// Font type, includes texture and charSet array data + /// + /// Font type, includes texture and charSet array data + /// [StructLayout(LayoutKind.Sequential)] public struct Font { - public int baseSize; // Base size (default chars height) - public int charsCount; // Number of characters - public int charsPadding; // Padding around the chars - public Texture2D texture; // Characters texture atals - public IntPtr recs; // Characters rectangles in texture (Rectangle *) - public IntPtr chars; // Characters info data (CharInfo *) + /// + /// Base size (default chars height) + /// + public int baseSize; + + /// + /// Number of characters + /// + public int charsCount; + + /// + /// Padding around the chars + /// + public int charsPadding; + + /// + /// Characters texture atals + /// + public Texture2D texture; + + /// + /// Characters rectangles in texture (Rectangle *) + /// + public IntPtr recs; + + /// + /// Characters info data (CharInfo *) + /// + public IntPtr chars; } - /// Camera type, defines a camera position/orientation in 3d space + /// + /// Camera type, defines a camera position/orientation in 3d space + /// [StructLayout(LayoutKind.Sequential)] public struct Camera3D { - public Vector3 position; // Camera position - public Vector3 target; // Camera target it looks-at - public Vector3 up; // Camera up vector (rotation over its axis) - public float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic - public CameraProjection projection; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + /// + /// Camera position + /// + public Vector3 position; + + /// + /// Camera target it looks-at + /// + public Vector3 target; + + /// + /// Camera up vector (rotation over its axis) + /// + public Vector3 up; + + /// + /// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic + /// + public float fovy; + + /// + /// Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + /// + public CameraProjection projection; public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovy, CameraProjection projection) { @@ -175,10 +328,25 @@ namespace Raylib_cs [StructLayout(LayoutKind.Sequential)] public struct Camera2D { - public Vector2 offset; // Camera offset (displacement from target) - public Vector2 target; // Camera target (rotation and zoom origin) - public float rotation; // Camera rotation in degrees - public float zoom; // Camera zoom (scaling), should be 1.0f by default + /// + /// Camera offset (displacement from target) + /// + public Vector2 offset; + + /// + /// Camera target (rotation and zoom origin) + /// + public Vector2 target; + + /// + /// Camera rotation in degrees + /// + public float rotation; + + /// + /// Camera zoom (scaling), should be 1.0f by default + /// + public float zoom; public Camera2D(Vector2 offset, Vector2 target, float rotation, float zoom) { @@ -189,70 +357,187 @@ namespace Raylib_cs } } - /// Vertex data definning a mesh - /// NOTE: Data stored in CPU memory (and GPU) + /// + /// Vertex data definning a mesh + /// NOTE: Data stored in CPU memory (and GPU) + /// [StructLayout(LayoutKind.Sequential)] public struct Mesh { - public int vertexCount; // Number of vertices stored in arrays - public int triangleCount; // Number of triangles stored (indexed or not) + /// + /// Number of vertices stored in arrays + /// + public int vertexCount; + + /// + /// Number of triangles stored (indexed or not) + /// + public int triangleCount; - // Default vertex data - public IntPtr vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0, float *) - public IntPtr texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1, float *) - public IntPtr texcoords2; // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5, float *) - public IntPtr normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2, float *) - public IntPtr tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4, float *) - public IntPtr colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3, unsigned char *) - public IntPtr indices; // Vertex indices (in case vertex data comes indexed, unsigned short *) +#region Default vertex data + + /// + /// Vertex position (XYZ - 3 components per vertex) (shader-location = 0, float *) + /// + public IntPtr vertices; + + /// + /// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1, float *) + /// + public IntPtr texcoords; + + /// + /// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5, float *) + /// + public IntPtr texcoords2; + + /// + /// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2, float *) + /// + public IntPtr normals; + + /// + /// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4, float *) + /// + public IntPtr tangents; + + /// + /// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3, unsigned char *) + /// + public IntPtr colors; + + /// + /// Vertex indices (in case vertex data comes indexed, unsigned short *) + /// + public IntPtr indices; + +#endregion + +#region Animation vertex data - // Animation vertex data - public IntPtr animVertices; // Animated vertex positions (after bones transformations, float *) - public IntPtr animNormals; // Animated normals (after bones transformations, float *) - public IntPtr boneIds; // Vertex bone ids, up to 4 bones influence by vertex (skinning, int *) - public IntPtr boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning, float *) + /// + /// Animated vertex positions (after bones transformations, float *) + /// + public IntPtr animVertices; - // OpenGL identifiers - public uint vaoId; // OpenGL Vertex Array Object id - public IntPtr vboId; // OpenGL Vertex Buffer Objects id (default vertex data, uint[]) + /// + /// Animated normals (after bones transformations, float *) + /// + public IntPtr animNormals; + + /// + /// Vertex bone ids, up to 4 bones influence by vertex (skinning, int *) + /// + public IntPtr boneIds; + + /// + /// Vertex bone weight, up to 4 bones influence by vertex (skinning, float *) + /// + public IntPtr boneWeights; + +#endregion + +#region OpenGL identifiers + + /// + /// OpenGL Vertex Array Object id + /// + public uint vaoId; + + /// + /// OpenGL Vertex Buffer Objects id (default vertex data, uint[]) + /// + public IntPtr vboId; + +#endregion } - /// Shader type (generic) + /// + /// Shader type (generic) + /// [StructLayout(LayoutKind.Sequential)] public struct Shader { - public uint id; // Shader program id - public IntPtr locs; // Shader locations array (MAX_SHADER_LOCATIONS, int *) + /// + /// Shader program id + /// + public uint id; + + /// + /// Shader locations array (MAX_SHADER_LOCATIONS, int *) + /// + public IntPtr locs; } - /// Material texture map + /// + /// Material texture map + /// [StructLayout(LayoutKind.Sequential)] public struct MaterialMap { - public Texture2D texture; // Material map texture - public Color color; // Material map color - public float value; // Material map value + /// + /// Material map texture + /// + public Texture2D texture; + + /// + /// Material map color + /// + public Color color; + + /// + /// Material map value + /// + public float value; } - /// Material type (generic) + /// + /// Material type (generic) + /// [StructLayout(LayoutKind.Sequential)] public struct Material { - public Shader shader; // Material shader - public IntPtr maps; // Material maps (MaterialMap *) - public IntPtr param; // Material generic parameters (if required, float *) + /// + /// Material shader + /// + public Shader shader; + + /// + /// Material maps (MaterialMap *) + /// + public IntPtr maps; + + /// + /// Material generic parameters (if required, float *) + /// + public IntPtr param; } - /// Transformation properties + /// + /// Transformation properties + /// [StructLayout(LayoutKind.Sequential)] public struct Transform { - public Vector3 translation; // Translation - public Vector4 rotation; // Rotation - public Vector3 scale; // Scale + /// + /// Translation + /// + public Vector3 translation; + + /// + /// Rotation + /// + public Vector4 rotation; + + /// + /// Scale + /// + public Vector3 scale; } - /// Bone information + /// + /// Bone information + /// [StructLayout(LayoutKind.Sequential)] public struct BoneInfo {