Example #1
0
        static unsafe JobHandle?GetJointsJob(
            void *input,
            int count,
            GLTFComponentType inputType,
            int inputByteStride,
            uint *output,
            int outputByteStride,
            ILogger logger
            )
        {
            Profiler.BeginSample("GetJointsJob");
            JobHandle?jobHandle;

            switch (inputType)
            {
            case GLTFComponentType.UnsignedByte:
                var jointsUInt8Job = new Jobs.GetJointsUInt8Job();
                jointsUInt8Job.inputByteStride  = inputByteStride > 0 ? inputByteStride : 4;
                jointsUInt8Job.input            = (byte *)input;
                jointsUInt8Job.outputByteStride = outputByteStride;
                jointsUInt8Job.result           = output;
                jobHandle = jointsUInt8Job.Schedule(count, GltfImport.DefaultBatchCount);
                break;

            case GLTFComponentType.UnsignedShort:
                var jointsUInt16Job = new Jobs.GetJointsUInt16Job();
                jointsUInt16Job.inputByteStride  = inputByteStride > 0 ? inputByteStride : 8;
                jointsUInt16Job.input            = (byte *)input;
                jointsUInt16Job.outputByteStride = outputByteStride;
                jointsUInt16Job.result           = output;
                jobHandle = jointsUInt16Job.Schedule(count, GltfImport.DefaultBatchCount);
                break;

            default:
                logger?.Error(LogCode.TypeUnsupported, "Joints", inputType.ToString());
                jobHandle = null;
                break;
            }

            Profiler.EndSample();
            return(jobHandle);
        }
Example #2
0
        protected unsafe JobHandle?GetJointsJob(
            void *input,
            int count,
            GLTFComponentType inputType,
            int inputByteStride,
            uint *output,
            int outputByteStride,
            bool normalized = false
            )
        {
            Profiler.BeginSample("GetJointsJob");
            JobHandle?jobHandle;

            switch (inputType)
            {
            // TODO: Complete
            // case GLTFComponentType.Float:
            //     break;
            case GLTFComponentType.UnsignedShort:
                var jobTangent = new Jobs.GetJointsUInt16Job();
                jobTangent.inputByteStride = inputByteStride > 0 ? inputByteStride : 8;
                // Assert.IsTrue(normalized);
                jobTangent.input            = (byte *)input;
                jobTangent.outputByteStride = outputByteStride;
                jobTangent.result           = output;
                jobHandle = jobTangent.Schedule(count, GLTFast.DefaultBatchCount);
                break;

            // TODO: Complete
            // case GLTFComponentType.UnsignedByte:
            //     break;
            default:
                Debug.LogErrorFormat(GLTFast.ErrorUnsupportedType, "Tangent", inputType);
                jobHandle = null;
                break;
            }

            Profiler.EndSample();
            return(jobHandle);
        }