Esempio n. 1
0
        public void Draw(Graphics.ISceneContext sc)
        {
            using (var scope = sc.Push()) {
                scope.DepthTest       = false;
                scope.BackFaceCulling = true;

                DrawBox(sc, this.BoundingBox);

                scope.Color    = Color.Red;
                scope.Lighting = true;

                Geom.Point3d p   = sc.Camera.ScreenToCamera(_pos);
                double       len = _length * sc.Camera.LengthPerPixel;
                scope.MultMatrix(new Geom.HmMatrix3d(
                                     1, 0, 0, 0,
                                     0, 1, 0, 0,
                                     0, 0, 1, 0,
                                     p.x / len, p.y / len, 0, 1 / len
                                     ));
                scope.MultMatrix(sc.Camera.ViewingPos.r.ToMatrix());

                // デプスでソートし、奥から手前に向かって順に描画するようにする
                foreach (var scene in _components.OrderBy(s => s.GetDepth(sc)))
                {
                    scene.Draw(sc);
                }
            }
        }
Esempio n. 2
0
 public void Draw(Graphics.ISceneContext sc)
 {
     if (this.Direction == ClipDirections.None)
     {
         return;
     }
     using (var scope = sc.Push()) {
         var epsilon = 1.0e-3 * _docviews.WorldDocumentScene.BoundingSphere.Radius;
         var codsys  = _clip.CodSys;
         codsys.o -= epsilon * codsys.n;
         scope.MultMatrix(codsys);
         scope.Color     = Color.FromArgb(16, Color.Lime);
         scope.DepthMask = false;
         scope.Lighting  = false;
         var radius = _docviews.WorldDocumentScene.BoundingSphere.Radius;
         sc.DrawQuads(gl =>
         {
             gl.Vertex(radius, radius);
             gl.Vertex(-radius, radius);
             gl.Vertex(-radius, -radius);
             gl.Vertex(radius, -radius);
         });
         scope.Color = (_highlightIndex == -1) ? Color.Lime : Color.Orange;
         sc.DrawLineLoop(gl =>
         {
             gl.Vertex(radius, radius);
             gl.Vertex(-radius, radius);
             gl.Vertex(-radius, -radius);
             gl.Vertex(radius, -radius);
         });
     }
 }
Esempio n. 3
0
 public void Draw(Graphics.ISceneContext sc)
 {
     using (var scope = sc.Push()) { scope.Color = this.Color; _obj.Render(); }
 }