/// <summary> /// マテリアル(2D)を生成する。 /// </summary> /// <param name="shader">シェーダー</param> /// <returns>マテリアル(2D)</returns> public Material2D CreateMaterial2D(Shader2D shader) { var material = CoreInstance.CreateMaterial2D_(shader.CoreInstance); var p = material.GetPtr(); var existing = GC.Material2Ds.GetObject(p); if (existing != null) { return(existing); } var ret = new Material2D(material); GC.Material2Ds.AddObject(p, ret); return(ret); }
/// <summary> /// シェーダー(2D)を生成する。 /// </summary> /// <param name="shaderText">シェーダーのコード</param> /// <returns></returns> public Shader2D CreateShader2D(string shaderText) { var shader = CoreInstance.CreateShader2D_(shaderText); if (shader == null) { return(null); } var p = shader.GetPtr(); var existing = GC.Shader2Ds.GetObject(p); if (existing != null) { return(existing); } var ret = new Shader2D(shader); GC.Shader2Ds.AddObject(p, ret); return(ret); }
public void SetShader2D(string name, Shader2D value) { CoreInstance.SetShader2D(value.CoreInstance); }
/// <summary> /// シェーダー(2D)を生成する。 /// </summary> /// <param name="shaderText">シェーダーのコード</param> /// <returns></returns> public Shader2D CreateShader2D(string shaderText) { var shader = graphics.CreateShader2D_(shaderText); if (shader == null) return null; var p = shader.GetPtr(); var existing = GC.Shader2Ds.GetObject(p); if (existing != null) { return existing; } var ret = new Shader2D(shader); GC.Shader2Ds.AddObject(p, ret); return ret; }
/// <summary> /// マテリアル(2D)を生成する。 /// </summary> /// <param name="shader">シェーダー</param> /// <returns>マテリアル(2D)</returns> public Material2D CreateMaterial2D(Shader2D shader) { var material = graphics.CreateMaterial2D_(shader.CoreInstance); var p = material.GetPtr(); var existing = GC.Material2Ds.GetObject(p); if (existing != null) { return existing; } var ret = new Material2D(material); GC.Material2Ds.AddObject(p, ret); return ret; }
public PostEffect(asd.Graphics g) { if (g.GraphicsDeviceType == GraphicsDeviceType.DirectX11) { m_shader = g.CreateShader2D( shader2d_dx_ps ); } else if (g.GraphicsDeviceType == GraphicsDeviceType.OpenGL) { m_shader = g.CreateShader2D( shader2d_gl_ps ); } else { throw new Exception(); } m_material2d = g.CreateMaterial2D(m_shader); }