当前位置: 首页>>代码示例>>C#>>正文


C# PaintJob.GetPosition方法代码示例

本文整理汇总了C#中JBooth.VertexPainterPro.PaintJob.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# PaintJob.GetPosition方法的具体用法?C# PaintJob.GetPosition怎么用?C# PaintJob.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JBooth.VertexPainterPro.PaintJob的用法示例。


在下文中一共展示了PaintJob.GetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LerpFunc

        // this is the delegate we're going to return to apply a brush stamp. Your passed a paint job,
        // which contains important cached information to make painting fast, and hold the actual stream data.
        // the index is the index into the vertex array, the val is the brush data we supplied in GetBrushObject,
        // and r is a 0 to 1 with how far to tween the value towards the brush (brush pressure * deltatime)
        void LerpFunc(PaintJob j, int idx, ref object val, float r)
        {
            // retrieve our brush data and get the stream we're painting into
             BrushData bd = val as BrushData;
             var s = j.stream;
             // use our vertex position to generate noise. We use the get position function because it will
             // return a vert position from the original meshes cached verticies or modified verticies if
             // we've modified them. This makes it compatible with deformations, etc.
             Vector3 pos = j.GetPosition(idx);
             // convert into world space
             pos = j.renderer.localToWorldMatrix.MultiplyPoint(pos);
             // scale by frequency
             pos.x *= bd.frequency;
             pos.y *= bd.frequency;
             pos.z *= bd.frequency;
             float noise = 0.5f * (0.5f * JBooth.VertexPainterPro.SimplexNoise.Noise.Generate(pos.x, pos.y, pos.z) + 0.5f);
             noise += 0.25f * (0.5f * JBooth.VertexPainterPro.SimplexNoise.Noise.Generate(pos.y * 2.031f, pos.z * 2.031f, pos.x * 2.031f) + 0.5f);
             noise += 0.25f * (0.5f * JBooth.VertexPainterPro.SimplexNoise.Noise.Generate(pos.z * 4.01f, pos.x * 4.01f, pos.y * 4.01f) + 0.5f);
             noise *= bd.amplitude;
             // lerp the noise in
             Color c = s.colors[idx];
             c.r = Mathf.Lerp(c.r, noise, r);
             c.g = Mathf.Lerp(c.g, noise, r);
             c.b = Mathf.Lerp(c.b, noise, r);

             s.colors[idx] = c;
        }
开发者ID:slipster216,项目名称:VertexPaint,代码行数:31,代码来源:VertexPainterNoiseBrush.cs


注:本文中的JBooth.VertexPainterPro.PaintJob.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。