MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / computeIntersectionPoints

Method computeIntersectionPoints

source/camera/CullingManager.cpp:178–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178bool CullingManager::computeIntersectionPoints(Ogre::Camera* camera, std::vector<Ogre::Vector3>& ogreVectors)
179{
180 if(ogreVectors.size() != 4)
181 {
182 OD_LOG_ERR("Unexpected size for ogreVectors size=" + Helper::toString(ogreVectors.size()));
183 return false;
184 }
185
186 const Ogre::Vector3* cameraVector = camera->getWorldSpaceCorners();
187 for(int ii = 0 ; ii < 4; ++ii)
188 {
189 Ogre::Ray ray(cameraVector[ii], cameraVector[ii+4] - cameraVector[ii]);
190 std::pair<bool, Ogre::Real> intersectionResult = ray.intersects(GROUND_PLANE);
191 if(intersectionResult.first)
192 ogreVectors[ii]= (ray.getPoint(intersectionResult.second));
193 else
194 {
195 OD_LOG_ERR("I didn't find the intersection point for " + Helper::toString(ii) + "th ray ");
196 }
197 }
198 return true;
199}
200
201void CullingManager::update(Ogre::Camera* camera, const std::vector<Ogre::Vector3>& ogreVectors)
202{

Callers 4

MiniMapCameraMethod · 0.80
updateMethod · 0.80
GameEditorModeBaseMethod · 0.80
onFrameStartedMethod · 0.80

Calls 1

toStringFunction · 0.50

Tested by

no test coverage detected