本文整理匯總了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();
}