Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -21,6 +21,27 @@ struct CESIUMGLTF_API ExtensionKhrGaussianSplatting final
* key in the `extensions` object. */
static constexpr const char* ExtensionName = "KHR_gaussian_splatting";

/**
* @brief Known values for Property specifying parameters regarding the kernel
* used to generate the Gaussians.
*/
struct Kernel {
/** @brief `ellipse` */
inline static const std::string ellipse = "ellipse";
};

/**
* @brief Known values for Property specifying the color space of the
* spherical harmonics.
*/
struct ColorSpace {
/** @brief `srgb_rec709_display` */
inline static const std::string srgb_rec709_display = "srgb_rec709_display";

/** @brief `lin_rec709_display` */
inline static const std::string lin_rec709_display = "lin_rec709_display";
};

/**
* @brief Known values for Optional property specifying how to project the
* Gaussians to achieve a perspective correct value. This property defaults to
Expand All @@ -29,9 +50,6 @@ struct CESIUMGLTF_API ExtensionKhrGaussianSplatting final
struct Projection {
/** @brief `perspective` */
inline static const std::string perspective = "perspective";

/** @brief `orthographic` */
inline static const std::string orthographic = "orthographic";
};

/**
Expand All @@ -41,40 +59,24 @@ struct CESIUMGLTF_API ExtensionKhrGaussianSplatting final
struct SortingMethod {
/** @brief `cameraDistance` */
inline static const std::string cameraDistance = "cameraDistance";

/** @brief `zDepth` */
inline static const std::string zDepth = "zDepth";
};

/**
* @brief Known values for Optional property specifying the color space of the
* spherical harmonics. This property defaults to BT.709.
* @brief Property specifying parameters regarding the kernel used to generate
* the Gaussians.
*
* Known values are defined in {@link Kernel}.
*
*/
struct ColorSpace {
/** @brief `BT.709` */
inline static const std::string BT_709 = "BT.709";

/** @brief `BT.2020-ITU` */
inline static const std::string BT_2020_ITU = "BT.2020-ITU";

/** @brief `BT.2020-HLG` */
inline static const std::string BT_2020_HLG = "BT.2020-HLG";

/** @brief `BT.2020-PQ` */
inline static const std::string BT_2020_PQ = "BT.2020-PQ";

/** @brief `Display-P3` */
inline static const std::string Display_P3 = "Display-P3";

/** @brief `linear` */
inline static const std::string linear = "linear";
};
std::string kernel = Kernel::ellipse;

/**
* @brief Optional property specifying parameters regarding the kernel used to
* generate the Gaussians. This property defaults to ellipse.
* @brief Property specifying the color space of the spherical harmonics.
*
* Known values are defined in {@link ColorSpace}.
*
*/
std::string kernel = "ellipse";
std::string colorSpace = ColorSpace::srgb_rec709_display;

/**
* @brief Optional property specifying how to project the Gaussians to achieve
Expand All @@ -94,15 +96,6 @@ struct CESIUMGLTF_API ExtensionKhrGaussianSplatting final
*/
std::string sortingMethod = SortingMethod::cameraDistance;

/**
* @brief Optional property specifying the color space of the spherical
* harmonics. This property defaults to BT.709.
*
* Known values are defined in {@link ColorSpace}.
*
*/
std::string colorSpace = ColorSpace::BT_709;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
Expand All @@ -114,7 +107,7 @@ struct CESIUMGLTF_API ExtensionKhrGaussianSplatting final
accum += int64_t(sizeof(ExtensionKhrGaussianSplatting));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
accum += int64_t(this->kernel.capacity() * sizeof(char));

return accum;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ExtensionKhrGaussianSplattingJsonHandler
private:
CesiumGltf::ExtensionKhrGaussianSplatting* _pObject = nullptr;
CesiumJsonReader::StringJsonHandler _kernel;
CesiumJsonReader::StringJsonHandler _colorSpace;
CesiumJsonReader::StringJsonHandler _projection;
CesiumJsonReader::StringJsonHandler _sortingMethod;
CesiumJsonReader::StringJsonHandler _colorSpace;
};
} // namespace CesiumGltfReader
10 changes: 5 additions & 5 deletions CesiumGltfReader/generated/src/GeneratedJsonHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3007,9 +3007,9 @@ ExtensionKhrGaussianSplattingJsonHandler::
const CesiumJsonReader::JsonReaderOptions& options) noexcept
: CesiumJsonReader::ExtensibleObjectJsonHandler(options),
_kernel(),
_colorSpace(),
_projection(),
_sortingMethod(),
_colorSpace() {}
_sortingMethod() {}

void ExtensionKhrGaussianSplattingJsonHandler::reset(
CesiumJsonReader::IJsonHandler* pParentHandler,
Expand Down Expand Up @@ -3051,15 +3051,15 @@ CesiumJsonReader::IJsonHandler* ExtensionKhrGaussianSplattingJsonHandler::
if ("kernel"s == str) {
return property("kernel", this->_kernel, o.kernel);
}
if ("colorSpace"s == str) {
return property("colorSpace", this->_colorSpace, o.colorSpace);
}
if ("projection"s == str) {
return property("projection", this->_projection, o.projection);
}
if ("sortingMethod"s == str) {
return property("sortingMethod", this->_sortingMethod, o.sortingMethod);
}
if ("colorSpace"s == str) {
return property("colorSpace", this->_colorSpace, o.colorSpace);
}

return this->readObjectKeyExtensibleObject(objectType, str, *this->_pObject);
}
Expand Down
15 changes: 5 additions & 10 deletions CesiumGltfWriter/generated/src/ModelJsonWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,10 +1192,11 @@ void writeJson(
const CesiumJsonWriter::ExtensionWriterContext& context) {
jsonWriter.StartObject();

if (obj.kernel != "ellipse") {
jsonWriter.Key("kernel");
writeJson(obj.kernel, jsonWriter, context);
}
jsonWriter.Key("kernel");
writeJson(obj.kernel, jsonWriter, context);

jsonWriter.Key("colorSpace");
writeJson(obj.colorSpace, jsonWriter, context);

if (obj.projection !=
CesiumGltf::ExtensionKhrGaussianSplatting::Projection::perspective) {
Expand All @@ -1209,12 +1210,6 @@ void writeJson(
writeJson(obj.sortingMethod, jsonWriter, context);
}

if (obj.colorSpace !=
CesiumGltf::ExtensionKhrGaussianSplatting::ColorSpace::BT_709) {
jsonWriter.Key("colorSpace");
writeJson(obj.colorSpace, jsonWriter, context);
}

writeExtensibleObject(obj, jsonWriter, context);

jsonWriter.EndObject();
Expand Down
Loading