/*------------------------------------------------------------------------- * 쉐이더사용용初期化 * Effectは설정済みであること * ---------------------------------------------------------------------------*/ private void initialize_shader() { try { m_decl = new VertexDeclaration(m_d3d_device, sprite_vertex.VertexElements); m_vb = new d3d_writable_vb_with_index( m_d3d_device, typeof(sprite_vertex), DRAW_SPRITE_ONCE * 4, SWAP_BFFER_MAX); m_vbo = new sprite_vertex[DRAW_SPRITE_ONCE * 4]; } catch { // 실패 m_effect = null; m_decl = null; m_vb = null; m_vbo = null; } }
/*------------------------------------------------------------------------- * エフェクトの解放 * ---------------------------------------------------------------------------*/ public void DisposeEffect() { if (m_effect != null) { m_effect.Dispose(); } if (m_decl != null) { m_decl.Dispose(); } if (m_vb != null) { m_vb.Dispose(); } m_effect = null; m_decl = null; m_vb = null; }
/*------------------------------------------------------------------------- * * ---------------------------------------------------------------------------*/ public d3d_sprite(Device device, bool is_use_ve1_1_ps1_1) { m_d3d_device = device; // バッファ m_vertex_list = new CustomVertex.TransformedColoredTextured[DRAW_SPRITE_ONCE * 6]; m_sprite_count = 0; // 쉐이더사용時 m_effect = null; m_decl = null; m_vb = null; m_vbo = null; // 쉐이더が使えるなら使う if (is_use_ve1_1_ps1_1) { Assembly ass = Assembly.GetExecutingAssembly(); initialize_shader(ass.GetManifestResourceStream("directx.fx.sprite.fxo")); } BeginFrame(); }