當前位置: 首頁>>代碼示例>>C#>>正文


C# AnimatTools.CalculateGain方法代碼示例

本文整理匯總了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();
        }
開發者ID:NeuroRoboticTech,項目名稱:AnimatLabVersion1,代碼行數:27,代碼來源:Util_DX.cs


注:本文中的AnimatTools.CalculateGain方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。