Fix vlj's profiler code, only worked in single player
This commit is contained in:
parent
d3ec1a27ce
commit
58f509d953
@ -45,6 +45,8 @@
|
||||
AlignedArray<Camera::EndCameraInformation> Camera::m_end_cameras;
|
||||
std::vector<Camera*> Camera::m_all_cameras;
|
||||
|
||||
Camera* Camera::s_active_camera = NULL;
|
||||
|
||||
// ============================================================================
|
||||
Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL)
|
||||
{
|
||||
@ -667,6 +669,7 @@ void Camera::handleEndCamera(float dt)
|
||||
*/
|
||||
void Camera::activate()
|
||||
{
|
||||
s_active_camera = this;
|
||||
irr::scene::ISceneManager *sm = irr_driver->getSceneManager();
|
||||
sm->setActiveCamera(m_camera);
|
||||
irr_driver->getVideoDriver()->setViewPort(m_viewport);
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
static Camera* s_active_camera;
|
||||
|
||||
/** The camera scene node. */
|
||||
scene::ICameraSceneNode *m_camera;
|
||||
|
||||
@ -271,6 +273,9 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the camera scene node. */
|
||||
scene::ICameraSceneNode *getCameraSceneNode() { return m_camera; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
static Camera* getActiveCamera() { return s_active_camera; }
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
@ -72,9 +72,12 @@ int LODNode::getLevel()
|
||||
if(m_forced_lod>-1)
|
||||
return m_forced_lod;
|
||||
|
||||
// TODO: optimize this, there is no need to check every frame
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
const Vec3 &pos = Camera::getCamera(0)->getKart()->getFrontXYZ();
|
||||
Camera* camera = Camera::getActiveCamera();
|
||||
if (camera == NULL)
|
||||
return m_detail.size() - 1;
|
||||
AbstractKart* kart = camera->getKart();
|
||||
const Vec3 &pos = kart->getFrontXYZ();
|
||||
|
||||
// Assumes all children are at the same location
|
||||
const int dist =
|
||||
|
Loading…
x
Reference in New Issue
Block a user