本文整理汇总了C#中Effect.GetVariableBySemantic方法的典型用法代码示例。如果您正苦于以下问题:C# Effect.GetVariableBySemantic方法的具体用法?C# Effect.GetVariableBySemantic怎么用?C# Effect.GetVariableBySemantic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Effect
的用法示例。
在下文中一共展示了Effect.GetVariableBySemantic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubscribeLazerEffectVariable
private void SubscribeLazerEffectVariable(PlaneBoard planeBoard, Effect effect, ShaderResourceView arg3)
{
planeBoard.DefaultEffectSubscribe();
int uvOffset = (int) (lastTime/100f)%8;
effect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime/100f);
effect.GetVariableBySemantic("DIRECTION").AsVector().Set(Vector3.UnitZ);
effect.GetVariableBySemantic("LENGTH").AsScalar().Set(200);//長さ
effect.GetVariableBySemantic("UP").AsVector().Set(Vector3.UnitY);
effect.GetVariableBySemantic("EYE")
.AsVector()
.Set(game.RenderContext.CurrentTargetContext.MatrixManager.ViewMatrixManager.CameraPosition);
effect.GetVariableBySemantic("UVOFFSET").AsScalar().Set(uvOffset);
effect.GetVariableBySemantic("LAZERHEIGHT").AsScalar().Set(40*(1-(float)Math.Exp(-lastTime/500d)));//レーザーの幅
}
示例2: RetrieveVariableBySemantic
private static EffectVariable RetrieveVariableBySemantic(Effect effect, string semantic, bool throwIfNotFound)
{
if (String.IsNullOrEmpty(semantic))
throw new ArgumentNullException("semantic");
Debug.Assert(effect != null);
EffectVariable variable = effect.GetVariableBySemantic(semantic);
if (!variable.IsValid && throwIfNotFound)
throw new ArgumentException(string.Format("Can't retrieve variable with given semantic {0}.", semantic), "semantic");
return variable;
}