Exemple #1
0
        const int MaxTextureDim = 8192;//2048;//16384;

        public OctData(OctLean[] frames, Byte8[] values)
        {
            Structs = frames;
            Values  = new byte[RoundToNextRow(values.Length * 4) * 2];

            for (int i = 0; i < values.Length; i++)
            {
                Byte8 v = values[i];
                int   p = ((i * 4) % MaxTextureDim) + 2 * MaxTextureDim * ((i * 4) / MaxTextureDim);

                Values[p]     = v.S;
                Values[p + 1] = v.T;
                Values[p + 2] = v.W;
                Values[p + 3] = v.X;

                p            += MaxTextureDim;
                Values[p]     = v.U;
                Values[p + 1] = v.V;
                Values[p + 2] = v.Y;
                Values[p + 3] = v.Z;
            }
            int RoundToNextRow(int x)
            {
                return((x + MaxTextureDim - 1) / MaxTextureDim * MaxTextureDim);
            }
        }
Exemple #2
0
            public        Byte8[] ManagedValues()
            {
                var v = new Byte8[Length];

                IntPtr bptr = Values;

                for (int i = 0; i < Length; i++)
                {
                    v[i]  = Marshal.PtrToStructure <Byte8>(bptr);
                    bptr += 8;
                }
                return(v);
            }
Exemple #3
0
        private void Cast(List <OctLean> octs, List <Byte8> values, float scale, Vector3 pos, int parent, int at)
        {
            int childstart = -1;

            if (Children != null)
            {
                childstart = octs.Count;

                for (int i = 0; i < 8; i++)
                {
                    octs.Add(new OctLean());
                    values.Add(new Byte8());
                }
                for (int i = 0; i < 8; i++)
                {
                    Children[i].Cast(octs, values, scale / 2, pos + SdfMath.split(i).Vector *scale / 2, at, childstart + i);
                }
            }
            octs[at]   = new OctLean(parent, childstart);
            values[at] = new Byte8(Vertices, scale);
        }