Exemplo n.º 1
0
 public override void ApplyModifier(GraphicShaderControl shaderControl)
 {
     shaderControl.SetColor(_color1Field, color1);
     shaderControl.SetColor(_color2Field, color2);
     shaderControl.SetFloat(_rampPowerField, power);
     shaderControl.SetFloat(_rampScaleField, scale);
     shaderControl.SetBool(_radialField, radial);
     shaderControl.SetBool(_invertField, invert);
     shaderControl.SetBool(_alphaRampField, applyAlpha);
     shaderControl.SetVector(_rampDirectionField, rampDirection.normalized);
 }
Exemplo n.º 2
0
    public override void ApplyModifier(GraphicShaderControl shaderControl)
    {
        float   angle   = Mathf.Deg2Rad * lineAngle;
        Vector2 lineDir = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));

        // equation: a*x + b*y + c = 0, where b = -1
        float   a        = (Math.Abs(lineDir.x) < 0.001f) ? 100000f: lineDir.y / lineDir.x;
        float   c        = 0.5f - 0.5f * a;
        float   d        = Mathf.Sqrt(a * a + c * c); // TODO: remove the sqrt?
        Vector3 lineDir2 = new Vector3(a, c, d);

        shaderControl.SetVector(_lineDirectionField, lineDir2);
        shaderControl.SetFloat(_lineSizeField, lineSize);
        shaderControl.SetFloat(_lineThicknessField, lineThickness);
        shaderControl.SetColor(_lineColorField, lineColor);

        shaderControl.SetBool(_applyRepeatField, applyRepeat);
        shaderControl.SetFloat(_repeatFrequencyField, repeatDistance + 1);
    }