メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ | 関連ページ

D3Render.h

00001 #ifndef D3RENDER_H
00002 #define D3RENDER_H
00003 
00004 #include <Graphics/GRRender.h>
00005 #include <WinBasis/WBUtility.h>
00006 #include <WinBasis/WBCriticalSection.h>
00007 #include <WinDx/D3D/WXD3D.h>
00008 
00009 
00010 struct TLVertex
00011 {
00012     float    x, y, z, rhw;
00013     D3DCOLOR diffuse;    
00014 };
00015 
00016 const DWORD VertexFVF = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
00017 
00018 namespace Spr {;
00019 /** テクスチャファイルの管理をするクラス.
00020     2重ロードをしない仕組み.*/
00021 class SPR_DLL D3TextureManager{
00022 public:
00023     class D3Render* render;
00024     D3TextureManager(){ render = NULL; }
00025     std::map<UTString, WXINTFV(Direct3DTexture)> textures;
00026     virtual WXINTFV(Direct3DTexture) Get(UTString filename);
00027 };
00028 
00029 /** グラフィックレンダラのDirect3Dによる実装.
00030 */
00031 class SPR_DLL D3Render:public GRRender{
00032 public:
00033     SGOBJECTDEF(D3Render);
00034     /// Direct3DDevice
00035     WXD3DDevice device;
00036     /// テクスチャ管理
00037     D3TextureManager textureManager;
00038     /// 行列スタック
00039     UTStack<Affinef> modelMatrixStack;
00040     /// 光源の数
00041     int nLights;
00042 
00043     /// コンストラクタ  
00044     D3Render();
00045     /// 生成
00046     virtual bool Create(void* arg);
00047     /// ロード後の初期化,GRMeshなどからD3Meshなどを生成する.
00048     void Loaded(SGScene* scene);
00049 
00050     /// バッファクリア
00051     virtual void ClearBuffer();
00052 
00053     virtual void ClearColor(float r, float g, float b, float alpha);
00054 
00055     /// バッファの表示
00056     void Present();
00057     /// バッファの表示
00058     void Present(HWND hw);
00059     /// レンダリングの開始前に呼ぶ関数
00060     virtual void BeginScene();
00061     /// レンダリングの終了後に呼ぶ関数
00062     virtual void EndScene();
00063     /// ターゲットのリサイズ
00064     virtual bool Resize(Vec2f size, HWND wnd=NULL);
00065     /// レンダラの準備
00066     void Setup(Vec2f screen);
00067     /// サーフェースをウィンドウ or フルスクリーンのサイズに合わせる.
00068     bool FitSurface(HWND hDeviceWnd = NULL);
00069     ///
00070     bool SetViewport(void* arg);
00071     ///
00072     bool SetViewport(Vec2f sz, Vec2f pos=Vec2f(), float minZ=0.0f, float maxZ=1.0f);
00073     ///
00074     bool IsFullscreen(){ return device.IsFullscreen(); }
00075     void Fullscreen();
00076     void Window();  
00077     //  DirectXのバージョンによるAPIの違いの吸収
00078     ///
00079     HRESULT SetFVF(DWORD fvf);
00080     //  描画
00081     virtual void MultModelMatrix(const Affinef& afw);
00082     virtual void PushModelMatrix();
00083     virtual void PopModelMatrix();
00084     virtual void SetModelMatrix(const Affinef& afw);
00085     virtual void SetViewMatrix(const Affinef& afv);
00086     virtual void SetProjectionMatrix(const Affinef& afp);
00087     virtual void DrawDirect(TPrimitiveType ty, Vec3f* begin, Vec3f* end);
00088     virtual void DrawIndexed(TPrimitiveType ty, size_t* begin, size_t* end, Vec3f* vtx);
00089     virtual void DrawText(Vec2f pos, FIString str, const GRFont& font);
00090     virtual Vec2f GetTextExtent(FIString str, const GRFont& font);
00091     virtual void SetMaterial(const GRMaterialData& m);
00092     virtual void SetTexture(const char* fn);
00093     virtual void PushLight(const GRLightData& m);
00094     virtual void PopLight();
00095     virtual void SetLineWidth(float w);
00096     virtual void SetDepthTest(bool b);
00097     virtual void SetDepthWrite(bool b);
00098     virtual void SetDepthFunc(TDepthFunc f);
00099     virtual void SetAlphaMode(TBlendFunc src, TBlendFunc dest);
00100     virtual bool CanDraw();
00101     void InitTree(SGFrame* fr, SGScene* scene);
00102     void Render(SGScene* s);
00103 
00104     virtual Vec3f getPointUnderPixel(int x, int y, bool& found, SGScene* scene);
00105 
00106 
00107 protected:
00108 };
00109 
00110 }   //  Spr
00111 #endif

Springheadに対してSun Apr 16 01:57:50 2006に生成されました。  doxygen 1.4.1