Small review changes

This commit is contained in:
Ashley Rogers 2024-12-20 10:31:45 -05:00
parent 9a2fe68dd8
commit b4a6700adc
2 changed files with 37 additions and 40 deletions

View File

@ -24,10 +24,8 @@ MetadataQuery::findFirstPropertyWithSemantic(
const Cesium3DTiles::Class& klass = classIt->second;
for (const auto& propertie : entity.properties) {
const std::pair<std::string, CesiumUtility::JsonValue>& property =
propertie;
auto propertyIt = klass.properties.find(property.first);
for (const auto& propertyValue : entity.properties) {
auto propertyIt = klass.properties.find(propertyValue.first);
if (propertyIt == klass.properties.end())
continue;
@ -36,9 +34,9 @@ MetadataQuery::findFirstPropertyWithSemantic(
return FoundMetadataProperty{
classIt->first,
classIt->second,
propertie.first,
propertyValue.first,
propertyIt->second,
propertie.second};
propertyValue.second};
}
}

View File

@ -25,40 +25,6 @@ using namespace CesiumGeospatial;
namespace Cesium3DTilesSelection {
namespace {
template <class T>
bool isBoundingVolumeVisible(
const T& boundingVolume,
const CullingVolume& cullingVolume) noexcept {
const CullingResult left =
boundingVolume.intersectPlane(cullingVolume.leftPlane);
if (left == CullingResult::Outside) {
return false;
}
const CullingResult right =
boundingVolume.intersectPlane(cullingVolume.rightPlane);
if (right == CullingResult::Outside) {
return false;
}
const CullingResult top =
boundingVolume.intersectPlane(cullingVolume.topPlane);
if (top == CullingResult::Outside) {
return false;
}
const CullingResult bottom =
boundingVolume.intersectPlane(cullingVolume.bottomPlane);
if (bottom == CullingResult::Outside) {
return false;
}
return true;
}
} // namespace
/* static */ ViewState ViewState::create(
const glm::dvec3& position,
const glm::dvec3& direction,
@ -103,6 +69,39 @@ ViewState::ViewState(
horizontalFieldOfView,
verticalFieldOfView)) {}
namespace {
template <class T>
bool isBoundingVolumeVisible(
const T& boundingVolume,
const CullingVolume& cullingVolume) noexcept {
const CullingResult left =
boundingVolume.intersectPlane(cullingVolume.leftPlane);
if (left == CullingResult::Outside) {
return false;
}
const CullingResult right =
boundingVolume.intersectPlane(cullingVolume.rightPlane);
if (right == CullingResult::Outside) {
return false;
}
const CullingResult top =
boundingVolume.intersectPlane(cullingVolume.topPlane);
if (top == CullingResult::Outside) {
return false;
}
const CullingResult bottom =
boundingVolume.intersectPlane(cullingVolume.bottomPlane);
if (bottom == CullingResult::Outside) {
return false;
}
return true;
}
} // namespace
bool ViewState::isBoundingVolumeVisible(
const BoundingVolume& boundingVolume) const noexcept {
// TODO: use plane masks