本文整理汇总了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;
}