Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support schemaUri property of EXT_structural_metadata #969

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void createTestForNonArrayJson(
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema> schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema> schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -252,7 +252,7 @@ static void createTestForNonArrayJson(
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema> schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema> schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -332,7 +332,7 @@ static void createTestForArrayJson(
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema>& schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema>& schema = pMetadata->schema;
REQUIRE(schema);
REQUIRE(schema->classes.find("default") != schema->classes.end());

Expand Down Expand Up @@ -591,7 +591,7 @@ TEST_CASE("Convert binary B3DM batch table to EXT_structural_metadata") {
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(metadata);

std::optional<Schema> schema = metadata->schema;
CesiumUtility::IntrusivePointer<Schema> schema = metadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -1258,7 +1258,7 @@ TEST_CASE("Upgrade nested JSON metadata to string") {
result.model->getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema>& schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema>& schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -1350,7 +1350,7 @@ TEST_CASE("Upgrade JSON booleans to binary") {
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema>& schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema>& schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -1952,7 +1952,7 @@ TEST_CASE("Defaults to string if no sentinel values are available") {
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema> schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema> schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down Expand Up @@ -2038,7 +2038,7 @@ TEST_CASE("Defaults to string if no sentinel values are available") {
model.getExtension<ExtensionModelExtStructuralMetadata>();
REQUIRE(pMetadata);

const std::optional<Schema> schema = pMetadata->schema;
const CesiumUtility::IntrusivePointer<Schema> schema = pMetadata->schema;
REQUIRE(schema);

const std::unordered_map<std::string, Class>& classes = schema->classes;
Expand Down
17 changes: 17 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AccessorSparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,22 @@ struct CESIUMGLTF_API AccessorSparse final
* accessor values.
*/
CesiumGltf::AccessorSparseValues values;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(AccessorSparse);
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
sizeof(CesiumUtility::ExtensibleObject);
accum += this->indices.getSizeBytes() -
sizeof(CesiumGltf::AccessorSparseIndices);
accum +=
this->values.getSizeBytes() - sizeof(CesiumGltf::AccessorSparseValues);
return accum;
}
};
} // namespace CesiumGltf
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AccessorSparseIndices.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,19 @@ struct CESIUMGLTF_API AccessorSparseIndices final
*
*/
int32_t componentType = ComponentType::UNSIGNED_BYTE;

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

return accum;
}
};
} // namespace CesiumGltf
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AccessorSparseValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,19 @@ struct CESIUMGLTF_API AccessorSparseValues final
* @brief The offset relative to the start of the bufferView in bytes.
*/
int64_t byteOffset = 0;

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

return accum;
}
};
} // namespace CesiumGltf
27 changes: 27 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ struct CESIUMGLTF_API AccessorSpec : public CesiumGltf::NamedObject {

static constexpr int32_t UNSIGNED_SHORT = 5123;

static constexpr int32_t INT = 5124;

static constexpr int32_t UNSIGNED_INT = 5125;

static constexpr int32_t INT64 = 5134;

static constexpr int32_t UNSIGNED_INT64 = 5135;

static constexpr int32_t FLOAT = 5126;

static constexpr int32_t DOUBLE = 5130;
};

/**
Expand Down Expand Up @@ -146,6 +154,25 @@ struct CESIUMGLTF_API AccessorSpec : public CesiumGltf::NamedObject {
*/
std::optional<CesiumGltf::AccessorSparse> sparse;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(AccessorSpec);
accum += CesiumGltf::NamedObject::getSizeBytes() -
sizeof(CesiumGltf::NamedObject);
accum += sizeof(double) * this->max.capacity();
accum += sizeof(double) * this->min.capacity();
if (this->sparse) {
accum +=
this->sparse->getSizeBytes() - sizeof(CesiumGltf::AccessorSparse);
}
return accum;
}

private:
/**
* @brief This class is not meant to be instantiated directly. Use {@link Accessor} instead.
Expand Down
23 changes: 23 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,28 @@ struct CESIUMGLTF_API Animation final : public CesiumGltf::NamedObject {
* algorithm.
*/
std::vector<CesiumGltf::AnimationSampler> samplers;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(Animation);
accum += CesiumGltf::NamedObject::getSizeBytes() -
sizeof(CesiumGltf::NamedObject);

accum += sizeof(CesiumGltf::AnimationChannel) * this->channels.capacity();
for (const CesiumGltf::AnimationChannel& value : this->channels) {
accum += value.getSizeBytes() - sizeof(CesiumGltf::AnimationChannel);
}
azrogers marked this conversation as resolved.
Show resolved Hide resolved

accum += sizeof(CesiumGltf::AnimationSampler) * this->samplers.capacity();
for (const CesiumGltf::AnimationSampler& value : this->samplers) {
accum += value.getSizeBytes() - sizeof(CesiumGltf::AnimationSampler);
}
return accum;
}
};
} // namespace CesiumGltf
15 changes: 15 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AnimationChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,20 @@ struct CESIUMGLTF_API AnimationChannel final
* @brief The descriptor of the animated property.
*/
CesiumGltf::AnimationChannelTarget target;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(AnimationChannel);
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
sizeof(CesiumUtility::ExtensibleObject);
accum += this->target.getSizeBytes() -
sizeof(CesiumGltf::AnimationChannelTarget);
return accum;
}
};
} // namespace CesiumGltf
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AnimationChannelTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,19 @@ struct CESIUMGLTF_API AnimationChannelTarget final
*
*/
std::string path = Path::translation;

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

return accum;
}
};
} // namespace CesiumGltf
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AnimationSampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,19 @@ struct CESIUMGLTF_API AnimationSampler final
* @brief The index of an accessor, containing keyframe output values.
*/
int32_t output = -1;

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

return accum;
}
};
} // namespace CesiumGltf
23 changes: 23 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,28 @@ struct CESIUMGLTF_API Asset final : public CesiumUtility::ExtensibleObject {
* version.
*/
std::optional<std::string> minVersion;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(Asset);
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
sizeof(CesiumUtility::ExtensibleObject);
if (this->copyright) {
accum += this->copyright->capacity() * sizeof(char);
}
if (this->generator) {
accum += this->generator->capacity() * sizeof(char);
}
accum += this->version.capacity() * sizeof(char);
if (this->minVersion) {
accum += this->minVersion->capacity() * sizeof(char);
}
return accum;
}
};
} // namespace CesiumGltf
16 changes: 16 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/BufferSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ struct CESIUMGLTF_API BufferSpec : public CesiumGltf::NamedObject {
*/
int64_t byteLength = int64_t();

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

private:
/**
* @brief This class is not meant to be instantiated directly. Use {@link Buffer} instead.
Expand Down
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/BufferView.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,19 @@ struct CESIUMGLTF_API BufferView final : public CesiumGltf::NamedObject {
*
*/
std::optional<int32_t> target;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(BufferView);
accum += CesiumGltf::NamedObject::getSizeBytes() -
sizeof(CesiumGltf::NamedObject);

return accum;
}
};
} // namespace CesiumGltf
21 changes: 21 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,26 @@ struct CESIUMGLTF_API Camera final : public CesiumGltf::NamedObject {
* **MUST** be defined.
*/
std::string type = Type::perspective;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += sizeof(Camera);
accum += CesiumGltf::NamedObject::getSizeBytes() -
sizeof(CesiumGltf::NamedObject);
if (this->orthographic) {
accum += this->orthographic->getSizeBytes() -
sizeof(CesiumGltf::CameraOrthographic);
}
if (this->perspective) {
accum += this->perspective->getSizeBytes() -
sizeof(CesiumGltf::CameraPerspective);
}
return accum;
}
};
} // namespace CesiumGltf
14 changes: 14 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/CameraOrthographic.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,19 @@ struct CESIUMGLTF_API CameraOrthographic final
* @brief The floating-point distance to the near clipping plane.
*/
double znear = double();

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

return accum;
}
};
} // namespace CesiumGltf
Loading
Loading