本文整理汇总了C#中AnimatTools.CalculateGain方法的典型用法代码示例。如果您正苦于以下问题:C# AnimatTools.CalculateGain方法的具体用法?C# AnimatTools.CalculateGain怎么用?C# AnimatTools.CalculateGain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatTools
的用法示例。
在下文中一共展示了AnimatTools.CalculateGain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColorReceptiveField
public static void ColorReceptiveField(Mesh d3dMesh, AnimatTools.Framework.Vec3d vFieldPoint, AnimatTools.DataObjects.Gain gnGain)
{
CustomVertex.PositionNormalColored vVertex;
GraphicsStream buffer = d3dMesh.LockVertexBuffer(LockFlags.None);
float fltBaseVal = (float) gnGain.CalculateGain(0);
float fltDist, fltGain=0;
for(int i=0; i<d3dMesh.NumberVertices; i++)
{
buffer.Position = i * d3dMesh.NumberBytesPerVertex;
vVertex = (CustomVertex.PositionNormalColored)buffer.Read(typeof(CustomVertex.PositionNormalColored));
//dwc changes
fltDist = (float) Distance(vFieldPoint, vVertex.X, vVertex.Y, vVertex.Z) * Util.Environment.DistanceUnitValue;
fltGain = (float) gnGain.CalculateGain(fltDist);
fltGain = 255 - (255*(fltGain/fltBaseVal));
if(fltGain < 0) fltGain = 0;
if(fltGain>255) fltGain = 255;
vVertex.Color = Color.FromArgb(255, (int) fltGain, (int) fltGain).ToArgb();
buffer.Position = i * d3dMesh.NumberBytesPerVertex;
buffer.Write(new CustomVertex.PositionNormalColored(vVertex.X, vVertex.Y, vVertex.Z, vVertex.Nx, vVertex.Ny, vVertex.Nz, vVertex.Color));
}
d3dMesh.UnlockVertexBuffer();
}