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