public CreaturePackPlayer(CreaturePackLoader dataIn)
        {
            data = dataIn;
            createRuntimeMap();
            isPlaying       = true;
            isLooping       = true;
            animBlendFactor = 0;
            animBlendDelta  = 0;

            // create data buffers
            renders_base_size = data.getNumPoints() / 2;
            render_points     = new float[getRenderPointsLength()];
            render_uvs        = new float[getRenderUVsLength()];
            render_colors     = new byte[getRenderColorsLength()];

            for (var i = 0; i < (int)getRenderColorsLength(); i++)
            {
                render_colors[i] = 255;
            }

            for (var i = 0; i < (int)getRenderUVsLength(); i++)
            {
                render_uvs[i] = data.uvs[i];
            }
        }
            public FinalPointsProcessData(int idxIn, CreaturePackLoader loaderIn)
            {
                idx          = idxIn;
                parentLoader = loaderIn;
                dMinX        = parentLoader.dMinX;
                dMinY        = parentLoader.dMinY;
                dMaxX        = parentLoader.dMaxX;
                dMaxY        = parentLoader.dMaxY;

                points   = parentLoader.points;
                fileData = parentLoader.fileData;
            }
 public FinalPointsProcessSplitData(CreaturePackLoader loaderIn, object[] dataList)
     : base(CreatureConsts.SPLIT_CLIP_ANIM_IDX, loaderIn)
 {
     fileData = dataList;
 }
Пример #4
0
        private static void processPerFinalAllPointsSample(object objIn)
        {
            FinalPointsProcessData curProcessData = (FinalPointsProcessData)objIn;
            int idx = curProcessData.idx;
            CreaturePackLoader parentLoader = curProcessData.parentLoader;

            var  deformCompressType  = parentLoader.hasDeformCompress();
            bool has_deform_compress = (deformCompressType.Length > 0);
            var  curOffsetPair       = parentLoader.getAnimationOffsets(idx);

            var animName = (string)(parentLoader.fileData[curOffsetPair.first]);
            var k        = curOffsetPair.first;

            k++;
            byte[] bytes2Data = new byte[2];

            while (k < curOffsetPair.second)
            {
                var pts_raw_array = parentLoader.fileData[k + 1];
                int raw_num       = 0;
                if (pts_raw_array.GetType() == typeof(object[]))
                {
                    raw_num = ((object[])pts_raw_array).Length;
                }
                else if (pts_raw_array.GetType() == typeof(byte[]))
                {
                    if (deformCompressType == "deform_comp1_1")
                    {
                        raw_num = ((byte[])pts_raw_array).Length / 2;
                    }
                    else
                    {
                        raw_num = ((byte[])pts_raw_array).Length;
                    }
                }

                var final_pts_array = new float[raw_num];
                if (!has_deform_compress)
                {
                    var pts_array = (object[])pts_raw_array;
                    for (int m = 0; m < raw_num; m++)
                    {
                        final_pts_array[m] = (float)pts_array[m];
                    }
                }
                else
                {
                    object[] pts_obj_array = null;
                    byte[]   pts_byte_array = null;
                    float    recp_x = 0, recp_y = 9;
                    float    numBuckets = 0.0f;
                    if (deformCompressType == "deform_comp1")
                    {
                        pts_obj_array = (object[])pts_raw_array;
                        numBuckets    = 65535.0f;
                    }
                    else if (deformCompressType == "deform_comp2")
                    {
                        pts_byte_array = (byte[])pts_raw_array;
                        numBuckets     = 255.0f;
                    }
                    else if (deformCompressType == "deform_comp1_1")
                    {
                        pts_byte_array = (byte[])pts_raw_array;
                        numBuckets     = 65535.0f;
                    }

                    recp_x = 1.0f / numBuckets * (parentLoader.dMaxX - parentLoader.dMinX);
                    recp_y = 1.0f / numBuckets * (parentLoader.dMaxY - parentLoader.dMinY);
                    int bucketType = 0;
                    if (deformCompressType == "deform_comp1")
                    {
                        bucketType = 1;
                    }
                    else if (deformCompressType == "deform_comp2")
                    {
                        bucketType = 2;
                    }
                    else if (deformCompressType == "deform_comp1_1")
                    {
                        bucketType = 3;
                    }

                    float bucketVal = 0.0f;
                    float setVal    = 0.0f;
                    for (int m = 0; m < raw_num; m++)
                    {
                        bucketVal = 0.0f;
                        if (bucketType == 1)
                        {
                            bucketVal = (float)((int)pts_obj_array[m]);
                        }
                        else if (bucketType == 2)
                        {
                            bucketVal = (float)((byte)pts_byte_array[m]);
                        }
                        else if (bucketType == 3)
                        {
                            bytes2Data[0] = pts_byte_array[m * 2];
                            bytes2Data[1] = pts_byte_array[m * 2 + 1];
                            int int_val = (int)BitConverter.ToUInt16(bytes2Data, 0);
                            bucketVal = (float)int_val;
                        }

                        setVal = 0.0f;
                        if (m % 2 == 0)
                        {
                            setVal  = bucketVal * recp_x + parentLoader.dMinX;
                            setVal += parentLoader.points[m];
                        }
                        else
                        {
                            setVal  = bucketVal * recp_y + parentLoader.dMinY;
                            setVal += parentLoader.points[m];
                        }

                        final_pts_array[m] = setVal;
                    }
                }

                parentLoader.fileData[k + 1] = final_pts_array;

                k += 4;
            }
        }
Пример #5
0
 public FinalPointsProcessData(int idxIn, CreaturePackLoader loaderIn)
 {
     idx          = idxIn;
     parentLoader = loaderIn;
 }