mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Merge pull request #3076 from ey6es/master
Fixes for uninitialized variable warnings, disabled strict aliasing to allow safe type punning (and avoid warnings).
This commit is contained in:
commit
e7d3e244fb
3 changed files with 4 additions and 4 deletions
|
@ -13,7 +13,7 @@ if (WIN32)
|
|||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-strict-aliasing")
|
||||
endif(WIN32)
|
||||
|
||||
if (NOT QT_CMAKE_PREFIX_PATH)
|
||||
|
|
|
@ -771,7 +771,7 @@ int VoxelizationVisitor::visit(MetavoxelInfo& info) {
|
|||
}
|
||||
return DEFAULT_ORDER;
|
||||
}
|
||||
QRgb closestColor;
|
||||
QRgb closestColor = QRgb();
|
||||
float closestDistance = FLT_MAX;
|
||||
for (unsigned int i = 0; i < sizeof(DIRECTION_ROTATIONS) / sizeof(DIRECTION_ROTATIONS[0]); i++) {
|
||||
glm::vec3 rotated = DIRECTION_ROTATIONS[i] * center;
|
||||
|
|
|
@ -1094,14 +1094,14 @@ const int ORDER_ELEMENT_MASK = (1 << ORDER_ELEMENT_BITS) - 1;
|
|||
|
||||
int MetavoxelVisitor::encodeRandomOrder() {
|
||||
// see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_.22inside-out.22_algorithm
|
||||
int order;
|
||||
int order = 0;
|
||||
int randomValues = rand();
|
||||
for (int i = 0, iShift = 0; i < MetavoxelNode::CHILD_COUNT; i++, iShift += ORDER_ELEMENT_BITS) {
|
||||
int j = (randomValues >> iShift) % (i + 1);
|
||||
int jShift = j * ORDER_ELEMENT_BITS;
|
||||
if (j != i) {
|
||||
int jValue = (order >> jShift) & ORDER_ELEMENT_MASK;
|
||||
order = (order & ~(ORDER_ELEMENT_MASK << iShift)) | (jValue << iShift);
|
||||
order |= (jValue << iShift);
|
||||
}
|
||||
order = (order & ~(ORDER_ELEMENT_MASK << jShift)) | (i << jShift);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue