History

Fixes for style conformance

matsukaze committed 12 years ago

Commit ef3d7951 parent 259b2855 files · +324 −369Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 5 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+20−27
@@ -1050,15 +1050,13 @@ int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, boo · 1049 unmodified lines
10501050 if (primitiveIndex) {
10511051 _renderer->remove(primitiveIndex);
10521052 node->setPrimitiveIndex(0);
1053− }
1054− else {
1053+ } else {
10551054 node->setVoxelSystem(this);
10561055 }
10571056 inspectForInteriorOcclusionsOperation(node, 0);
10581057
1059− if (node->getInteriorOcclusions() != OctreeElement::HalfSpace::All)
1060− {
1061− Cube *cube = new Cube(
1058+ if (node->getInteriorOcclusions() != OctreeElement::HalfSpace::All) {
1059+ Cube* cube = new Cube(
10621060 startVertex.x, startVertex.y, startVertex.z, voxelScale,
10631061 color[RED_INDEX], color[GREEN_INDEX], color[BLUE_INDEX],
10641062 node->getInteriorOcclusions());
@@ -1067,8 +1065,7 @@ int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, boo · 2 unmodified lines
10671065 node->setPrimitiveIndex(primitiveIndex);
10681066 }
10691067 }
1070− }
1071− else {
1068+ } else {
10721069 glBufferIndex nodeIndex = GLBUFFER_INDEX_UNKNOWN;
10731070 if (reuseIndex && node->isKnownBufferIndex()) {
10741071 nodeIndex = node->getBufferIndex();
@@ -1531,12 +1528,12 @@ bool VoxelSystem::inspectForInteriorOcclusionsOperation(OctreeElement* element, · 456 unmodified lines
15311528 }
15321529
15331530 // Bit mask of occluded shared faces indexed by child
1534− unsigned char occludedSharedFace[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1531+ unsigned char occludedSharedFace[NUMBER_OF_CHILDREN] = { 0, 0, 0, 0, 0, 0, 0, 0 };
15351532
15361533 // Traverse all pair combinations of children
15371534 for (int i = NUMBER_OF_CHILDREN; --i >= 0; ) {
15381535
1539− VoxelTreeElement *childA = voxel->getChildAtIndex(i);
1536+ VoxelTreeElement* childA = voxel->getChildAtIndex(i);
15401537 if (childA) {
15411538
15421539 // Get the child A's occluding faces, for a leaf that will be
@@ -1551,7 +1548,7 @@ bool VoxelSystem::inspectForInteriorOcclusionsOperation(OctreeElement* element, · 8 unmodified lines
15511548
15521549 for (int j = i; --j >= 0; ) {
15531550
1554− VoxelTreeElement *childB = voxel->getChildAtIndex(j);
1551+ VoxelTreeElement* childB = voxel->getChildAtIndex(j);
15551552 if (childB) {
15561553
15571554 // Get child B's occluding faces
@@ -1564,22 +1561,22 @@ bool VoxelSystem::inspectForInteriorOcclusionsOperation(OctreeElement* element, · 6 unmodified lines
15641561
15651562 // Determine the shared halfspace partition between siblings A and B,
15661563 // i.e., near/far, left/right, or top/bottom
1567− unsigned char partition = octantIndexToSharedBitMask[i][j] &
1564+ unsigned char partition = _sOctantIndexToSharedBitMask[i][j] &
15681565 exteriorOcclusionsA & exteriorOcclusionsB;
15691566
1570− // Determine which face of each sibling is occluded.
1567+ // Determine which face of each sibling is occluded.
15711568 // Note the intentionally crossed indicies. It is necessary because
1572− // the octantIndexToBitMask is a partition occupancy mask. For
1569+ // the _sOctantIndexToBitMask is a partition occupancy mask. For
15731570 // example, if the near-left-top (NLT) and near-left-bottom (NLB) child voxels
15741571 // exist, the shared partition is top-bottom (TB), and thus the occluded
15751572 // shared face of the NLT voxel is its bottom face.
1576− occludedSharedFace[i] |= (partition & octantIndexToBitMask[j]);
1577− occludedSharedFace[j] |= (partition & octantIndexToBitMask[i]);
1573+ occludedSharedFace[i] |= (partition & _sOctantIndexToBitMask[j]);
1574+ occludedSharedFace[j] |= (partition & _sOctantIndexToBitMask[i]);
15781575 }
15791576 }
15801577 // Combine this voxel's interior excluded shared face only to those children which are coincident
15811578 // with the excluded face.
1582− occludedSharedFace[i] |= (voxel->getInteriorOcclusions() & octantIndexToBitMask[i]);
1579+ occludedSharedFace[i] |= (voxel->getInteriorOcclusions() & _sOctantIndexToBitMask[i]);
15831580
15841581 // Inform the child
15851582 childA->setInteriorOcclusions(occludedSharedFace[i]);
@@ -1610,13 +1607,13 @@ bool VoxelSystem::inspectForExteriorOcclusionsOperation(OctreeElement* element, · 24 unmodified lines
16101607 // Traverse all children
16111608 for (int i = NUMBER_OF_CHILDREN; --i >= 0; ) {
16121609
1613− VoxelTreeElement *child = voxel->getChildAtIndex(i);
1610+ VoxelTreeElement* child = voxel->getChildAtIndex(i);
16141611 if (child) {
16151612 // Get the child's occluding faces, for a leaf, that will be
16161613 // all six voxel faces, and for a non leaf, that will be
16171614 // all faces which are completely covered by four child octants.
16181615 unsigned char exteriorOcclusionsOfChild = child->getExteriorOcclusions();
1619− exteriorOcclusionsOfChild &= octantIndexToBitMask[i];
1616+ exteriorOcclusionsOfChild &= _sOctantIndexToBitMask[i];
16201617
16211618 for (int j = 6; --j >= 0; ) {
16221619
@@ -1656,9 +1653,7 @@ bool VoxelSystem::inspectForExteriorOcclusionsOperation(OctreeElement* element, · 33 unmodified lines
16561653 // occupied. Hence, the subtree from this node could be
16571654 // pruned and replaced by a leaf voxel, if the visible
16581655 // properties of the children are the same
1659− }
1660− else
1661− if (exteriorOcclusions) {
1656+ } else if (exteriorOcclusions) {
16621657 //const glm::vec3& v = voxel->getCorner();
16631658 //float s = voxel->getScale();
16641659
@@ -1682,8 +1677,7 @@ bool VoxelSystem::clearOcclusionsOperation(OctreeElement* element, void* extraDa · 17 unmodified lines
16821677 // And the sibling occluders
16831678 voxel->setInteriorOcclusions(0);
16841679 rc = false;
1685− }
1686− else {
1680+ } else {
16871681 voxel->setExteriorOcclusions(0);
16881682 voxel->setInteriorOcclusions(0);
16891683 rc = true;
@@ -1711,8 +1705,7 @@ void VoxelSystem::cullSharedFaces() { · 21 unmodified lines
17111705 _tree->recurseTreeWithOperation(inspectForInteriorOcclusionsOperation);
17121706 unlockTree();
17131707 qDebug("culling shared faces in %d nodes", _nodeCount);
1714− }
1715− else {
1708+ } else {
17161709 cleanupVoxelMemory();
17171710 _usePrimitiveRenderer = false;
17181711 initVoxelMemory();
@@ -3112,7 +3105,7 @@ void VoxelSystem::beginLoadingLocalVoxelCache() { · 1393 unmodified lines
31123105 // Octant bitmask array indexed by octant. The mask value indicates the octant's halfspace partitioning. The index
31133106 // value corresponds to the voxel's octal code derived in "pointToVoxel" in SharedUtil.cpp, which, BTW, does *not*
31143107 // correspond to the "ChildIndex" enum value in OctreeElement.h
3115−unsigned char VoxelSystem::octantIndexToBitMask[8] = {
3108+unsigned char VoxelSystem::_sOctantIndexToBitMask[8] = {
31163109 OctreeElement::HalfSpace::Bottom | OctreeElement::HalfSpace::Left | OctreeElement::HalfSpace::Near,
31173110 OctreeElement::HalfSpace::Bottom | OctreeElement::HalfSpace::Left | OctreeElement::HalfSpace::Far,
31183111 OctreeElement::HalfSpace::Top | OctreeElement::HalfSpace::Left | OctreeElement::HalfSpace::Near,
@@ -3125,7 +3118,7 @@ unsigned char VoxelSystem::octantIndexToBitMask[8] = { · 6 unmodified lines
31253118
31263119 // Two dimensional array map indexed by octant row and column. The mask value
31273120 // indicates the two faces shared by the octants
3128−unsigned char VoxelSystem::octantIndexToSharedBitMask[8][8] = {
3121+unsigned char VoxelSystem::_sOctantIndexToSharedBitMask[8][8] = {
31293122 { // Index 0: Bottom-Left-Near
31303123 0, // Bottom-Left-Near
31313124 OctreeElement::HalfSpace::Near | OctreeElement::HalfSpace::Far, // Bottom-Left-Far