Example #1
0
 /// <summary>
 ///     エフェクトパスを割り当てる
 /// </summary>
 /// <param name="ipmxSubset"></param>
 public void ApplyEffectPass(ISubset ipmxSubset, MMEEffectPassType passType, Action <ISubset> drawAction)
 {
     if (ipmxSubset.MaterialInfo.DiffuseColor.W == 0)
     {
         return;
     }
     //両面描画かどうかに応じてカリングの値を切り替える
     if (ipmxSubset.DoCulling)
     {
         Context.DeviceManager.Context.Rasterizer.State = Context.CullingRasterizerState;
     }
     else
     {
         Context.DeviceManager.Context.Rasterizer.State = Context.NonCullingRasterizerState;
     }
     //使用するtechniqueを検索する
     MMEEffectTechnique[] techniques = (from teq in Techniques
                                        where
                                        teq.Subset.Contains(ipmxSubset.SubsetId) && teq.MMDPassAnnotation == passType &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseToon, ipmxSubset.MaterialInfo.IsToonUsed) &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseTexture, ipmxSubset.MaterialInfo.MaterialTexture != null) &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseSphereMap,
                                                                                ipmxSubset.MaterialInfo.MaterialSphereMap != null) && MMEEffectTechnique.CheckExtebdedBoolean(teq.MulSphere, ipmxSubset.MaterialInfo.SphereMode == MMDFileParser.PMXModelParser.SphereMode.Multiply)
                                        select teq).ToArray();
     foreach (MMEEffectTechnique technique in techniques)
     {
         technique.ExecuteTechnique(Context.DeviceManager.Context, drawAction, ipmxSubset);
         return;
     }
 }
Example #2
0
 public void Execute(Action <ISubset> drawAction, ISubset ipmxSubset)
 {
     for (CurrentExecuter = 0; CurrentExecuter < ParsedExecuters.Count; ParsedExecuters[CurrentExecuter].Increment(this))
     {
         ParsedExecuters[CurrentExecuter].Execute(ipmxSubset, drawAction);
     }
 }
Example #3
0
        public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
        {
            int count = this.runtime.LoopCounts.Pop();

            this.targetVariable.AsScalar().Set(count);
            this.runtime.LoopCounts.Push(count);
        }
Example #4
0
 /// <summary>
 ///     Assign the effect pass
 /// </summary>
 /// <param name="ipmxSubset"></param>
 public void ApplyEffectPass(ISubset ipmxSubset, MMEEffectPassType passType, Action <ISubset> drawAction)
 {
     if (ipmxSubset.MaterialInfo.DiffuseColor.W == 0)
     {
         return;
     }
     //Switch a culling value depending on whether double-sided drawing
     if (ipmxSubset.DoCulling)
     {
         this.Context.DeviceManager.Context.Rasterizer.State = this.Context.CullingRasterizerState;
     }
     else
     {
         this.Context.DeviceManager.Context.Rasterizer.State = this.Context.NonCullingRasterizerState;
     }
     //To find a technique to use
     MMEEffectTechnique[] techniques = (from teq in this.Techniques
                                        where
                                        teq.Subset.Contains(ipmxSubset.SubsetId) && teq.MMDPassAnnotation == passType &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseToon, ipmxSubset.MaterialInfo.IsToonUsed) &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseTexture, ipmxSubset.MaterialInfo.MaterialTexture != null) &&
                                        MMEEffectTechnique.CheckExtebdedBoolean(teq.UseSphereMap,
                                                                                ipmxSubset.MaterialInfo.MaterialSphereMap != null) && MMEEffectTechnique.CheckExtebdedBoolean(teq.MulSphere, ipmxSubset.MaterialInfo.SphereMode == MMDFileParser.PMXModelParser.SphereMode.Multiply)
                                        select teq).ToArray();
     foreach (MMEEffectTechnique technique in techniques)
     {
         technique.ExecuteTechnique(this.Context.DeviceManager.Context, drawAction, ipmxSubset);
         return;
     }
 }
Example #5
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     if (isClearDepth)
     {
         context.DeviceManager.Context.ClearDepthStencilView(context.CurrentRenderDepthStencilTarget, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, context.CurrentClearDepth, 0);
     }
     else
     {
         context.DeviceManager.Context.ClearRenderTargetView(context.CurrentRenderColorTargets[index], context.CurrentClearColor);
     }
 }
        /// <summary>
        /// Returns the total number of elements that can be
        /// retrieved from the sequence.
        /// </summary>
        public static int Total <T>(this IEnumerable <T> collection)
        {
            ISubset subset = (collection as ISubset);

            if (subset == null)
            {
                return(collection.Count());
            }

            return(subset.Total);
        }
Example #7
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     if (this.isDrawGeometry)
     {
         this.targetPass.Pass.Apply(this.context);
         drawAction(ipmxSubset);
     }
     else
     {
         //TODO Draw=Bufferの場合の処理
     }
 }
Example #8
0
 public void Execute(Action <ISubset> drawAction, ISubset ipmxSubset)
 {
     if (string.IsNullOrWhiteSpace(this.ScriptRuntime.ScriptCode))
     {
         this.Pass.Apply(this.context.DeviceManager.Context);
         drawAction(ipmxSubset);
     }
     else//If you have a script at Script Runtime delegate to
     {
         this.ScriptRuntime.Execute(drawAction, ipmxSubset);
     }
 }
Example #9
0
 public void Execute(Action <ISubset> drawAction, ISubset ipmxSubset)
 {
     if (string.IsNullOrWhiteSpace(ScriptRuntime.ScriptCode))
     {
         Pass.Apply(context.DeviceManager.Context);
         drawAction(ipmxSubset);
     }
     else//スクリプトが存在する場合は処理をスクリプトランタイムに任せる
     {
         ScriptRuntime.Execute(drawAction, ipmxSubset);
     }
 }
Example #10
0
 private void UpdateConstantByMaterial(ISubset ipmxSubset)
 {
     MMEEffect.ApplyAllMaterialVariables(ipmxSubset.MaterialInfo);
 }
Example #11
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     this.context.CurrentRenderDepthStencilTarget = this.isDefaultTarget? this.context.CurrentTargetContext.DepthTargetView: this.stencilView;
     this.context.DeviceManager.Context.OutputMerger.SetTargets(this.context.CurrentRenderDepthStencilTarget, this.context.CurrentRenderColorTargets);
 }
Example #12
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     context.CurrentClearDepth = sourceVariable.AsScalar().GetFloat();
 }
Example #13
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     runtime.LoopBegins.Push(runtime.ParsedExecuters.Count);
     runtime.LoopCounts.Push(0);
     runtime.LoopEndCount.Push(loopCount);
 }
Example #14
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     this.context.CurrentClearColor = new Color4(this.sourceVariable.AsVector().GetVector());
 }
 /// <summary>
 /// Converts the elements of an <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// to the specified type.
 /// </summary>
 /// <typeparam name="TInput">The type to convert the elements of source from.</typeparam>
 /// <typeparam name="TOutput">The type to convert the elements of source to.</typeparam>
 /// <param name="collection">The <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// that contains the elements to be converted.</param>
 /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation
 /// that supplies culture-specific formatting information.</param>
 public static IEnumerable <TOutput> Convert <TInput, TOutput>(
     this ISubset <TInput> collection, IFormatProvider provider)
 {
     return(new Subset <TOutput>(collection.Convert <TOutput>(provider), collection.Total));
 }
 /// <summary>
 /// Converts the elements of an <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// to the specified type.
 /// </summary>
 /// <typeparam name="TInput">The type to convert the elements of source from.</typeparam>
 /// <typeparam name="TOutput">The type to convert the elements of source to.</typeparam>
 /// <param name="collection">The <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// that contains the elements to be converted.</param>
 public static IEnumerable <TOutput> Convert <TInput, TOutput>(
     this ISubset <TInput> collection)
 {
     return(Convert <TInput, TOutput>(collection, CultureInfo.CurrentCulture));
 }
Example #17
0
 public abstract void Execute(ISubset subset, Action <ISubset> action);
Example #18
0
 public void ExecuteTechnique(DeviceContext context, Action <ISubset> drawAction, ISubset ipmxSubset)
 {
     if (string.IsNullOrWhiteSpace(this.ScriptRuntime.ScriptCode))
     {
         foreach (MMEEffectPass pass in this.Passes.Values)
         {
             pass.Pass.Apply(context);
             drawAction(ipmxSubset);
         }
     }
     else//If you have a script at Script Runtime delegate to
     {
         this.ScriptRuntime.Execute(drawAction, ipmxSubset);
     }
 }
Example #19
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     this.targetPass.Execute(drawAction, ipmxSubset);
 }
Example #20
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     context.CurrentRenderColorTargets[index] = isDefaultTarget ? context.CurrentTargetContext.RenderTargetView : targetView;
     context.DeviceManager.Context.OutputMerger.SetTargets(context.CurrentRenderDepthStencilTarget, context.CurrentRenderColorTargets);
 }
Example #21
0
 public void ExecuteTechnique(DeviceContext context, Action <ISubset> drawAction, ISubset ipmxSubset)
 {
     if (string.IsNullOrWhiteSpace(ScriptRuntime.ScriptCode))
     {
         foreach (MMEEffectPass pass in Passes.Values)
         {
             pass.Pass.Apply(context);
             drawAction(ipmxSubset);
         }
     }
     else//スクリプトが存在する場合は処理をスクリプトランタイムに任せる
     {
         ScriptRuntime.Execute(drawAction, ipmxSubset);
     }
 }
Example #22
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
 }
 /// <summary>
 /// Converts the elements of an <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// to the specified type.
 /// </summary>
 /// <typeparam name="TInput">The type to convert the elements of source from.</typeparam>
 /// <typeparam name="TOutput">The type to convert the elements of source to.</typeparam>
 /// <param name="collection">The <see cref="T:Radischevo.Wahha.Data.ISubset"/>
 /// that contains the elements to be converted.</param>
 public static IEnumerable <TOutput> Cast <TInput, TOutput>(
     this ISubset <TInput> collection)
 {
     return(new Subset <TOutput>(collection.Cast <TOutput>(), collection.Total));
 }