Ejemplo n.º 1
0
 private GLCmdViewportParameter(GLCmdArraySlice <float> views, GLCmdArraySlice <double> depths)
 {
     First      = views.First;
     Count      = views.Count;
     Viewport   = views;
     DepthRange = depths;
 }
Ejemplo n.º 2
0
        public static GLCmdArraySlice <TFloat> MergeData(int factor, GLCmdArraySlice <TFloat> basis, GLCmdArraySlice <TFloat> change)
        {
            var length = GetAdjustedLength(basis.Count, change.First, change.Count);
            var dest   = new TFloat[factor * length];

            var combined = new GLCmdArraySlice <TFloat>(dest, basis.Factor, 0, length);

            Array.Copy(basis.Values, dest, basis.Values.Length);
            var offset     = (change.First * factor);
            var arrayCount = change.Count * factor;

            Array.Copy(change.Values, 0, dest, offset, arrayCount);

            return(combined);
        }
Ejemplo n.º 3
0
        private static GLCmdArraySlice <double> ConvertToDepthRanges(uint first, MgViewport[] depthRanges)
        {
            Func <double[], uint, MgViewport, uint> copyFn = (dest, offset, vp) => {
                dest [0 + offset] = vp.MinDepth;
                dest [1 + offset] = vp.MaxDepth;
                return(2);
            };

            const int factor = 2;
            var       count  = depthRanges.Length;
            var       values = new double[factor * count];

            GLCmdArraySlice <double> .CopyValues <MgViewport>(values, 0, depthRanges, copyFn);

            return(new GLCmdArraySlice <double> (values, factor, first, count));
        }
Ejemplo n.º 4
0
        private static GLCmdArraySlice <float> ConvertTo2DViewports(uint first, MgViewport[] viewports)
        {
            const int factor = 4;
            var       count  = viewports.Length;
            var       values = new float[factor * count];

            Func <float[], uint, MgViewport, uint> copyFn = (dest, offset, vp) => {
                dest [0 + offset] = vp.X;
                dest [1 + offset] = vp.Y;
                dest [2 + offset] = vp.Width;
                dest [3 + offset] = vp.Height;
                return(4);
            };

            GLCmdArraySlice <float> .CopyValues <MgViewport>(values, 0, viewports, copyFn);

            return(new GLCmdArraySlice <float> (values, factor, first, count));
        }
Ejemplo n.º 5
0
        public GLCmdScissorParameter(uint first, MgRect2D[] scissors)
        {
            const int factor = 4;
            var       count  = scissors.Length;
            var       values = new int[factor * count];

            Func <int[], uint, MgRect2D, uint> copyFn = (dest, offset, sc) => {
                dest [0 + offset] = sc.Offset.X;
                dest [1 + offset] = sc.Offset.Y;
                dest [2 + offset] = (int)sc.Extent.Width;
                dest [3 + offset] = (int)sc.Extent.Height;
                return(4);
            };

            GLCmdArraySlice <int> .CopyValues <MgRect2D>(values, 0, scissors, copyFn);

            Parameters = new GLCmdArraySlice <int> (values, factor, first, count);
        }
Ejemplo n.º 6
0
        public bool Matches(GLCmdArraySlice <TFloat> other, Func <TFloat, TFloat, bool> isDifferent)
        {
            bool quickCheck = this.First == other.First &&
                              this.Count == other.Count;

            if (!quickCheck)
            {
                return(false);
            }

            for (uint i = 0; i < Values.Length; ++i)
            {
                if (isDifferent(this.Values [i], other.Values [i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 7
0
 public GLCmdArraySlice <TFloat> Merge(GLCmdArraySlice <TFloat> delta)
 {
     return(MergeData(this.Factor, this, delta));
 }
Ejemplo n.º 8
0
 private GLCmdScissorParameter(GLCmdArraySlice <int> scissors)
 {
     Parameters = scissors;
 }