AttributeAccessor is use to access and modify a particle vertex attribute.
Ejemplo n.º 1
0
 /// <summary>
 /// Sets the data for the current vertex using the provided <see cref="AttributeAccessor"/>
 /// </summary>
 /// <param name="accessor">Accessor to the vertex data</param>
 /// <param name="ptrRef">Pointer to the source data</param>
 public void SetAttribute(AttributeAccessor accessor, IntPtr ptrRef)
 {
     Utilities.CopyMemory(VertexBuffer + accessor.Offset, ptrRef, accessor.Size);
 }
Ejemplo n.º 2
0
        public void TransformAttributePerParticle <T, U>(AttributeAccessor accessorFrom, AttributeAccessor accessorTo, IAttributeTransformer <T, U> transformMethod, ref U transformer)
            where T : struct
            where U : struct
        {
            for (var i = 0; i < vertexBuilder.VerticesPerParticle; 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);
            }
        }