MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / positionFromView

Function positionFromView

Cesium3DTilesSelection/src/ViewState.cpp:50–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49namespace {
50glm::dvec3 positionFromView(const glm::dmat4& viewMatrix) {
51 // Back out the world position by multiplying the view matrix translation by
52 // the rotation transpose (inverse) and negating.
53 glm::dvec3 position(0.0);
54 position.x = -glm::dot(glm::dvec3(viewMatrix[0]), glm::dvec3(viewMatrix[3]));
55 position.y = -glm::dot(glm::dvec3(viewMatrix[1]), glm::dvec3(viewMatrix[3]));
56 position.z = -glm::dot(glm::dvec3(viewMatrix[2]), glm::dvec3(viewMatrix[3]));
57 return position;
58}
59
60glm::dvec3 directionFromView(const glm::dmat4& viewMatrix) {
61 return glm::dvec3(viewMatrix[0][2], viewMatrix[1][2], viewMatrix[2][2]) *

Callers 1

ViewStateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected