protected override void NextQuad(ref SgtPointStar quad, int starIndex)
    {
        var position  = Random.insideUnitSphere;
        var magnitude = Offset;

        if (Inverse == true)
        {
            magnitude += (1.0f - position.magnitude) * (1.0f - Offset);
        }
        else
        {
            magnitude += position.magnitude * (1.0f - Offset);
        }

        position.y *= Symmetry;

        quad.Variant     = Random.Range(int.MinValue, int.MaxValue);
        quad.Color       = Color.white;
        quad.Radius      = Mathf.Lerp(StarRadiusMin, StarRadiusMax, Mathf.Pow(Random.value, StarRadiusBias));
        quad.Angle       = Random.Range(-180.0f, 180.0f);
        quad.Position    = position.normalized * magnitude * Radius;
        quad.PulseRange  = Random.value * StarPulseMax;
        quad.PulseSpeed  = Random.value;
        quad.PulseOffset = Random.value;
    }
Esempio n. 2
0
    protected override void NextQuad(ref SgtPointStar quad, int starIndex)
    {
        for (var i = Samples - 1; i >= 0; i--)
        {
            var sampleX = Random.Range(0.0f, 1.0f);
            var sampleY = Random.Range(0.0f, 1.0f);
            var pixel   = sourceTex2D.GetPixelBilinear(sampleX, sampleY);
            var gray    = pixel.grayscale;

            if (gray > Threshold || i == 0)
            {
                var position = -halfSize + Random.insideUnitSphere * Jitter * StarRadiusMax;

                position.x += Size.x * sampleX;
                position.y += Size.y * GetWeight(HeightSource, pixel, 0.5f);
                position.z += Size.z * sampleY;

                quad.Variant     = Random.Range(int.MinValue, int.MaxValue);
                quad.Color       = pixel;
                quad.Radius      = Random.Range(StarRadiusMin, StarRadiusMax) * GetWeight(ScaleSource, pixel, 1.0f);
                quad.Angle       = Random.Range(-180.0f, 180.0f);
                quad.Position    = position;
                quad.PulseRange  = Random.value * StarPulseMax;
                quad.PulseSpeed  = Random.value;
                quad.PulseOffset = Random.value;

                return;
            }
        }
    }
Esempio n. 3
0
    protected override void NextQuad(ref SgtPointStar star, int starIndex)
    {
        var x        = Random.Range(-1.0f, 1.0f);
        var y        = Random.Range(-1.0f, 1.0f);
        var z        = Random.Range(Offset * 1.0f, 1.0f);
        var position = default(Vector3);

        if (Random.value >= 0.5f)
        {
            z = -z;
        }

        switch (Random.Range(0, 3))
        {
        case 0: position = new Vector3(z, x, y); break;

        case 1: position = new Vector3(x, z, y); break;

        case 2: position = new Vector3(x, y, z); break;
        }

        star.Variant     = Random.Range(int.MinValue, int.MaxValue);
        star.Color       = Color.white;
        star.Radius      = Random.Range(StarRadiusMin, StarRadiusMax);
        star.Angle       = Random.Range(-180.0f, 180.0f);
        star.Position    = Vector3.Scale(position, Extents);
        star.PulseRange  = Random.value * StarPulseMax;
        star.PulseSpeed  = Random.value;
        star.PulseOffset = Random.value;
    }
Esempio n. 4
0
 public void CopyFrom(SgtPointStar other)
 {
     Variant     = other.Variant;
     Color       = other.Color;
     Radius      = other.Radius;
     Angle       = other.Angle;
     Position    = other.Position;
     PulseSpeed  = other.PulseSpeed;
     PulseRange  = other.PulseRange;
     PulseOffset = other.PulseOffset;
 }
Esempio n. 5
0
    protected override void NextQuad(ref SgtPointStar star, int starIndex)
    {
        var position  = Random.insideUnitSphere;
        var magnitude = 1 - (Random.insideUnitSphere).magnitude;

        position *= (1 - magnitude) * Thickness.Evaluate(Random.value);

        position += Quaternion.AngleAxis(starIndex * armStep + magnitude * twistStep, Vector3.up) * Vector3.forward * magnitude;

        star.Variant     = Random.Range(int.MinValue, int.MaxValue);
        star.Color       = Color.white;
        star.Radius      = Mathf.Lerp(StarRadiusMin, StarRadiusMax, Mathf.Pow(Random.value, StarRadiusBias));
        star.Angle       = Random.Range(-180.0f, 180.0f);
        star.Position    = position * Radius;
        star.PulseRange  = Random.value * StarPulseMax;
        star.PulseSpeed  = Random.value;
        star.PulseOffset = Random.value;
    }
Esempio n. 6
0
 protected override void NextQuad(ref SgtPointStar quad, int starIndex)
 {
     quad.CopyFrom(Stars[starIndex]);
 }
Esempio n. 7
0
 protected abstract void NextQuad(ref SgtPointStar quad, int starIndex);