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 #pragma once 00034 00035 #include "../GameData/K3dGameData.h" 00036 #include "../../MathCore/K3dVector3Obj.h" 00037 #include "../../Geometry/K3dCameraObj.h" 00038 #include "../../Geometry/K3dRayObj.h" 00039 #include "../K3dEnums.h" 00040 #include "../../Geometry/K3dPlaneObj.h" 00041 #include "../../Geometry/K3dLineObj.h" 00042 #include "../../Geometry/K3dSphereObj.h" 00043 #include "../../MathCore/K3dIntersection.h" 00044 #include "../Builder/K3dPlaneBuild.h" 00045 #include "../Worker/K3dVector3Work.h" 00046 00047 enum ERotAxis 00048 { 00049 K3D_ROT_AXIS_X=0, 00050 K3D_ROT_AXIS_Y, 00051 K3D_ROT_AXIS_Z 00052 }; 00053 00054 class K3dSphereWork 00055 { 00056 K3dGameData *m_pGameData; 00057 int m_iSphereId; 00058 ERotAxis m_eRotAxis; 00059 bool m_bIsMouseRightUp; 00060 K3dPlaneObj *m_pPlane; 00061 K3dIntersection *m_pIntersection; 00062 K3dPlaneBuild *m_pPlaneBuild; 00063 public: 00064 K3dSphereWork ( K3dGameData *_pGameData ); 00065 ~K3dSphereWork(); 00066 00067 void InitSphereWork(); 00068 void MoveByMouse ( const int _iSphereId ); 00069 void UpdateSpheres(); 00070 void LinkObject ( const int _iSphereId, const int _iObjId, const int _iObjType ); 00071 int FindSphereId ( const char* _strName ); 00072 00074 int &GetSphereId() 00075 { 00076 return m_iSphereId; 00077 } 00078 00080 K3dPlaneObj *GetAimPlane() 00081 { 00082 return m_pPlane; 00083 } 00084 00086 void SetAimPlane ( K3dPlaneObj *_pPlane ) 00087 { 00088 m_pPlane = _pPlane; 00089 } 00090 00091 }; 00092