Exemplo n.º 1
0
        /// <summary>
        /// Initialize a new SplatSet with vertex count and attribute layout.  Attributes should
        /// match the length of weights applied (one attribute per value).
        /// Weight values are initialized to zero (unless preAlloc is false, then only the channel
        /// container array is initialized and arrays aren't allocated)
        /// </summary>
        /// <param name="vertexCount"></param>
        /// <param name="attributes"></param>
        /// <param name="preAlloc">Allocate and initialize Weight values to 0 ?</param>
        internal SplatSet(int vertexCount, AttributeLayout[] attributes, bool preAlloc = true)
        {
            this.channelMap = SplatWeight.GetChannelMap(attributes);
            int channels = channelMap.Count;

            this.attributeLayout = attributes;
            this.weights         = new Vector4[channels][];
            this.weightCount     = vertexCount;

            if (preAlloc)
            {
                for (int i = 0; i < channels; i++)
                {
                    this.weights[i] = new Vector4[vertexCount];
                }
            }
        }