Skip to content

Commit

Permalink
Fix: Update docs example code
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Oct 23, 2023
1 parent 807dc6c commit 8c5f198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ The following snippet illustrates how to use fastgltf to load a glTF file.

.. code:: c++

#include <fastgltf_parser.hpp>
#include <fastgltf_types.hpp>
#include <fastgltf/parser.hpp>
#include <fastgltf/types.hpp>

void load(std::filesystem::path path) {
// Creates a Parser instance. Optimally, you should reuse this across loads, but don't use it
Expand All @@ -139,6 +139,7 @@ The following snippet illustrates how to use fastgltf to load a glTF file.

// This loads the glTF file into the gltf object and parses the JSON. For GLB files, use
// Parser::loadBinaryGLTF instead.
// You can detect the type of glTF using fastgltf::determineGltfFileType.
auto asset = parser.loadGLTF(&data, path.parent_path(), fastgltf::Options::None);
if (auto error = asset.error(); error != fastgltf::Error::None) {
// Some error occurred while reading the buffer, parsing the JSON, or validating the data.
Expand All @@ -151,11 +152,11 @@ The following snippet illustrates how to use fastgltf to load a glTF file.
// Process the buffers.
}

// Optionally, you can now also call the Parser::validate method. This will more strictly
// Optionally, you can now also call the fastgltf::validate method. This will more strictly
// enforce the glTF spec and is not needed most of the time, though I would certainly
// recommend it in a development environment or when debugging to avoid mishaps.

// parser.validate(asset.get());
// fastgltf::validate(asset.get());
}


Expand Down
3 changes: 3 additions & 0 deletions docs/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ For example, ``glm::vec3`` would be a vector of 3 floats, which would be defined
template <>
struct fastgltf::ElementTraits<glm::vec3> : fastgltf::ElementTraitsBase<glm::vec3, AccessorType::Vec3, float> {};

Note that, for glm types, there is a header with all pre-defined types shipped with fastgltf: ``fastgltf/glm_element_traits.hpp``.
This header includes the ElementTraits definition for all relevant glm types.


.. warning::

Expand Down

0 comments on commit 8c5f198

Please sign in to comment.