mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Change renderproperties from value checking to changed flag
Make matrix fromLuaConversion functions actually work
This commit is contained in:
@@ -320,12 +320,19 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
float min = static_cast<float>(p->minValue());
|
||||
float max = static_cast<float>(p->maxValue());
|
||||
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f", p->exponent());
|
||||
bool changed = ImGui::SliderFloat(
|
||||
name.c_str(),
|
||||
&value,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != static_cast<float>(p->value())) {
|
||||
if (changed) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
}
|
||||
|
||||
@@ -345,12 +352,12 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
int min = p->minValue();
|
||||
int max = p->maxValue();
|
||||
|
||||
ImGui::SliderInt(name.c_str(), &value, min, max);
|
||||
bool changed = ImGui::SliderInt(name.c_str(), &value, min, max);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
}
|
||||
|
||||
@@ -369,7 +376,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
IVec2Property::ValueType value = *p;
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
ImGui::SliderInt2(
|
||||
bool changed = ImGui::SliderInt2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -379,7 +386,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -403,7 +410,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
|
||||
ImGui::SliderInt3(
|
||||
bool changed = ImGui::SliderInt3(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -413,7 +420,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -436,7 +443,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
|
||||
ImGui::SliderInt4(
|
||||
bool changed = ImGui::SliderInt4(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -446,7 +453,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -468,12 +475,19 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
FloatProperty::ValueType value = *p;
|
||||
float min = p->minValue();
|
||||
float max = p->maxValue();
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f", p->exponent());
|
||||
bool changed = ImGui::SliderFloat(
|
||||
name.c_str(),
|
||||
&value,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
}
|
||||
|
||||
@@ -493,7 +507,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
ImGui::SliderFloat2(
|
||||
bool changed = ImGui::SliderFloat2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -505,7 +519,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -529,14 +543,15 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
bool changed = false;
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
ImGui::ColorEdit3(
|
||||
changed = ImGui::ColorEdit3(
|
||||
name.c_str(),
|
||||
glm::value_ptr(value)
|
||||
);
|
||||
}
|
||||
else {
|
||||
ImGui::SliderFloat3(
|
||||
changed = ImGui::SliderFloat3(
|
||||
name.c_str(),
|
||||
glm::value_ptr(value),
|
||||
min,
|
||||
@@ -549,7 +564,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -573,14 +588,15 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
bool changed = false;
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
ImGui::ColorEdit4(
|
||||
changed = ImGui::ColorEdit4(
|
||||
name.c_str(),
|
||||
glm::value_ptr(value)
|
||||
);
|
||||
}
|
||||
else {
|
||||
ImGui::SliderFloat4(
|
||||
changed = ImGui::SliderFloat4(
|
||||
name.c_str(),
|
||||
glm::value_ptr(value),
|
||||
min,
|
||||
@@ -616,7 +632,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
glm::vec2 value = glm::dvec2(*p);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
ImGui::SliderFloat2(
|
||||
bool changed = ImGui::SliderFloat2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -628,7 +644,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dvec2(value) != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -688,7 +704,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
ImGui::SliderFloat4(
|
||||
bool changed = ImGui::SliderFloat4(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
@@ -700,7 +716,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dvec4(value) != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -735,14 +751,22 @@ void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
ImGui::SliderFloat2("[0]", glm::value_ptr(value[0]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat2("[1]", glm::value_ptr(value[1]), min, max, "%.5f", p->exponent());
|
||||
bool changed = false;
|
||||
changed |= ImGui::SliderFloat2(
|
||||
"[0]",
|
||||
glm::value_ptr(value[0]),
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat2("[1]", glm::value_ptr(value[1]), min, max, "%.5f", p->exponent());
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat2(value) != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -779,16 +803,37 @@ void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
|
||||
ImGui::SliderFloat3("[0]", glm::value_ptr(value[0]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat3("[1]", glm::value_ptr(value[1]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat3("[2]", glm::value_ptr(value[2]), min, max, "%.5f", p->exponent());
|
||||
bool changed = false;
|
||||
changed |= ImGui::SliderFloat3(
|
||||
"[0]",
|
||||
&value[0].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat3(
|
||||
"[1]",
|
||||
&value[1].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat3(
|
||||
"[2]",
|
||||
&value[2].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat3(value) != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
@@ -827,17 +872,45 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
|
||||
ImGui::SliderFloat4("[0]", glm::value_ptr(value[0]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat4("[1]", glm::value_ptr(value[1]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat4("[2]", glm::value_ptr(value[2]), min, max, "%.5f", p->exponent());
|
||||
ImGui::SliderFloat4("[3]", glm::value_ptr(value[3]), min, max, "%.5f", p->exponent());
|
||||
bool changed = false;
|
||||
changed |= ImGui::SliderFloat4(
|
||||
"[0]",
|
||||
&value[0].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat4(
|
||||
"[1]",
|
||||
&value[1].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat4(
|
||||
"[2]",
|
||||
&value[2].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
changed |= ImGui::SliderFloat4(
|
||||
"[3]",
|
||||
&value[3].x,
|
||||
min,
|
||||
max,
|
||||
"%.5f",
|
||||
p->exponent()
|
||||
);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat4(value) != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat2x2 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat2x2 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat2x2>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat2x2>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x2(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x2(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat2x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat2x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat2x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat2x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x3(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat2x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat2x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat2x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat2x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat2x4(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat3x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat3x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat3x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat3x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x3(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat3x2 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat3x2 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat3x2>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat3x2>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x2(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x2(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat3x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat3x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat3x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat3x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat3x4(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat4x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat4x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat4x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat4x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat4x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat4x4(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::dmat4x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::dmat4x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::dmat4x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::dmat4x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::dmat4x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::dmat4x3(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat2x2 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat2x2 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat2x2>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat2x2>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat2x2(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat2x2(0);
|
||||
|
||||
@@ -36,10 +36,15 @@ namespace {
|
||||
|
||||
glm::mat2x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat2x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat2x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat2x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat2x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat2x3(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat2x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat2x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat2x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat2x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat2x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat2x4(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat3x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat3x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat3x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat3x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat3x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat3x3(0);
|
||||
|
||||
@@ -34,11 +34,16 @@ namespace {
|
||||
|
||||
glm::mat3x2 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat3x2 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat3x2>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat3x2>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat3x2(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat3x2(0);
|
||||
} else {
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat3x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat3x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat3x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat3x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat3x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat3x4(0);
|
||||
|
||||
@@ -36,10 +36,15 @@ namespace {
|
||||
|
||||
glm::mat4x4 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat4x4 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat4x4>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat4x4>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat4x4(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat4x4(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat4x2 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat4x2 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat4x2>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat4x2>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat4x2(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat4x2(0);
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace {
|
||||
|
||||
glm::mat4x3 fromLuaConversion(lua_State* state, bool& success) {
|
||||
glm::mat4x3 result;
|
||||
lua_pushnil(state);
|
||||
int number = 1;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_cols<glm::mat4x3>::value; ++i) {
|
||||
for (glm::length_t j = 0; j < ghoul::glm_rows<glm::mat4x3>::value; ++j) {
|
||||
lua_getfield(state, -1, std::to_string(number).c_str());
|
||||
int hasNext = lua_next(state, -2);
|
||||
if (hasNext != 1) {
|
||||
success = false;
|
||||
return glm::mat4x3(0);
|
||||
}
|
||||
if (lua_isnumber(state, -1) != 1) {
|
||||
success = false;
|
||||
return glm::mat4x3(0);
|
||||
|
||||
Reference in New Issue
Block a user