Skip to content

Commit 3db332a

Browse files
Updated documentation
1 parent feeb5a1 commit 3db332a

File tree

11 files changed

+265
-226
lines changed

11 files changed

+265
-226
lines changed

AssetLoader/interface/GLTFLoader.hpp

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
#pragma once
2929

30+
/// \file
31+
/// GLTF loader implementation.
32+
3033
#include <vector>
3134
#include <array>
3235
#include <cfloat>
@@ -72,7 +75,7 @@ class MaterialBuilder;
7275
/// Texture attribute description.
7376
struct TextureAttributeDesc
7477
{
75-
/// Texture attribute name (e.g. "baseColorTexture", "metallicRoughnessTexture", etc.)
78+
/// Texture attribute name (e.g. `"baseColorTexture"`, `"metallicRoughnessTexture"`, etc.)
7679
const char* Name = nullptr;
7780

7881
/// Texture attribute index in Material.ShaderAttribs (e.g. UVSelectorX, TextureSliceX, UVScaleBias[X]).
@@ -631,7 +634,7 @@ struct Animation
631634
/// Vertex attribute description.
632635
struct VertexAttributeDesc
633636
{
634-
/// Attribute name ("POSITION", "NORMAL", "TEXCOORD_0", "TEXCOORD_1", "JOINTS_0", "WEIGHTS_0", etc.).
637+
/// Attribute name (`"POSITION"`, `"NORMAL"`, `"TEXCOORD_0"`, `"TEXCOORD_1"`, `"JOINTS_0"`, `"WEIGHTS_0"`, etc.).
635638
const char* Name = nullptr;
636639

637640
/// Index of the vertex buffer that stores this attribute.
@@ -644,15 +647,15 @@ struct VertexAttributeDesc
644647
Uint8 NumComponents = 0;
645648

646649
/// Relative offset, in bytes, from the start of the vertex data to the start of the attribute.
647-
/// If this value is set to 0xFFFFFFFF (the default value), the offset will
650+
/// If this value is set to `0xFFFFFFFF` (the default value), the offset will
648651
/// be computed automatically by placing the attribute right after the previous one.
649652
Uint32 RelativeOffset = ~0U;
650653

651654
/// Default attribute value.
652-
///
653-
/// \remarks This value is used when the attribute is not present in the source GLTF model.
654-
/// The pointer must point to a value of the appropriate type (e.g. float3 for VT_FLOAT32, 3).
655-
/// If this value is null, the attribute will be initialized with zeros.
655+
656+
/// This value is used when the attribute is not present in the source GLTF model.
657+
/// The pointer must point to a value of the appropriate type (e.g. float3 for VT_FLOAT32, 3).
658+
/// If this value is null, the attribute will be initialized with zeros.
656659
const void* pDefaultValue = nullptr;
657660

658661
constexpr VertexAttributeDesc() noexcept {}
@@ -737,6 +740,9 @@ struct ModelCreateInfo
737740
ResourceManager* pResourceManager = nullptr;
738741

739742
using NodeLoadCallbackType = std::function<void(const void* pSrcModel, int SrcNodeIndex, const void* pSrcNode, Node& DstNode)>;
743+
744+
/// Node loading callback function.
745+
740746
/// User-provided node loading callback function that will be called for
741747
/// every node being loaded.
742748
///
@@ -745,44 +751,53 @@ struct ModelCreateInfo
745751
/// \param [in] pSrcNode - a pointer to the source node.
746752
/// \param [out] DstNode - reference to the destination node.
747753
///
748-
/// \remarks The application should cast pSrcNode to the appropriate type
749-
/// depending on the loader it is using (e.g. tinygltf::Node*).
754+
/// The application should cast `pSrcNode` to the appropriate type
755+
/// depending on the loader it is using (e.g. `tinygltf::Node*`).
750756
NodeLoadCallbackType NodeLoadCallback = nullptr;
751757

752758
using MeshLoadCallbackType = std::function<void(const void* pSrcModel, const void* pSrcMesh, Mesh& DstMesh)>;
759+
760+
/// Mesh loading callback function.
761+
753762
/// User-provided mesh loading callback function that will be called for
754763
/// every mesh being loaded.
755764
///
756765
/// \param [in] pSrcModel - a pointer to the source GLTF model.
757766
/// \param [in] pSrcMesh - a pointer to the source mesh.
758767
/// \param [out] DstMesh - reference to the destination mesh.
759768
///
760-
/// \remarks The application should cast pSrcMesh to the appropriate type
761-
/// depending on the loader it is using (e.g. tinygltf::Mesh*).
769+
/// The application should cast `pSrcMesh` to the appropriate type
770+
/// depending on the loader it is using (e.g. `tinygltf::Mesh*`).
762771
MeshLoadCallbackType MeshLoadCallback = nullptr;
763772

764773
using PrimitiveLoadCallbackType = std::function<void(const void* pSrcModel, const void* pSrcPrim, Primitive& DstPrim)>;
774+
775+
/// Primitive loading callback function.
776+
765777
/// User-provided primitive loading callback function that will be called for
766778
/// every primitive being loaded.
767779
///
768780
/// \param [in] pSrcModel - a pointer to the source model.
769781
/// \param [in] pSrcPrim - a pointer to the source primitive.
770782
/// \param [out] DstPrim - reference to the destination primitive.
771783
///
772-
/// \remarks The application should cast pSrcPrim to the appropriate type
773-
/// depending on the loader it is using (e.g. tinygltf::Primitive*).
784+
/// The application should cast `pSrcPrim` to the appropriate type
785+
/// depending on the loader it is using (e.g. `tinygltf::Primitive*`).
774786
PrimitiveLoadCallbackType PrimitiveLoadCallback = nullptr;
775787

776788
using MaterialLoadCallbackType = std::function<void(const void* pSrcModel, const void* pSrcMat, Material& DstMat)>;
789+
790+
/// Material loading callback function.
791+
777792
/// User-provided material loading callback function that will be called for
778793
/// every material being loaded.
779794
///
780795
/// \param [in] pSrcModel - a pointer to the source model.
781796
/// \param [in] pSrcMat - a pointer to the source material.
782797
/// \param [out] DstMat - reference to the destination material.
783798
///
784-
/// \remarks The application should cast pSrcMat to the appropriate type
785-
/// depending on the loader it is using (e.g. tinygltf::Material*).
799+
/// The application should cast `pSrcMat` to the appropriate type
800+
/// depending on the loader it is using (e.g. `tinygltf::Material*`).
786801
MaterialLoadCallbackType MaterialLoadCallback = nullptr;
787802

788803
using FileExistsCallbackType = std::function<bool(const char* FilePath)>;
@@ -807,15 +822,15 @@ struct ModelCreateInfo
807822
/// A pointer to the array of NumVertexAttributes vertex attributes defining
808823
/// the vertex layout.
809824
///
810-
/// \remarks If null is provided, default vertex attributes will be used (see DefaultVertexAttributes).
825+
/// If null is provided, default vertex attributes will be used (see DefaultVertexAttributes).
811826
const VertexAttributeDesc* VertexAttributes = nullptr;
812827

813828
/// The number of elements in the VertexAttributes array.
814829
Uint32 NumVertexAttributes = 0;
815830

816831
/// A pointer to the array of NumTextureAttributes texture attributes.
817832
///
818-
/// \remarks If null is provided, default vertex attributes will be used (see DefaultTextureAttributes).
833+
/// If null is provided, default vertex attributes will be used (see DefaultTextureAttributes).
819834
const TextureAttributeDesc* TextureAttributes = nullptr;
820835

821836
/// The number of elements in the TextureAttributes array.
@@ -825,27 +840,28 @@ struct ModelCreateInfo
825840
Int32 SceneId = -1;
826841

827842
/// Whether to compute primitive bounding boxes from vertex positions.
828-
///
829-
/// \remarks By default, primitive bounding boxes are defined by the
830-
/// min/max values of the primitive's position accessor in the
831-
/// source GLTF model. If this flag is set to true, the bounding
832-
/// boxes will be computed from vertex positions instead.
833-
/// This may be useful if the source model does not define
834-
/// bounding boxes for its primitives or if the bounding boxes
835-
/// are imprecise.
843+
844+
/// By default, primitive bounding boxes are defined by the
845+
/// min/max values of the primitive's position accessor in the
846+
/// source GLTF model. If this flag is set to true, the bounding
847+
/// boxes will be computed from vertex positions instead.
848+
/// This may be useful if the source model does not define
849+
/// bounding boxes for its primitives or if the bounding boxes
850+
/// are imprecise.
836851
bool ComputeBoundingBoxes = false;
837852

838853
/// Whether to create stub vertex buffers even if the model
839854
/// does provide any attribute to store in the buffer.
840855
///
841-
/// \remarks By default, if the model does not provide any attribute
842-
/// to store in the vertex buffer, the buffer will not be
843-
/// created. However, an application may still request the
844-
/// buffer to be created by setting this flag to true.
845-
/// This may be useful if the application uses the same vertex
846-
/// layout for all models and wants to avoid checking if the
847-
/// buffer is null.
848-
/// The buffer will be zero-initialized.
856+
/// By default, if the model does not provide any attribute
857+
/// to store in the vertex buffer, the buffer will not be
858+
/// created. However, an application may still request the
859+
/// buffer to be created by setting this flag to true.
860+
/// This may be useful if the application uses the same vertex
861+
/// layout for all models and wants to avoid checking if the
862+
/// buffer is null.
863+
///
864+
/// The buffer will be zero-initialized.
849865
bool CreateStubVertexBuffers = false;
850866

851867
ModelCreateInfo() = default;
@@ -897,6 +913,7 @@ struct ModelTransforms
897913
std::vector<AnimationTransforms> NodeAnimations;
898914
};
899915

916+
/// GLTF model.
900917
struct Model
901918
{
902919
std::vector<Scene> Scenes;
@@ -1033,16 +1050,16 @@ struct Model
10331050
}
10341051

10351052
/// Returns an index of the vertex pool in the resource manager.
1036-
///
1037-
/// \remarks This index should be passed to the GetVertexPool method of the resource manager.
1053+
1054+
/// This index should be passed to the GetVertexPool method of the resource manager.
10381055
Uint32 GetVertexPoolIndex() const
10391056
{
10401057
return VertexData.PoolId;
10411058
}
10421059

10431060
/// Returns an index of the index buffer allocator in the resource manager.
1044-
///
1045-
/// \remarks This index should be passed to the GetIndexBuffer method of the resource manager.
1061+
1062+
/// This index should be passed to the GetIndexBuffer method of the resource manager.
10461063
Uint32 GetIndexAllocatorIndex() const
10471064
{
10481065
return IndexData.AllocatorId;
@@ -1087,6 +1104,7 @@ struct Model
10871104
/// Returns the material texture attribute index in Material.ShaderAttribs for
10881105
/// the given texture attribute name, or -1 if the attribute is not defined.
10891106
/// For example, for default attributes:
1107+
///
10901108
/// "baseColorTexture" -> 0
10911109
/// "metallicRoughnessTexture" -> 1
10921110
/// "normalTexture" -> 2

0 commit comments

Comments
 (0)