Skip to content

Commit

Permalink
Lots of additional docs
Browse files Browse the repository at this point in the history
  • Loading branch information
azrogers committed Dec 10, 2024
1 parent 254e759 commit d98f4b9
Show file tree
Hide file tree
Showing 23 changed files with 735 additions and 102 deletions.
9 changes: 9 additions & 0 deletions CesiumGeometry/include/CesiumGeometry/Availability.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ struct CESIUMGEOMETRY_API SubtreeBufferView {
uint8_t buffer;
};

/**
* @brief A view into availability information for part of the availability
* tree. This could be either a constant boolean value or a descriptor pointing
* to a buffer in an \ref AvailabilitySubtree where the information will be
* looked up.
*
* Instead of using this type directly, \ref AvailabilityAccessor can be used to
* work with it safely.
*/
typedef std::variant<ConstantAvailability, SubtreeBufferView> AvailabilityView;

/**
Expand Down
24 changes: 24 additions & 0 deletions CesiumGeometry/include/CesiumGeometry/AxisAlignedBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@

namespace CesiumGeometry {

/**
* @brief An Axis-Aligned Bounding Box (AABB), where the axes of the box are
* aligned with the axes of the coordinate system.
*/
struct CESIUMGEOMETRY_API AxisAlignedBox final {

/**
* @brief Creates an empty AABB with a length, width, and height of zero,
* with the center located at (0, 0, 0).
*/
constexpr AxisAlignedBox() noexcept
: minimumX(0.0),
minimumY(0.0),
Expand All @@ -20,6 +28,16 @@ struct CESIUMGEOMETRY_API AxisAlignedBox final {
lengthZ(0.0),
center(0.0) {}

/**
* @brief Creates a new AABB using the range of coordinates the box covers.
*
* @param minimumX_ The minimum X coordinate within the box.
* @param minimumY_ The minimum Y coordinate within the box.
* @param minimumZ_ The minimum Z coordinate within the box.
* @param maximumX_ The maximum X coordinate within the box.
* @param maximumY_ The maximum Y coordinate within the box.
* @param maximumZ_ The maximum Z coordinate within the box.
*/
constexpr AxisAlignedBox(
double minimumX_,
double minimumY_,
Expand Down Expand Up @@ -91,6 +109,12 @@ struct CESIUMGEOMETRY_API AxisAlignedBox final {
*/
glm::dvec3 center;

/**
* @brief Checks if this AABB contains the given position.
*
* @param position The position to check.
* @returns True if this AABB contains the position, false otherwise.
*/
constexpr bool contains(const glm::dvec3& position) const noexcept {
return position.x >= this->minimumX && position.x <= this->maximumX &&
position.y >= this->minimumY && position.y <= this->maximumY &&
Expand Down
10 changes: 10 additions & 0 deletions CesiumGeometry/include/CesiumGeometry/OctreeAvailability.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

namespace CesiumGeometry {

/**
* @brief An availability tree for an octree, where availability can be stored
* and computed based on \ref OctreeTileID.
*/
class CESIUMGEOMETRY_API OctreeAvailability final {
public:
/**
Expand Down Expand Up @@ -136,20 +140,26 @@ class CESIUMGEOMETRY_API OctreeAvailability final {

/**
* @brief Gets the number of levels in each subtree.
*
* @returns The number of levels in each subtree.
*/
constexpr inline uint32_t getSubtreeLevels() const noexcept {
return this->_subtreeLevels;
}

/**
* @brief Gets the index of the maximum level in this implicit tileset.
*
* @returns The index of the maximum level.
*/
constexpr inline uint32_t getMaximumLevel() const noexcept {
return this->_maximumLevel;
}

/**
* @brief Gets a pointer to the root subtree node of this implicit tileset.
*
* @returns The root node of the availability tree.
*/
AvailabilityNode* getRootNode() noexcept { return this->_pRoot.get(); }

Expand Down
4 changes: 4 additions & 0 deletions CesiumGeometry/include/CesiumGeometry/QuadtreeAvailability.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

namespace CesiumGeometry {

/**
* @brief An availability tree for a quadtree, where availability can be stored
* and computed based on \ref QuadtreeTileID.
*/
class CESIUMGEOMETRY_API QuadtreeAvailability final {
public:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

namespace CesiumGeospatial {

/**
* @brief Helper class for creating a \ref BoundingRegion or \ref GlobeRectangle
* from a set of points.
*/
class CESIUMGEOSPATIAL_API BoundingRegionBuilder {
public:
/**
Expand Down
40 changes: 40 additions & 0 deletions CesiumGltf/include/CesiumGltf/PropertyArrayView.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,29 @@ template <typename ElementType> class PropertyArrayView {
PropertyArrayView(const std::span<const std::byte>& buffer) noexcept
: _values{CesiumUtility::reintepretCastSpan<const ElementType>(buffer)} {}

/**
* @brief Accesses the element of this array at the given index.
*/
const ElementType& operator[](int64_t index) const noexcept {
return this->_values[index];
}

/**
* @brief The number of elements in this array.
*/
int64_t size() const noexcept { return this->_values.size(); }

/**
* @brief The `begin` iterator.
*/
auto begin() { return this->_values.begin(); }
/**
* @brief The `end` iterator.
*/
auto end() { return this->_values.end(); }
/** @copydoc begin */
auto begin() const { return this->_values.begin(); }
/** @copydoc end */
auto end() const { return this->_values.end(); }

private:
Expand Down Expand Up @@ -125,6 +139,13 @@ template <typename ElementType> class PropertyArrayCopy {
PropertyArrayView<ElementType> _view;
};

/**
* @brief A view on a bool array element of a {@link PropertyTableProperty}
* or {@link PropertyTextureProperty}.
*
* Provides utility to retrieve the data stored in the array of
* elements via the array index operator.
*/
template <> class PropertyArrayView<bool> {
public:
/**
Expand All @@ -146,6 +167,9 @@ template <> class PropertyArrayView<bool> {
int64_t size) noexcept
: _values{buffer}, _bitOffset{bitOffset}, _size{size} {}

/**
* @brief Obtains the element in the array at the given index.
*/
bool operator[](int64_t index) const noexcept {
index += _bitOffset;
const int64_t byteIndex = index / 8;
Expand All @@ -154,6 +178,9 @@ template <> class PropertyArrayView<bool> {
return bitValue == 1;
}

/**
* @brief The number of entries in the array.
*/
int64_t size() const noexcept { return _size; }

private:
Expand All @@ -162,6 +189,13 @@ template <> class PropertyArrayView<bool> {
int64_t _size;
};

/**
* @brief A view on a string array element of a {@link PropertyTableProperty}
* or {@link PropertyTextureProperty}.
*
* Provides utility to retrieve the data stored in the array of
* elements via the array index operator.
*/
template <> class PropertyArrayView<std::string_view> {
public:
/**
Expand Down Expand Up @@ -191,6 +225,9 @@ template <> class PropertyArrayView<std::string_view> {
_stringOffsetType{stringOffsetType},
_size{size} {}

/**
* @brief Obtains an `std::string_view` for the element at the given index.
*/
std::string_view operator[](int64_t index) const noexcept {
const size_t currentOffset =
getOffsetFromOffsetsBuffer(index, _stringOffsets, _stringOffsetType);
Expand All @@ -203,6 +240,9 @@ template <> class PropertyArrayView<std::string_view> {
(nextOffset - currentOffset));
}

/**
* @brief The number of elements in this array.
*/
int64_t size() const noexcept { return _size; }

private:
Expand Down
Loading

0 comments on commit d98f4b9

Please sign in to comment.