Skip to content

Commit

Permalink
Merge pull request #969 from CesiumGS/external-structural-metadata
Browse files Browse the repository at this point in the history
Support `schemaUri` property of EXT_structural_metadata
  • Loading branch information
kring authored Nov 17, 2024
2 parents 0bc7245 + 1f09276 commit 8d1bea8
Show file tree
Hide file tree
Showing 119 changed files with 2,730 additions and 143 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Added support for `EXT_accessor_additional_types` in `AccessorView`.
- Added `EllipsoidTilesetLoader` that will generate a tileset by tesselating the surface of an ellipsoid, producing a simple globe tileset without any terrain features.
- The `schemaUri` property in the `EXT_structural_metadata` glTF extension is now supported, allowing structural metadata schemas to be loaded from URIs rather than being embedded in the glTF itself.

##### Fixes :wrench:

Expand Down
18 changes: 18 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,23 @@ struct CESIUM3DTILES_API Asset final : public CesiumUtility::ExtensibleObject {
* existing tileset is updated.
*/
std::optional<std::string> tilesetVersion;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Asset));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(this->version.capacity() * sizeof(char));
if (this->tilesetVersion) {
accum += int64_t(this->tilesetVersion->capacity() * sizeof(char));
}
return accum;
}
};
} // namespace Cesium3DTiles
15 changes: 15 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Availability.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,20 @@ struct CESIUM3DTILES_API Availability final
*
*/
std::optional<int32_t> constant;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Availability));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));

return accum;
}
};
} // namespace Cesium3DTiles
17 changes: 17 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/BoundingVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,22 @@ struct CESIUM3DTILES_API BoundingVolume final
* shall not be negative.
*/
std::vector<double> sphere;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(BoundingVolume));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(sizeof(double) * this->box.capacity());
accum += int64_t(sizeof(double) * this->region.capacity());
accum += int64_t(sizeof(double) * this->sphere.capacity());
return accum;
}
};
} // namespace Cesium3DTiles
20 changes: 20 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/BufferSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ struct CESIUM3DTILES_API BufferSpec : public CesiumUtility::ExtensibleObject {
*/
std::optional<std::string> name;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(BufferSpec));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->uri) {
accum += int64_t(this->uri->capacity() * sizeof(char));
}
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
return accum;
}

private:
/**
* @brief This class is not meant to be instantiated directly. Use {@link Buffer} instead.
Expand Down
17 changes: 17 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/BufferView.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,22 @@ struct CESIUM3DTILES_API BufferView final
* @brief The name of the `bufferView`.
*/
std::optional<std::string> name;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(BufferView));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
return accum;
}
};
} // namespace Cesium3DTiles
27 changes: 27 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,32 @@ struct CESIUM3DTILES_API Class final : public CesiumUtility::ExtensibleObject {
* identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
*/
std::unordered_map<std::string, Cesium3DTiles::ClassProperty> properties;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Class));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
if (this->description) {
accum += int64_t(this->description->capacity() * sizeof(char));
}
accum += int64_t(
this->properties.bucket_count() *
(sizeof(std::string) + sizeof(Cesium3DTiles::ClassProperty)));
for (const auto& [k, v] : this->properties) {
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
accum += v.getSizeBytes() - int64_t(sizeof(Cesium3DTiles::ClassProperty));
}
return accum;
}
};
} // namespace Cesium3DTiles
26 changes: 26 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/ClassProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,31 @@ struct CESIUM3DTILES_API ClassProperty final
* interpreted. The semantic cannot be used by other properties in the class.
*/
std::optional<std::string> semantic;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(ClassProperty));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
if (this->description) {
accum += int64_t(this->description->capacity() * sizeof(char));
}
if (this->enumType) {
accum += int64_t(this->enumType->capacity() * sizeof(char));
}
if (this->semantic) {
accum += int64_t(this->semantic->capacity() * sizeof(char));
}
return accum;
}
};
} // namespace Cesium3DTiles
22 changes: 22 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/ClassStatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,27 @@ struct CESIUM3DTILES_API ClassStatistics final
* statistics about property values.
*/
std::unordered_map<std::string, Cesium3DTiles::PropertyStatistics> properties;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(ClassStatistics));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(
this->properties.bucket_count() *
(sizeof(std::string) + sizeof(Cesium3DTiles::PropertyStatistics)));
for (const auto& [k, v] : this->properties) {
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
accum +=
v.getSizeBytes() - int64_t(sizeof(Cesium3DTiles::PropertyStatistics));
}
return accum;
}
};
} // namespace Cesium3DTiles
23 changes: 23 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Content.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,28 @@ struct CESIUM3DTILES_API Content final
* array of `groups` that is defined for the containing tileset.
*/
std::optional<int64_t> group;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Content));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->boundingVolume) {
accum += this->boundingVolume->getSizeBytes() -
int64_t(sizeof(Cesium3DTiles::BoundingVolume));
}
accum += int64_t(this->uri.capacity() * sizeof(char));
if (this->metadata) {
accum += this->metadata->getSizeBytes() -
int64_t(sizeof(Cesium3DTiles::MetadataEntity));
}
return accum;
}
};
} // namespace Cesium3DTiles
25 changes: 25 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,30 @@ struct CESIUM3DTILES_API Enum final : public CesiumUtility::ExtensibleObject {
* are not allowed.
*/
std::vector<Cesium3DTiles::EnumValue> values;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Enum));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
if (this->description) {
accum += int64_t(this->description->capacity() * sizeof(char));
}
accum +=
int64_t(sizeof(Cesium3DTiles::EnumValue) * this->values.capacity());
for (const Cesium3DTiles::EnumValue& value : this->values) {
accum += value.getSizeBytes() - int64_t(sizeof(Cesium3DTiles::EnumValue));
}
return accum;
}
};
} // namespace Cesium3DTiles
18 changes: 18 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/EnumValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,23 @@ struct CESIUM3DTILES_API EnumValue final
* @brief The integer enum value.
*/
int64_t value = int64_t();

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(EnumValue));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(this->name.capacity() * sizeof(char));
if (this->description) {
accum += int64_t(this->description->capacity() * sizeof(char));
}
return accum;
}
};
} // namespace Cesium3DTiles
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,20 @@ struct CESIUM3DTILES_API Extension3dTilesBoundingVolumeS2 final
* the WGS84 ellipsoid.
*/
double maximumHeight = double();

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(Extension3dTilesBoundingVolumeS2));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(this->token.capacity() * sizeof(char));
return accum;
}
};
} // namespace Cesium3DTiles
14 changes: 14 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/GroupMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@ namespace Cesium3DTiles {
*/
struct CESIUM3DTILES_API GroupMetadata final : public MetadataEntity {
static inline constexpr const char* TypeName = "GroupMetadata";

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(GroupMetadata));
accum += MetadataEntity::getSizeBytes() - int64_t(sizeof(MetadataEntity));

return accum;
}
};
} // namespace Cesium3DTiles
16 changes: 16 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/ImplicitTiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,21 @@ struct CESIUM3DTILES_API ImplicitTiling final
* @brief An object describing the location of subtree files.
*/
Cesium3DTiles::Subtrees subtrees;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(ImplicitTiling));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += this->subtrees.getSizeBytes() -
int64_t(sizeof(Cesium3DTiles::Subtrees));
return accum;
}
};
} // namespace Cesium3DTiles
22 changes: 22 additions & 0 deletions Cesium3DTiles/generated/include/Cesium3DTiles/MetadataEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,27 @@ struct CESIUM3DTILES_API MetadataEntity
* in this dictionary.
*/
std::unordered_map<std::string, CesiumUtility::JsonValue> properties;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(MetadataEntity));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(this->classProperty.capacity() * sizeof(char));
accum += int64_t(
this->properties.bucket_count() *
(sizeof(std::string) + sizeof(CesiumUtility::JsonValue)));
for (const auto& [k, v] : this->properties) {
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
accum += int64_t(sizeof(CesiumUtility::JsonValue));
}
return accum;
}
};
} // namespace Cesium3DTiles
Loading

0 comments on commit 8d1bea8

Please sign in to comment.