예제 #1
0
        // Helper creates an EffectTransferTable3D by evaluating the specified transfer function for every location within the table.
        private static EffectTransferTable3D CreateTransferTableFromFunction(ICanvasResourceCreator resourceCreator, int sizeB, int sizeG, int sizeR, Func <Vector3, Vector3> transferFunction)
        {
            var tableColors = new List <Color>();

            var maxExtents = new Vector3(sizeR, sizeG, sizeB) - Vector3.One;

            for (int r = 0; r < sizeR; r++)
            {
                for (int g = 0; g < sizeG; g++)
                {
                    for (int b = 0; b < sizeB; b++)
                    {
                        Vector3 sourceColor = new Vector3(r, g, b) / maxExtents;

                        Vector3 outputColor = transferFunction(sourceColor);

                        tableColors.Add(ToColor(outputColor));
                    }
                }
            }

            return(EffectTransferTable3D.CreateFromColors(resourceCreator, tableColors.ToArray(), sizeB, sizeG, sizeR));
        }
예제 #2
0
 public Lut3DEffectGenerator(Lut lut, ICanvasResourceCreator liveView)
 {
     table = EffectTransferTable3D.CreateFromColors(liveView, lut.Colors, lut.BlueNum, lut.GreenNum, lut.RedNum);
 }