Exemplo n.º 1
0
        private void AddUniformCycleData(Material mat)
        {
            var szecsiCycleGen = new SzecsiCyclesGenerator(2, 2);

            var cycle = szecsiCycleGen.GenerateCycle(123);

            var uniformCycle = szecsiCycleGen.GenerateUniformFromCycle(cycle);

            var uniformGroup       = szecsiCycleGen.GenerateUniformGroupFromCycle(cycle, 2);
            var uniformCyclesGroup = uniformGroup.Select(c => (uint)c).ToList();

            var xCycle = uniformCyclesGroup[0];
            var yCycle = uniformCyclesGroup[1];

            mat.SetInt("_UniformCycleX", (int)uniformCyclesGroup[0]);
            mat.SetInt("_UniformCycleY", (int)uniformCyclesGroup[1]);

            var buf = new ComputeBuffer(3, sizeof(int));

            buf.SetData(new List <uint>()
            {
                uniformCycle, xCycle, yCycle
            });
            mat.SetBuffer("_UniformCyclesBuf", buf);

            mat.SetTexture("_SeedPositionTex", GenerateSeedPositionTexture2D(uniformGroup));
        }
Exemplo 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);
 }