Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 6
0
        /// <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);
        }
Exemplo n.º 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の場合の処理
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 10
0
 private void UpdateConstantByMaterial(ISubset ipmxSubset)
 {
     MMEEffect.ApplyAllMaterialVariables(ipmxSubset.MaterialInfo);
 }
Exemplo n.º 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);
 }
Exemplo n.º 12
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     context.CurrentClearDepth = sourceVariable.AsScalar().GetFloat();
 }
Exemplo n.º 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);
 }
Exemplo n.º 14
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     this.context.CurrentClearColor = new Color4(this.sourceVariable.AsVector().GetVector());
 }
Exemplo n.º 15
0
 /// <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));
 }
Exemplo n.º 16
0
 /// <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));
 }
Exemplo n.º 17
0
 public abstract void Execute(ISubset subset, Action <ISubset> action);
Exemplo n.º 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);
     }
 }
Exemplo n.º 19
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
     this.targetPass.Execute(drawAction, ipmxSubset);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 22
0
 public override void Execute(ISubset ipmxSubset, Action <ISubset> drawAction)
 {
 }
Exemplo n.º 23
0
 /// <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));
 }