Ejemplo n.º 1
0
        private Texture2D GenerateSeedPositionTexture2D(ulong[] uniformGroup)
        {
            var positionsWithBits = SzecsiCyclesGenerator.GeneratePointsFromUniformGroup(uniformGroup, 2, 16);

            var tex = new Texture2D(4, 4, TextureFormat.ARGB32, false)
            {
                wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Point
            };

            for (int i = 0; i < 16; i++)
            {
                var pos = positionsWithBits.Positions[i];

                var seedBlockCoord = new IntVector2(
                    Mathf.FloorToInt(pos[0] * 4),
                    Mathf.FloorToInt(pos[1] * 4)
                    );

                Vector2 seedOffset = new Vector2(
                    pos[0] * 4 - seedBlockCoord.X,
                    pos[1] * 4 - seedBlockCoord.Y
                    );

                var     bits          = positionsWithBits.LastCycleBits[i];
                Vector2 cycleLastBits = new Vector2(bits[0], bits[1]);

                tex.SetPixel(seedBlockCoord.X, seedBlockCoord.Y, new Color(seedOffset.x, seedOffset.y, cycleLastBits.x, cycleLastBits.y));
            }
            tex.Apply();
            return(tex);
        }
Ejemplo n.º 2
0
 private static PointsWithLastBits GenerateRandomPointsDistribution(int seed, SzecsiCyclesGenerator szecsiCycleGen, int dimension, int cycleLength)
 {
     var cycle = szecsiCycleGen.GenerateCycle(seed);
     var uniformGroup = szecsiCycleGen.GenerateUniformGroupFromCycle(cycle, (uint) dimension);
     return SzecsiCyclesGenerator.GeneratePointsFromUniformGroup(uniformGroup, dimension, cycleLength);
 }