コード例 #1
0
ファイル: LineRenderer.cs プロジェクト: lulzzz/3DpointCloud
 public void Draw(Renderer cam)
 {
     for (int i = 0; i < pt1List.Count; i++)
     {
         GLUtility.DrawLine(new GLPen(this.color, width), pt1List[i], pt2List[i]);
     }
 }
コード例 #2
0
 public void Draw(Renderer cam)
 {
     if (mean != null && covariance != null)
     {
         List <List <Vector2> > meanCpy = new List <List <Vector2> >(mean);
         foreach (List <Vector2> list in meanCpy)
         {
             if (drawMean)
             {
                 for (float i = width; i >= 0; i -= 0.1f)
                 {
                     GLUtility.DrawDiamond(new GLPen(meanColor, penThickness), list[0], i);
                 }
             }
             if (drawCov)
             {
                 try
                 {
                     GLUtility.DrawLineLoop(new GLPen(covColor, penThickness), covariance[meanCpy.IndexOf(list)].ToArray());
                 }
                 catch
                 { }
             }
         }
     }
 }
コード例 #3
0
        protected void plane(Vector3 horizontal, Vector3 vertical, bool isDragging, bool isHovering, Color color)
        {
            if (isDragging && this.isSnapping)
            {
                GL.Color(new Color(0f, 0f, 0f, 0.5f));
                float   num     = DevkitSelectionToolOptions.instance.snapPosition / base.transform.localScale.x;
                int     num2    = Mathf.Max(2, Mathf.CeilToInt(2f / num));
                Vector3 vector  = horizontal * num * (float)num2;
                Vector3 vector2 = vertical * num * (float)num2;
                for (int i = -num2; i <= num2; i++)
                {
                    Vector3 vector3 = horizontal * num * (float)i;
                    GLUtility.line(vector3 - vector2, vector3 + vector2);
                }
                for (int j = -num2; j <= num2; j++)
                {
                    Vector3 vector4 = vertical * num * (float)j;
                    GLUtility.line(vector4 - vector, vector4 + vector);
                }
            }
            GL.Color((!isDragging) ? ((!isHovering) ? color : Color.yellow) : Color.white);
            Vector3 vector5 = horizontal * 0.25f;
            Vector3 vector6 = vertical * 0.25f;

            GLUtility.line(vector5, vector5 + vector6);
            GLUtility.line(vector6, vector6 + vector5);
        }
コード例 #4
0
        protected override void BackendDraw(ReadOnlySpan <Vertex> vertices, Sampler sampler)
        {
            Rectangle viewport = new Rectangle();

            glGetIntegerv(GL_VIEWPORT, ref viewport.X);
            _transform.M11 = 2f / viewport.Width;
            _transform.M22 = -2f / viewport.Height;

            glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
            glBufferData(GL_ARRAY_BUFFER, vertices, GL_DYNAMIC_DRAW);
            GLUtility.CheckErrors(nameof(glBufferData));

            glBindVertexArray(_vertexArray);

            glUseProgram(_program);

            glUniformMatrix4fv(_vertTranformLocation, 1, false, ref _transform.M11);
            GLUtility.CheckErrors(nameof(glUniformMatrix4fv));

            glActiveTexture(GL_TEXTURE0);

            if (sampler is Texture texture)
            {
                glBindTexture(GL_TEXTURE_2D, (uint)texture.Handle);
            }

            glUniform1i(_fragSamplerLocation, 0);
            GLUtility.CheckErrors(nameof(glUniform1ui));

            glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
            glDrawElements(GL_TRIANGLES, (vertices.Length / 4) * 6, GL_UNSIGNED_SHORT, IntPtr.Zero);
            GLUtility.CheckErrors(nameof(glDrawElements));
        }
コード例 #5
0
        internal GLGraphicsContext(Func <string, IntPtr> getProcAddress, int maxVertices)
            : base(maxVertices)
        {
            glInit(getProcAddress, 4, 0);

            glClearColor(_clearColor.R, _clearColor.G, _clearColor.B, _clearColor.A);

            _vertexBuffer = glGenBuffer();
            glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
            glBufferData(GL_ARRAY_BUFFER, Vertex.SizeInBytes * maxVertices, IntPtr.Zero, GL_DYNAMIC_DRAW);
            GLUtility.CheckErrors(nameof(glBufferData));

            _vertexArray = glGenVertexArray();
            glBindVertexArray(_vertexArray);
            glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SizeInBytes, IntPtr.Zero);
            GLUtility.CheckErrors(nameof(glVertexAttribPointer));
            glVertexAttribPointer(1, 4, GL_FLOAT, false, Vertex.SizeInBytes, (IntPtr)Marshal.SizeOf <Vector3>());
            GLUtility.CheckErrors(nameof(glVertexAttribPointer));
            glVertexAttribPointer(2, 2, GL_FLOAT, false, Vertex.SizeInBytes, (IntPtr)(Marshal.SizeOf <Vector3>() + Marshal.SizeOf <Vector4>()));
            GLUtility.CheckErrors(nameof(glVertexAttribPointer));
            glEnableVertexAttribArray(0);
            glEnableVertexAttribArray(1);
            glEnableVertexAttribArray(2);

            ushort[] indices = new ushort[1024 * 6];
            for (ushort i = 0, vertex = 0; i < indices.Length; i += 6, vertex += 4)
            {
                indices[i]     = vertex;
                indices[i + 1] = (ushort)(vertex + 1);
                indices[i + 2] = (ushort)(vertex + 3);
                indices[i + 3] = (ushort)(vertex + 1);
                indices[i + 4] = (ushort)(vertex + 2);
                indices[i + 5] = (ushort)(vertex + 3);
            }

            _indexBuffer = glGenBuffer();
            glBindBuffer(GL_ARRAY_BUFFER, _indexBuffer);
            glBufferData(GL_ARRAY_BUFFER, sizeof(ushort) * indices.Length, indices, GL_STATIC_DRAW);
            GLUtility.CheckErrors(nameof(glBufferData));

            uint vertexShader   = GLUtility.CreateAndCompileShader(GL_VERTEX_SHADER, VertexShaderCode);
            uint fragmentShader = GLUtility.CreateAndCompileShader(GL_FRAGMENT_SHADER, FragmentShaderCode);

            _program = GLUtility.CreateAndLinkProgram(vertexShader, fragmentShader);

            _vertTranformLocation = glGetUniformLocation(_program, "vertTransform");
            _fragSamplerLocation  = glGetUniformLocation(_program, "fragSampler");

            glDisable(GL_CULL_FACE);
            glCullFace(GL_BACK);
            glFrontFace(GL_CW);

            glEnable(GL_BLEND);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

            glEnable(GL_DEPTH_TEST);
            glDepthFunc(GL_LEQUAL);

            glActiveTexture(GL_TEXTURE0);
        }
コード例 #6
0
 public void DrawSimulationResults(ITreeNode n, GLPen p)
 {
     for (int i = 0; i < n.SimulationPoints.Count - 1; i++)
     {
         GLUtility.DrawLine(p, n.SimulationPoints[i], n.SimulationPoints[i + 1]);
     }
 }
コード例 #7
0
        private void drawRect(int i, int j)
        {
            double x1, y1, x2, y2, x3, y3, x4, y4;

            float heightVal = (float)(grid.GetCellByIdx(i, j));

            if (heightVal >= .1)
            {
                grid.GetReals(i, j, out x1, out y1);
                grid.GetReals(i + 1, j, out x2, out y2);
                grid.GetReals(i, j + 1, out x3, out y3);
                grid.GetReals(i + 1, j + 1, out x4, out y4);
                //pen = new GLPen(ColorFromHeight(heightVal), 1f);

                //pen.GLApplyPen();
                //Gl.glVertex3f((float)x, (float)y, heightVal);
                //Gl.glVertex3f((float)x, (float)y, 0);

                GLUtility.Draw3DRectangle(new GLPen(ColorFromHeight(heightVal), 1f),
                                          new Vector3(x1, y1, heightVal),
                                          new Vector3(x2, y2, grid.GetCellByIdx(i + 1, j)),
                                          new Vector3(x3, y3, grid.GetCellByIdx(i, j + 1)),
                                          new Vector3(x4, y4, grid.GetCellByIdx(i + 1, j + 1)));
            }
        }
コード例 #8
0
 public void Draw()
 {
     GLUtility.GoToTransform((float)location.x, (float)location.y);
     GLUtility.GoToTransform((float)location.yaw);
     GLUtility.FillCone(renderColor, opacity, new PointF(0, 0), (float)range, (float)-fov / 2.0f, (float)fov / 2.0f);
     GLUtility.ComeBackFromTransform();
     GLUtility.ComeBackFromTransform();
 }
コード例 #9
0
 public void Draw(Renderer cam)
 {
     DrawNodeRecrusive(root);
     if (goal != null)
     {
         GLUtility.DrawCircle(goalPen, goal.Point, .1f);
         DrawBackFromParent(goal);
     }
 }
コード例 #10
0
 private static void handleGLRender()
 {
     foreach (DevkitHierarchyVolume devkitHierarchyVolume in PlayerClipVolumeSystem.volumes)
     {
         if (devkitHierarchyVolume.visibilityGroupOverride.isVisible)
         {
             GLUtility.matrix = devkitHierarchyVolume.transform.localToWorldMatrix;
             GLUtility.volumeHelper(devkitHierarchyVolume.isSelected, devkitHierarchyVolume.visibilityGroupOverride);
         }
     }
 }
コード例 #11
0
ファイル: SelectTool.cs プロジェクト: lulzzz/3DpointCloud
 public void Draw(Renderer r)
 {
     if (isActive)
     {
         GLUtility.DrawRectangle(new GLPen(Color.Red, 1.0f),
                                 new RectangleF((float)selectionRectangle.x,
                                                (float)selectionRectangle.y,
                                                (float)selectionRectangle.width,
                                                (float)selectionRectangle.height));
     }
 }
コード例 #12
0
 private void DrawChildren(SimpleTreeNode <Vector2> node)
 {
     foreach (SimpleTreeNode <Vector2> child in node.Children)
     {
         Vector2[] treeLine = new Vector2[2];
         treeLine[0] = node.Value;
         treeLine[1] = child.Value;
         GLUtility.DrawLines(new GLPen(Color.Blue, 1.0f), treeLine);
         DrawChildren(child);
     }
 }
コード例 #13
0
        public void Draw(Renderer cam)
        {
            Vector2 bodyPnt     = new Vector2(pose.x, pose.y);
            Vector2 bodyHeading = new Vector2(bodyPnt.X + Math.Cos(pose.yaw), bodyPnt.Y + Math.Sin(pose.yaw));

            GLUtility.DrawLineLoop(new GLPen(color, drawLineWidth), bodyPlygn.ToArray());

            // Draw heading
            GLUtility.DrawLine(new GLPen(Color.Red, drawLineWidth), bodyPnt, bodyHeading);
            // Draw the name
            GLUtility.DrawString(name, Color.Black, new PointF((float)bodyPnt.X, (float)bodyPnt.Y));
        }
コード例 #14
0
 private static void handleGLRender()
 {
     if (!WaterSystem.waterVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (WaterVolume waterVolume in WaterSystem.volumes)
     {
         GLUtility.matrix = waterVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(waterVolume.isSelected, WaterSystem.waterVisibilityGroup);
     }
 }
コード例 #15
0
        /// <summary>
        /// Draw the sketch pixels
        /// </summary>
        /// <param name="r"></param>
        #region sketch drawing code

        public void Draw(Renderer r)
        {
            if (pixelListWorld.Count > 0)
            {
                foreach (Vector4 v in pixelListWorld)
                {
                    PointF pixelPointWorld = new PointF((float)v.X, (float)v.Y);
                    pixelRect = new RectangleF((float)pixelPointWorld.X - pixelWidth / 2, (float)pixelPointWorld.Y - pixelWidth / 2, pixelWidth, pixelWidth);
                    GLUtility.FillRectangle(pen.color, pixelRect);
                }
            }
        }
コード例 #16
0
ファイル: DeadzoneSystem.cs プロジェクト: sky-xk-nge/Unturned
 private static void handleGLRender()
 {
     if (!DeadzoneSystem.deadzoneVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (DeadzoneVolume deadzoneVolume in DeadzoneSystem.volumes)
     {
         GLUtility.matrix = deadzoneVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(deadzoneVolume.isSelected, DeadzoneSystem.deadzoneVisibilityGroup);
     }
 }
コード例 #17
0
 // Token: 0x060008D5 RID: 2261 RVA: 0x0004DCA8 File Offset: 0x0004C0A8
 private static void handleGLRender()
 {
     if (!AmbianceSystem.ambianceVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (AmbianceVolume ambianceVolume in AmbianceSystem.volumes)
     {
         GLUtility.matrix = ambianceVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(ambianceVolume.isSelected, AmbianceSystem.ambianceVisibilityGroup);
     }
 }
コード例 #18
0
 private static void handleGLRender()
 {
     if (!KillVolumeSystem.killVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (KillVolume killVolume in KillVolumeSystem.volumes)
     {
         GLUtility.matrix = killVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(killVolume.isSelected, KillVolumeSystem.killVisibilityGroup);
     }
 }
コード例 #19
0
 // Token: 0x060009C6 RID: 2502 RVA: 0x000505A0 File Offset: 0x0004E9A0
 private static void handleGLRender()
 {
     if (!EffectVolumeSystem.effectVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (EffectVolume effectVolume in EffectVolumeSystem.volumes)
     {
         GLUtility.matrix = effectVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(effectVolume.isSelected, EffectVolumeSystem.effectVisibilityGroup);
     }
 }
コード例 #20
0
 private static void handleGLRender()
 {
     if (!LandscapeHoleSystem.holeVisibilityGroup.isVisible)
     {
         return;
     }
     foreach (LandscapeHoleVolume landscapeHoleVolume in LandscapeHoleSystem.volumes)
     {
         GLUtility.matrix = landscapeHoleVolume.transform.localToWorldMatrix;
         GLUtility.volumeHelper(landscapeHoleVolume.isSelected, LandscapeHoleSystem.holeVisibilityGroup);
     }
 }
コード例 #21
0
 protected void handleGLRender()
 {
     GLUtility.LINE_FLAT_COLOR.SetPass(0);
     GL.Begin(1);
     GLUtility.matrix = base.transform.localToWorldMatrix;
     this.arrow(new Vector3(this.inversion.x, 0f, 0f), this.drag == DevkitScaleHandle.EDevkitScaleHandleSelection.X, this.hover == DevkitScaleHandle.EDevkitScaleHandleSelection.X, Color.red);
     this.arrow(new Vector3(0f, this.inversion.y, 0f), this.drag == DevkitScaleHandle.EDevkitScaleHandleSelection.Y, this.hover == DevkitScaleHandle.EDevkitScaleHandleSelection.Y, Color.green);
     this.arrow(new Vector3(0f, 0f, this.inversion.z), this.drag == DevkitScaleHandle.EDevkitScaleHandleSelection.Z, this.hover == DevkitScaleHandle.EDevkitScaleHandleSelection.Z, Color.blue);
     GL.Color((this.drag != DevkitScaleHandle.EDevkitScaleHandleSelection.UNIFORM) ? ((this.hover != DevkitScaleHandle.EDevkitScaleHandleSelection.UNIFORM) ? Color.white : Color.yellow) : Color.white);
     GLUtility.boxWireframe(this.inversion * 0.125f, new Vector3(0.25f, 0.25f, 0.25f));
     GL.End();
 }
コード例 #22
0
        public void Draw(Renderer cam)
        {
            /*Gl.glPushMatrix();
             * Gl.glTranslatef(0f, 0f, 0.0f);
             * Gl.glScalef(50, 50, 0.0f);
             * Gl.glRotatef(0f, 0.0f, 0.0f, 1.0f);
             * Gl.glBindTexture(Gl.GL_TEXTURE_2D, textureID);
             * Gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
             * Gl.glCallList(textureGeom);
             * Gl.glPopMatrix();*/

            GLUtility.FillTexturedRectangle(textureID, new RectangleF(0f, 0f, 300f, 400f));
        }
コード例 #23
0
ファイル: PolygonTool.cs プロジェクト: lulzzz/3DpointCloud
        public void Draw(Renderer cam)
        {
            Vector2 lastPoint = currentPoints.Count > 0 ? currentPoints.ElementAt <Vector2>(0) : new Vector2();

            foreach (Vector2 p in currentPoints)
            {
                GLUtility.DrawCircle(new GLPen(Color.Chartreuse, 1.0f), new PointF((float)p.X, (float)p.Y), 0.25f);
                if (!p.Equals(currentPoints.ElementAt <Vector2>(0)))
                {
                    GLUtility.DrawLine(new GLPen(Color.Chartreuse, 1.0f), lastPoint, p);
                    lastPoint = p;
                }
            }
        }
コード例 #24
0
 protected void handleGLRender()
 {
     GLUtility.LINE_FLAT_COLOR.SetPass(0);
     GL.Begin(1);
     GLUtility.matrix = base.transform.localToWorldMatrix;
     this.plane(new Vector3(0f, this.inversion.y, 0f), new Vector3(0f, 0f, this.inversion.z), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_X, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_X, Color.red);
     this.plane(new Vector3(this.inversion.x, 0f, 0f), new Vector3(0f, 0f, this.inversion.z), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_Y, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_Y, Color.green);
     this.plane(new Vector3(this.inversion.x, 0f, 0f), new Vector3(0f, this.inversion.y, 0f), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_Z, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.PLANE_Z, Color.blue);
     GLUtility.matrix = Matrix4x4.TRS(base.transform.position, Quaternion.identity, base.transform.localScale);
     this.arrow(base.transform.right * this.inversion.x, GLUtility.getDirectionFromViewToArrow(MainCamera.instance.transform.position, base.transform.position, base.transform.right * this.inversion.x), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_X, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_X, Color.red);
     this.arrow(base.transform.up * this.inversion.y, GLUtility.getDirectionFromViewToArrow(MainCamera.instance.transform.position, base.transform.position, base.transform.up * this.inversion.y), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_Y, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_Y, Color.green);
     this.arrow(base.transform.forward * this.inversion.z, GLUtility.getDirectionFromViewToArrow(MainCamera.instance.transform.position, base.transform.position, base.transform.forward * this.inversion.z), this.drag == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_Z, this.hover == DevkitPositionHandle.EDevkitPositionHandleSelection.AXIS_Z, Color.blue);
     GL.End();
 }
コード例 #25
0
        public void Draw(Renderer r)
        {
            float lineWidth = selected ? 2.0f : 1.0f;

            PointF bodyPnt     = new PointF(x, y);
            PointF bodyHeading = new PointF(bodyPnt.X + (float)Math.Cos(heading), bodyPnt.Y + (float)Math.Sin(heading));

            GLUtility.DrawLineLoop(new GLPen(color, lineWidth), bodyPlygn.ToArray());

            GLUtility.FillTriangle(color, 0.6f, bodyPlygn[0].ToPointF(), bodyPlygn[1].ToPointF(), bodyPlygn[2].ToPointF());
            GLUtility.FillTriangle(color, 0.6f, bodyPlygn[2].ToPointF(), bodyPlygn[3].ToPointF(), bodyPlygn[0].ToPointF());

            // Draw heading
            //GLUtility.DrawLine(new GLPen(Color.Red, lineWidth), Vector2.FromPointF(bodyPnt), Vector2.FromPointF(bodyHeading));
            GLUtility.DrawLine(new GLPen(Color.Red, lineWidth), bodyPnt, bodyHeading);

            //// Draw the name
            //if (modeString.Equals(""))
            //    GLUtility.DrawString(MythName + ": " + name, Color.Black, bodyPnt);
            //else if (modeQualifier.Equals(""))
            //    GLUtility.DrawString(name + ": " + modeString, Color.Black, bodyPnt);
            //else// if (defaultRenderer != null)
            //{
            //    try
            //    {
            //        GLUtility.DrawStringMultiLine(name + ": " + modeString + '\n' + "NOTE: " + modeQualifier, Color.Black, bodyPnt, r.CurrentCamera);
            //    }
            //    catch { GLUtility.DrawString(name + ": " + modeString, Color.Black, bodyPnt); }
            //}//else
            ////    GLUtility.DrawString(name + ": " + modeString +  "(NOTE: " + modeQualifier + ")", Color.Black, bodyPnt);

            GLUtility.DrawString(name, Color.Black, bodyPnt);

            DrawFlagLine(x, y, color);
            if (drawCameraView && IsSelected)
            {
                PointF p1 = bodyPnt;
                PointF p2 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading - 0.5 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading - 0.5 * (cameraFOVangle * Math.PI / 180)));
                PointF p3 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading - 0.167 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading - 0.167 * (cameraFOVangle * Math.PI / 180)));
                PointF p4 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading + 0.167 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading + 0.167 * (cameraFOVangle * Math.PI / 180)));
                PointF p5 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading + 0.5 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading + 0.5 * (cameraFOVangle * Math.PI / 180)));

                GLUtility.FillTriangle(color, 0.1f, p1, p2, p3);
                GLUtility.FillTriangle(color, 0.1f, p1, p3, p4);
                GLUtility.FillTriangle(color, 0.1f, p1, p4, p5);
                //GLUtility.FillTriangle(Color.BlueViolet, 0.3f, p1, p2, p3);
                //GLUtility.FillTriangle(Color.Blue, 0.3f, p1, p3, p4);
                //GLUtility.FillTriangle(Color.Turquoise, 0.3f, p1, p4, p5);
            }
        }
コード例 #26
0
        public void Draw(Renderer cam)
        {
            //Console.WriteLine("trying to draw notepoint");
            PointF npCenter = new PointF((float)x, (float)y);

            GLUtility.DrawCircle(new GLPen(color, 0.25f), npCenter, .1f);
            GLUtility.DrawCircle(new GLPen(color, 0.25f), npCenter, .25f);


            GLUtility.DrawString(comments, Color.Black, npCenter);
            if (name != null)
            {
                GLUtility.DrawString(name, Color.Black, npCenter);
            }
        }
コード例 #27
0
 public void DrawNodeRecrusive(ITreeNode n)
 {
     if (n == null)
     {
         return;
     }
     //draw a link from this node to each of its children
     DrawSimulationResults(n, edgePen);
     foreach (ITreeNode c in n.Children)
     {
         GLUtility.DrawCircle(circPen, n.Point, .10f);
         //GLUtility.DrawLine(edgePen, n.Point, c.Point);
         DrawNodeRecrusive(c);
     }
 }
コード例 #28
0
ファイル: PointsRenderer.cs プロジェクト: lulzzz/3DpointCloud
        public void Draw(Renderer cam)
        {
            if (points == null)
            {
                return;
            }
            List <Vector2> copy = new List <Vector2>(points);

            lock (this.drawLock)
            {
                foreach (Vector2 v in copy)
                {
                    GLUtility.DrawCross(new GLPen(color, 1.0f), v, size);
                }
            }
        }
コード例 #29
0
        public void Draw(Renderer cam)
        {
            if (poses.Count == 0)
            {
                return;
            }
            lock (poses)
            {
                RobotPose lastPose = poses[0];
                foreach (RobotPose p in poses)
                {
                    GLUtility.DrawCross(pen, p.ToVector2(), .2f);
                    //GLUtility.DrawLine(pen, lastPose.ToVector2(), p.ToVector2());
                    lastPose = p;
                }

                if (poses[poses.Count - 1].covariance[0, 0] != 0)
                {
                    //calculate the error ellipse
                    Matrix cov = new Matrix(2, 2);
                    cov[0, 0] = poses[poses.Count - 1].covariance[0, 0];
                    cov[0, 1] = poses[poses.Count - 1].covariance[0, 1];
                    cov[1, 0] = poses[poses.Count - 1].covariance[1, 0];
                    cov[1, 1] = poses[poses.Count - 1].covariance[1, 1];

                    double theta = .5 * Math.Atan2((-2 * cov[0, 1]), (cov[0, 0] - cov[1, 1]));
                    if (Double.IsNaN(theta))
                    {
                        theta = 0;
                    }
                    double sigu2 = (cov[0, 0] * Math.Sin(theta) * Math.Sin(theta)) +
                                   (2 * cov[0, 1] * Math.Sin(theta) * Math.Cos(theta)) +
                                   (cov[1, 1] * Math.Cos(theta) * Math.Cos(theta));

                    double sigv2 = (cov[0, 0] * Math.Cos(theta) * Math.Cos(theta)) +
                                   (2 * cov[0, 1] * Math.Sin(theta) * Math.Cos(theta)) +
                                   (cov[1, 1] * Math.Sin(theta) * Math.Sin(theta));

                    GLUtility.GoToTransformXYZ((float)poses[poses.Count - 1].x, (float)poses[poses.Count - 1].y, 0);
                    GLUtility.GoToTransformYPR((float)theta, 0, 0);

                    GLUtility.DrawEllipse(ellipsePen, new RectangleF((float)-sigu2 / 2, (float)-sigv2 / 2, (float)sigu2, (float)sigv2));
                    GLUtility.ComeBackFromTransform();
                    GLUtility.ComeBackFromTransform();
                }
            }
        }
コード例 #30
0
        // Token: 0x06000B05 RID: 2821 RVA: 0x000579C0 File Offset: 0x00055DC0
        protected void circle(Vector3 horizontalAxis, Vector3 verticalAxis, bool isDragging, bool isHovering, Color color)
        {
            if (isDragging && this.isSnapping)
            {
                GL.Color(new Color(0f, 0f, 0f, 0.5f));
                float num  = this.angleOrigin + this.displayAngle;
                float num2 = 0.0174532924f * DevkitSelectionToolOptions.instance.snapRotation;
                int   num3 = Mathf.Max(1, Mathf.CeilToInt(1.57079637f / num2));
                for (int i = -num3; i <= num3; i++)
                {
                    float f  = num + (float)i * num2;
                    float d  = Mathf.Cos(f);
                    float d2 = Mathf.Sin(f);
                    GLUtility.line(horizontalAxis * d * 0.9f + verticalAxis * d2 * 0.9f, horizontalAxis * d * 1.1f + verticalAxis * d2 * 1.1f);
                }
            }
            GL.Color((!isDragging) ? ((!isHovering) ? color : Color.yellow) : Color.white);
            float   num4 = 6.28318548f;
            float   num5 = 0f;
            float   num6 = num4 / 32f;
            Vector3 v    = GLUtility.matrix.MultiplyPoint3x4(horizontalAxis);

            while (num5 < num4)
            {
                num5 += num6;
                float   f2     = Mathf.Min(num5, num4);
                float   d3     = Mathf.Cos(f2);
                float   d4     = Mathf.Sin(f2);
                Vector3 vector = GLUtility.matrix.MultiplyPoint3x4(horizontalAxis * d3 + verticalAxis * d4);
                GL.Vertex(v);
                GL.Vertex(vector);
                v = vector;
            }
            if (isDragging)
            {
                float   f3  = this.angleOrigin;
                float   d5  = Mathf.Cos(f3) * 1.5f;
                float   d6  = Mathf.Sin(f3) * 1.5f;
                Vector3 end = horizontalAxis * d5 + verticalAxis * d6;
                GLUtility.line(Vector3.zero, end);
                float   f4   = this.angleOrigin + this.displayAngle;
                float   d7   = Mathf.Cos(f4) * 1.5f;
                float   d8   = Mathf.Sin(f4) * 1.5f;
                Vector3 end2 = horizontalAxis * d7 + verticalAxis * d8;
                GLUtility.line(Vector3.zero, end2);
            }
        }