glc_repcrossmover.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "glc_repcrossmover.h"
00024 #include "glc_viewport.h"
00025
00026
00027 GLC_RepCrossMover::GLC_RepCrossMover(GLC_Viewport* pViewport)
00028 : GLC_RepMover(pViewport)
00029 {
00030
00031 }
00032
00033
00034 GLC_RepCrossMover::GLC_RepCrossMover(const GLC_RepCrossMover& repMover)
00035 : GLC_RepMover(repMover)
00036 {
00037
00038 }
00039
00040 GLC_RepCrossMover::~GLC_RepCrossMover()
00041 {
00042
00043 }
00044
00046
00048
00049
00050 GLC_RepMover* GLC_RepCrossMover::clone() const
00051 {
00052 return new GLC_RepCrossMover(*this);
00053 }
00054
00056
00058
00059
00060 void GLC_RepCrossMover::glDraw()
00061 {
00062 int nLgAxe;
00063 const int winHSize= m_pViewport->viewHSize();
00064 const int winVSize= m_pViewport->viewVSize();
00065 if (winHSize > winVSize)
00066 {
00067 nLgAxe = static_cast<int>(static_cast<double>(winVSize) / 2.0);
00068 }
00069 else
00070 {
00071 nLgAxe = static_cast<int>(static_cast<double>(winHSize) / 2.0);
00072 }
00073
00074
00075 const double ChampsVision = 2 * (m_pViewport->cameraHandle()->distEyeTarget()) * tan((m_pViewport->viewAngle() * glc::PI / 180.0) / 2.0);
00076
00077
00078
00079 const double dLgAxe= ((double)nLgAxe * ChampsVision / (double)winVSize) / 7;
00080 const double dDecAxe= dLgAxe / 3;
00081 glPushMatrix();
00082
00083 glTranslated(m_pViewport->cameraHandle()->target().x(), m_pViewport->cameraHandle()->target().y(),
00084 m_pViewport->cameraHandle()->target().z() );
00085
00086
00087 glDisable(GL_TEXTURE_2D);
00088 glDisable(GL_LIGHTING);
00089 glColor4d(m_MainColor.redF(), m_MainColor.greenF(), m_MainColor.blueF(), m_MainColor.alphaF());
00090 glLineWidth(1.0);
00091
00092
00093 glBegin(GL_LINES);
00094
00095 glVertex3d(-dLgAxe, 0, 0);
00096 glVertex3d(-dDecAxe, 0, 0);
00097 glVertex3d(dDecAxe, 0, 0);
00098 glVertex3d(dLgAxe, 0, 0);
00099
00100
00101 glVertex3d(0, -dLgAxe, 0);
00102 glVertex3d(0, -dDecAxe, 0);
00103 glVertex3d(0, dDecAxe, 0);
00104 glVertex3d(0, dLgAxe, 0);
00105
00106
00107 glVertex3d(0, 0, -dLgAxe);
00108 glVertex3d(0, 0, -dDecAxe);
00109 glVertex3d(0, 0, dDecAxe);
00110 glVertex3d(0, 0, dLgAxe);
00111
00112 glEnd();
00113
00114 glPopMatrix();
00115
00116 }
00117
00118