Skip to content

Commit

Permalink
Temp
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Sep 16, 2024
1 parent f5e80dd commit b0aecad
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 67 deletions.
68 changes: 63 additions & 5 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ Checks:
# - "bugprone-incorrect-roundings"
# - "bugprone-infinite-loop"
# - "bugprone-unhandled-self-assignment"
- "bugprone-unchecked-optional-access"

# - "bugprone-unchecked-optional-access"
# - "bugprone-switch-missing-default-case"
# - "bugprone-misplaced-widening-cast"
# - "bugprone-reserved-identifier"
# - "bugprone-signed-char-misuse"
# - "bugprone-optional-value-conversion"
# - "bugprone-integer-division"
# - "bugprone-lambda-function-name"
# - "bugprone-macro-parentheses"
# - "bugprone-macro-repeated-side-effects"
# - "bugprone-misplaced-operator-in-strlen-in-alloc"
# - "bugprone-misplaced-pointer-arithmetic-in-alloc"
# - "bugprone-misplaced-widening-cast"
# - "bugprone-move-forwarding-reference"
# - "bugprone-multi-level-implicit-pointer-conversion"
# - "bugprone-multiple-new-in-one-expression"
# - "bugprone-multiple-statement-macro"
# - "bugprone-no-escape"
# - "bugprone-non-zero-enum-to-bool-conversion"
# - "bugprone-not-null-terminated-result"
# - "bugprone-optional-value-conversion"
# - "bugprone-parent-virtual-call"
# - "bugprone-pointer-arithmetic-on-polymorphic-object"
# - "bugprone-posix-return"
Expand Down Expand Up @@ -72,7 +74,6 @@ Checks:
# - "bugprone-suspicious-string-compare"
# - "bugprone-suspicious-stringview-data-usage"
# - "bugprone-swapped-arguments"
# - "bugprone-switch-missing-default-case"
# - "bugprone-terminating-continue"
# - "bugprone-throw-keyword-missing"
# - "bugprone-too-small-loop-variable"
Expand All @@ -86,6 +87,57 @@ Checks:
# - "bugprone-unused-return-value"
# - "bugprone-use-after-move"
# - "bugprone-virtual-near-miss"
# - "cert-dcl50-cpp"
# - "cert-dcl58-cpp"
# - "cert-env33-c"
# - "cert-err33-c"
# - "cert-err34-c"
# - "cert-err52-cpp"
# - "-cert-err58-cpp"
# - "cert-err60-cpp"
# - "cert-flp30-c"
# - "cert-mem57-cpp"
# - "cert-msc50-cpp"
# - "cert-msc51-cpp"
# - "cert-oop57-cpp"
# - "cert-oop58-cpp"
# - "concurrency-mt-unsafe"
# - "concurrency-thread-canceltype-asynchronous"
# - "cppcoreguidelines-macro-usage"
# - "modernize-use-equals-default"
# - "cppcoreguidelines-virtual-class-destructor"
# - "cppcoreguidelines-prefer-member-initializer"
# - "cppcoreguidelines-avoid-const-or-ref-data-members"
# - "-cppcoreguidelines-pro-bounds-pointer-arithmetic"
# - "cppcoreguidelines-avoid-non-const-global-variables"
# - "cppcoreguidelines-init-variables"
# - "-cppcoreguidelines-pro-type-reinterpret-cast"
# - "cppcoreguidelines-rvalue-reference-param-not-moved"
# - "cppcoreguidelines-narrowing-conversions"
# - "cppcoreguidelines-missing-std-forward"

- "cppcoreguidelines-pro-type-member-init"


# - "-cppcoreguidelines-special-member-functions" # Handle later
# - "cppcoreguidelines-avoid-capturing-lambda-coroutines"
# - "cppcoreguidelines-avoid-do-while"
# - "cppcoreguidelines-avoid-goto"
# - "cppcoreguidelines-avoid-reference-coroutine-parameters"
# - "cppcoreguidelines-interfaces-global-init"
# - "cppcoreguidelines-misleading-capture-default-by-value"
# - "cppcoreguidelines-no-malloc"
# - "cppcoreguidelines-no-suspend-with-lock"
# - "cppcoreguidelines-owning-memory"
# - "cppcoreguidelines-pro-bounds-array-to-pointer-decay"
# - "-cppcoreguidelines-pro-bounds-constant-array-index"
# - "cppcoreguidelines-pro-type-const-cast"
# - "cppcoreguidelines-pro-type-cstyle-cast"
# - "cppcoreguidelines-pro-type-static-cast-downcast"
# - "cppcoreguidelines-pro-type-union-access"
# - "cppcoreguidelines-pro-type-vararg"
# - "cppcoreguidelines-slicing"


WarningsAsErrors: "*"
FormatStyle: none
Expand All @@ -94,10 +146,16 @@ CheckOptions:
value: "true"
- key: cppcoreguidelines-rvalue-reference-param-not-moved.AllowPartialMove
value: "true"
- key: cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreNonDeducedTemplateTypes
value: "true"
- key: cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreUnnamedParams
value: "true"
- key: modernize-use-auto.RemoveStars
value: "true"
- key: misc-include-cleaner.IgnoreHeaders
value: ".*cesium-async\\+\\+\\.h"
- key: cppcoreguidelines-macro-usage.AllowedRegexp
value: "^CESIUM_.*"
HeaderFilterRegex: ".*"
HeaderFileExtensions: ["h"]
ImplementationFileExtensions: ["cpp"]
2 changes: 1 addition & 1 deletion Cesium3DTilesContent/src/B3dmToGltfConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ CesiumAsync::Future<GltfConverterResult> B3dmToGltfConverter::convert(
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher) {
GltfConverterResult result;
B3dmHeader header;
B3dmHeader header{};
uint32_t headerLength = 0;
parseB3dmHeader(b3dmBinary, header, headerLength, result);
if (result.errors) {
Expand Down
9 changes: 5 additions & 4 deletions Cesium3DTilesContent/src/PntsToGltfConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,10 +802,11 @@ void parseDracoExtensionFromBatchTableJson(
continue;
}

DracoMetadataSemantic semantic;
semantic.dracoId = dracoPropertyIt->value.GetInt();
semantic.componentType = stringToMetadataComponentType.at(componentType);
semantic.type = stringToMetadataType.at(type);
DracoMetadataSemantic semantic = {
dracoPropertyIt->value.GetInt(),
stringToMetadataComponentType.at(componentType),
stringToMetadataType.at(type),
};

parsedContent.dracoMetadataSemantics.insert({name, semantic});
}
Expand Down
2 changes: 1 addition & 1 deletion Cesium3DTilesSelection/src/TilesetContentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct ContentKindSetter {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
TileContent& tileContent;
std::optional<RasterOverlayDetails> rasterOverlayDetails;
void* pRenderResources;
void* pRenderResources{};
};

void unloadTileRecursively(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CESIUMGEOMETRY_API QuadtreeRectangleAvailability final {

private:
struct RectangleWithLevel {
uint32_t level;
uint32_t level{};
Rectangle rectangle;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class CESIUMGEOSPATIAL_API S2CellBoundingVolume final {
S2CellID _cellID;
double _minimumHeight;
double _maximumHeight;
glm::dvec3 _center;
glm::dvec3 _center{};
std::array<CesiumGeometry::Plane, 6> _boundingPlanes;
std::array<glm::dvec3, 8> _vertices;
std::array<glm::dvec3, 8> _vertices{};
};

} // namespace CesiumGeospatial
54 changes: 34 additions & 20 deletions CesiumGeospatial/src/LocalHorizontalCoordinateSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,7 @@ glm::dvec3 directionToEnuVector(LocalDirection direction) {
}
}

} // namespace

LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
const Cartographic& origin,
LocalDirection xAxisDirection,
LocalDirection yAxisDirection,
LocalDirection zAxisDirection,
double scaleToMeters,
const Ellipsoid& ellipsoid)
: LocalHorizontalCoordinateSystem(
ellipsoid.cartographicToCartesian(origin),
xAxisDirection,
yAxisDirection,
zAxisDirection,
scaleToMeters,
ellipsoid) {}

LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
glm::dmat4 computeLocalToEcef(
const glm::dvec3& originEcef,
LocalDirection xAxisDirection,
LocalDirection yAxisDirection,
Expand All @@ -90,10 +73,41 @@ LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
scaleToMeters * directionToEnuVector(yAxisDirection),
scaleToMeters * directionToEnuVector(zAxisDirection));

this->_localToEcef = enuToFixed * glm::dmat4(localToEnuAndScale);
this->_ecefToLocal = glm::affineInverse(this->_localToEcef);
return enuToFixed * glm::dmat4(localToEnuAndScale);
}

} // namespace

LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
const Cartographic& origin,
LocalDirection xAxisDirection,
LocalDirection yAxisDirection,
LocalDirection zAxisDirection,
double scaleToMeters,
const Ellipsoid& ellipsoid)
: LocalHorizontalCoordinateSystem(
ellipsoid.cartographicToCartesian(origin),
xAxisDirection,
yAxisDirection,
zAxisDirection,
scaleToMeters,
ellipsoid) {}

LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
const glm::dvec3& originEcef,
LocalDirection xAxisDirection,
LocalDirection yAxisDirection,
LocalDirection zAxisDirection,
double scaleToMeters,
const Ellipsoid& ellipsoid)
: LocalHorizontalCoordinateSystem(computeLocalToEcef(
originEcef,
xAxisDirection,
yAxisDirection,
zAxisDirection,
scaleToMeters,
ellipsoid)) {}

CesiumGeospatial::LocalHorizontalCoordinateSystem::
LocalHorizontalCoordinateSystem(const glm::dmat4& localToEcef)
: _ecefToLocal(glm::affineInverse(localToEcef)),
Expand Down
4 changes: 2 additions & 2 deletions CesiumGeospatial/src/S2CellBoundingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ computeIntersection(const Plane& p0, const Plane& p1, const Plane& p2) {

std::array<glm::dvec3, 8>
computeVertices(const std::array<Plane, 6>& boundingPlanes) {
std::array<glm::dvec3, 8> vertices;
std::array<glm::dvec3, 8> vertices{};

for (size_t i = 0; i < 4; ++i) {
// Vertices on the top plane.
Expand Down Expand Up @@ -332,7 +332,7 @@ glm::dvec3 closestPointPolygon(
double S2CellBoundingVolume::computeDistanceSquaredToPosition(
const glm::dvec3& position) const noexcept {
size_t numSelectedPlanes = 0;
std::array<size_t, 6> selectedPlaneIndices;
std::array<size_t, 6> selectedPlaneIndices{};

if (this->_boundingPlanes[0].getPointDistance(position) > 0.0) {
selectedPlaneIndices[numSelectedPlanes++] = 0;
Expand Down
51 changes: 27 additions & 24 deletions CesiumGeospatial/src/SimplePlanarEllipsoidCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,39 @@ glm::dvec3 SimplePlanarEllipsoidCurve::getPosition(
return geocentricPosition + geocentricUp * altitudeOffset;
}

SimplePlanarEllipsoidCurve::SimplePlanarEllipsoidCurve(
const Ellipsoid& ellipsoid,
namespace {
glm::dquat computeFlyQuat(
const glm::dvec3& scaledSourceEcef,
const glm::dvec3& scaledDestinationEcef,
const glm::dvec3& originalSourceEcef,
const glm::dvec3& originalDestinationEcef)
: _ellipsoid(ellipsoid),
_sourceEcef(originalSourceEcef),
_destinationEcef(originalDestinationEcef) {
const glm::dvec3& scaledDestinationEcef) {
// Here we find the center of a circle that passes through both the source and
// destination points, and then calculate the angle that we need to move along
// that circle to get from point A to B.

glm::dquat flyQuat = glm::rotation(
return glm::rotation(
glm::normalize(scaledSourceEcef),
glm::normalize(scaledDestinationEcef));

this->_rotationAxis = glm::axis(flyQuat);
this->_totalAngle = glm::angle(flyQuat);

// Calculate difference between lengths instead of length between points -
// allows for negative source height
// NOLINTBEGIN(cppcoreguidelines-prefer-member-initializer)
this->_sourceHeight =
glm::length(originalSourceEcef) - glm::length(scaledSourceEcef);
this->_destinationHeight =
glm::length(originalDestinationEcef) - glm::length(scaledDestinationEcef);
// NOLINTEND(cppcoreguidelines-prefer-member-initializer)

this->_sourceDirection = glm::normalize(originalSourceEcef);
}
} // namespace

SimplePlanarEllipsoidCurve::SimplePlanarEllipsoidCurve(
const Ellipsoid& ellipsoid,
const glm::dvec3& scaledSourceEcef,
const glm::dvec3& scaledDestinationEcef,
const glm::dvec3& originalSourceEcef,
const glm::dvec3& originalDestinationEcef)
: _totalAngle(
glm::angle(computeFlyQuat(scaledSourceEcef, scaledDestinationEcef))),
// Calculate difference between lengths instead of length between points -
// allows for negative source height
_sourceHeight(
glm::length(originalSourceEcef) - glm::length(scaledSourceEcef)),
_destinationHeight(
glm::length(originalDestinationEcef) -
glm::length(scaledDestinationEcef)),
_ellipsoid(ellipsoid),
_sourceDirection(glm::normalize(originalSourceEcef)),
_rotationAxis(
glm::axis(computeFlyQuat(scaledSourceEcef, scaledDestinationEcef))),
_sourceEcef(originalSourceEcef),
_destinationEcef(originalDestinationEcef) {}

} // namespace CesiumGeospatial
4 changes: 2 additions & 2 deletions CesiumGltf/include/CesiumGltf/AccessorUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct IndicesForFaceFromAccessor {
return {-1, -1, -1};
}

std::array<int64_t, 3> result;
std::array<int64_t, 3> result{};

if (primitiveMode == MeshPrimitive::Mode::TRIANGLE_FAN) {
result[0] = 0;
Expand Down Expand Up @@ -219,7 +219,7 @@ struct IndicesForFaceFromAccessor {
return {-1, -1, -1};
}

std::array<int64_t, 3> result;
std::array<int64_t, 3> result{};

if (primitiveMode == MeshPrimitive::Mode::TRIANGLE_FAN) {
result[0] = value[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ class CESIUMRASTEROVERLAYS_API QuadtreeRasterOverlayTileProvider

struct CombinedImageMeasurements {
CesiumGeometry::Rectangle rectangle;
int32_t widthPixels;
int32_t heightPixels;
int32_t channels;
int32_t bytesPerChannel;
int32_t widthPixels{};
int32_t heightPixels{};
int32_t channels{};
int32_t bytesPerChannel{};
};

static CombinedImageMeasurements measureCombinedImage(
Expand All @@ -159,6 +159,7 @@ class CESIUMRASTEROVERLAYS_API QuadtreeRasterOverlayTileProvider
uint32_t _imageHeight;
CesiumGeometry::QuadtreeTilingScheme _tilingScheme;

// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
struct CacheEntry {
CesiumGeometry::QuadtreeTileID tileID;
CesiumAsync::SharedFuture<LoadedQuadtreeImage> future;
Expand Down
2 changes: 1 addition & 1 deletion CesiumRasterOverlays/src/TileMapServiceRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace CesiumRasterOverlays {
namespace {
struct TileMapServiceTileset {
std::string url;
uint32_t level;
uint32_t level{};
};
} // namespace

Expand Down

0 comments on commit b0aecad

Please sign in to comment.