Skip to content

Commit

Permalink
Add FEATURE_ID_n semantic and InstanceAttributeSemantics
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Dec 3, 2024
1 parent f4d479b commit d774117
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
35 changes: 35 additions & 0 deletions CesiumGltf/include/CesiumGltf/InstanceAttributeSemantics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include <array>
#include <string>

namespace CesiumGltf {

/**
* @brief The standard glTF instance attribute semantics from
* `EXT_mesh_gpu_instancing` plus additional instance attribute semantics from
* extensions.
*/
struct InstanceAttributeSemantics {
/**
* @brief XYZ translation vector.
*/
static const std::string TRANSLATION;

/**
* @brief XYZW rotation quaternion.
*/
static const std::string ROTATION;

/**
* @brief XYZ scale vector.
*/
static const std::string SCALE;

/**
* @brief Feature IDs used in `EXT_instance_features`.
*/
static const std::array<std::string, 8> FEATURE_ID_n;
};

} // namespace CesiumGltf
8 changes: 7 additions & 1 deletion CesiumGltf/include/CesiumGltf/VertexAttributeSemantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
namespace CesiumGltf {

/**
* @brief The standard glTF vertex attribute semantics from the specification.
* @brief The standard glTF vertex attribute semantics from the specification
* plus additional vertex attribute semantics from extensions.
*/
struct VertexAttributeSemantics {
/**
Expand Down Expand Up @@ -46,6 +47,11 @@ struct VertexAttributeSemantics {
* @brief The weights indicating how strongly the joint influences the vertex.
*/
static const std::array<std::string, 8> WEIGHTS_n;

/**
* @brief Feature IDs used in `EXT_mesh_features`.
*/
static const std::array<std::string, 8> FEATURE_ID_n;
};

} // namespace CesiumGltf
33 changes: 33 additions & 0 deletions CesiumGltf/src/InstanceAttributeSemantics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <CesiumGltf/InstanceAttributeSemantics.h>

namespace CesiumGltf {

/**
* @brief XYZ translation vector.
*/
const std::string InstanceAttributeSemantics::TRANSLATION = "TRANSLATION";

/**
* @brief XYZW rotation quaternion.
*/
const std::string InstanceAttributeSemantics::ROTATION = "ROTATION";

/**
* @brief XYZ scale vector.
*/
const std::string InstanceAttributeSemantics::SCALE = "SCALE";

/**
* @brief Feature IDs used in `EXT_mesh_features`.
*/
const std::array<std::string, 8> InstanceAttributeSemantics::FEATURE_ID_n = {
"_FEATURE_ID_0",
"_FEATURE_ID_1",
"_FEATURE_ID_2",
"_FEATURE_ID_3",
"_FEATURE_ID_4",
"_FEATURE_ID_5",
"_FEATURE_ID_6",
"_FEATURE_ID_7"};

} // namespace CesiumGltf
13 changes: 13 additions & 0 deletions CesiumGltf/src/VertexAttributeSemantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,17 @@ const std::array<std::string, 8> VertexAttributeSemantics::WEIGHTS_n = {
"WEIGHTS_6",
"WEIGHTS_7"};

/**
* @brief Feature IDs used in `EXT_mesh_features`.
*/
const std::array<std::string, 8> VertexAttributeSemantics::FEATURE_ID_n = {
"_FEATURE_ID_0",
"_FEATURE_ID_1",
"_FEATURE_ID_2",
"_FEATURE_ID_3",
"_FEATURE_ID_4",
"_FEATURE_ID_5",
"_FEATURE_ID_6",
"_FEATURE_ID_7"};

} // namespace CesiumGltf

0 comments on commit d774117

Please sign in to comment.