Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all
Unified · Split
| @@ -1156,3 +1156,33 @@ void VoxelSystem::copyFromTreeIntoSubTree(VoxelTree* sourceTree, VoxelNode* dest · 1155 unmodified lines | ||
| 1156 | 1156 | _tree->copyFromTreeIntoSubTree(sourceTree, destinationNode); |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | +struct FalseColorizeOccludedArgs { | |
| 1160 | + VoxelProjectedShadow occluder; | |
| 1161 | + ViewFrustum* viewFrustum; | |
| 1162 | +}; | |
| 1163 | + | |
| 1164 | +bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraData) { | |
| 1165 | + FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData; | |
| 1166 | + if (node->isColored()) { | |
| 1167 | + AABox voxelBox = node->getAABox(); | |
| 1168 | + voxelBox.scale(TREE_SCALE); | |
| 1169 | + VoxelProjectedShadow voxelShadow = args->viewFrustum->getProjectedShadow(voxelBox); | |
| 1170 | + if (args->occluder.occludes(voxelShadow)) { | |
| 1171 | + node->setFalseColor(255, 0, 0); | |
| 1172 | + } | |
| 1173 | + } | |
| 1174 | + return true; // keep going! | |
| 1175 | +} | |
| 1176 | + | |
| 1177 | +void VoxelSystem::falseColorizeOccluded() { | |
| 1178 | + FalseColorizeOccludedArgs args; | |
| 1179 | + args.viewFrustum = Application::getInstance()->getViewFrustum(); | |
| 1180 | + | |
| 1181 | + AABox box(glm::vec3(0.0125,0,0.025), 0.0125); | |
| 1182 | + box.scale(TREE_SCALE); | |
| 1183 | + args.occluder = args.viewFrustum->getProjectedShadow(box); | |
| 1184 | + | |
| 1185 | + _tree->recurseTreeWithOperation(falseColorizeOccludedOperation,(void*)&args); | |
| 1186 | + setupNewVoxelsForDrawing(); | |
| 1187 | +} | |
| 1188 | + | |