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

GRRender.h

00001 #ifndef GRRENDER_H
00002 #define GRRENDER_H
00003 #include <SceneGraph/SGEngine.h>
00004 #include <WinBasis/WBCriticalSection.h>
00005 
00006 namespace Spr{;
00007 
00008 class GRCamera;
00009 class SGFrame;
00010 struct GRMaterialData;
00011 struct GRLightData;
00012 
00013 class SPR_DLL GRFont{
00014 public:
00015     int height;
00016     int width;
00017     int weight;
00018     FIString face;
00019     DWORD color;
00020     bool bItalic;
00021     GRFont(int h=20, const char* f=NULL);
00022     void SetColor(DWORD c){ color = c; }
00023     bool operator < (GRFont& f);
00024 };
00025 
00026 /** グラフィックスレンダラーの基本クラス.*/
00027 class SPR_DLL GRRender:public SGEngine{
00028 public:
00029     SGOBJECTDEFABST(GRRender);
00030     WBCriticalSection cr;           ///<    レンダリングAPIのロック用
00031     bool bDrawDebug;                ///<    デバッグ情報を描画するか?
00032     UTRef<GRCamera> camera;         ///<    使用するカメラ
00033     SGScene* scene;                 ///<    描画対象のScene
00034     UTStack<SGFrame*> frames;       ///<    描画用のフレームのスタック
00035     
00036     enum TDrawState{
00037         DRAW_OPAQUE=1,
00038         DRAW_TRANSPARENT=2,
00039         DRAW_BOTH=3,
00040     } drawState;
00041     GRRender();
00042     virtual ~GRRender();
00043     /// 生成
00044     virtual bool Create(void* arg){return false;}
00045     /// シーングラフのあるフレーム以下を見て,このレンダラで描画できる形式に変換する.
00046     virtual void InitTree(SGFrame* fr, SGScene* scene);
00047     /// Viewportの設定
00048     virtual bool SetViewport(void* arg){return false;}
00049     /// レンダラーをクリア
00050     virtual void Clear(SGScene* s);
00051     /// フルスクリーンモードか?
00052     virtual bool IsFullscreen(){return false;}
00053     /// フルスクリーンモードにする
00054     virtual void Fullscreen(){}
00055     /// ウィンドウモードにする
00056     virtual void Window(){}
00057     /// @name レンダリングの都度呼ぶ関数
00058     //@{
00059     /// バッファのクリア
00060     virtual void ClearBuffer(){}
00061     virtual void ClearColor(float r, float g, float b, float alpha){}
00062 
00063     /// レンダリングの開始前に呼ぶ関数
00064     virtual void BeginScene(){}
00065     /// シーンのレンダリング(視点の設定を含む)
00066     virtual void Render(SGScene* s);
00067     /// フレームのレンダリング(再帰部)
00068     virtual void RenderRecurse();
00069     /// レンダリングの終了後に呼ぶ関数
00070     virtual void EndScene(){}
00071     /// バックバッファの表示
00072     virtual void Present(){}
00073     //@}
00074 
00075     /// @name 描画関数
00076     //@{
00077     enum TPrimitiveType {
00078         POINTS,
00079         LINES,
00080         LINESTRIP,
00081         TRIANGLES,
00082         TRIANGLESTRIP,
00083         TRIANGLEFAN
00084     };
00085     virtual void MultModelMatrix(const Affinef& afw){}
00086     virtual void PushModelMatrix(){}
00087     virtual void PopModelMatrix(){}
00088     virtual void SetModelMatrix(const Affinef& afw){}
00089     virtual void SetViewMatrix(const Affinef& afv){}
00090     virtual void SetProjectionMatrix(const Affinef& afp){}
00091     virtual void DrawDirect(TPrimitiveType ty, Vec3f* begin, Vec3f* end){}
00092     virtual void DrawIndexed(TPrimitiveType ty, size_t* begin, size_t* end, Vec3f* vtx){}
00093     virtual void DrawText(Vec2f pos, FIString str, const GRFont& font){}
00094     virtual Vec2f GetTextExtent(FIString str, const GRFont& font){ return Vec2f(); }
00095     virtual void SetMaterial(const GRMaterialData& m){}
00096     virtual void SetTexture(const char* fn){}
00097     virtual void PushLight(const GRLightData& m){}
00098     virtual void PopLight(){}
00099     virtual void SetLineWidth(float w){}
00100     virtual void SetDepthTest(bool b){}
00101     virtual void SetDepthWrite(bool b){}
00102     enum TDepthFunc{
00103         DF_NEVER, DF_LESS, DF_EQUAL, DF_LEQUAL, DF_GREATER, DF_NOTEQUAL, 
00104         DF_GEQUAL, DF_ALWAYS
00105     };
00106     virtual void SetDepthFunc(TDepthFunc f){}
00107     enum TBlendFunc{
00108         BF_ZERO = 1,
00109         BF_ONE = 2,
00110         BF_SRCCOLOR = 3,
00111         BF_INVSRCCOLOR = 4,
00112         BF_SRCALPHA = 5,
00113         BF_INVSRCALPHA = 6,
00114         BF_DESTALPHA = 7,
00115         BF_INVDESTALPHA = 8,
00116         BF_DESTCOLOR = 9,
00117         BF_INVDESTCOLOR = 10,
00118         BF_SRCALPHASAT = 11,
00119         BF_BOTHSRCALPHA = 12,
00120         BF_BOTHINVSRCALPHA = 13,
00121         BF_BLENDFACTOR = 14,
00122         BF_INVBLENDFACTOR = 15
00123     };
00124     virtual void SetAlphaMode(TBlendFunc src, TBlendFunc dest){}
00125     virtual bool CanDraw(){return true;}
00126     //@}
00127     /// カメラの設定
00128     virtual void Set(SGObject* obj);
00129 
00130     ///Get 3d position under pixel x, y. Found is false if the point is on the background, true ortherwise
00131     virtual Vec3f getPointUnderPixel(int x, int y, bool& found, SGScene* scene){
00132         found=false; Vec3f res; return res;}
00133 
00134 
00135 };
00136 
00137 }
00138 #endif

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