Ejemplo n.º 1
0
        /// <summary>
        /// draw all grid lines for axis
        /// </summary>
        protected override void drawGrid()
        {
            float x1, y1, z;
            float x2, y2, x3, y3;
            float xmin = m_clipping.XMin;
            float ymin = m_clipping.YMin;
            float xmax = m_clipping.XMax;
            float ymax = m_clipping.YMax;

            ILOGLPanel.SetupLineStyle(m_grid);
            GL.Disable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Blend);
            GL.Begin(BeginMode.Lines);
            #region determine which side to draw on
            switch (m_layoutData.CameraPosition.Quadrant)
            {
            case CameraQuadrant.TopLeftFront:
            case CameraQuadrant.BottomLeftFront:
                x1 = xmin; y1 = ymax;
                x2 = xmax; y2 = ymax;
                x3 = xmax; y3 = ymin;
                break;

            case CameraQuadrant.TopLeftBack:
            case CameraQuadrant.BottomLeftBack:
                x1 = xmax; y1 = ymax;
                x2 = xmax; y2 = ymin;
                x3 = xmin; y3 = ymin;
                break;

            case CameraQuadrant.TopRightBack:
            case CameraQuadrant.BottomRightBack:
                x1 = xmax; y1 = ymin;
                x2 = xmin; y2 = ymin;
                x3 = xmin; y3 = ymax;
                break;

            default:
            case CameraQuadrant.TopRightFront:
            case CameraQuadrant.BottomRightFront:
                x1 = xmin; y1 = ymin;
                x2 = xmin; y2 = ymax;
                x3 = xmax; y3 = ymax;
                break;
            }
            #endregion
            foreach (LabeledTick tick in m_labeledTicks)
            {
                if (tick.Position >= m_clipping.ZMin &&
                    tick.Position <= m_clipping.ZMax)
                {
                    z = tick.Position;
                    GL.Vertex3(x1, y1, z);
                    GL.Vertex3(x2, y2, z);
                    GL.Vertex3(x2, y2, z);
                    GL.Vertex3(x3, y3, z);
                }
            }
            GL.End();
        }
Ejemplo n.º 2
0
        public override void Draw(ILRenderProperties props, ILShape shape)
        {
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            GL.Enable(EnableCap.DepthTest);
            ILLines lines = (shape as ILLines);

            ILOGLPanel.SetupLineStyle(lines.Properties);
            fixed(C4bV3f *pVertices = lines.Vertices)
            {
                GL.InterleavedArrays(InterleavedArrayFormat.C4ubV3f, 0, (IntPtr)pVertices);
                if (lines.Shading == ShadingStyles.Interpolate)
                {
                    GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    GL.ShadeModel(ShadingModel.Flat);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.Color4(lines.FillColor);
                }
                GL.DrawArrays(BeginMode.LineStrip, 0, lines.VertexCount);
            }
        }
Ejemplo n.º 3
0
        public override void Draw(ILRenderProperties props, ILShape shape, int[] indices)
        {
            System.Diagnostics.Debug.Assert(indices != null);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            ILShape <C4bV3f> cShape = (shape as ILShape <C4bV3f>);

            if (cShape is ILLines)
            {
                ILOGLPanel.SetupLineStyle((cShape as ILLines).Properties);
                GL.Disable(EnableCap.DepthTest);
            }

            fixed(int *pIndices = indices)
            fixed(C4bV3f * pVertices = cShape.Vertices)
            {
                GL.InterleavedArrays(InterleavedArrayFormat.C4ubV3f, 0, (IntPtr)pVertices);
                if (cShape.Shading == ShadingStyles.Interpolate)
                {
                    GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    GL.ShadeModel(ShadingModel.Flat);
                    GL.DisableClientState(EnableCap.ColorArray);
                }
                GL.DrawElements(BeginMode.Lines, indices.Length,
                                DrawElementsType.UnsignedInt, (IntPtr)pIndices);
            }
        }
Ejemplo n.º 4
0
 internal ILOGLAxis (AxisNames name, ILClippingData clippingView,
                     ILLayoutData layoutData,
                     ILOGLPanel panel)
     : base (name,clippingView,layoutData,panel) {
     m_invalidated = true;
     panel.GraphicsDeviceCreated += new ILGraphicsDeviceCreatedEvent(initialize);
     panel.GraphicsDeviceReset += new ILGraphicsDeviceResetEvent(configure);
 }
Ejemplo n.º 5
0
 public ILOGLSurfaceGraph(ILOGLPanel panel, ILBaseArray X,
                          ILBaseArray Y, ILBaseArray Z, ILBaseArray C,
                          ILClippingData clippingContainer)
     : base(panel, X, Y, Z, C, clippingContainer)
 {
     m_indexReady  = false;
     m_vertexReady = false;
 }
Ejemplo n.º 6
0
 internal ILOGLAxis(AxisNames name, ILClippingData clippingView,
                    ILLayoutData layoutData,
                    ILOGLPanel panel)
     : base(name, clippingView, layoutData, panel)
 {
     m_invalidated = true;
     panel.GraphicsDeviceCreated += new ILGraphicsDeviceCreatedEvent(initialize);
     panel.GraphicsDeviceReset   += new ILGraphicsDeviceResetEvent(configure);
 }
Ejemplo n.º 7
0
        public override void Draw(ILRenderProperties props, ILShape shape)
        {
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            GL.Enable(EnableCap.DepthTest);
            ILLine line = (shape as ILLine);

            if (line != null && line.Border.Visible)
            {
                fixed(C4bV3f *pVertices = line.Vertices)
                {
                    ILOGLPanel.SetupLineStyle(line.Border);
                    GL.InterleavedArrays(InterleavedArrayFormat.C4ubV3f, 0, (IntPtr)pVertices);
                    GL.DisableClientState(EnableCap.ColorArray);
                    if (line.OldestVertexID == 0)
                    {
                        GL.DrawArrays(BeginMode.LineStrip, 0, line.VertexCount);
                    }
                    else
                    {
                        GL.DrawArrays(BeginMode.LineStrip, line.OldestVertexID, line.VertexCount - line.OldestVertexID);
                        GL.DrawElements(BeginMode.Lines, 2, DrawElementsType.UnsignedInt, m_closeLoopIndices);
                        GL.DrawArrays(BeginMode.LineStrip, 0, line.OldestVertexID);
                    }
                }
            }
            ILOGLPanel.SetupLineStyle(line.Properties);
            fixed(C4bV3f *pVertices = line.Vertices)
            {
                GL.InterleavedArrays(InterleavedArrayFormat.C4ubV3f, 0, (IntPtr)pVertices);
                if (line.Shading == ShadingStyles.Interpolate)
                {
                    GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    GL.ShadeModel(ShadingModel.Flat);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.Color4(line.FillColor);
                }
                if (line.OldestVertexID == 0)
                {
                    GL.DrawArrays(BeginMode.LineStrip, 0, line.VertexCount);
                }
                else
                {
                    GL.DrawArrays(BeginMode.LineStrip, line.OldestVertexID, line.VertexCount - line.OldestVertexID);
                    GL.DrawElements(BeginMode.Lines, 2, DrawElementsType.UnsignedInt, m_closeLoopIndices);
                    GL.DrawArrays(BeginMode.LineStrip, 0, line.OldestVertexID);
                }
            }
        }
Ejemplo n.º 8
0
 public ILOGLImageSCGraph (ILOGLPanel panel, ILBaseArray X,
                           ILBaseArray Y,ILBaseArray Z,ILBaseArray C,  
                          ILClippingData clippingContainer) 
      : base(panel,X,Y,Z,C, clippingContainer) { 
     m_panel = panel; 
     m_localClipping.ZMax = 0; 
     m_localClipping.ZMin = 0; 
     m_localClipping.XMax = (float)m_cols+0.5f;
     m_localClipping.XMin = -0.5f; 
     m_localClipping.YMax = (float)m_rows+0.5f; 
     m_localClipping.YMin = -0.5f; 
 }
Ejemplo n.º 9
0
 public ILOGLImageSCGraph(ILOGLPanel panel, ILBaseArray X,
                          ILBaseArray Y, ILBaseArray Z, ILBaseArray C,
                          ILClippingData clippingContainer)
     : base(panel, X, Y, Z, C, clippingContainer)
 {
     m_panel = panel;
     m_localClipping.ZMax = 0;
     m_localClipping.ZMin = 0;
     m_localClipping.XMax = (float)m_cols + 0.5f;
     m_localClipping.XMin = -0.5f;
     m_localClipping.YMax = (float)m_rows + 0.5f;
     m_localClipping.YMin = -0.5f;
 }
        public override void Draw(ILRenderProperties props, ILShape shape)
        {
            if (shape.VertexCount == 0)
            {
                return;
            }
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            GL.Enable(EnableCap.DepthTest);
            //GL.Disable(EnableCap.PolygonOffsetFill);
            ILShape <C4fN3fV3f> cShape = (shape as ILShape <C4fN3fV3f>);

            fixed(C4fN3fV3f *pVertices = cShape.Vertices)
            {
                if (UseLight && (cShape is IILSupportsLight))
                {
                    setupLight(cShape as IILSupportsLight);
                }
                else
                {
                    GL.Disable(EnableCap.Lighting);
                }
                GL.InterleavedArrays(InterleavedArrayFormat.C4fN3fV3f, 0, (IntPtr)pVertices);
                if (cShape.Shading == ShadingStyles.Interpolate)
                {
                    GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    GL.ShadeModel(ShadingModel.Flat);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.Color4(shape.FillColor);
                }
                GL.DrawArrays(m_primitiveType, 0, cShape.VertexCount);
            }

            GL.Disable(EnableCap.Lighting);
            ILBorderedShape <C4fN3fV3f> bShape = (shape as ILBorderedShape <C4fN3fV3f>);

            if (bShape != null && bShape.Border.Visible)
            {
                fixed(C4fN3fV3f *pVertices = bShape.Vertices)
                {
                    ILOGLPanel.SetupLineStyle(bShape.Border);
                    GL.InterleavedArrays(InterleavedArrayFormat.C4fN3fV3f, 0, (IntPtr)pVertices);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.DrawArrays(BeginMode.LineLoop, 0, bShape.VertexCount);
                }
            }
        }
Ejemplo n.º 11
0
        public override void Draw(ILRenderProperties p)
        {
            //System.Diagnostics.Debug.WriteLine("ILOGLGraphPlot2D_Draw");
            #region draw line
            // draw linestrip - simple case - fast vertex rendering
            if (m_properties.Visible)
            {
                GL.Disable(EnableCap.Blend);
                GL.Disable(EnableCap.Texture2D);
                ILOGLPanel.SetupLineStyle(m_properties);
                unsafe
                {
                    fixed(C4bV3f *pVertArr = m_vertices)
                    {
                        GL.InterleavedArrays(InterleavedArrayFormat.C4ubV3f, 0, (IntPtr)pVertArr);
                        if (m_properties.Color.IsEmpty)
                        {
                            GL.ShadeModel(ShadingModel.Smooth);
                        }
                        else
                        {
                            GL.ShadeModel(ShadingModel.Flat);
                            GL.DisableClientState(EnableCap.ColorArray);
                        }

                        if (m_startID < 2)
                        {
                            GL.DrawArrays(BeginMode.LineStrip, m_startID, m_vertexCount - 1);
                        }
                        else
                        {
                            GL.DrawArrays(BeginMode.LineStrip, m_startID, m_vertexCount - m_startID);
                            GL.DrawArrays(BeginMode.LineStrip, 0, m_startID);
                        }
                    }
                }
            }
            #endregion
            #region draw markers
            if (m_marker.Visible)
            {
                m_marker.Shape.Draw(p, m_marker, m_vertices, 0, m_vertexCount - 1);
            }
            #endregion
        }
Ejemplo n.º 12
0
 /// <summary>
 /// draw all lines for the axis
 /// </summary>
 /// <param name="p">render properties</param>
 /// <param name="background">true: draw lines in the back only, false: draw foreground lines</param>
 protected override void iDrawAxis(ILRenderProperties p, bool background)
 {
     // create vertex data: main axis and ticks
     if (m_visible)
     {
         float tickLen;
         float x, y, z
         , xmin = m_clipping.XMin
         , xmax = m_clipping.XMax
         , ymin = m_clipping.YMin
         , ymax = m_clipping.YMax
         , zmin = m_clipping.ZMin
         , zmax = m_clipping.ZMax;
         tickLen = m_labeledTicks.TickFraction
                   * ((m_labeledTicks.Direction == TickDirection.Inside) ? -m_clipping.WidthF : m_clipping.WidthF);
         // must draw ticks?
         bool drawticks = false, drawlines = false;
         if (m_labeledTicks.Display == TickDisplay.BothSides)
         {
             drawticks = true;
         }
         else
         {
             drawticks = (background ^ m_layoutData.CameraPosition.LooksFromTop);
         }
         y = ymin; z = zmin;
         // determine which axis to draw: find front
         if (!m_layoutData.CameraPosition.LooksFromLeft && !m_layoutData.CameraPosition.Is2DView)
         {
             x = xmax;
         }
         else
         {
             x        = xmin;
             tickLen *= -1.0f;
         }
         if (background)
         {
             if (x == xmin)
             {
                 x = xmax;
             }
             else
             {
                 x = xmin;
             }
             tickLen *= -1.0f;
             GL.Disable(EnableCap.DepthTest);
             if (m_farLines.Visible)
             {
                 ILOGLPanel.SetupLineStyle(m_farLines);
                 drawlines = true;
             }
         }
         else
         {
             if (m_nearLines.Visible)
             {
                 ILOGLPanel.SetupLineStyle(m_nearLines);
                 drawlines = true;
             }
         }
         if (drawlines)
         {
             GL.Begin(BeginMode.Lines);
             GL.Vertex3(x, y, z);
             y = ymax;
             GL.Vertex3(x, y, z);
             if (m_layoutData.CameraPosition.SinRho > 1e-5)
             {
                 z = zmax;
                 GL.Vertex3(x, y, z);
                 y = ymin;
                 GL.Vertex3(x, y, z);
             }
             GL.End();
         }
         if (drawticks && drawlines)
         {
             #region create ticks
             if (!m_layoutData.CameraPosition.LooksFromTop)
             {
                 //tickLen *= -1.0f;
                 //x *= -1.0f;
                 if (background)
                 {
                     GL.Color3(m_labeledTicks.NearColor);
                 }
                 else
                 {
                     GL.Color3(m_labeledTicks.FarColor);
                 }
             }
             else
             {
                 if (background)
                 {
                     GL.Color3(m_labeledTicks.FarColor);
                 }
                 else
                 {
                     GL.Color3(m_labeledTicks.NearColor);
                 }
             }
             //scale = m_clipping.ScaleToUnitCube().Y;
             //offse = m_clipping.CenterToUnitCube().Y;
             GL.Enable(EnableCap.DepthTest);
             GL.Disable(EnableCap.LineStipple);
             GL.Begin(BeginMode.Lines);
             foreach (LabeledTick tick in m_labeledTicks)
             {
                 if (tick.Position >= ymin &&
                     tick.Position <= ymax)
                 {
                     y = tick.Position;
                     if (m_layoutData.CameraPosition.SinRho > 1e-5)
                     {
                         z = zmax;
                         GL.Vertex3(x, y, z);
                         x += tickLen;
                         GL.Vertex3(x, y, z);
                     }
                     else
                     {
                         x += tickLen;
                     }
                     z = zmin;
                     GL.Vertex3(x, y, z);
                     x -= tickLen;
                     GL.Vertex3(x, y, z);
                 }
             }
             GL.End();
         }
         if (background && m_grid.Visible)
         {
             drawGrid();
         }
         #endregion
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor - this class should be created only from within ILNumerics assemblies!
 /// </summary>
 /// <param name="clippingView">panels clipping view</param>
 /// <param name="layoutData">instance with layout informations</param>
 /// <param name="panel">the panel containing the axis</param>
 internal ILOGLYAxis(ILClippingData clippingView,
                     ILLayoutData layoutData,
                     ILOGLPanel panel)
     : base(AxisNames.YAxis, clippingView, layoutData, panel)
 {
 }
Ejemplo n.º 14
0
        /// <summary>
        /// draw all grid lines for axis
        /// </summary>
        protected override void drawGrid()
        {
            GL.Color3(m_grid.Color);
            float x, y, z;
            float zmax       = m_clipping.ZMax;
            float zmin       = m_clipping.ZMin;
            float xmin       = m_clipping.XMin;
            float xmax       = m_clipping.XMax;
            bool  drawBottom = m_layoutData.CameraPosition.LooksFromTop;

            ILOGLPanel.SetupLineStyle(m_grid);
            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.Blend);
            GL.Begin(BeginMode.Lines);
            if (!m_layoutData.CameraPosition.LooksFromLeft)
            {
                x = xmin;
            }
            else
            {
                x = xmax;
            }
            foreach (LabeledTick tick in m_labeledTicks)
            {
                if (tick.Position >= m_clipping.YMin &&
                    tick.Position <= m_clipping.YMax)
                {
                    y = tick.Position;
                    if (!m_layoutData.CameraPosition.Is2DView)
                    {
                        z = zmax;
                        GL.Vertex3(x, y, z);
                        z = zmin;
                        GL.Vertex3(x, y, z);
                    }
                    else
                    {
                        z = zmin;
                    }
                    if (drawBottom)
                    {
                        GL.Vertex3(x, y, z);
                        if (x == xmin)
                        {
                            x = xmax;
                        }
                        else
                        {
                            x = xmin;
                        }
                        GL.Vertex3(x, y, z);
                        if (x == xmin)
                        {
                            x = xmax;
                        }
                        else
                        {
                            x = xmin;
                        }
                    }
                }
            }
            GL.End();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Draw the graph
        /// </summary>
        public override void Draw(ILRenderProperties p)
        {
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            ILLineProperties wireprops = m_wireLines;

            ILOGLPanel.SetupLineStyle(wireprops);
            unsafe
            {
                fixed(float *pVertices = m_vertices)
                {
                    // populate vertex array to GL
                    GL.InterleavedArrays(InterleavedArrayFormat.C4fN3fV3f
                                         , 0, (IntPtr)pVertices);
                    // general setup shading & transparency
                    if (m_shading == ShadingStyles.Interpolate)
                    {
                        GL.ShadeModel(ShadingModel.Smooth);
                        //GL.Disable(EnableCap.DepthTest);
                    }
                    else
                    {
                        GL.ShadeModel(ShadingModel.Flat);
                        //if (m_opacity < 1.0f)
                        //else
                        //    GL.Enable(EnableCap.DepthTest);
                    }
                    GL.Enable(EnableCap.DepthTest);


                    if (m_opacity == 1.0f && m_shading == ShadingStyles.Interpolate)
                    {
                        #region no transpareny
                        GL.Disable(EnableCap.Blend);
                        GL.Enable(EnableCap.DepthTest);
                        fixed(UInt32 *pGridIndices = m_gridIndices)
                        fixed(UInt32 * pIndices = m_indices)
                        {
                            UInt32 *pGridIndWalk = pGridIndices;

                            // first surface strip
                            if (m_filled)
                            {
                                GL.DrawElements(BeginMode.TriangleStrip, m_stripesLen,
                                                DrawElementsType.UnsignedInt,
                                                (IntPtr)pIndices);
                            }
                            // first grid strip
                            if (m_wireLines.Visible)
                            {
                                if (!wireprops.Color.IsEmpty)
                                {
                                    // if a color was specified, use it for wireframes!
                                    GL.DisableClientState(EnableCap.ColorArray);
                                    //GL.Color3(wireprops.ForeColor); // color for grid lines
                                }
                                GL.DrawElements(BeginMode.Lines,
                                                m_gridStripsLen + m_gridStripsLenOnce, // 2*(m_cols-1),
                                                DrawElementsType.UnsignedInt,
                                                (IntPtr)pGridIndWalk);
                                pGridIndWalk += (m_gridStripsLen + m_gridStripsLenOnce);
                                if (!wireprops.Color.IsEmpty)
                                {
                                    GL.EnableClientState(EnableCap.ColorArray);
                                }
                            }
                            for (int i = 1; i < m_stripesCount; i++)
                            {
                                // subsequent surface strips
                                if (m_filled)
                                {
                                    GL.DrawElements(BeginMode.TriangleStrip,
                                                    m_stripesLen,
                                                    DrawElementsType.UnsignedInt,
                                                    (IntPtr)(pIndices + i * m_stripesLen));
                                }
                                // subsequent grid strips
                                if (m_wireLines.Visible)
                                {
                                    GL.Disable(EnableCap.Blend);
                                    if (!wireprops.Color.IsEmpty)
                                    {
                                        // if a color was specified, use it for wireframes!
                                        GL.DisableClientState(EnableCap.ColorArray);
                                        //GL.Color3(wireprops.ForeColor); // color for grid lines
                                    }
                                    GL.DrawElements(BeginMode.Lines,
                                                    m_gridStripsLen,
                                                    DrawElementsType.UnsignedInt,
                                                    (IntPtr)(pGridIndWalk));
                                    pGridIndWalk += m_gridStripsLen;
                                    if (!wireprops.Color.IsEmpty)
                                    {
                                        GL.EnableClientState(EnableCap.ColorArray);
                                    }
                                }
                            }
                            GL.Finish();
                        }
                        #endregion
                    }
                    else
                    {
                        #region transparency or flat shading
                        GL.Enable(EnableCap.Blend);
                        fixed(UInt32 *pGridIndices = m_gridIndices)
                        fixed(UInt32 * pIndices = m_indices)
                        {
                            UInt32 *pGridIndWalk = pGridIndices;

                            // first surface strip
                            if (m_filled)
                            {
                                GL.DrawElements(BeginMode.Triangles, m_stripesLen,
                                                DrawElementsType.UnsignedInt,
                                                (IntPtr)pIndices);
                            }
                            // first grid strip
                            if (m_wireLines.Visible)
                            {
                                GL.Disable(EnableCap.Blend);
                                if (!wireprops.Color.IsEmpty)
                                {
                                    // if a color was specified, use it for wireframes!
                                    GL.DisableClientState(EnableCap.ColorArray);
                                    GL.Color3(m_wireLines.Color);
                                }
                                GL.DrawElements(BeginMode.Lines,
                                                m_gridStripsLen + m_gridStripsLenOnce,
                                                DrawElementsType.UnsignedInt,
                                                (IntPtr)pGridIndWalk);
                                pGridIndWalk += m_gridStripsLen + m_gridStripsLenOnce;
                                if (!wireprops.Color.IsEmpty)
                                {
                                    // if a color was specified, use it for wireframes!
                                    GL.EnableClientState(EnableCap.ColorArray);
                                }
                                GL.Enable(EnableCap.Blend);
                            }
                            for (int i = 1; i < m_stripesCount; i++)
                            {
                                // subsequent surface strips
                                if (m_filled)
                                {
                                    GL.DrawElements(BeginMode.Triangles,
                                                    m_stripesLen,
                                                    DrawElementsType.UnsignedInt,
                                                    (IntPtr)(pIndices + i * m_stripesLen));
                                }
                                // subsequent grid strips
                                if (m_wireLines.Visible)
                                {
                                    GL.Disable(EnableCap.Blend);
                                    if (!wireprops.Color.IsEmpty)
                                    {
                                        // if a color was specified, use it for wireframes!
                                        GL.DisableClientState(EnableCap.ColorArray);
                                        GL.Color3(m_wireLines.Color);
                                    }
                                    GL.DrawElements(BeginMode.Lines,
                                                    m_gridStripsLen,
                                                    DrawElementsType.UnsignedInt,
                                                    (IntPtr)(pGridIndWalk));
                                    if (!wireprops.Color.IsEmpty)
                                    {
                                        GL.EnableClientState(EnableCap.ColorArray);
                                    }
                                    GL.Enable(EnableCap.Blend);
                                    pGridIndWalk += m_gridStripsLen;
                                }
                            }
                            GL.Finish();
                        }
                        #endregion
                    }
                }
            }
            //GL.Disable(EnableCap.Lighting);
            //GL.PopMatrix();
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Constructor - this class should be created only from within ILNumerics assemblies! 
 /// </summary>
 /// <param name="clippingView">panels clipping view</param>
 /// <param name="layout">instance with layout informations</param>
 /// <param name="panel">the panel containing the axis</param>
 internal ILOGLZAxis (ILClippingData clippingView,
                     ILLayoutData layout,
                     ILOGLPanel panel)
     : base (AxisNames.ZAxis,clippingView,layout,panel) { }
        public override void Draw(ILRenderProperties props, ILShape shape, int[] indices)
        {
            System.Diagnostics.Debug.Assert(indices != null);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha,
                         BlendingFactorDest.OneMinusSrcAlpha);
            // draw shape
            ILShape <C4fN3fV3f> cShape = (shape as ILShape <C4fN3fV3f>);

            fixed(int *pIndices = indices)
            fixed(C4fN3fV3f * pVertices = cShape.Vertices)
            {
                if (UseLight && (cShape is ILLitCompositeShape <C4fN3fV3f>))
                {
                    setupLight(cShape as ILLitCompositeShape <C4fN3fV3f>);
                }
                else
                {
                    GL.Disable(EnableCap.Lighting);
                }
                GL.InterleavedArrays(InterleavedArrayFormat.C4fN3fV3f, 0, (IntPtr)pVertices);
                if (cShape.Shading == ShadingStyles.Interpolate)
                {
                    GL.ShadeModel(ShadingModel.Smooth);
                }
                else
                {
                    GL.ShadeModel(ShadingModel.Flat);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.Color4(shape.FillColor);
                }
                GL.DrawElements(m_primitiveType, indices.Length, DrawElementsType.UnsignedInt, (IntPtr)pIndices);
                //IntPtr pObj = Glu.NewQuadric();
                //GL.MatrixMode(MatrixMode.Modelview);
                //GL.PushMatrix();
                //GL.Translate(cShape.Vertices[0].Position.X, cShape.Vertices[0].Position.Y, cShape.Vertices[0].Position.Z);
                //Glu.QuadricDrawStyle(pObj, QuadricDrawStyle.Fill);
                //Glu.Sphere(pObj, 2, 20, 10);
                //GL.PopMatrix();
            }
            // draw border
            ILBorderedShape <C4fN3fV3f> bShape = (shape as ILBorderedShape <C4fN3fV3f>);

            if (bShape != null && bShape.Border.Visible)
            {
                fixed(int *pIndices = indices)
                fixed(C4fN3fV3f * pVertices = bShape.Vertices)
                {
                    ILOGLPanel.SetupLineStyle(bShape.Border);
                    GL.InterleavedArrays(
                        InterleavedArrayFormat.C4fN3fV3f, 0, (IntPtr)pVertices);
                    GL.DisableClientState(EnableCap.ColorArray);
                    GL.DrawElements(BeginMode.LineLoop, indices.Length,
                                    DrawElementsType.UnsignedInt, (IntPtr)pIndices);
                }
            }

#if RENDERER_DRAW_NORMALS
            #region DEBUG_DRAW_NORMALS
            GL.Color3(0, 0, 0);
            GL.Begin(BeginMode.Lines);
            for (int i = 0; i < shape.VertexCount; i++)
            {
                GL.Vertex3(cShape.Vertices[i].XPosition, cShape.Vertices[i].YPosition, cShape.Vertices[i].ZPosition);
                GL.Vertex3(cShape.Vertices[i].XPosition + cShape.Vertices[i].Normal.X,
                           cShape.Vertices[i].YPosition + cShape.Vertices[i].Normal.Y,
                           cShape.Vertices[i].ZPosition + cShape.Vertices[i].Normal.Z);
            }
            GL.End();
            #endregion
#endif
            GL.Disable(EnableCap.Lighting);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// draw all lines for the axis
        /// </summary>
        /// <param name="g">graphics object (ignored)</param>
        /// <param name="background">true: draw lines in the back only, false: draw foreground lines</param>
        protected override void iDrawAxis(ILRenderProperties p, bool background)
        {
            // create vertex data: main axis and ticks
            if (!m_visible)
            {
                return;
            }
            int   count = 8; float tickLen;
            float scale, offse, x, y, z
            , xmin = m_clipping.XMin
            , xmax = m_clipping.XMax
            , ymin = m_clipping.YMin
            , ymax = m_clipping.YMax
            , zmin = m_clipping.ZMin
            , zmax = m_clipping.ZMax;

            tickLen = m_labeledTicks.TickFraction
                      * ((m_labeledTicks.Direction == TickDirection.Inside) ? m_clipping.WidthF : -m_clipping.WidthF);
            //ConfigureOGLLineProperties(LineStyle.Solid,1);
            // must draw ticks?
            bool drawticks, drawlines = false;

            if (m_labeledTicks.Display == TickDisplay.BothSides)
            {
                drawticks = true;
            }
            else
            {
                drawticks = (background && !m_layoutData.CameraPosition.LooksFromTop) ||
                            (!background && m_layoutData.CameraPosition.LooksFromTop);
            }
            x = xmin; y = ymin; z = zmin;
            float x2, y2, tickLen2 = tickLen;

            switch (m_layoutData.CameraPosition.Quadrant)
            {
            case CameraQuadrant.TopLeftFront:     // Q1
            case CameraQuadrant.BottomLeftFront:
                x  = xmin;
                x2 = xmin;
                y  = ymax;
                y2 = ymin;
                //tickLen2 *= -1.0f;
                break;

            case CameraQuadrant.TopLeftBack:      // Q2
            case CameraQuadrant.BottomLeftBack:
                x        = xmax;
                y        = ymax;
                x2       = xmin;
                y2       = ymax;
                tickLen *= -1.0f;
                break;

            case CameraQuadrant.TopRightBack:       // Q3
            case CameraQuadrant.BottomRightBack:
                x         = xmax;
                x2        = xmax;
                y         = ymin;
                y2        = ymax;
                tickLen  *= -1.0f;
                tickLen2 *= -1.0f;
                break;

            case CameraQuadrant.TopRightFront:
            case CameraQuadrant.BottomRightFront:      // Q4
            default:
                x         = xmin;
                x2        = xmax;
                y         = ymin;
                y2        = ymin;
                tickLen2 *= -1.0f;
                break;
            }
            if (background)
            {
                if (x == xmin)
                {
                    x = xmax;
                }
                else
                {
                    x = xmin;
                }
                if (y == ymin)
                {
                    y = ymax;
                }
                else
                {
                    y = ymin;
                }
                if (x2 == xmin)
                {
                    x2 = xmax;
                }
                else
                {
                    x2 = xmin;
                }
                if (y2 == ymin)
                {
                    y2 = ymax;
                }
                else
                {
                    y2 = ymin;
                }
                GL.Disable(EnableCap.DepthTest);
                if (m_farLines.Visible)
                {
                    drawlines = true;
                    ILOGLPanel.SetupLineStyle(m_farLines);
                }
            }
            else
            {
                if (m_nearLines.Visible)
                {
                    drawlines = true;
                    ILOGLPanel.SetupLineStyle(m_nearLines);
                }
            }
            if (drawlines)
            {
                GL.Begin(BeginMode.Lines);
                GL.Vertex3(x, y, z);
                z = zmax;
                GL.Vertex3(x, y, z);
                GL.Vertex3(x2, y2, z);
                z = zmin;
                GL.Vertex3(x2, y2, z);
                GL.End();
            }
            if (m_labeledTicks.Display == TickDisplay.BothSides || (!background && drawlines))
            {
                #region create ticks
                GL.Enable(EnableCap.DepthTest);
                if (background)
                {
                    GL.Color3(m_labeledTicks.FarColor);
                    tickLen  *= -1.0f;
                    tickLen2 *= -1.0f;
                }
                else
                {
                    GL.Color3(m_labeledTicks.NearColor);
                }
                GL.Disable(EnableCap.LineStipple);
                GL.Begin(BeginMode.Lines);
                foreach (LabeledTick tick in m_labeledTicks)
                {
                    if (tick.Position >= m_clipping.ZMin &&
                        tick.Position <= m_clipping.ZMax)
                    {
                        z = tick.Position;
                        GL.Vertex3(x, y, z);
                        x += tickLen;
                        GL.Vertex3(x, y, z);
                        x -= tickLen;
                        GL.Vertex3(x2, y2, z);
                        x2 += tickLen2;
                        GL.Vertex3(x2, y2, z);
                        x2 -= tickLen2;
                    }
                }
                GL.End();
                #endregion
            }
            if (background && m_grid.Visible)
            {
                drawGrid();
            }
        }
Ejemplo n.º 19
0
 public ILOGLSurfaceGraph (  ILOGLPanel panel, ILBaseArray X,
                             ILBaseArray Y, ILBaseArray Z, ILBaseArray C,
                             ILClippingData clippingContainer) 
                       : base(panel,X,Y,Z,C,clippingContainer) {
     m_indexReady = false; 
     m_vertexReady = false; 
 }