Beispiel #1
0
    void ScheduleNextPointUpdateJob()
    {
        // change some of the points before next frame to simulate pointcloud
        var turbulence = Mathf.Clamp01(UnityEngine.Random.value + 0.333f) - .333f;

        m_UpdatePointCloudJob = new UpdatePointCloudJob()
        {
            points        = m_PointCloud,
            sinTimeRandom = Mathf.Sin(Time.time) * turbulence,
            cosTimeRandom = Mathf.Cos(Time.time) * turbulence,
            random        = turbulence,
            frameCount    = Time.frameCount
        };

        m_PointCloudUpdateHandle = m_UpdatePointCloudJob.Schedule(m_PointCloud.Length, 64);
    }
Beispiel #2
0
        JobHandle EndReadRequest(ReadRequest req, NativeArray <byte> textureData)
        {
            EndReadMarker.Begin();

            var updateJob = new UpdatePointCloudJob()
            {
                Input  = new NativeArray <byte>(textureData, Allocator.TempJob),
                Output = Points,

                Index       = req.Index,
                Count       = req.Count,
                MaxRayCount = req.MaxRayCount,
                StartRay    = req.StartRay,

                Origin              = req.Origin,
                Start               = req.Start,
                Transform           = req.Transform,
                CameraToWorldMatrix = req.CameraToWorldMatrix,

                SinLatitudeAngles = SinLatitudeAngles,
                CosLatitudeAngles = CosLatitudeAngles,

                SinStartLongitudeAngle = SinStartLongitudeAngle,
                CosStartLongitudeAngle = CosStartLongitudeAngle,
                SinDeltaLongitudeAngle = SinDeltaLongitudeAngle,
                CosDeltaLongitudeAngle = CosDeltaLongitudeAngle,
                XScale = XScale,
                YScale = YScale,

                LaserCount = CurrentLaserCount,
                MeasurementsPerRotation = CurrentMeasurementsPerRotation,
                TextureWidth            = RenderTextureWidth,
                TextureHeight           = RenderTextureHeight,

                MinDistance = MinDistance,
                MaxDistance = MaxDistance,

                Compensated = Compensated,
            };

            EndReadMarker.End();
            return(updateJob.Schedule());
        }
Beispiel #3
0
        JobHandle EndReadRequest(ReadRequest req, NativeArray <byte> textureData)
        {
            EndReadMarker.Begin();

            var updateJob = new UpdatePointCloudJob()
            {
                Input  = new NativeArray <byte>(textureData, Allocator.TempJob),
                Output = Points,

                Index       = req.Index,
                Count       = req.Count,
                MaxRayCount = req.MaxRayCount,
                StartRay    = req.StartRay,

                Origin = req.Origin,
                Start  = req.Start,
                DeltaX = req.DeltaX,
                DeltaY = req.DeltaY,

                Transform = req.Transform,

                LaserCount = CurrentLaserCount,
                MeasurementsPerRotation = CurrentMeasurementsPerRotation,
                TextureWidth            = RenderTextureWidth,
                TextureHeight           = RenderTextureHeight,

                MinDistance = MinDistance,
                MaxDistance = MaxDistance,

                Compensated = Compensated,
            };

            EndReadMarker.End();

            return(updateJob.Schedule());
        }