![]() |
Springhead
An open source physics engine for virtual reality, haptics and motion generation.
|
OpenGLによるグラフィックス描画の実装
#include <GRDeviceGL.h>

構成 | |
| struct | tri_array |
| sin, cosのキャッシュ [詳細] | |
| struct | VertexAttribute |
Public メソッド | |
| GRDeviceGL () | |
| コンストラクタ | |
| virtual void | Init () |
| virtual void | SetViewport (Vec2f pos, Vec2f sz) |
| virtual Vec2f | GetViewportPos () |
| virtual Vec2f | GetViewportSize () |
| virtual void | ClearBuffer (bool color, bool depth) |
| virtual void | BeginScene () |
| virtual void | EndScene () |
| virtual void | SwapBuffers () |
| バッファを表示するための呼ぶ関数 | |
| virtual void | SetViewMatrix (const Affinef &afv) |
| カレントの視点行列をafvで置き換える | |
| virtual void | GetViewMatrix (Affinef &afv) |
| virtual void | SetProjectionMatrix (const Affinef &afp) |
| カレントの投影行列を取得する | |
| virtual void | GetProjectionMatrix (Affinef &afp) |
| virtual void | PushProjectionMatrix () |
| virtual void | PopProjectionMatrix () |
| virtual void | SetModelMatrix (const Affinef &afw) |
| virtual void | GetModelMatrix (Affinef &afw) |
| virtual void | MultModelMatrix (const Affinef &afw) |
| カレントのモデル行列に対してafwを掛ける | |
| virtual void | PushModelMatrix () |
| virtual void | PopModelMatrix () |
| virtual void | SetBlendMatrix (const Affinef &afb, unsigned int id) |
| virtual void | SetVertexFormat (const GRVertexElement *e) |
| virtual void | DrawDirect (GRRenderBaseIf::TPrimitiveType ty, void *begin, size_t count, size_t stride=0) |
| virtual void | DrawIndexed (GRRenderBaseIf::TPrimitiveType ty, GLuint *idx, void *vtx, size_t count, size_t stride=0) |
| virtual void | DrawPoint (Vec3f p) |
| virtual void | DrawLine (Vec3f p0, Vec3f p1) |
| virtual void | DrawSpline (Vec3f p0, Vec3f v0, Vec3f p1, Vec3f v1, int ndiv) |
| virtual void | DrawArrow (Vec3f p0, Vec3f p1, float rbar, float rhead, float lhead, int slice, bool solid) |
| virtual void | DrawBox (float sx, float sy, float sz, bool solid=true) |
| virtual void | DrawSphere (float radius, int slices, int stacks, bool solid=true) |
| virtual void | DrawEllipsoid (Vec3f radius, int slices, int stacks, bool solid) |
| virtual void | DrawCone (float radius, float height, int slice, bool solid=true) |
| virtual void | DrawCylinder (float radius, float height, int slice, bool solid=true, bool cap=true) |
| virtual void | DrawDisk (float radius, int slice, bool solid=true) |
| virtual void | DrawCapsule (float radius, float height, int slice=20, bool solid=true) |
| virtual void | DrawRoundCone (float rbottom, float rtop, float height, int slice=20, bool solid=true) |
| virtual void | DrawCurve (const Curve3f &curve) |
| virtual void | DrawGrid (float size, int slice, float lineWidth) |
| virtual int | StartList () |
| virtual void | EndList () |
| virtual void | DrawList (int i) |
| virtual void | ReleaseList (int i) |
| virtual void | SetFont (const GRFont &font) |
| virtual void | DrawFont (Vec2f pos, const std::string str) |
| virtual void | DrawFont (Vec3f pos, const std::string str) |
| virtual void | SetMaterial (const GRMaterialDesc &mat) |
| virtual void | SetMaterial (const GRMaterialIf *mat) |
| virtual void | SetPointSize (float sz, bool smooth) |
| virtual void | SetLineWidth (float w, bool smooth) |
| virtual void | PushLight (const GRLightDesc &light) |
| virtual void | PushLight (const GRLightIf *light) |
| virtual void | PopLight () |
| virtual int | NLights () |
| virtual void | SetDepthWrite (bool b) |
| virtual void | SetDepthTest (bool b) |
| virtual void | SetDepthFunc (GRRenderBaseIf::TDepthFunc f) |
| virtual void | SetAlphaTest (bool b) |
| virtual void | SetAlphaMode (GRRenderBaseIf::TBlendFunc src, GRRenderBaseIf::TBlendFunc dest) |
| virtual void | SetLighting (bool b) |
| virtual void | SetTexture2D (bool b) |
| virtual void | SetTexture3D (bool b) |
| virtual void | SetBlending (bool b) |
| virtual unsigned int | LoadTexture (const std::string filename) |
| virtual void | SetTextureImage (const std::string id, int components, int xsize, int ysize, int format, const char *tb) |
| virtual GRShaderIf * | CreateShader (const GRShaderDesc &sd) |
| virtual bool | SetShader (GRShaderIf *sh) |
| virtual void | SetShadowLight (const GRShadowLightDesc &sld) |
| virtual void | EnterShadowMapGeneration () |
| virtual void | LeaveShadowMapGeneration () |
| bool | CheckGLVersion (int major, int minor) |
| OpenGLバージョンチェック | |
| int | GetGLMajorVersion () |
| int | GetGLMinorVersion () |
| void | SetGLVersion (int major, int minor) |
Public メソッド inherited from GRDevice | |
| SPR_OBJECTDEF_ABST (GRDevice) | |
| virtual void | GetClearColor (Vec4f &color) |
| 背景色の取得 | |
| virtual void | SetClearColor (const Vec4f &color) |
Public メソッド inherited from GRRenderBase | |
| SPR_OBJECTDEF_ABST (GRRenderBase) | |
| virtual void | ClearBlendMatrix () |
| virtual void | DrawArrays (GRRenderBaseIf::TPrimitiveType ty, GRVertexArray *arrays, size_t count) |
| virtual void | DrawArrays (GRRenderBaseIf::TPrimitiveType ty, size_t *idx, GRVertexArray *arrays, size_t count) |
| virtual void | SetMaterial (int matname) |
| virtual void | SetMaterial (int matname, float alpha) |
Public メソッド inherited from Object | |
| SPR_OBJECTDEF (Object) | |
| クラス名の取得などの基本機能の実装 | |
| ObjectIf * | GetObjectIf () |
| const ObjectIf * | GetObjectIf () const |
| virtual void | Print (std::ostream &os) const |
| デバッグ用の表示 | |
| virtual void | PrintShort (std::ostream &os) const |
| virtual ObjectIf * | CreateObject (const IfInfo *info, const void *desc) |
| オブジェクトの作成 | |
| virtual size_t | NChildObject () const |
| 子オブジェクトの数 | |
| virtual ObjectIf * | GetChildObject (size_t pos) |
| 子オブジェクトの取得 | |
| virtual const ObjectIf * | GetChildObject (size_t pos) const |
| virtual bool | AddChildObject (ObjectIf *o) |
| 子オブジェクトの追加 | |
| virtual bool | DelChildObject (ObjectIf *o) |
| 子オブジェクトの削除 | |
| virtual void | Clear () |
| すべての子オブジェクトの削除とプロパティのクリア | |
| virtual void | Loaded (UTLoadContext *) |
| ファイルロード後に一度呼ばれる。ノードの設定に使う。 呼び出し順序に依存する処理がしたい場合は、UTLoadHandeler と UTLoadTask を使うと良い。 | |
| virtual void | Setup () |
| ノードの設定をするための関数 | |
| virtual bool | GetDesc (void *desc) const |
| デスクリプタの読み出し(コピー版) | |
| virtual void | SetDesc (const void *desc) |
| デスクリプタの設定 | |
| virtual const void * | GetDescAddress () const |
| デスクリプタの読み出し(参照版) | |
| virtual size_t | GetDescSize () const |
| デスクリプタのサイズ | |
| virtual bool | GetState (void *state) const |
| 状態の読み出し(コピー版) | |
| virtual const void * | GetStateAddress () const |
| 状態の読み出し(参照版) | |
| virtual void | GetStateR (char *&state) |
| 状態の再帰的な読み出し | |
| virtual void | SetState (const void *state) |
| 状態の設定 | |
| virtual void | SetStateR (const char *&state) |
| 状態の再帰的な設定 | |
| virtual bool | WriteStateR (std::ostream &fout) |
| 状態のファイルへの書き出し | |
| virtual bool | WriteState (std::string fileName) |
| virtual bool | ReadStateR (std::istream &fin) |
| 状態の読み込み | |
| virtual bool | ReadState (std::string fileName) |
| virtual size_t | GetStateSize () const |
| 状態のサイズ | |
| virtual void | ConstructState (void *m) const |
| メモリブロックを状態型に初期化 | |
| virtual void | DestructState (void *m) const |
| 状態型をメモリブロックに戻す | |
| virtual void | DumpObjectR (std::ostream &os, int level=0) const |
| メモリデバッグ用。単純にツリーのオブジェクトをファイルにダンプする。 | |
Protected メソッド | |
| float | GetSin (int i, int slice) |
| float | GetCos (int i, int slice) |
| bool | ReadShaderSource (const char *filename, std::string &src) |
| シェーダソース読み込み | |
| void | PrintShaderInfoLog (int id, bool prog_or_shader) |
| シェーダのコンパイル・リンクレポート | |
| void | CalcShadowMatrix () |
| シャドウマッピング用変換を計算 | |
Protected メソッド inherited from Object | |
| virtual void | PrintHeader (std::ostream &os, bool bClose) const |
| 開き括弧 | |
| virtual void | PrintChildren (std::ostream &os) const |
| 子オブジェクトをPrint | |
| virtual void | PrintFooter (std::ostream &os) const |
| 閉じ括弧 | |
| virtual void | BeforeGetDesc () const |
| GetDesc()の前に呼ばれる | |
| virtual void | AfterSetDesc () |
| SetDesc()のあとに呼ばれる | |
Protected 変数 | |
| int | majorVersion |
| GLコンテキストのメジャーバージョン | |
| int | minorVersion |
| GLコンテキストのマイナーバージョン | |
| int | nLights |
| 光源の数 | |
| int | vertexFormatGl |
| glInterleavedArraysで使う,GLの頂点フォーマットID | |
| size_t | vertexSize |
| 頂点のサイズ | |
| bool | vertexColor |
| 頂点が色を持つかどうか | |
| GRMaterialDesc | currentMaterial |
| 現在のマテリアル | |
| bool | bPointSmooth |
| DrawPointにアンチエイリアスかけるか | |
| bool | bLineSmooth |
| DrawLineにアンチエイリアスかけるか | |
| std::map< int, tri_array > | tri_cache |
マトリックス変数 | |
GLではModelを変えずにViewだけを変えるということができない。 | |
| Affinef | viewMatrix |
| カレント視点行列 | |
| Affinef | modelMatrix |
| カレントモデル行列 | |
| std::stack< Affinef > | modelMatrixStack |
| モデル行列スタック | |
| std::vector< Affinef > | blendMatrices |
| ブレンド変換行列 | |
フォント変数 | |
新規に指定されたフォントはfontListに格納される。 | |
| std::map< unsigned int, GRFont > | fontList |
| フォントリスト<DisplayListのindex, font> | |
| unsigned int | fontBase |
| ディスプレイリストのindex numberの基底数 | |
| GRFont | font |
| フォント情報 | |
Protected 変数 inherited from GRDevice | |
| Vec4f | clearColor |
| 背景色 | |
テクスチャマネージャ | |
|
typedef std::map< std::string, unsigned int, UTStringLess > | GRTexnameMap |
| GRTexnameMap | texnameMap |
シェーダ変数 | |
|
typedef std::vector< UTRef < GRShader > > | Shaders |
| シェーダ情報 | |
| Shaders | shaders |
| GRShader * | curShader |
| GRShadowLightDesc | shadowDesc |
| シャドウマッピング | |
| unsigned | shadowTexId |
| unsigned | shadowBufferId |
| Affinef | shadowView |
| Affinef | shadowProj |
| Affinef | shadowMatrix |
| Vec2f | shadowVpPosTmp |
| Vec2f | shadowVpSizeTmp |
| Affinef | shadowViewTmp |
| Affinef | shadowProjTmp |
Additional Inherited Members | |
Static Protected メソッド inherited from Object | |
| static void | ConstructState (ObjectIf *o, char *&s) |
| sをoのStateとして初期化する. | |
| static void | DestructState (ObjectIf *o, char *&s) |
| sをoのStateからメモリブロックに戻す. | |