00001 /* 00002 * lib-controler : Un contrôleur générique de scène 3D. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-controler 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 //****************************************************************************** 00025 #include "view-precompile-ortho.hh" 00026 #include "parameter-eye-position.hh" 00027 #include "parameter-aimed-position.hh" 00028 //****************************************************************************** 00029 CViewPrecompileOrtho:: 00030 CViewPrecompileOrtho(CParameterEyePosition * AParameterEyePosition, 00031 CParameterAimedPosition * AParameterAimedPosition, 00032 CParameterDrawing * AParameterDrawing, 00033 const CVertex & AOx, 00034 const CVertex & AOy) : 00035 CViewPrecompile(AParameterEyePosition, 00036 AParameterAimedPosition, AParameterDrawing), 00037 FOx(AOx), 00038 FOy(AOy) 00039 { 00040 FOz = FOx * FOy; 00041 } 00042 //****************************************************************************** 00043 CViewPrecompileOrtho::~CViewPrecompileOrtho() 00044 {} 00045 //****************************************************************************** 00046 void CViewPrecompileOrtho::setScenePosition() 00047 { 00048 setScenePositionInitialize(); 00049 00050 float d = FParameterEyePosition->getDistance(); 00051 00052 float p0 = FParameterAimedPosition->getLookAt(0); 00053 float p1 = FParameterAimedPosition->getLookAt(1); 00054 float p2 = FParameterAimedPosition->getLookAt(2); 00055 00056 glOrtho(-d*FRatio/2,+d*FRatio/2, -d/2,+d/2, -1000,+1000); 00057 00058 gluLookAt(p0+d*FOz.getX(), p1+d*FOz.getY(), p2+d*FOz.getZ(), 00059 p0,p1,p2, 00060 FOy.getX(), FOy.getY(), FOy.getZ()); 00061 00062 setScenePositionFinalize(); 00063 } 00064 //******************************************************************************
1.5.8