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 <string> 00036 #include <vector> 00037 #include <iostream> 00038 using namespace std; 00039 00040 #include "../K3dDefines.h" 00041 #include "../K3dTypedef.h" 00042 00043 00044 //class K3dScene; 00045 class K3dVM; 00046 class K3dTimer; 00047 class K3dMouse; 00048 class K3dLua; 00049 class K3dKeyMap; 00050 class K3dMatrix; 00051 class K2dImageBuild; 00052 class K3dTextureBuild; 00053 class K3dPlaneBuild; 00054 class K3dPlaneWork; 00055 class K3dPolyPlaneBuild; 00056 class K3dOpenGL; 00057 class K3dVector3Build; 00058 class K3dVector3Work; 00059 class K3dVector2Build; 00060 class K3dColor3Build; 00061 class K3dColor4Build; 00062 class K3dMatrixBuild; 00063 class K3dSphereBuild; 00064 class K3dStream; 00065 class K3dRayBuild; 00066 class K3dIntersection; 00067 class K3dVertexBuild; 00068 class K3dVertexWork; 00069 class K2dImageWork; 00070 class K3dBoxWork; 00071 class K3dLineBuild; 00072 class K3dLineWork; 00073 class K3dBoxBuild; 00074 class K3dTriangleBuild; 00075 class K3dTriangleWork; 00076 class K3dMouse; 00077 class K3dVorLeafBuild; 00078 class K3dPolyBuild; 00079 class K3dPolyWork; 00080 class K3dMatrixWork; 00081 class K3dDir; 00082 class K3dScene; 00083 00085 enum EPathType 00086 { 00087 K_PATH_APP=0, // Application path 00088 K_PATH_MAP, // Maps path 00089 K_PATH_SCRIPT, // Script path 00090 K_NUM_PATHS // Number of pahts 00091 }; 00092 00093 class K3dSceneData 00094 { 00095 TStrArray m_tPath; 00096 K3dString m_strMapFileName; 00097 K3dString m_strOut; 00098 K3dTimer *m_pTimer; 00099 K3dKeyMap *m_pKeyMap; 00100 int m_iNumDrawTriangles; 00101 K3dMouse *m_pMouse; 00102 K3dLua *m_pLua; 00103 K3dVM *m_pVM; 00104 K3dMatrix *m_pViewMatrix; 00105 K3dScene *m_pScene; 00106 K3dPlaneBuild *m_pPlaneBuild; 00107 K3dPlaneWork *m_pPlaneWork; 00108 K3dPolyPlaneBuild *m_pPolyPlaneBuild; 00109 K2dImageBuild *m_pImageBuild; 00110 K3dTextureBuild *m_pTextureBuild; 00111 K3dOpenGL *m_pOpenGL; 00112 K3dVector3Build *m_pVector3Build; 00113 K3dVector3Work *m_pVector3Work; 00114 K3dVector2Build *m_pVector2Build; 00115 K3dColor3Build *m_pColor3Build; 00116 K3dColor4Build *m_pColor4Build; 00117 K3dMatrixBuild *m_pMatrixBuild; 00118 K3dSphereBuild *m_pSphereBuild; 00119 K3dStream *m_pStream; 00120 K3dRayBuild *m_pRayBuild; 00121 K3dIntersection *m_pIntersection; 00122 K3dVertexBuild *m_pVertexBuild; 00123 K3dVertexWork *m_pVertexWork; 00124 K2dImageWork *m_pImageWork; 00125 K3dBoxWork *m_pBoxWork; 00126 K3dLineBuild *m_pLineBuild; 00127 K3dLineWork *m_pLineWork; 00128 K3dBoxBuild *m_pBoxBuild; 00129 K3dTriangleBuild *m_pTriangleBuild; 00130 K3dTriangleWork *m_pTriangleWork; 00131 K3dVorLeafBuild *m_pVorLeafBuild; 00132 K3dPolyBuild *m_pPolyBuild; 00133 K3dPolyWork *m_pPolyWork; 00134 K3dMatrixWork *m_pMatrixWork; 00135 K3dDir *m_pDir; 00136 public: 00137 K3dSceneData(); 00138 ~K3dSceneData(); 00139 00140 void InitPath(); 00141 00143 K3dString &GetMapFileName() 00144 { 00145 return m_strMapFileName; 00146 } 00147 00151 void SetPath ( K3dString& _strPath, EPathType _ePathType ) 00152 { 00153 if ( ! ( ( 0 <= _ePathType ) && ( _ePathType < ( int ) m_tPath.size() ) ) ) 00154 { 00155 cerr << "void K3dSceneData::SetPath() -- Error - Invalid path array index" << endl; 00156 return; 00157 } 00158 m_tPath[_ePathType] = _strPath; 00159 } 00163 K3dString& GetPath ( const EPathType _ePathType ) 00164 { 00165 if ( ! ( ( 0 <= _ePathType ) && ( _ePathType < ( int ) m_tPath.size() ) ) ) 00166 { 00167 m_strOut = K_STR_ERROR; 00168 cerr << "K3dString& K3dSceneData::GetPath() -- Error - Invalid path array index " + m_strOut.GetString() << endl; 00169 return m_strOut; 00170 } 00171 return m_tPath[_ePathType]; 00172 } 00174 int GetNumPaths() 00175 { 00176 return ( int ) m_tPath.size(); 00177 } 00179 void DeletePathArray() 00180 { 00181 cout << "void K3dSceneData::DeletePathArray()" << endl; 00182 m_tPath.clear(); 00183 } 00184 00186 K3dTimer *GetTimer() 00187 { 00188 return m_pTimer; 00189 } 00190 00192 void SetTimer ( K3dTimer *_pTimer ) 00193 { 00194 m_pTimer = _pTimer; 00195 } 00196 00198 K3dKeyMap *GetKeyMap() 00199 { 00200 return m_pKeyMap; 00201 } 00202 00204 void SetKeyMap ( K3dKeyMap *_pKeyMap ) 00205 { 00206 m_pKeyMap = _pKeyMap; 00207 } 00208 00210 K3dMouse *GetMouse() 00211 { 00212 return m_pMouse; 00213 } 00214 00216 void SetMouse ( K3dMouse *_pMouse ) 00217 { 00218 m_pMouse = _pMouse; 00219 } 00220 00222 int& NumDrawTriangles() 00223 { 00224 return m_iNumDrawTriangles; 00225 } 00226 00228 K3dLua *GetLua() 00229 { 00230 return m_pLua; 00231 } 00232 00234 void SetLua ( K3dLua *_pLua ) 00235 { 00236 m_pLua = _pLua; 00237 } 00238 00240 K3dVM *GetVM() 00241 { 00242 return m_pVM; 00243 } 00244 00246 void SetVM ( K3dVM *_pVM ) 00247 { 00248 m_pVM = _pVM; 00249 } 00250 00252 K3dMatrix *GetViewMatrix() 00253 { 00254 return m_pViewMatrix; 00255 } 00256 00258 void SetViewMatrix ( K3dMatrix *_pViewMatrix ) 00259 { 00260 m_pViewMatrix = _pViewMatrix; 00261 } 00262 00264 K3dScene *GetScene() 00265 { 00266 return m_pScene; 00267 } 00268 00270 void SetScene ( K3dScene *_pScene ) 00271 { 00272 m_pScene = _pScene; 00273 } 00274 00276 K3dPlaneBuild *GetPlaneBuild() 00277 { 00278 return m_pPlaneBuild; 00279 } 00280 00282 void SetPlaneBuild ( K3dPlaneBuild *_pPlaneBuild ) 00283 { 00284 m_pPlaneBuild = _pPlaneBuild; 00285 } 00286 00288 K3dPlaneWork *GetPlaneWork() 00289 { 00290 return m_pPlaneWork; 00291 } 00292 00294 void SetPlaneWork ( K3dPlaneWork *_pPlaneWork ) 00295 { 00296 m_pPlaneWork = _pPlaneWork; 00297 } 00298 00300 K3dPolyPlaneBuild *GetPolyPlaneBuild() 00301 { 00302 return m_pPolyPlaneBuild; 00303 } 00304 00306 void SetPolyPlaneBuild ( K3dPolyPlaneBuild *_pPolyPlaneBuild ) 00307 { 00308 m_pPolyPlaneBuild = _pPolyPlaneBuild; 00309 } 00310 00312 K2dImageBuild *GetImageBuild() 00313 { 00314 return m_pImageBuild; 00315 } 00316 00318 void SetImageBuild ( K2dImageBuild *_pImageBuild ) 00319 { 00320 m_pImageBuild = _pImageBuild; 00321 } 00322 00324 K3dTextureBuild *GetTextureBuild() 00325 { 00326 return m_pTextureBuild; 00327 } 00328 00330 void SetTextureBuild ( K3dTextureBuild *_pTextureBuild ) 00331 { 00332 m_pTextureBuild = _pTextureBuild; 00333 } 00334 00336 K3dOpenGL *GetOpenGL() 00337 { 00338 return m_pOpenGL; 00339 } 00340 00342 void SetOpenGL ( K3dOpenGL *_pOpenGL ) 00343 { 00344 m_pOpenGL = _pOpenGL; 00345 } 00346 00348 K3dVector3Build *GetVector3Build() 00349 { 00350 return m_pVector3Build; 00351 } 00352 00354 void SetVector3Build ( K3dVector3Build *_pVector3Build ) 00355 { 00356 m_pVector3Build = _pVector3Build; 00357 } 00358 00360 K3dVector3Work *GetVector3Work() 00361 { 00362 return m_pVector3Work; 00363 } 00364 00366 void SetVector3Work ( K3dVector3Work *_pVector3Work ) 00367 { 00368 m_pVector3Work = _pVector3Work; 00369 } 00370 00372 K3dVector2Build *GetVector2Build() 00373 { 00374 return m_pVector2Build; 00375 } 00376 00378 void SetVector2Build ( K3dVector2Build *_pVector2Build ) 00379 { 00380 m_pVector2Build = _pVector2Build; 00381 } 00382 00384 K3dColor3Build *GetColor3Build() 00385 { 00386 return m_pColor3Build; 00387 } 00388 00390 void SetColor4Build ( K3dColor4Build *_pColor4Build ) 00391 { 00392 m_pColor4Build = _pColor4Build; 00393 } 00394 00396 K3dColor4Build *GetColor4Build() 00397 { 00398 return m_pColor4Build; 00399 } 00400 00402 void SetColor3Build ( K3dColor3Build *_pColor3Build ) 00403 { 00404 m_pColor3Build = _pColor3Build; 00405 } 00406 00408 K3dMatrixBuild *GetMatrixBuild() 00409 { 00410 return m_pMatrixBuild; 00411 } 00412 00414 void SetMatrixBuild ( K3dMatrixBuild *_pMatrixBuild ) 00415 { 00416 m_pMatrixBuild = _pMatrixBuild; 00417 } 00418 00420 K3dSphereBuild *GetSphereBuild() 00421 { 00422 return m_pSphereBuild; 00423 } 00424 00426 void SetSphereBuild ( K3dSphereBuild *_pSphereBuild ) 00427 { 00428 m_pSphereBuild = _pSphereBuild; 00429 } 00430 00432 K3dStream *GetStream() 00433 { 00434 return m_pStream; 00435 } 00436 00438 void SetStream ( K3dStream *_pStream ) 00439 { 00440 m_pStream = _pStream; 00441 } 00442 00444 K3dRayBuild *GetRayBuild() 00445 { 00446 return m_pRayBuild; 00447 } 00448 00450 void SetRayBuild ( K3dRayBuild *_pRayBuild ) 00451 { 00452 m_pRayBuild = _pRayBuild; 00453 } 00454 00456 K3dIntersection *GetIntersection() 00457 { 00458 return m_pIntersection; 00459 } 00460 00462 void SetIntersection ( K3dIntersection *_pIntersection ) 00463 { 00464 m_pIntersection = _pIntersection; 00465 } 00466 00468 K3dVertexBuild *GetVertexBuild() 00469 { 00470 return m_pVertexBuild; 00471 } 00472 00474 void SetVertexBuild ( K3dVertexBuild *_pVertexBuild ) 00475 { 00476 m_pVertexBuild = _pVertexBuild; 00477 } 00478 00480 K3dVertexWork *GetVertexWork() 00481 { 00482 return m_pVertexWork; 00483 } 00484 00486 void SetVertexWork ( K3dVertexWork *_pVertexWork ) 00487 { 00488 m_pVertexWork = _pVertexWork; 00489 } 00490 00492 K3dLineWork *GetLineWork() 00493 { 00494 return m_pLineWork; 00495 } 00496 00498 void SetLineWork ( K3dLineWork *_pLineWork ) 00499 { 00500 m_pLineWork = _pLineWork; 00501 } 00502 00504 K2dImageWork *GetImageWork() 00505 { 00506 return m_pImageWork; 00507 } 00508 00510 void SetImageWork ( K2dImageWork *_pImageWork ) 00511 { 00512 m_pImageWork = _pImageWork; 00513 } 00514 00516 K3dBoxWork *GetBoxWork() 00517 { 00518 return m_pBoxWork; 00519 } 00520 00522 void SetBoxWork ( K3dBoxWork *_pBoxWork ) 00523 { 00524 m_pBoxWork = _pBoxWork; 00525 } 00526 00528 K3dLineBuild *GetLineBuild() 00529 { 00530 return m_pLineBuild; 00531 } 00532 00534 void SetLineBuild ( K3dLineBuild *_pLineBuild ) 00535 { 00536 m_pLineBuild = _pLineBuild; 00537 } 00538 00540 K3dBoxBuild *GetBoxBuild() 00541 { 00542 return m_pBoxBuild; 00543 } 00544 00546 void SetBoxBuild ( K3dBoxBuild *_pBoxBuild ) 00547 { 00548 m_pBoxBuild = _pBoxBuild; 00549 } 00550 00552 K3dTriangleBuild *GetTriangleBuild() 00553 { 00554 return m_pTriangleBuild; 00555 } 00556 00558 void SetTriangleBuild ( K3dTriangleBuild *_pTriangleBuild ) 00559 { 00560 m_pTriangleBuild = _pTriangleBuild; 00561 } 00562 00564 K3dTriangleWork *GetTriangleWork() 00565 { 00566 return m_pTriangleWork; 00567 } 00568 00570 void SetTriangleWork ( K3dTriangleWork *_pTriangleWork ) 00571 { 00572 m_pTriangleWork = _pTriangleWork; 00573 } 00574 00576 K3dVorLeafBuild *GetVorLeafBuild() 00577 { 00578 return m_pVorLeafBuild; 00579 } 00580 00582 void SetVorLeafBuild ( K3dVorLeafBuild *_pVorLeafBuild ) 00583 { 00584 m_pVorLeafBuild = _pVorLeafBuild; 00585 } 00586 00588 K3dPolyBuild *GetPolyBuild() 00589 { 00590 return m_pPolyBuild; 00591 } 00592 00594 void SetPolyBuild ( K3dPolyBuild *_pPolyBuild ) 00595 { 00596 m_pPolyBuild = _pPolyBuild; 00597 } 00598 00600 K3dPolyWork *GetPolyWork() 00601 { 00602 return m_pPolyWork; 00603 } 00604 00606 void SetPolyWork ( K3dPolyWork *_pPolyWork ) 00607 { 00608 m_pPolyWork = _pPolyWork; 00609 } 00610 00612 K3dMatrixWork *GetMatrixWork() 00613 { 00614 return m_pMatrixWork; 00615 } 00616 00618 void SetMatrixWork ( K3dMatrixWork *_pMatrixWork ) 00619 { 00620 m_pMatrixWork = _pMatrixWork; 00621 } 00622 00624 K3dDir *GetDir() 00625 { 00626 return m_pDir; 00627 } 00628 00630 void SetDir( K3dDir *_pDir ) 00631 { 00632 m_pDir = _pDir; 00633 } 00634 }; 00635 00636