Ejemplo n.º 1
0
        // Height jobs for the next frame
        public static void UpdateHeights()
        {
            if (_processing)
            {
                return;
            }

            _processing = true;

            // Buoyant Object Job
            var waterHeight = new GerstnerWavesJobs.HeightJob()
            {
                WaveData     = _waveData,
                Position     = _positions,
                OffsetLength = new int2(0, _positions.Length),
                Time         = Time.time,
                OutPosition  = _wavePos,
                OutNormal    = _waveNormal
            };

            _waterHeightHandle = waterHeight.Schedule(_positionCount, 32);

            JobHandle.ScheduleBatchedJobs();

            _firstFrame = false;
        }
Ejemplo n.º 2
0
        // Height jobs for the next frame
        public static void UpdateHeights()
        {
            if (!processing)
            {
                processing = true;

                // Buoyant Object Job
                var waterHeight = new GerstnerWavesJobs.HeightJob()
                {
                    waveData     = waveData,
                    position     = positions,
                    offsetLength = new int2(0, positions.Length),
                    time         = Time.time,
                    outPosition  = wavePos,
                    outNormal    = tempNullNormal,
                    normal       = 0
                };
                // dependant on job4
                waterHeightHandle = waterHeight.Schedule(positionCount, 32);

                // Simple Buoyant Object Job
                var waterSimpleHeight = new GerstnerWavesJobs.HeightJob()
                {
                    waveData     = waveData,
                    position     = simplePositions,
                    offsetLength = new int2(0, simplePositions.Length),
                    time         = Time.time,
                    outPosition  = waveSimplePos,
                    outNormal    = waveSimpleNormal,
                    normal       = 1
                };
                // dependant on job4
                waterSimpleHeightHandle = waterSimpleHeight.Schedule(simplePositionCount, 32);

                JobHandle.ScheduleBatchedJobs();

                firstFrame = false;
            }
        }