K3dDrawLine.cpp

Go to the documentation of this file.
00001 
00012 /***************************************************************************
00013  *   Copyright (C) 2007 by Jan Koci   *
00014  *   honza.koci@email.cz   *
00015  *   http://kengine.sourceforge.net/tutorial/
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  *   This program is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00025  *   GNU General Public License for more details.                          *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU General Public License     *
00028  *   along with this program; if not, write to the                         *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00031  ***************************************************************************/
00032 
00033 
00034 #include "K3dDrawLine.h"
00035 
00037 void K3dDrawLine::DrawLines()
00038 {
00039         for(int i=0; i<m_pGameData->GetLineObjSP().GetNum(); i++)
00040         {
00041                 // Get line
00042                 K3dLineObj *pLine = m_pGameData->GetLineObjSP().Get(i);
00043                 if(pLine->GetIsVisible() == true)
00044                 {
00045                         glDisable(GL_TEXTURE_2D);
00046                         //glColor3fv(pLine->GetColorArray());
00047                         glColor3ubv(pLine->GetColor()->GetColorArray());
00048                         glLineWidth(pLine->GetWidth());
00049                         glPushMatrix();
00050                         // Move with line by matrix
00051                         m_kViewMatrix = *m_pGameData->GetViewMatrix();
00052                         m_kModelMatrix = *pLine->GetMatrix();
00053                         // Multiply model and view matrix
00054                         m_kViewMatrix.Multiply(m_kModelMatrix);
00055                         // Set new view matrix
00056                         glLoadMatrixf(m_kViewMatrix.GetMatrix());
00057                         glBegin( GL_LINES  );
00058                                 glVertex3f((GLfloat) pLine->GetRelOrigin()[0][0], (GLfloat) pLine->GetRelOrigin()[0][1], (GLfloat) pLine->GetRelOrigin()[0][2]);
00059                                 glVertex3f((GLfloat) pLine->GetRelDirection()[0][0], (GLfloat) pLine->GetRelDirection()[0][1], (GLfloat) pLine->GetRelDirection()[0][2]);
00060                         glEnd();
00061                         glPopMatrix();
00062                         // Set default white color
00063                         glColor3ub( 255, 255, 255 ); 
00064                         glEnable(GL_TEXTURE_2D);                // Enable texturing*/
00065                 }
00066         }
00067 }

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0