Exemplo n.º 1
0
        public void TransformAttributePerParticle <T>(AttributeAccessor accessorFrom, AttributeAccessor accessorTo, IAttributeTransformer <T> transformMethod) where T : struct
        {
            for (var i = 0; i < verticesPerParticle; i++)
            {
                var temp = Utilities.Read <T>(vertexBuffer + accessorFrom.Offset + i * VertexDeclaration.VertexStride);

                transformMethod.Transform(ref temp);

                Utilities.Write(vertexBuffer + accessorTo.Offset + i * VertexDeclaration.VertexStride, ref temp);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Transforms attribute data using already written data from another attribute
        /// </summary>
        /// <typeparam name="T">Type data</typeparam>
        /// <param name="accessorTo">Vertex attribute accessor to the destination attribute</param>
        /// <param name="accessorFrom">Vertex attribute accessor to the source attribute</param>
        /// <param name="transformMethod">Transform method for the type data</param>
        public void TransformAttributePerSegment <T, U>(AttributeAccessor accessorFrom, AttributeAccessor accessorTo, IAttributeTransformer <T, U> transformMethod, ref U transformer)
            where T : struct
            where U : struct
        {
            for (var i = 0; i < VerticesPerSegCurrent; i++)
            {
                var temp = Utilities.Read <T>(VertexBuffer + accessorFrom.Offset + i * VertexStride);

                transformMethod.Transform(ref temp, ref transformer);

                Utilities.Write(VertexBuffer + accessorTo.Offset + i * VertexStride, ref temp);
            }
        }