コード例 #1
0
        public static void GenerateSingleSubmeshInstruction(SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Material material)
        {
            ExposedList <Slot> drawOrder = skeleton.drawOrder;
            int count = drawOrder.Count;

            instructionOutput.Clear();
            ExposedList <SubmeshInstruction> submeshInstructions = instructionOutput.submeshInstructions;

            submeshInstructions.Resize(1);
            instructionOutput.attachments.Resize(count);
            Attachment[]       items = instructionOutput.attachments.Items;
            int                num   = 0;
            SubmeshInstruction submeshInstruction = default(SubmeshInstruction);

            submeshInstruction.skeleton = skeleton;
            submeshInstruction.preActiveClippingSlotSource = -1;
            submeshInstruction.startSlot           = 0;
            submeshInstruction.rawFirstVertexIndex = 0;
            submeshInstruction.material            = material;
            submeshInstruction.forceSeparate       = false;
            submeshInstruction.endSlot             = count;
            SubmeshInstruction submeshInstruction2 = submeshInstruction;
            bool hasActiveClipping = false;

            Slot[] items2 = drawOrder.Items;
            for (int i = 0; i < count; i++)
            {
                Slot             slot             = items2[i];
                Attachment       attachment       = items[i] = slot.attachment;
                RegionAttachment regionAttachment = attachment as RegionAttachment;
                int num2;
                int num3;
                if (regionAttachment != null)
                {
                    num2 = 4;
                    num3 = 6;
                }
                else
                {
                    MeshAttachment meshAttachment = attachment as MeshAttachment;
                    if (meshAttachment != null)
                    {
                        num2 = meshAttachment.worldVerticesLength >> 1;
                        num3 = meshAttachment.triangles.Length;
                    }
                    else
                    {
                        ClippingAttachment clippingAttachment = attachment as ClippingAttachment;
                        if (clippingAttachment != null)
                        {
                            submeshInstruction2.hasClipping = true;
                            hasActiveClipping = true;
                        }
                        num2 = 0;
                        num3 = 0;
                    }
                }
                submeshInstruction2.rawTriangleCount += num3;
                submeshInstruction2.rawVertexCount   += num2;
                num += num2;
            }
            instructionOutput.hasActiveClipping = hasActiveClipping;
            instructionOutput.rawVertexCount    = num;
            submeshInstructions.Items[0]        = submeshInstruction2;
        }