本文整理汇总了C#中RenderOptions.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# RenderOptions.HasFlag方法的具体用法?C# RenderOptions.HasFlag怎么用?C# RenderOptions.HasFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderOptions
的用法示例。
在下文中一共展示了RenderOptions.HasFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeOptions
public void ChangeOptions(ViewportPolicy viewportPolicy, RenderOptions renderOptions)
{
this.Policy = viewportPolicy;
this.Options = renderOptions;
bool wantCanvas = (renderOptions & RenderOptions.Canvas) == RenderOptions.Canvas;
if (this.canvas == null && wantCanvas)
this.canvas = new Canvas(PhantomGame.Game.GraphicsDevice);
else if (this.canvas != null && !wantCanvas)
this.canvas = null;
if (!renderOptions.HasFlag(RenderOptions.ApplyEffect))
this.fx = null;
this.sortMode = Renderer.ToSortMode(renderOptions);
this.blendState = Renderer.ToBlendState(renderOptions);
if (this.sortMode == SpriteSortMode.Immediate)
this.activeRenderPass = this.RenderPassFullLock;
else
this.activeRenderPass = this.RenderPassEndLock;
}
示例2: Add
public static void Add(Effect fx, RenderOptions options)
{
if (Params.ContainsKey(fx))
return;
Dictionary<string, EffectParameter> extractedParams = new Dictionary<string, EffectParameter>();
if (!(options.HasFlag(RenderOptions.NoStandardParams)))
{
for (int i = 0; i < sStandardParamNames.Length; i++)
{
extractedParams.Add(sStandardParamNames[i], fx.Parameters[sStandardParamNames[i]]);
}
foreach (KeyValuePair<string, string[]> kvp in sStandardStructParamNames)
{
// Dirlight is special because it's an array.
if (kvp.Key == DIRLIGHT_STRUCT_NAME)
{
for (int i = 0; i < NUM_LIGHTS_PER_EFFECT; i++)
{
for (int j = 0; j < kvp.Value.Length; j++)
{
// Stick a digit on the end of the param name to keep it unique when we flatten it.
string lightParamName = DIRLIGHT_STRUCT_NAME + kvp.Value[j] + i.ToString();
extractedParams.Add(lightParamName, fx.Parameters[kvp.Key].Elements[i].StructureMembers[kvp.Value[j]]);
}
}
}
else
{
for (int j = 0; j < kvp.Value.Length; j++)
{
extractedParams.Add(kvp.Value[j], fx.Parameters[kvp.Value[j]]);
}
}
}
}
if ((options & RenderOptions.RequiresSkeletalPose) > 0)
{
extractedParams.Add(POSEDBONES_PARAM_NAME, fx.Parameters[POSEDBONES_PARAM_NAME]);
extractedParams.Add(WEIGHTS_PER_VERT_PARAM_NAME, fx.Parameters[WEIGHTS_PER_VERT_PARAM_NAME]);
}
if ((options & RenderOptions.RequiresShadowMap) > 0)
{
fx.Parameters[INVSHADOWMAPSIZE_PARAM_NAME].SetValue(1.0f / (float)(SceneResources.SMAP_SIZE));
extractedParams.Add(SHADOWTRANSFORM_PARAM_NAME, fx.Parameters[SHADOWTRANSFORM_PARAM_NAME]);
extractedParams.Add(SHADOWMAP_PARAM_NAME, fx.Parameters[SHADOWMAP_PARAM_NAME]);
}
if ((options & RenderOptions.RequiresEnviroMap) > 0)
{
extractedParams.Add(ENVIROMAP_PARAM_NAME, fx.Parameters[ENVIROMAP_PARAM_NAME]);
}
if ((options & RenderOptions.RequiresHDRLighting) > 0)
{
extractedParams.Add(IRRADIANCEMAP_PARAM_NAME, fx.Parameters[IRRADIANCEMAP_PARAM_NAME]);
extractedParams.Add(SPECPREFILTER_PARAM_NAME, fx.Parameters[SPECPREFILTER_PARAM_NAME]);
extractedParams.Add(NUMSPECLEVELS_PARAM_NAME, fx.Parameters[NUMSPECLEVELS_PARAM_NAME]);
extractedParams.Add(SPECEXPFACTOR_PARAM_NAME, fx.Parameters[SPECEXPFACTOR_PARAM_NAME]);
extractedParams.Add(AMBIENTLIGHT_PARAM_NAME, fx.Parameters[AMBIENTLIGHT_PARAM_NAME]);
}
if (options.HasFlag(RenderOptions.RequiresFringeMap))
{
extractedParams.Add(FRINGEMAP_PARAM_NAME, fx.Parameters[FRINGEMAP_PARAM_NAME]);
}
if (options.HasFlag(RenderOptions.ParticleParams))
{
extractedParams.Add(VIEWPROJ_PARAM_NAME, fx.Parameters[VIEWPROJ_PARAM_NAME]);
extractedParams.Add(PROJ_XSCALE_PARAM_NAME, fx.Parameters[PROJ_XSCALE_PARAM_NAME]);
extractedParams.Add(VIEWPORT_SCALE_PARAM_NAME, fx.Parameters[VIEWPORT_SCALE_PARAM_NAME]);
extractedParams.Add(SECONDS_TIMER_VALUE_PARAM_NAME, fx.Parameters[SECONDS_TIMER_VALUE_PARAM_NAME]);
}
if (options.HasFlag(RenderOptions.BillboardParams))
{
extractedParams.Add(IRRADIANCEMAP_PARAM_NAME, fx.Parameters[IRRADIANCEMAP_PARAM_NAME]);
extractedParams.Add(ALPHA_TEST_DIRECTION_PARAM_NAME, fx.Parameters[ALPHA_TEST_DIRECTION_PARAM_NAME]);
extractedParams.Add(SECONDS_TIMER_VALUE_PARAM_NAME, fx.Parameters[SECONDS_TIMER_VALUE_PARAM_NAME]);
}
Params.Add(fx, extractedParams);
}