1
// $Id: irr_debug_drawer.cpp 839 2006-10-24 00:01:56Z hiker $
3
// SuperTuxKart - a fun racing game with go-kart
4
// Copyright (C) 2010 Joerg Henrichs
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 3
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#include "physics/irr_debug_drawer.hpp"
22
#include "modes/world.hpp"
24
IrrDebugDrawer::IrrDebugDrawer()
26
m_debug_mode = DM_NONE;
29
// -----------------------------------------------------------------------------
30
/** Activates the next debug mode, or switches the mode off again.
32
void IrrDebugDrawer::nextDebugMode()
34
// Go to next debug mode. Note that debug mode 3 (
35
m_debug_mode = (DebugModeType) ((m_debug_mode+1) % 3);
36
World *world = World::getWorld();
37
unsigned int num_karts = world->getNumKarts();
38
for(unsigned int i=0; i<num_karts; i++)
40
Kart *kart = world->getKart(i);
41
if(kart->isEliminated()) continue;
42
kart->getNode()->setVisible(!(m_debug_mode & DM_NO_KARTS_GRAPHICS));
46
// -----------------------------------------------------------------------------
47
void IrrDebugDrawer::drawLine(const btVector3& from, const btVector3& to,
48
const btVector3& color)
50
video::SColor c(255, (int)(color.getX()*255), (int)(color.getY()*255),
51
(int)(color.getZ()*255) );
52
irr_driver->getVideoDriver()->draw3DLine((const core::vector3df&)from,
53
(const core::vector3df&)to, c);