コード例 #1
0
        /// <summary>
        /// This is what schedules the actual IJob for the meshing.
        /// Override this to easily implement new meshing algorithms.
        /// </summary>
        /// <param name="dependency"></param>
        /// <returns></returns>
        protected virtual JobHandle ScheduleMeshingJob(JobHandle dependency = default)
        {
            DetermineSplineSettings(out Space splineSpace, out Matrix4x4 localToWorldMatrix, out Matrix4x4 worldToLocalMatrix);

            var job = new BuildMeshFromSpline()
            {
                quality                   = quality,
                width                     = scaleMult.x,
                height                    = scaleMult.y,
                uv_tile_scale             = uv_tile_scale,
                use_splinepoint_rotations = use_splinepoint_rotations,
                use_splinepoint_scale     = use_splinepoint_scale,
                vertexOffset              = vertexOffset,
                rotationEulorOffset       = rotationEulorOffset,
                normalsMode               = MeshNormalsMode,
                uvsMode                   = UVsMode,

                verts    = _nativeVertices,
                normals  = _nativeNormals,
                tangents = _nativeTangents,
                uvs0     = _nativeUV0,
                uvs1     = _nativeUV1,
                tris     = _nativeTris,
                bounds   = _nativeBounds,
                colors   = _nativeColors,

                Points       = SplineReference.NativePoints,
                Mode         = SplineReference.GetSplineMode(),
                ClosedSpline = SplineReference.GetSplineClosed(),

                SplineSpace        = splineSpace,
                worldToLocalMatrix = worldToLocalMatrix,
                localToWorldMatrix = localToWorldMatrix,

                built_to_t            = built_to_t,
                cover_ends_with_quads = cover_ends_with_quads,
            };

            return(job.Schedule(dependency));
        }
コード例 #2
0
        public void Rebuild_Jobified()
        {
            if (SplineReference == null)
            {
                return;
            }

            if (!SplineReference.NativePoints.IsCreated)
            {
                return;
            }

            var job = new BuildMeshFromSpline()
            {
                quality       = quality,
                width         = width,
                height        = height,
                uv_tile_scale = uv_tile_scale,

                verts   = verts,
                normals = normals,
                uvs     = uvs,
                tris    = tris,

                Points             = SplineReference.NativePoints,
                Mode               = SplineReference.GetSplineMode(),
                SplineSpace        = SplineReference.GetSplineSpace(),
                localToWorldMatrix = SplineReference.transform.localToWorldMatrix,
                ClosedSpline       = SplineReference.GetSplineClosed(),
            };

            previousHandle = job.Schedule();

            if (!AllowAsyncRebuild)
            {
                CompleteJob();
            }
        }