Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

GraphicsDeviceEnumeration.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * グラフィックスデバイス列挙ヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef GRAPHICS_DEVICE_ENUMERATION_H_
00026 #define GRAPHICS_DEVICE_ENUMERATION_H_
00027 
00028 #include <Core/Container/ArrayList.h>
00029 #include <Graphics/Enumeration/ConfirmGraphicsDevice.h>
00030 #include <Graphics/Enumeration/GraphicsDeviceComboInformation.h>
00031 #include <Graphics/Enumeration/GraphicsDeviceInformation.h>
00032 #include <Graphics/Enumeration/GraphicsAdapterInformation.h>
00033 
00034 namespace Lamp{
00035 
00036 //------------------------------------------------------------------------------
00037 /**
00038  * グラフィックスデバイス列挙
00039  */
00040 class GraphicsDeviceEnumeration : public ConfirmGraphicsDevice{
00041 friend class LampGraphics;
00042 public:
00043     //--------------------------------------------------------------------------
00044     /**
00045      * インスタンス取得
00046      * @return インスタンス
00047      */
00048     static GraphicsDeviceEnumeration* getInstance(){
00049         Assert(instance_ != NULL);
00050         return instance_;
00051     }
00052 
00053     //--------------------------------------------------------------------------
00054     // 列挙用パラメータ
00055     //--------------------------------------------------------------------------
00056     /**
00057      * 許可するフォーマットの追加
00058      * @param allowedFormat 許可するフォーマット
00059      */
00060     virtual void addAllowedFormat(D3DFORMAT allowedFormat){
00061         allowedFormats_.add(allowedFormat);
00062     }
00063 
00064     /**
00065      * 許可するフォーマットの削除
00066      * @param allowedFormat 許可するフォーマット
00067      */
00068     virtual void removeAllowedFormat(D3DFORMAT allowedFormat){
00069         allowedFormats_.removeByValue(allowedFormat);
00070     }
00071 
00072     /**
00073      * 許可するフォーマット数の取得
00074      * @return 許可するフォーマット数
00075      */
00076     virtual int getAllowedFormatCount() const{
00077         return allowedFormats_.getCount();
00078     }
00079 
00080     /**
00081      * 許可するフォーマットの取得
00082      * @return 許可するフォーマット
00083      */
00084     virtual D3DFORMAT getAllowedFormat(int index){
00085         return allowedFormats_.get(index);
00086     }
00087 
00088     //--------------------------------------------------------------------------
00089     /**
00090      * グラフィックスデバイス確認インターフェースの設定
00091      * @param confirm グラフィックスデバイス確認インターフェース
00092      */
00093     virtual void setConfirmGraphicsDevice(ConfirmGraphicsDevice* confirm){
00094         Assert(confirm != NULL);
00095         confirmGraphicsDevice_ = confirm;
00096     }
00097 
00098     /**
00099      * グラフィックスデバイス確認インターフェースの取得
00100      * @return グラフィックスデバイス確認インターフェース
00101      */
00102     virtual ConfirmGraphicsDevice* getConfirmGraphicsDevice() const{
00103         return confirmGraphicsDevice_;
00104     }
00105 
00106     /**
00107      * グラフィックスデバイスの確認
00108      * @param deviceCapability デバイス能力
00109      * @param vertexProcessingType 頂点プロセスタイプ
00110      * @param adapterFormat アダプタのフォーマット
00111      * @param backBufferFormat バックバッファのフォーマット
00112      * @return デバイスの使用を許可するならばtrueを返す。
00113      */
00114     virtual bool confirmGraphicsDevice(
00115         const D3DCapacity& deviceCapability, u_int vertexProcessingType,
00116         D3DFORMAT adapterFormat, D3DFORMAT backBufferFormat){ return true; }
00117 
00118     //--------------------------------------------------------------------------
00119     /**
00120      * 最小フルスクリーン幅の設定
00121      * @param width 最小フルスクリーン幅
00122      */
00123     virtual void setMinimumFullscreenWidth(u_int width){
00124         minimumFullscreenWidth_ = width;
00125     }
00126 
00127     /**
00128      * 最小フルスクリーン幅の取得
00129      * @return 最小フルスクリーン幅
00130      */
00131     virtual u_int getMinimumFullscreenWidth() const{
00132         return minimumFullscreenWidth_;
00133     }
00134 
00135     //--------------------------------------------------------------------------
00136     /**
00137      * 最小フルスクリーン高さの設定
00138      * @param height 最小フルスクリーン高さ
00139      */
00140     virtual void setMinimumFullscreenHeight(u_int height){
00141         minimumFullscreenHeight_ = height;
00142     }
00143 
00144     /**
00145      * 最小フルスクリーン高さの取得
00146      * @return 最小フルスクリーン高さ
00147      */
00148     virtual u_int getMinimumFullscreenHeight() const{
00149         return minimumFullscreenHeight_;
00150     }
00151 
00152     //--------------------------------------------------------------------------
00153     /**
00154      * 最小アダプタカラーチャンネルビットの設定
00155      * @param bits 最小アダプタカラーチャンネルビット
00156      */
00157     virtual void setMinimumAdapterColorChannelBits(u_int bits){
00158         minimumAdapterColorChannelBits_ = bits;
00159     }
00160 
00161     /**
00162      * 最小アダプタカラーチャンネルビットの取得
00163      * @return 最小アダプタカラーチャンネルビット
00164      */
00165     virtual u_int getMinimumAdapterColorChannelBits() const{
00166         return minimumAdapterColorChannelBits_;
00167     }
00168 
00169     //--------------------------------------------------------------------------
00170     /**
00171      * 最小バックバッファアルファチャンネルビットの設定
00172      * @param bits 最小バックバッファアルファチャンネルビット
00173      */
00174     virtual void setMinimumBackBufferAlphaChannelBits(u_int bits){
00175         minimumBackBufferAlphaChannelBits_ = bits;
00176     }
00177 
00178     /**
00179      * 最小バックバッファアルファチャンネルビットの取得
00180      * @return 最小バックバッファアルファチャンネルビット
00181      */
00182     virtual u_int getMinimumBackBufferAlphaChannelBits() const{
00183         return minimumBackBufferAlphaChannelBits_;
00184     }
00185 
00186     //--------------------------------------------------------------------------
00187     /**
00188      * 最小深度ビットの設定
00189      * @param bits 最小深度ビット
00190      */
00191     virtual void setMinimumDepthBits(u_int bits){
00192         minimumDepthBits_ = bits;
00193     }
00194 
00195     /**
00196      * 最小深度ビットの取得
00197      * @return 最小深度ビット
00198      */
00199     virtual u_int getMinimumDepthBits() const{
00200         return minimumDepthBits_;
00201     }
00202 
00203     //--------------------------------------------------------------------------
00204     /**
00205      * 最小ステンシルビットの設定
00206      * @param bits 最小ステンシルビット
00207      */
00208     virtual void setMinimumStencilBits(u_int bits){
00209         minimumStencilBits_ = bits;
00210     }
00211 
00212     /**
00213      * 最小ステンシルビットの取得
00214      * @return 最小ステンシルビット
00215      */
00216     virtual u_int getMinimumStencilBits() const{
00217         return minimumStencilBits_;
00218     }
00219 
00220     //--------------------------------------------------------------------------
00221     /**
00222      * ウィンドウモードが必要かどうかの設定
00223      * @param requires ウィンドウモードが必要ならtrue
00224      */
00225     virtual void setRequiresWindowMode(bool requires){
00226         requiresWindowMode_ = requires;
00227     }
00228 
00229     /**
00230      * ウィンドウモードが必要かどうかの取得
00231      * @return ウィンドウモードが必要ならtrue
00232      */
00233     virtual bool getRequiresWindowMode() const{
00234         return requiresWindowMode_;
00235     }
00236 
00237     //--------------------------------------------------------------------------
00238     /**
00239      * フルスクリーンモードが必要かどうかの設定
00240      * @param requires フルスクリーンモードが必要ならtrue
00241      */
00242     virtual void setRequiresFullscreenMode(bool requires){
00243         requiresFullscreenMode_ = requires;
00244     }
00245 
00246     /**
00247      * フルスクリーンモードが必要かどうかの取得
00248      * @return フルスクリーンモードが必要ならtrue
00249      */
00250     virtual bool getRequiresFullscreenMode() const{
00251         return requiresFullscreenMode_;
00252     }
00253 
00254     //--------------------------------------------------------------------------
00255     /**
00256      * 深度、ステンシルバッファを使用するかの設定
00257      * @param uses 深度、ステンシルバッファを使用するならtrue
00258      */
00259     virtual void setUsesDepthStencilBuffer(bool uses){
00260         usesDepthStencilBuffer_ = uses;
00261     }
00262 
00263     /**
00264      * 深度、ステンシルバッファを使用するかの取得
00265      * @return 深度、ステンシルバッファを使用するならtrue
00266      */
00267     virtual bool getUsesDepthStencilBuffer() const{
00268         return usesDepthStencilBuffer_;
00269     }
00270 
00271     //--------------------------------------------------------------------------
00272     /**
00273      * 混合頂点演算を使用するかの設定
00274      * @param uses 混合頂点演算を使用するならtrue
00275      */
00276     virtual void setUsesMixedVertexProcessing(bool uses){
00277         usesMixedVertexProcessing_ = uses;
00278     }
00279 
00280     /**
00281      * 混合頂点演算を使用するかの取得
00282      * @return 混合頂点演算を使用するならtrue
00283      */
00284     virtual bool getUsesMixedVertexProcessing() const{
00285         return usesMixedVertexProcessing_;
00286     }
00287 
00288     //--------------------------------------------------------------------------
00289     // 列挙の結果取得
00290     //--------------------------------------------------------------------------
00291     /**
00292      * アダプタ数の取得
00293      * @return アダプタ数
00294      */
00295     virtual int getAdapterCount(){ return adapters_.getCount(); }
00296 
00297     /**
00298      * アダプタの取得
00299      * @param index アダプタのインデクス
00300      * @return アダプタ
00301      */
00302     virtual GraphicsAdapterInformation* getAdapter(int index){
00303         return adapters_.get(index);
00304     }
00305 
00306     //--------------------------------------------------------------------------
00307 protected:
00308     /**
00309      * コンストラクタ
00310      */
00311     GraphicsDeviceEnumeration();
00312 
00313     /**
00314      * デストラクタ
00315      */
00316     virtual ~GraphicsDeviceEnumeration();
00317 
00318     //--------------------------------------------------------------------------
00319     /**
00320      * 列挙
00321      * @return 使用できるデバイスが存在すればtrue
00322      */
00323     virtual bool enumerate();
00324 
00325 private:
00326     // コピーコンストラクタの隠蔽
00327     GraphicsDeviceEnumeration(const GraphicsDeviceEnumeration& copy);
00328 
00329     // 代入コピーの隠蔽
00330     void operator =(const GraphicsDeviceEnumeration& copy);
00331 
00332     //--------------------------------------------------------------------------
00333     // 列挙用パラメータ
00334     //--------------------------------------------------------------------------
00335     // 許可するフォーマット
00336     ArrayList<D3DFORMAT> allowedFormats_;
00337     // グラフィックスデバイス確認
00338     ConfirmGraphicsDevice* confirmGraphicsDevice_;
00339     // 最小フルスクリーン幅
00340     u_int minimumFullscreenWidth_;
00341     // 最小フルスクリーン高さ
00342     u_int minimumFullscreenHeight_;
00343     // 最小アダプタカラーチャンネルビット
00344     u_int minimumAdapterColorChannelBits_;
00345     // 最小バックバッファアルファチャンネルビット
00346     u_int minimumBackBufferAlphaChannelBits_;
00347     // 最小深度ビット
00348     u_int minimumDepthBits_;
00349     // 最小ステンシルビット
00350     u_int minimumStencilBits_;
00351     // ウィンドウモードが必要か
00352     bool requiresWindowMode_;
00353     // フルスクリーンモードが必要か
00354     bool requiresFullscreenMode_;
00355     // 深度、ステンシルバッファを使用するか
00356     bool usesDepthStencilBuffer_;
00357     // 混合頂点演算を使用するか
00358     bool usesMixedVertexProcessing_;
00359 
00360     // アダプタ
00361     ArrayList<GraphicsAdapterInformation*> adapters_;
00362     // 列挙済みかどうか
00363     bool enumerated_;
00364 
00365     // インスタンス
00366     static GraphicsDeviceEnumeration* instance_;
00367 
00368 };
00369 
00370 //------------------------------------------------------------------------------
00371 } // End of namespace Lamp
00372 #endif // End of GRAPHICS_DEVICE_ENUMERATION_H_
00373 //------------------------------------------------------------------------------
00374 

Generated on Wed Mar 16 10:29:31 2005 for Lamp by doxygen 1.3.2