示例#1
0
    void Update()
    {
        if (firstFrame)
        {
            firstFrame = false;
        }
        else
        {
            meshJobHandle.Complete();

            meshJob.vertices.CopyTo(editedVertices);
            mesh.vertices = editedVertices;
        }

        barJob = new BarJob {
            vertices   = vertices,
            pins       = pins,
            bars       = bars,
            barLengths = barLengths
        };

        meshJob = new UpdateMeshJob {
            vertices     = vertices,
            oldVertices  = oldVertices,
            pins         = pins,
            gravity      = transform.InverseTransformVector(-Vector3.up * Time.deltaTime * Time.deltaTime),
            localToWorld = transform.localToWorldMatrix,
            worldToLocal = transform.worldToLocalMatrix
        };

        barJobHandle  = barJob.Schedule();
        meshJobHandle = meshJob.Schedule(vertices.Length, 128, barJobHandle);
    }
示例#2
0
 protected override void Update()
 {
     base.Update();
     meshModifyJob = new UpdateMeshJob {
         waterVertices = waterVertices,
         waterNormals  = waterNormals,
         offsetSpeed   = waveOffsetSpeed,
         time          = GameMode.Instance.CurrentTime,
         scale         = waveScale,
         height        = waveHeight
     };
     meshModifyHandle = meshModifyJob.Schedule(waterVertices.Length, 64);
 }
示例#3
0
        private void Update()
        {
            _meshModificationJob = new UpdateMeshJob()
            {
                Vertices    = _waterVertices,
                Normals     = _waterNormals,
                OffsetSpeed = waveOffsetSpeed,
                Time        = Time.time,
                Scale       = waveScale,
                Height      = waveHeight
            };

            _meshModificationJobHandle = _meshModificationJob.Schedule(_waterVertices.Length, 64);
        }
示例#4
0
    private void Update()
    {
        meshModificationJob = new UpdateMeshJob()
        {
            vertices    = waterVertices,
            normals     = waterNormals,
            offsetSpeed = waveOffsetSpeed,
            time        = Time.time,
            scale       = waveScale,
            height      = waveHeight
        };

        meshModificationJobHandle = meshModificationJob.Schedule(waterVertices.Length, 64);
    }
    private void Update()
    {
        //Creating a job and assigning the variables within the Job
        meshModificationJob = new UpdateMeshJob()
        {
            vertices    = waterVertices,
            normals     = waterNormals,
            offsetSpeed = waveOffsetSpeed,
            time        = Time.time,
            scale       = waveScale,
            height      = waveHeight
        };

        //Setup of the job handle
        meshModificationJobHandle = meshModificationJob.Schedule(waterVertices.Length, 64);
    }
    // Creating a job and assigning the variables within the job
    private void Update()
    {
        // Initialize the UpdateMeshJob with all the variables required for the job.
        meshModificationJob = new UpdateMeshJob()
        {
            vertices    = waterVertices,
            normals     = waterNormals,
            offsetSpeed = waveOffsetSpeed,
            time        = Time.time,
            scale       = waveScale,
            height      = waveHeight
        };

        // IJobParallelFor’s Schedule() requires the length of the loop and the batch size.
        // The batch size determines how many segments to divide the work into.
        meshModificationJobHandle = meshModificationJob.Schedule(waterVertices.Length, 64);
    }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        meshModificationJob = new UpdateMeshJob()
        {
            vertices          = waterVertices,
            normals           = waterNormals,
            time              = Time.time,
            octaves           = octaves,
            dimensions        = dimensions,
            anchorVerts       = anchorVertices,
            meshIndexLimits   = meshIndexLimits,
            transformMatrices = transformMatrices,
            ratios            = ratios
        };

        meshModificationJobHandle =
            meshModificationJob.Schedule(waterVertices.Length, 64);
    }