From 9760c325fc33e4f2f3d93c489e1e352ca074e3f0 Mon Sep 17 00:00:00 2001 From: oreo639 Date: Tue, 16 Jan 2024 18:31:31 -0800 Subject: [PATCH] docs: inital attribs documentation --- include/c3d/attribs.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/c3d/attribs.h b/include/c3d/attribs.h index 71d404d..85776d9 100644 --- a/include/c3d/attribs.h +++ b/include/c3d/attribs.h @@ -1,6 +1,11 @@ +/** + * @file attribs.h + * @brief Configure vertex attributes + */ #pragma once #include "types.h" +/// Vertex attribute info typedef struct { u32 flags[2]; @@ -8,9 +13,44 @@ typedef struct int attrCount; } C3D_AttrInfo; +/** + * @brief Resets and initializes \ref C3D_AttrInfo structure to default values. + * @param[out] info Pointer to attribute info structure. + */ void AttrInfo_Init(C3D_AttrInfo* info); + +/** + * @brief Defines an array of vertex attribute data. + * @note The attribute index returned should be the same as the order used + * when specifying \ref AttrInfo_AddLoader() and \ref AttrInfo_AddFixed(). + * @param[out] info Attribute info structure. + * @param[in] regId Specifies the attribute register in the vertex shader that will be modified. + * @param[in] format Specifies the data type of the array. + * @param[in] count Specifies the length of the array. + * @return Attribute index if successful, negative value on failure. + */ int AttrInfo_AddLoader(C3D_AttrInfo* info, int regId, GPU_FORMATS format, int count); + +/** + * @brief Defines a fixed vertex attribute. + * @note The attribute index returned should be the same as the order used + * when specifying \ref AttrInfo_AddLoader() and \ref AttrInfo_AddFixed(). + * @param[out] info Attribute info structure. + * @param[in] regId Specifies the attribute register in the vertex shader that will be modified. + * @return Attribute index if successful, negative value on failure. + */ int AttrInfo_AddFixed(C3D_AttrInfo* info, int regId); +/** + * @brief Gets pointer to the global \ref C3D_AttrInfo structure. + * @return Pointer to global \ref C3D_AttrInfo. This should not be freed. + */ C3D_AttrInfo* C3D_GetAttrInfo(void); + +/** + * @brief Sets global \ref C3D_AttrInfo structure. + * Copies values from the specified \ref C3D_AttrInfo structure to the + * global \ref C3D_AttrInfo structure. + * @param[in] info Pointer to user \ref C3D_AttrInfo. + */ void C3D_SetAttrInfo(C3D_AttrInfo* info);