void FrustumCulling::CheckVoxels(const std::vector<TNode>& _nodes, uint32_t _nodePtr, std::vector<uint32_t>& _visibleNodes, FVEC3 _origin, int _depth) { TNode node = _nodes[_nodePtr]; uint32_t dim = std::pow(2, _depth); if (!CheckCube(_origin.x, _origin.y, _origin.z, dim)) return; if (node.IsLeaf()) // leaf { if (!node.IsNull()) _visibleNodes.push_back(_nodePtr); } else if (_depth < 0) { printf("depth < 0\n"); return; } else { for (int i = 0; i < 8; ++i) { int index = MortonOrder[i]; if (node.HasChildAtIndex(index)) { FVEC3 nodepos = offset[index]; nodepos *= ((float)dim / 2.0f); int depth = _depth; CheckVoxels(_nodes, node.GetChildAddress(index), _visibleNodes, _origin + nodepos, --depth); } } } }
void FrustumCulling::CheckVoxels(const std::vector<GPU_Node>& _nodes, uint32_t _nodePtr, std::vector<uint32_t>& _visibleNodes, FVEC3 _origin) { GPU_Node node = _nodes[_nodePtr]; uint32_t dim = std::pow(2, node.level); if (!CheckCube(_origin.x, _origin.y, _origin.z, dim)) return; if (node.IsLeaf()) // leaf { if (node.HasData()) _visibleNodes.push_back(_nodePtr); } else { for (int i = 0; i < 8; ++i) { int index = MortonOrder[i]; if (node.HasChild(index)) { FVEC3 nodepos = offset[index]; nodepos *= (dim * 0.5); CheckVoxels(_nodes, node.GetChildAddress(index), _visibleNodes, _origin + nodepos); } } } }
/** * SetCenter sets the image coordinates to the center of the image. * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup * CameraPointInfo::SetCenter() { if (CheckCube()) { camera->SetImage(currentCube->Samples()/2, currentCube->Lines()/2); return GetPointInfo(); } return NULL; }
/** * SetGround sets a latitude, longitude grrund coordinate in the * camera so data can be accessed. * * @param latitude A latitude coordinate in or almost in the * cube * @param longitude A longitude coordinate in or almost in the * cube * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup * CameraPointInfo::SetGround(const double latitude, const double longitude) { if (CheckCube()) { camera->SetUniversalGround(latitude, longitude); return GetPointInfo(); } return NULL; }
/** * SetImage sets a sample, line image coordinate in the camera * so data can be accessed. * * @param sample A sample coordinate in or almost in the cube * @param line A line coordinate in or almost in the cubei * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup * CameraPointInfo::SetImage(double sample, double line) { if (CheckCube()) { camera->SetImage(sample, line); return GetPointInfo(); } return NULL; }
/** * SetLine sets the image coordinates to the center sample and the * given line. * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup * CameraPointInfo::SetLine(double line) { if (CheckCube()) { camera->SetImage(currentCube->Samples()/2, line); return GetPointInfo(); } return NULL; }
/** * SetSample sets the image coordinates to the center line and the * given sample. * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup * CameraPointInfo::SetSample(double sample) { if (CheckCube()) { camera->SetImage(sample, currentCube->Lines()/2); return GetPointInfo(); } return NULL; }
/** * SetImage sets a sample, line image coordinate in the camera * so data can be accessed. * * @param sample A sample coordinate in or almost in the cube * @param line A line coordinate in or almost in the cubei * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup *CameraPointInfo::SetImage(const double sample, const double line, const bool outside, const bool errors) { if (CheckCube()) { bool passed = m_camera->SetImage(sample, line); return GetPointInfo(passed, outside, errors); } // Should never get here, error will be thrown in CheckCube() return NULL; }
/** * SetGround sets a latitude, longitude grrund coordinate in the * camera so data can be accessed. * * @param latitude A latitude coordinate in or almost in the * cube * @param longitude A longitude coordinate in or almost in the * cube * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup *CameraPointInfo::SetGround(const double latitude, const double longitude, const bool outside, const bool errors) { if (CheckCube()) { bool passed = m_camera->SetUniversalGround(latitude, longitude); return GetPointInfo(passed, outside, errors); } // Should never get here, error will be thrown in CheckCube() return NULL; }
/** * SetCenter sets the image coordinates to the center of the image. * * @return PvlGroup* The pertinent data from the Camera class on * the point. Ownership is passed to caller. */ PvlGroup *CameraPointInfo::SetCenter(const bool outside, const bool errors) { if (CheckCube()) { bool passed = m_camera->SetImage(m_currentCube->sampleCount() / 2.0, m_currentCube->lineCount() / 2.0); return GetPointInfo(passed, outside, errors); } // Should never get here, error will be thrown in CheckCube() return NULL; }