mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-28 15:09:36 -06:00
Fixes to make the new GLM version compatible
This commit is contained in:
Submodule ext/ghoul updated: c1c66477bb...85b73b3249
@@ -499,7 +499,7 @@ void InteractionHandler::orbit(const float &dx, const float &dy, const float &dz
|
||||
|
||||
lockControls();
|
||||
|
||||
glm::vec3 cameraUp = glm::normalize((glm::inverse(_camera->viewRotationMatrix()) * glm::vec4(_camera->lookUpVector(), 0))).xyz;
|
||||
glm::vec3 cameraUp = glm::normalize((glm::inverse(_camera->viewRotationMatrix()) * glm::vec4(_camera->lookUpVector(), 0))).xyz();
|
||||
glm::vec3 cameraRight = glm::cross(_camera->viewDirection(), cameraUp);
|
||||
|
||||
glm::mat4 transform;
|
||||
|
||||
@@ -76,7 +76,7 @@ void MouseController::trackballRotate(int x, int y) {
|
||||
float height = static_cast<float>(sgct::Engine::instance()->getCurrentYResolution());
|
||||
glm::vec2 mousePos = glm::vec2((float)x / width, (float)y / height);
|
||||
|
||||
mousePos = glm::clamp(mousePos, -0.5, 1.5); // Ugly fix #1: Camera position becomes NaN on mouse values outside [-0.5, 1.5]
|
||||
mousePos = glm::clamp(mousePos, -0.5f, 1.5f); // Ugly fix #1: Camera position becomes NaN on mouse values outside [-0.5, 1.5]
|
||||
//mousePos[1] = 0.5; // Ugly fix #2: Tempoarily only allow rotation around y
|
||||
|
||||
glm::vec3 curTrackballPos = mapToTrackball(mousePos);
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace properties {
|
||||
[](lua_State* state, bool& success) -> __TYPE__ { \
|
||||
__TYPE__ result; \
|
||||
int number = 1; \
|
||||
for (__TYPE__::size_type i = 0; i < __TYPE__::row_size(); ++i) { \
|
||||
for (__TYPE__::size_type j = 0; j < __TYPE__::col_size(); ++j) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::rows; ++i) { \
|
||||
for (glm::length_t j = 0; j < __TYPE__::cols; ++j) { \
|
||||
lua_getfield(state, -1, std::to_string(number).c_str()); \
|
||||
if (lua_isnumber(state, -1) != 1) { \
|
||||
success = false; \
|
||||
@@ -61,8 +61,8 @@ namespace properties {
|
||||
[](lua_State* state, __TYPE__ value) -> bool { \
|
||||
lua_newtable(state); \
|
||||
int number = 1; \
|
||||
for (__TYPE__::size_type i = 0; i < __TYPE__::row_size(); ++i) { \
|
||||
for (__TYPE__::size_type j = 0; j < __TYPE__::col_size(); ++j) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::rows; ++i) { \
|
||||
for (glm::length_t j = 0; j < __TYPE__::cols; ++j) { \
|
||||
lua_pushnumber(state, static_cast<lua_Number>(value[i][j])); \
|
||||
lua_setfield(state, -2, std::to_string(number).c_str()); \
|
||||
++number; \
|
||||
@@ -75,13 +75,13 @@ namespace properties {
|
||||
[](std::string value, bool& success) -> __TYPE__ { \
|
||||
__TYPE__ result; \
|
||||
std::vector<std::string> tokens = ghoul::tokenizeString(value, ','); \
|
||||
if (tokens.size() != (__TYPE__::row_size() * __TYPE__::col_size())) { \
|
||||
if (tokens.size() != (__TYPE__::rows * __TYPE__::cols)) { \
|
||||
success = false; \
|
||||
return result; \
|
||||
} \
|
||||
int number = 0; \
|
||||
for (__TYPE__::size_type i = 0; i < __TYPE__::row_size(); ++i) { \
|
||||
for (__TYPE__::size_type j = 0; j < __TYPE__::col_size(); ++j) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::rows; ++i) { \
|
||||
for (glm::length_t j = 0; j < __TYPE__::cols; ++j) { \
|
||||
std::stringstream s(tokens[number]); \
|
||||
__TYPE__::value_type v; \
|
||||
s >> v; \
|
||||
@@ -102,8 +102,8 @@ namespace properties {
|
||||
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
|
||||
[](std::string& outValue, __TYPE__ inValue) -> bool { \
|
||||
outValue = ""; \
|
||||
for (__TYPE__::size_type i = 0; i < __TYPE__::row_size(); ++i) { \
|
||||
for (__TYPE__::size_type j = 0; j < __TYPE__::col_size(); ++j) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::rows; ++i) { \
|
||||
for (glm::length_t j = 0; j < __TYPE__::cols; ++j) { \
|
||||
outValue += std::to_string(inValue[i][j]) + ","; \
|
||||
} \
|
||||
outValue.pop_back(); \
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace properties {
|
||||
[](lua_State * state, bool& success) -> __TYPE__ { \
|
||||
__TYPE__ result; \
|
||||
lua_pushnil(state); \
|
||||
for (__TYPE__::size_type i = 0; i < result.length(); ++i) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::components; ++i) { \
|
||||
int success = lua_next(state, -2); \
|
||||
if (success != 1) { \
|
||||
success = false; \
|
||||
@@ -61,7 +61,7 @@ namespace properties {
|
||||
[](lua_State * state, __TYPE__ value) -> bool { \
|
||||
lua_newtable(state); \
|
||||
int number = 1; \
|
||||
for (__TYPE__::size_type i = 0; i < value.length(); ++i) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::components; ++i) { \
|
||||
lua_pushnumber(state, static_cast<lua_Number>(value[i])); \
|
||||
lua_setfield(state, -2, std::to_string(number).c_str()); \
|
||||
++number; \
|
||||
@@ -77,7 +77,7 @@ namespace properties {
|
||||
success = false; \
|
||||
return result; \
|
||||
} \
|
||||
for (__TYPE__::size_type i = 0; i < result.length(); ++i) { \
|
||||
for (glm::length_t i = 0; i < __TYPE__::components; ++i) { \
|
||||
std::stringstream s(tokens[i]); \
|
||||
__TYPE__::value_type v; \
|
||||
s >> v; \
|
||||
@@ -95,7 +95,7 @@ namespace properties {
|
||||
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
|
||||
[](std::string& outValue, __TYPE__ inValue) -> bool { \
|
||||
outValue = "{"; \
|
||||
for (__TYPE__::size_type i = 0; i < inValue.length(); ++i) \
|
||||
for (glm::length_t i = 0; i < __TYPE__::components; ++i) \
|
||||
outValue += std::to_string(inValue[i]) + ","; \
|
||||
outValue.pop_back(); \
|
||||
outValue += "}"; \
|
||||
|
||||
@@ -147,7 +147,7 @@ void Camera::compileViewRotationMatrix()
|
||||
// the camera matrix needs to be rotated inverse to the world
|
||||
// _viewDirection = glm::rotate(glm::inverse(_viewRotation), _cameraDirection);
|
||||
//_viewDirection = (glm::inverse(_localViewRotationMatrix) * glm::vec4(_cameraDirection, 0.f)).xyz;
|
||||
_viewDirection = (glm::inverse(_localViewRotationMatrix) * glm::vec4(_cameraDirection, 0.f)).xyz;
|
||||
_viewDirection = (glm::inverse(_localViewRotationMatrix) * glm::vec4(_cameraDirection, 0.f)).xyz();
|
||||
_viewDirection = glm::normalize(_viewDirection);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user