示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="geometry"></param>
        /// <param name="material"></param>
        public PointCloud(BaseGeometry geometry = null, Material material = null)
        {
            this.type = "PointCloud";

            this.Geometry = geometry ?? new Geometry();
            this.Material = material ?? new PointCloudMaterial();
        }
示例#2
0
 /// <summary>
 /// Create an YnMeshGeometry with a geometry and a material.
 /// </summary>
 /// <param name="geometry">Geometry to use.</param>
 /// <param name="material">Material to use with geometry.</param>
 public YnMeshGeometry(BaseGeometry <VertexPositionNormalTexture> geometry, BaseMaterial material)
     : base()
 {
     _geometry            = geometry;
     _material            = material;
     _worldMatrixIsMaster = false;
 }
示例#3
0
        private void calculate_Click(object sender, RoutedEventArgs e)
        {
            RouteLoadingPanel.Begin();
            BaseGeometry bg = GetItemByID("routing", "begin");

            GetBegionRoad(bg.Geometry.Coordinate.Y, bg.Geometry.Coordinate.X, 100);
        }
示例#4
0
 private void btnSquare_Click(object sender, EventArgs e)
 {
     if (PrepareNewInstance())
     {
         bg = new Square(ref win);
         win.SetGeometry(bg);
     }
 }
示例#5
0
        void rsc_GetBeginRoadCompleted(object sender, GetBeginRoadCompletedEventArgs e)
        {
            string[] strArray = e.Result[0].Split(new char[] { ',' });
            begin = int.Parse(strArray[2]);

            BaseGeometry bg = GetItemByID("routing", "last");

            GetLastRoad(bg.Geometry.Coordinate.Y, bg.Geometry.Coordinate.X, 1000);
        }
示例#6
0
 public override bool CanISelect()
 {
     if (BaseGeometry.LookingAngle2D(transform, Player.Instance.Move.Position()) < 70)
     {
         return(base.CanISelect());
     }
     else
     {
         return(false);
     }
 }
示例#7
0
文件: Mesh.cs 项目: vijirams/three.cs
        /// <summary>
        ///
        /// </summary>
        /// <param name="geometry"></param>
        /// <param name="material"></param>
        public Mesh(BaseGeometry geometry = null, Material material = null)
        {
            this.type = "Mesh";

            this.Geometry = geometry ?? new Geometry();
            this.Material = material ?? new MeshBasicMaterial()
            {
                Color = new Color().Random()
            };

            UpdateMorphTargets();
        }
示例#8
0
 private bool PrepareNewInstance()
 {
     if (win == null)
     {
         MessageBox.Show("Create the window first.", "Invalid Operation!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     if (bg != null)
     {
         bg.Dispose(new EventArgs());
         bg = null;
     }
     return(true);
 }
示例#9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Line(BaseGeometry geometry = null, Material material = null, int?type = null)
        {
            this.type = "Line";

            this.Geometry = geometry ?? new Geometry();
            this.Material = material ?? new LineBasicMaterial {
                Color = new Color().Random()
            };

            this.Mode = Three.LineStrip;
            if (null != type)
            {
                this.Mode = type.Value;
            }
        }
示例#10
0
        private void btnTexture_Click(object sender, EventArgs e)
        {
            if (PrepareNewInstance())
            {
                try
                {
                    bg = new BitMap(ref win);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Invalid Operation!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                win.SetGeometry(bg);
            }
        }
示例#11
0
        public static void Main(string[] _)
        {
            //new Input().Initialize(Input.ReadConsole).OnKey += (c) => { System.Console.WriteLine(c); };
            //camera.AddComponent(new Camera(60));
            camera = new Camera(60, new ConsoleRenderer(), new Dimensions2(30, 20)).DefaultObject();
            Scene scene = new Scene(camera.GetComponent <Camera>());

            camera.GetComponent <Camera>().renderer.renderMode = RenderMode.Shaded;
            EngineLoop e = new EngineLoop(scene, 10);

            e.RenderEvent += OnUpdate;                                 // Add the OnUpdate event for every time the camera renders

            cube1.AddComponent(new Mesh(BaseGeometry.CubeGeometry())); // Add a cube geometry to cube1
            cube1.GetComponent <Mesh>().color = new Color(1, 0, 1);    // Set the color of cube1's mesh
            cube1.worldPosition += new Point3(0, 0, 3);                // Change the worldPosition of cube1
            scene.objects.Add(cube1);                                  // Add cube1 to the scene

            camera.worldPosition = new Point3(0, -2, 0);
            camera.worldRotation = Quaternion.Euler(-30, 0, 0, Quaternion.AngleUnit.Degrees);
            //scene.light.color = Color.FromArgb(0, 255, 0);

            //cubeChild.parent = cube1; // Set the parent of cubeChild to be cube1
            cubeChild.localScale = new Direction3(0.5, 0.5, 1);
            cubeChild.AddComponent(new Mesh(BaseGeometry.CubeGeometry()));
            cubeChild.localPosition = new Point3(0, 0, 3);
            cubeChild.localRotation = Quaternion.Euler(145, 0, 0, Quaternion.AngleUnit.Degrees);
            cubeChild.GetComponent <Mesh>().color = new Color(0, 1, 1);

            SceneObject occ = new SceneObject();

            //occ.parent = cubeChild;
            occ.AddComponent(new Mesh(BaseGeometry.CubeGeometry()));
            occ.localPosition = new Point3(0, 0, 3);
            occ.GetComponent <Mesh>().color = new Color(0, 1, 0);
            occ.worldScale = new Direction3(1, 1, 1);
            //Tweener.TweenTo(ref cube1._localworldPosition,new Point3(0,0,0),5000);
            //scene.objects.Add(occ);

            //c.parent = o;*/
            //c.localworldPosition = new Point3(0, 0, 5);
            while (true)
            {
            }
        }
示例#12
0
    public bool GetOcclusion(GameObject obj, string[] ignore_tags)
    {
        RaycastHit hit;
        Vector3    direction = BaseGeometry.GetDirection(Player.Instance.Camera.transform.position, obj.transform.position);


        Debug.DrawRay(Player.Instance.Camera.transform.position, direction, Color.green);

        if (Physics.Raycast(Player.Instance.Camera.transform.position, direction, out hit, visible_layerMask))
        {
            Debug.Log(obj.name + " sound collides with - " + hit.collider.tag);

            switch (hit.collider.tag)
            {
            case "Wall":
            case "Door":
            case "Elevator":
            {
                if (IsEqual(hit.collider.tag, ignore_tags))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            default:
            {
                return(false);
            }
            }
        }
        else
        {
            return(false);
        }
    }
示例#13
0
 /// <summary>
 /// Create an YnMeshGeometry with a geometry and a BasicMaterial.
 /// </summary>
 /// <param name="geometry">Geometry to use.</param>
 /// <param name="textureName">Texture name to use with BasicMaterial</param>
 public YnMeshGeometry(BaseGeometry <VertexPositionNormalTexture> geometry, string textureName)
     : this(geometry, new BasicMaterial(textureName))
 {
 }
示例#14
0
 /// <summary>
 /// Create an YnMeshGeoemtry with a geometry and a BasicMaterial without texture.
 /// </summary>
 /// <param name="geometry"></param>
 public YnMeshGeometry(BaseGeometry <VertexPositionNormalTexture> geometry)
     : this(geometry, "")
 {
 }
示例#15
0
        private void ctlMap_MouseClick(object sender, MapMouseEventArgs e)
        {
            if (isbegin == true)
            {
                BaseGeometry bg = GetItemByID("routing", "begin");

                if (bg != null)
                {
                    LayerReset();
                }


                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "begin",
                    Label = "起点",
                });

                layer.Add(data);

                isbegin = false;
            }

            if (islast == true)
            {
                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "last",
                    Label = "终点",
                });

                layer.Add(data);


                DraggablePushpin dp = GetDCarByMSID("drapcar", carml);
                if (dp != null)
                {
                    GetBegionRoad(dp.Location.Latitude, dp.Location.Longitude, 100);
                }
                Dtimer.Begin();
                Ltimer.Begin();
                islast = false;
            }

            if (isbarrier == true)
            {
                //初始化一个图标

                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                GetBarrier(point.X, point.Y, 30);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "barrier",
                    Label = "障碍" + bn.ToString(),
                });

                layer.Add(data);

                isbarrier = false;
                bn++;
            }
        }
        public static void DrawRectangle(BaseGeometry.Vector Position, BaseGeometry.Vector Size)
        {
            GL.Begin(BeginMode.Quads);
            {
                GL.TexCoord2(0, 0);
                GL.Vertex3(Position.X, Position.Y, Position.Z);

                GL.TexCoord2(0, 1);
                GL.Vertex3(Position.X, Position.Y + Size.Y, Position.Z);

                GL.TexCoord2(1, 1);
                GL.Vertex3(Position.X + Size.X, Position.Y + Size.Y, Position.Z);

                GL.TexCoord2(1, 0);
                GL.Vertex3(Position.X + Size.X, Position.Y, Position.Z);
            }
            GL.End();
        }
示例#17
0
 /// <summary>
 /// Create an YnMeshGeometry with a geometry and a material.
 /// </summary>
 /// <param name="geometry">Geometry to use.</param>
 /// <param name="material">Material to use with geometry.</param>
 public YnMeshGeometry(BaseGeometry<VertexPositionNormalTexture> geometry, BaseMaterial material)
     : base()
 {
     _geometry = geometry;
     _material = material;
     _worldMatrixIsMaster = false;
 }
示例#18
0
        /// <summary>
        /// Create an YnMeshGeometry with a geometry and a BasicMaterial.
        /// </summary>
        /// <param name="geometry">Geometry to use.</param>
        /// <param name="textureName">Texture name to use with BasicMaterial</param>
        public YnMeshGeometry(BaseGeometry<VertexPositionNormalTexture> geometry, string textureName)
            : this(geometry, new BasicMaterial(textureName))
        {

        }
示例#19
0
        /// <summary>
        /// Create an YnMeshGeoemtry with a geometry and a BasicMaterial without texture.
        /// </summary>
        /// <param name="geometry"></param>
        public YnMeshGeometry(BaseGeometry<VertexPositionNormalTexture> geometry)
            : this(geometry, "")
        {

        }