FineKernelToolKit
2.8.10
|
00001 /**************************************************************************** 00002 * 00003 * Copyright (c) 1999-2011, Fine Kernel Project, All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, 00006 * with or without modification, are permitted provided that the 00007 * following conditions are met: 00008 * 00009 * - Redistributions of source code must retain the above 00010 * copyright notice, this list of conditions and the 00011 * following disclaimer. 00012 * 00013 * - Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the 00015 * following disclaimer in the documentation and/or 00016 * other materials provided with the distribution. 00017 * 00018 * - Neither the name of the copyright holders nor the names 00019 * of its contributors may be used to endorse or promote 00020 * products derived from this software without specific 00021 * prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00031 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00032 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00033 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************/ 00037 /**************************************************************************** 00038 * 00039 * Copyright (c) 1999-2011, Fine Kernel Project, All rights reserved. 00040 * 00041 * 本ソフトウェアおよびソースコードのライセンスは、基本的に 00042 * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。 00043 * 00044 * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、 00045 * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。 00046 * 00047 * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、 00048 * および下記免責条項を含めること。 00049 * 00050 * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の 00051 * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を 00052 * 含めること。 00053 * 00054 * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の 00055 * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または 00056 * コントリビューターの名前を使用してはならない。 00057 * 00058 * 本ソフトウェアは、著作権者およびコントリビューターによって「現 00059 * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、 00060 * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ 00061 * に限定されない、いかなる保証もないものとします。著作権者もコン 00062 * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを 00063 * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その 00064 * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可 00065 * 能性を知らされていたとしても、本ソフトウェアの使用によって発生 00066 * した(代替品または代用サービスの調達、使用の喪失、データの喪失、 00067 * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、 00068 * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に 00069 * ついて、一切責任を負わないものとします。 00070 * 00071 ****************************************************************************/ 00072 #ifndef __FK_PROJECTION_HEADER__ 00073 #define __FK_PROJECTION_HEADER__ 00074 00075 #include <FK/Base.h> 00076 00078 enum fk_ProjectMode { 00079 FK_NONE_PROJ_MODE, 00080 FK_PERSPECTIVE_MODE, 00081 FK_FRUSTUM_MODE, 00082 FK_ORTHO_MODE 00083 }; 00084 00085 00087 00094 class fk_ProjectBase : public fk_BaseObject { 00095 private: 00096 fk_ProjectMode Mode; 00097 00098 protected: 00099 00100 #ifndef FK_DOXYGEN_USER_PROCESS 00101 00102 void SetMode(fk_ProjectMode); 00103 00104 #endif 00105 00106 public: 00107 00109 fk_ProjectBase(fk_ProjectMode = FK_NONE_PROJ_MODE); 00110 00112 virtual ~fk_ProjectBase(); 00113 00115 00120 fk_ProjectMode getMode(void) const; 00121 }; 00122 00124 00160 class fk_Perspective : public fk_ProjectBase { 00161 private: 00162 double Fovy; 00163 double Near, Far; 00164 00165 public: 00166 00168 00175 fk_Perspective(double fovy = 2.0*FK_PI/9.0, 00176 double near = 1.0, 00177 double far = 6000.0); 00178 00180 virtual ~fk_Perspective(); 00181 00183 fk_Perspective(const fk_Perspective &); 00184 00186 fk_Perspective & operator =(const fk_Perspective &); 00187 00189 00194 void setFovy(double fovy); 00195 00197 00202 void setNear(double near); 00203 00205 00210 void setFar(double far); 00211 00213 00220 void setAll(double fovy, double near, double far); 00221 00223 00228 double getFovy(void) const; 00229 00230 00232 00237 double getNear(void) const; 00238 00240 00245 double getFar(void) const; 00246 }; 00247 00249 00282 class fk_Frustum : public fk_ProjectBase { 00283 private: 00284 double Left, Right, Bottom, Top, Near, Far; 00285 00286 public: 00288 00298 fk_Frustum(double left = -10.0, 00299 double right = 10.0, 00300 double bottom = -10.0, 00301 double top = 10.0, 00302 double near = 1.0, 00303 double far = 6000.0); 00304 00306 virtual ~fk_Frustum(); 00307 00309 fk_Frustum(const fk_Frustum &); 00310 00312 fk_Frustum & operator =(const fk_Frustum &); 00313 00315 00320 void setLeft(double left); 00321 00323 00328 void setRight(double right); 00329 00331 00336 void setBottom(double bottom); 00337 00339 00344 void setTop(double top); 00345 00347 00352 void setNear(double near); 00353 00355 00360 void setFar(double far); 00361 00363 00373 void setAll(double left, 00374 double right, 00375 double bottom, 00376 double top, 00377 double near, 00378 double far); 00379 00381 00386 double getLeft(void) const; 00387 00389 00394 double getRight(void) const; 00395 00397 00402 double getBottom(void) const; 00403 00405 00410 double getTop(void) const; 00411 00413 00418 double getNear(void) const; 00419 00421 00426 double getFar(void) const; 00427 }; 00428 00430 00450 class fk_Ortho : public fk_ProjectBase { 00451 private: 00452 double Left, Right; 00453 double Bottom, Top; 00454 double Near, Far; 00455 00456 public: 00457 00459 00470 fk_Ortho(double left = -500.0, double right = 500.0, 00471 double bottom = -500.0, double top = 500.0, 00472 double near = 0.0, double far = 10000.0); 00473 00475 virtual ~fk_Ortho(); 00476 00478 fk_Ortho(const fk_Ortho &); 00479 00481 fk_Ortho & operator =(const fk_Ortho &); 00482 00484 00489 void setLeft(double left); 00490 00492 00497 void setRight(double right); 00498 00500 00505 void setBottom(double bottom); 00506 00508 00513 void setTop(double top); 00514 00516 00521 void setNear(double near); 00522 00524 00529 void setFar(double far); 00530 00532 00543 void setAll(double left, double right, 00544 double bottom, double top, 00545 double near, double far); 00546 00548 00553 double getLeft(void) const; 00554 00556 00561 double getRight(void) const; 00562 00564 00569 double getBottom(void) const; 00570 00572 00577 double getTop(void) const; 00578 00580 00585 double getNear(void) const; 00586 00588 00593 double getFar(void) const; 00594 }; 00595 00596 #endif // !__FK_PROJECTION_HEADER__