Example #1
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");
        }
Example #2
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);
        }