Пример #1
0
        /// <summary>
        /// Automatic setup of frequency data from a vertices group (eg, geometry and instance data in two buffers)
        /// </summary>
        /// <param name="vertices"></param>
        /// <param name="layout"></param>
        public StreamFrequency(VerticesGroup vertices, DataLayout layout)
        {
            this.layout         = layout;
            this.frequency      = new int[vertices.ChildCount];
            this.indexFrequency = new int[vertices.ChildCount];
            this.dataFrequency  = new int[vertices.ChildCount];

            if (layout == DataLayout.Stream0Geometry_Stream1InstanceData)
            {
                if (vertices.Count < 2)
                {
                    throw new ArgumentException("vertices.Count");
                }
                RepeatCount = vertices.GetChild(1).Count;
            }
        }
Пример #2
0
            public Graphics.VerticesGroup Fill(Graphics.IVertices vertices, int count)
            {
                if (this.instanceBuffer == null)
                {
                    this.instanceBuffer = new Graphics.VerticesGroup(vertices, this.instanceMatrices);
                }

                bufferActive = false;

                this.instanceBuffer.Count = vertices.Count;
                this.instanceBuffer.SetChild(0, vertices);
                this.instanceBuffer.SetIndexOffset(1, index);
                this.instanceMatrices.SetDirtyRange(index, count);
                this.index += count;

                return(this.instanceBuffer);
            }