Esempio 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;
     }
 }
Esempio n. 2
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;
     }
 }