Ejemplo n.º 1
0
 /// <summary>
 /// アンマネージ リソースの解放およびリセットに関連付けられているアプリケーション定義のタスクを実行します。
 /// </summary>
 public virtual void Dispose()
 {
     Effect.Dispose();
     BufferManager.Dispose();
     ToonManager.Dispose();
     SubsetManager.Dispose();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the specified render context.
        /// </summary>
        /// <param name="renderContext">The render context.</param>
        public void Load(RenderContext renderContext)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            RenderContext = renderContext;
            Device device = RenderContext.DeviceManager.Device;

            if (!IsInitialized)
            {
//モデルの読み込みなどはリセットしない
                //シェーダーの読み込み
                ToonManager.Initialize(RenderContext, SubresourceLoader);
                SubsetManager.Initialze(RenderContext, Effect, SubresourceLoader, ToonManager);
                Effect = InitializeEffect();
                SubsetManager.ResetEffect(Effect);

                //定数バッファ
                //PhongConstantBuffer.Initialize(device, Effect.EffectFile,
                //    PhongShadingConstantBufferInputLayout.SizeInBytes, new PhongShadingConstantBufferInputLayout());
                ZPlotPass = Effect.EffectFile.GetTechniqueByIndex(1).GetPassByIndex(0);
                InitializeBuffers(device);
                Skinning      = InitializeSkinning();
                Morphmanager  = new PMXMorphManager(this);
                IsInitialized = true;
            }
            MotionManager = InitializeMotionManager();
            InitializeOther(device);
            sw.Stop();
            Trace.WriteLine(sw.ElapsedMilliseconds + "ms");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Draws the ground shadow.
 /// </summary>
 public void DrawGroundShadow()
 {
     Effect.ApplyAllMatrixVariables();
     Skinning.ApplyEffect(Effect.EffectFile);
     RenderContext.DeviceManager.Device.ImmediateContext.InputAssembler.SetVertexBuffers(0,
                                                                                         new VertexBufferBinding(BufferManager.VertexBuffer, BasicInputLayout.SizeInBytes, 0));
     RenderContext.DeviceManager.Device.ImmediateContext.InputAssembler.SetIndexBuffer(
         BufferManager.IndexBuffer, Format.R32_UInt, 0);
     RenderContext.DeviceManager.Device.ImmediateContext.InputAssembler.InputLayout       = BufferManager.VertexLayout;
     RenderContext.DeviceManager.Device.ImmediateContext.InputAssembler.PrimitiveTopology =
         PrimitiveTopology.TriangleList;
     SubsetManager.DrawGroundShadow();
 }
Ejemplo n.º 4
0
        //public Task LoadAsync(RenderContext renderContext)
        //{
        //    Task task=new Task(() => Load(renderContext));
        //    task.Start();
        //    return task;
        //}


        #endregion

        #region 初期化系

        /// <summary>
        /// Loads the effect.
        /// </summary>
        /// <param name="effectFile">The effect file.</param>
        public void LoadEffect(string effectFile)
        {
            if (Effect != null)
            {
                Effect.Dispose();
            }
            if (string.IsNullOrEmpty(effectFile))
            {
                Effect = MMEEffectManager.Load(@"Shader\DefaultShader.fx", this, RenderContext, SubresourceLoader);
            }
            else
            {
                Effect = MMEEffectManager.Load(effectFile, this, RenderContext, SubresourceLoader);
            }
            SubsetManager.ResetEffect(Effect);
        }