Пример #1
0
            public override void OnDraw(ace.RenderTexture2D dst, ace.RenderTexture2D src)
            {
                m_material2d.SetTexture2D("g_texture", src);
                m_material2d.SetVector3DF("g_values", new Vector3DF(640, 480, 200));

                DrawOnTexture2DWithMaterial(dst, m_material2d);
            }
Пример #2
0
        /// <summary>
        /// 描画先として指定可能なテクスチャを生成する。
        /// </summary>
        /// <param name="width">横幅</param>
        /// <param name="height">縦幅</param>
        /// <param name="format">フォーマット</param>
        /// <returns>テクスチャ</returns>
        public RenderTexture2D CreateRenderTexture2D(int width, int height, TextureFormat format)
        {
            var rt = graphics.CreateRenderTexture2D_Imp(width, height, (swig.eTextureFormat)format);
            var p  = rt.GetPtr();

            var existing = GC.Texture2Ds.GetObject(p);

            if (existing != null)
            {
                return((RenderTexture2D)existing);
            }

            var ret = new RenderTexture2D(rt);

            GC.Texture2Ds.AddObject(p, ret);
            return(ret);
        }
Пример #3
0
        /// <summary>
        /// ネイティブのインスタンスからラッパー側のインスタンスを生成する。
        /// </summary>
        /// <param name="o"></param>
        /// <param name="type"></param>
        internal static RenderTexture2D GenerateRenderTexture2D(swig.RenderTexture2D o, GenerationType type)
        {
            var p = o.GetPtr();

            var existing = GC.Texture2Ds.GetObject(p);

            existing = GenerateInternal(existing, o, type);
            if (existing != null)
            {
                return((RenderTexture2D)existing);
            }

            var ret = new RenderTexture2D(o);

            GC.Texture2Ds.AddObject(p, ret);
            return(ret);
        }
Пример #4
0
        internal void EndDrawing()
        {
            commonObject.EndDrawing();

            if (postEffects.Count > 0)
            {
                foreach (var p in postEffects)
                {
                    Scene.CoreScene.BeginPostEffect(p.SwigObject);

                    var src_ = Scene.CoreScene.GetSrcTarget();
                    var dst_ = Scene.CoreScene.GetDstTarget();

                    RenderTexture2D src = GC.GenerateRenderTexture2D(src_, GC.GenerationType.Get);
                    RenderTexture2D dst = GC.GenerateRenderTexture2D(dst_, GC.GenerationType.Get);

                    p.OnDraw(dst, src);

                    Scene.CoreScene.EndPostEffect(p.SwigObject);
                }
            }
        }
Пример #5
0
        protected override void OnUpdateInternal()
        {
            coreObject.SetPostEffectCount(postEffects.Count);

            int count = 0;

            foreach (var p in postEffects)
            {
                coreObject.BeginPostEffect(p.SwigObject);

                var src_ = coreObject.GetSrcForPostEffect(count);
                var dst_ = coreObject.GetDstForPostEffect(count);

                RenderTexture2D src = GC.GenerateRenderTexture2D(src_, GC.GenerationType.Get);
                RenderTexture2D dst = GC.GenerateRenderTexture2D(dst_, GC.GenerationType.Get);

                p.OnDraw(dst, src);

                coreObject.EndPostEffect(p.SwigObject);

                count++;
            }
        }
Пример #6
0
 /// <summary>
 /// マテリアルを用いてテクスチャに画像を描画する。
 /// </summary>
 /// <param name="target">描画先</param>
 /// <param name="material">マテリアル</param>
 public void DrawOnTexture2DWithMaterial(RenderTexture2D target, Material2D material)
 {
     SwigObject.DrawOnTexture2DWithMaterial((swig.RenderTexture2D)(target.SwigObject), material.SwigObject);
 }
Пример #7
0
 /**
  * @brief
  */
 /// <summary>
 /// オーバーライドして、毎フレーム描画される処理を記述できる。
 /// </summary>
 public virtual void OnDraw(RenderTexture2D dst, RenderTexture2D src)
 {
 }