~ubuntu-branches/ubuntu/precise/supertuxkart/precise

« back to all changes in this revision

Viewing changes to src/physics/irr_debug_drawer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-24 22:36:25 UTC
  • mfrom: (1.1.9 upstream) (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110224223625-ygrjfpg92obovuch
Tags: 0.7+dfsg1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  $Id: irr_debug_drawer.cpp 839 2006-10-24 00:01:56Z hiker $
 
2
//
 
3
//  SuperTuxKart - a fun racing game with go-kart
 
4
//  Copyright (C) 2010 Joerg Henrichs
 
5
//
 
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.
 
10
//
 
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.
 
15
//
 
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.
 
19
 
 
20
#include "physics/irr_debug_drawer.hpp"
 
21
 
 
22
#include "modes/world.hpp"
 
23
 
 
24
IrrDebugDrawer::IrrDebugDrawer()
 
25
{
 
26
    m_debug_mode = DM_NONE;
 
27
}   // IrrDebugDrawer
 
28
 
 
29
// -----------------------------------------------------------------------------
 
30
/** Activates the next debug mode, or switches the mode off again.
 
31
 */
 
32
void IrrDebugDrawer::nextDebugMode()
 
33
{
 
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++)
 
39
    {
 
40
        Kart *kart = world->getKart(i);
 
41
        if(kart->isEliminated()) continue;
 
42
        kart->getNode()->setVisible(!(m_debug_mode & DM_NO_KARTS_GRAPHICS));
 
43
    }
 
44
}   // nextDebugMode
 
45
 
 
46
// -----------------------------------------------------------------------------
 
47
void IrrDebugDrawer::drawLine(const btVector3& from, const btVector3& to,
 
48
                              const btVector3& color)
 
49
{
 
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);
 
54
}
 
55
 
 
56
/* EOF */
 
57