Esempio n. 1
0
        private void CheckBallPosition()
        {
            // Check ball position
            if (_round.Playing && !_resetPending)
            {
                TV_3DVECTOR linVel = _gameManager.CurrentLevel.Ball.GetLinVelocity();

                // Did player 2 score a goal?
                CheckForGoal(_gameManager.Player1, _gameManager.CurrentLevel.Player1GoalArea, _gameManager.CurrentLevel.Player1GoalHeight,
                             _gameManager.Player2);

                // Did player 1 score a goal?
                CheckForGoal(_gameManager.Player2, _gameManager.CurrentLevel.Player2GoalArea, _gameManager.CurrentLevel.Player2GoalHeight,
                             _gameManager.Player1);

                // Ball is not moving
                if (_gameManager.TvMaths.TVVec3Length(linVel) < 3f)
                {
                    _gameManager.Message.AddMessage(new Message("Ball too slow!", "", 3000), false);
                    _resetPending = true;
                    _resetTime    = _gameManager.TotalTimeElapsed;
                }

                // Ball has fallen down
                else if (_gameManager.CurrentLevel.Ball.GetPosition().y < -1000)
                {
                    _gameManager.Message.AddMessage(new Message("Ball gone!", "", 3000), false);
                    _resetPending = true;
                    _resetTime    = _gameManager.TotalTimeElapsed;
                }
            }
        }
Esempio n. 2
0
        public void Update(float posX, float posY)
        {
            TV_3DVECTOR oldPos = _gameManager.TvPhysics.GetBodyPosition(_physicsBody);

            if (MoveArea.IsPointInside(posX, posY))
            {
                // move the bat
                TV_3DVECTOR linVel = new TV_3DVECTOR();

                if (posY > oldPos.z)
                {
                    linVel.z = 100;
                }
                else if (posY < oldPos.z)
                {
                    linVel.z = -100;
                }

                if (posX > oldPos.x)
                {
                    linVel.x = 100;
                }
                else if (posX < oldPos.x)
                {
                    linVel.x = -100;
                }

                _gameManager.TvPhysics.SetBodyLinearVelocity(_physicsBody, linVel);
            }
        }
Esempio n. 3
0
        public void MoveX(float value)
        {
            TV_3DVECTOR position = Physics.GetBodyPosition(PhysicsId);

            position.x += value;
            Physics.SetBodyPosition(PhysicsId, position.x, position.y, position.z);
        }
Esempio n. 4
0
        public void Update(TVCamera camera)
        {
            TV_3DVECTOR position = camera.GetPosition();
            TV_3DVECTOR lookDir  = camera.GetLookAt() - camera.GetPosition();

            SoundEngine.SetListenerPosition(new Vector3D(position.x, position.y, position.z),
                                            new Vector3D(lookDir.x, lookDir.y, lookDir.z).Normalize());
        }
Esempio n. 5
0
        public TV_3DVECTOR GetMaxBBox()
        {
            TV_3DVECTOR minBB = new TV_3DVECTOR();
            TV_3DVECTOR maxBB = new TV_3DVECTOR();

            mesh.GetBoundingBox(ref minBB, ref maxBB);
            return(maxBB);
        }
Esempio n. 6
0
 private TV_3DVECTOR getDirection(Statistics statistics, TV_3DVECTOR targetPos)
 {
     var pos = statistics.Position;
     TV_3DVECTOR dVector = new TV_3DVECTOR();
     Game.Math.TVVec3Subtract(ref dVector, targetPos, pos);
     Game.Math.TVVec3Normalize(ref dVector, dVector);
     return dVector;
 }
Esempio n. 7
0
        public TV_3DVECTOR GetRealPos(WorldPosition WorldPos)
        {
            TV_3DVECTOR RealPos = new TV_3DVECTOR();

            RealPos.y = WorldPos.TilePosY; //As always, the easiest first !
            RealPos.x = (WorldPos.TileX < 0 ? (WorldPos.TileX + 1) : WorldPos.TileX) * (256 * MapTile.TileSize) + WorldPos.TilePosX;
            RealPos.z = (WorldPos.TileZ < 0 ? (WorldPos.TileZ + 1) : WorldPos.TileZ) * (256 * MapTile.TileSize) + WorldPos.TilePosZ;
            return(RealPos);
        }
Esempio n. 8
0
        public void ReLoad()
        {
            TV_3DVECTOR cameraPos = _gameManager.TvCamera.GetPosition();
            TV_3DVECTOR lookAtPos = _gameManager.TvCamera.GetLookAt();

            Unload();
            Load();
            _gameManager.TvCamera.SetPosition(cameraPos.x, cameraPos.y, cameraPos.z);
            _gameManager.TvCamera.SetLookAt(lookAtPos.x, lookAtPos.y, lookAtPos.z);
        }
Esempio n. 9
0
        public void RotateZ(float angle)
        {
            TV_3DVECTOR position = Physics.GetBodyPosition(PhysicsId);
            TV_3DMATRIX mat      = new TV_3DMATRIX();
            TV_3DMATRIX modyMat  = Physics.GetBodyMatrix(PhysicsId);

            MathLibrary.TVMatrixRotationZ(ref mat, angle);
            MathLibrary.TVMatrixMultiply(ref mat, modyMat, mat);
            Physics.SetBodyMatrix(PhysicsId, mat);
            Physics.SetBodyPosition(PhysicsId, position.x, position.y, position.z);
        }
Esempio n. 10
0
        public bool InteractsWith(Trigger target)
        {
            TV_3DVECTOR meshBBoxMin = new TV_3DVECTOR();
            TV_3DVECTOR meshBBoxMax = new TV_3DVECTOR();

            mesh.GetBoundingBox(ref meshBBoxMin, ref meshBBoxMax);
            return((meshBBoxMin.x < target.BoundingBoxMax.x) &&
                   (meshBBoxMax.x > target.BoundingBoxMin.x) &&
                   (meshBBoxMin.y < target.BoundingBoxMax.y) &&
                   (meshBBoxMax.y > target.BoundingBoxMin.y) &&
                   (meshBBoxMin.z < target.BoundingBoxMax.z) &&
                   (meshBBoxMax.z > target.BoundingBoxMin.z));
        }
Esempio n. 11
0
        private VECTOR3D GetDirection()
        {
            TV_3DVECTOR camPos    = Core.Camera.GetPosition();
            TV_3DVECTOR camLookAt = Core.Camera.GetLookAt();

            Core.Camera.SetPosition(Position.X, Position.Y, Position.Z);
            Core.Camera.SetLookAt(0f, 0f, 0f);
            TV_3DVECTOR camDirection = Core.Camera.GetDirection();

            Core.MathLibrary.TVVec3Normalize(ref camDirection, camDirection);
            Core.Camera.SetPosition(camPos.x, camPos.y, camPos.z);
            Core.Camera.SetLookAt(camLookAt.x, camLookAt.y, camLookAt.z);

            return(new VECTOR3D(camDirection.x, camDirection.y, camDirection.z));
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            var settings = new EngineSettings();

            settings.VSync         = true;
            settings.UseGlowEffect = true;
            //settings.UpdateFrequency = 1f / 60f;
            settings.MultiThreading  = true;
            settings.MultisampleType = Helpers.GetMultisample(Helpers.GameSettings.Antialiasing);
            settings.Fullscreen      = Helpers.GameSettings.FullScreen;
            settings.ScreenMode      = Helpers.GameSettings.ScreenMode;

            if (args.Length > 0)
            {
                var startupScene          = args[0];
                var startupCameraPosition = new TV_3DVECTOR(float.Parse(args[1], CultureInfo.InvariantCulture),
                                                            float.Parse(args[2], CultureInfo.InvariantCulture),
                                                            float.Parse(args[3], CultureInfo.InvariantCulture));
                var startupCameraLookAt = new TV_3DVECTOR(float.Parse(args[4], CultureInfo.InvariantCulture),
                                                          float.Parse(args[5], CultureInfo.InvariantCulture),
                                                          float.Parse(args[6], CultureInfo.InvariantCulture));
                settings.StartupScene          = startupScene;
                settings.StartupCameraPosition = startupCameraPosition;
                settings.StartupCameraLookAt   = startupCameraLookAt;
                settings.PreviewMode           = true;
                settings.Fullscreen            = false;
            }
            else
            {
                settings.StartupScene = "data/scenes/main.xml";
            }

            try
            {
                new Program().Run(settings);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                message += ex.StackTrace;
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        public PointLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            Position   = new VECTOR3D(position.x, position.y, position.z);
            this.Color = new MyColor();
            mesh       = core.Scene.CreateMeshBuilder();
            mesh       = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.pointLight), position.x, position.y,
                                                    position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);

            UniqueId = mesh.GetMeshName();
            Radius   = 30f;
            LightId  = core.LightEngine.CreatePointLight(position, 1f, 1f, 1f, Radius);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = core.GetName <PointLight>();
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            var settings = new EngineSettings();
            settings.VSync = true;
            settings.UseGlowEffect = true;
            //settings.UpdateFrequency = 1f / 60f;
            settings.MultiThreading = true;
            settings.MultisampleType = Helpers.GetMultisample(Helpers.GameSettings.Antialiasing);
            settings.Fullscreen = Helpers.GameSettings.FullScreen;
            settings.ScreenMode = Helpers.GameSettings.ScreenMode;

            if (args.Length > 0)
            {
                var startupScene = args[0];
                var startupCameraPosition = new TV_3DVECTOR(float.Parse(args[1], CultureInfo.InvariantCulture),
                    float.Parse(args[2], CultureInfo.InvariantCulture),
                    float.Parse(args[3], CultureInfo.InvariantCulture));
                var startupCameraLookAt = new TV_3DVECTOR(float.Parse(args[4], CultureInfo.InvariantCulture),
                    float.Parse(args[5], CultureInfo.InvariantCulture),
                    float.Parse(args[6], CultureInfo.InvariantCulture));
                settings.StartupScene = startupScene;
                settings.StartupCameraPosition = startupCameraPosition;
                settings.StartupCameraLookAt = startupCameraLookAt;
                settings.PreviewMode = true;
                settings.Fullscreen = false;
            }
            else
            {
                settings.StartupScene = "data/scenes/main.xml";
            }

            try
            {
                new Program().Run(settings);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                message += ex.StackTrace;
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 15
0
        public void RotateZAroundPoint(TV_3DVECTOR point, float angle)
        {
            TVMesh node = Scene.CreateMeshBuilder();

            node.SetPosition(point.x, point.y, point.z);
            mesh.AttachTo(CONST_TV_NODETYPE.TV_NODETYPE_MESH, node.GetIndex(), -1);
            TV_3DVECTOR nodePos = node.GetPosition();
            TV_3DMATRIX mat     = new TV_3DMATRIX();
            TV_3DMATRIX modyMat = node.GetMatrix();

            MathLibrary.TVMatrixRotationZ(ref mat, angle);
            node.SetRotationMatrix(mat);
            mesh.AttachTo(CONST_TV_NODETYPE.TV_NODETYPE_NONE, -1, -1);
            node.Destroy();
            mat = mesh.GetMatrix();
            Physics.SetBodyMatrix(PhysicsId, mat);
        }
Esempio n. 16
0
        //Get a position's height
        public float GetPositionHeight(WorldPosition Position)
        {
            int tilei = Position.TileX - WorldPos.TileX + RenderedTilesDistance;
            int tilej = Position.TileZ - WorldPos.TileZ + RenderedTilesDistance;

            if ((tilei >= 0) && (tilei <= 2 * RenderedTilesDistance) && (tilej >= 0) && (tilej <= 2 * RenderedTilesDistance))
            {
                TV_3DVECTOR RealPos = GetRealPos(Position);
                //return MapTiles[tilei][tilej].Landscape.GetHeight(Position.TilePosX, Position.TilePosZ);
                return(MapTiles[tilei][tilej].Landscape.GetHeight(RealPos.x, RealPos.z));
            }
            else
            {
                Debug.WriteLine("HEIGHT_NOT_FOUND");
                return(0);
            }
        }
Esempio n. 17
0
        private void MoveBat(Player player)
        {
            TV_3DVECTOR batPos   = player.Bat.GetPosition();
            Area        moveArea = player.Bat.MoveArea;

            if (_gameManager.TvInputEngine.IsKeyPressed(player.UpKey))
            {
                batPos.z += 0.001f;
            }
            if (_gameManager.TvInputEngine.IsKeyPressed(player.DownKey))
            {
                batPos.z -= 0.001f;
            }

            if (_gameManager.TvInputEngine.IsKeyPressed(player.LeftKey))
            {
                batPos.x -= 0.001f;
            }
            if (_gameManager.TvInputEngine.IsKeyPressed(player.RightKey))
            {
                batPos.x += 0.001f;
            }

            //make sure bat is inside area
            if (batPos.x < moveArea.X1)
            {
                batPos.x = moveArea.X1;
            }
            if (batPos.x > moveArea.X2)
            {
                batPos.x = moveArea.X2;
            }

            //make sure bat is inside area
            if (batPos.z < moveArea.Y1)
            {
                batPos.z = moveArea.Y1;
            }
            if (batPos.z > moveArea.Y2)
            {
                batPos.z = moveArea.Y2;
            }

            player.Update(batPos.x, batPos.z);
        }
Esempio n. 18
0
 public Sound(ICore core, string fileName)
     : base(core)
 {
     FileName = fileName;
     Name = core.GetName<Sound>();
     
     TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);
     Position = new VECTOR3D(position.x, position.y, position.z);
     Is3D = false;
     mySound = core.SoundFactory.Load(fileName, Is3D);
     core.SoundFactory.StopAllSounds();
     mesh = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.sound), position.x, position.y,
                                       position.z, 1.0f, 1.0f);
     mesh.SetAlphaTest(true); 
     Stopped = true;
     Loop = false;
     volume = 100;
     UniqueId = mesh.GetMeshName();
 }
Esempio n. 19
0
        public DirectionalLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            LightId = -1;
            Position = new VECTOR3D(position.x, position.y, position.z);
            Direction = GetDirection();
            this.Color = new MyColor();
            mesh = core.Scene.CreateMeshBuilder();
            mesh = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.directionalLight), position.x, position.y,
                                             position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);
            UniqueId = mesh.GetMeshName();

            LightId = core.LightEngine.CreateDirectionalLight(new TV_3DVECTOR(Direction.X, Direction.Y, Direction.Z), Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f, Helpers.SUN);
            //core.LightEngine.SetLightAttenuation(LightId, 1f, 0f, 0f);
            //core.LightEngine.SetSpecularLighting(true);
            //core.LightEngine.EnableLight(LightId, true);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = "DirectionalLight";
        }
Esempio n. 20
0
        public DirectionalLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            LightId    = -1;
            Position   = new VECTOR3D(position.x, position.y, position.z);
            Direction  = GetDirection();
            this.Color = new MyColor();
            mesh       = core.Scene.CreateMeshBuilder();
            mesh       = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.directionalLight), position.x, position.y,
                                                    position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);
            UniqueId = mesh.GetMeshName();

            LightId = core.LightEngine.CreateDirectionalLight(new TV_3DVECTOR(Direction.X, Direction.Y, Direction.Z), Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f, Helpers.SUN);
            //core.LightEngine.SetLightAttenuation(LightId, 1f, 0f, 0f);
            //core.LightEngine.SetSpecularLighting(true);
            //core.LightEngine.EnableLight(LightId, true);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = "DirectionalLight";
        }
Esempio n. 21
0
        public void Load(TV_3DVECTOR startPosition)
        {
            _startPos = startPosition;

            // Mesh
            _mesh = _gameManager.TvScene.CreateMeshBuilder();
            _mesh.CreateSphere(4.5f);

            _mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL);
            _mesh.SetMaterial(_gameManager.CurrentLevel.StandardMaterial);
            _mesh.ComputeNormalsEx();

            // Physics
            _physicsBody = _gameManager.TvPhysics.CreateMeshBody(0.01f, _mesh, CONST_TV_PHYSICSBODY_BOUNDING.TV_BODY_BOX);

            _gameManager.TvPhysics.SetBodyMaterialGroup(_physicsBody, 0);
            _gameManager.TvPhysics.SetDamping(_physicsBody, 0.00001f, new TV_3DVECTOR());

            _gameManager.TvPhysics.SetBodyPosition(_physicsBody, _startPos.x, _startPos.y, _startPos.z);
        }
Esempio n. 22
0
        /// <summary>
        /// Gets TV_3DVECTOR from string.
        /// </summary>
        public static TV_3DVECTOR GetVector3D(string value)
        {
            var result = new TV_3DVECTOR();

            string[] v = value.Split(' ');

            float f = 0f;

            float.TryParse(v[0], NumberStyles.Any, CultureInfo.InvariantCulture, out f);
            result.x = f;

            f = 0f;
            float.TryParse(v[1], NumberStyles.Any, CultureInfo.InvariantCulture, out f);
            result.y = f;

            f = 0f;
            float.TryParse(v[2], NumberStyles.Any, CultureInfo.InvariantCulture, out f);
            result.z = f;

            return(result);
        }
Esempio n. 23
0
        public bool goToTarget(Statistics statistics, TV_3DVECTOR targetPos)
        {
            TV_3DVECTOR vec = statistics.Position;
            if (getDistance(vec, targetPos) > 3)
            {
                float frameTime = Game.Engine.TimeElapsed();
                float movementSpeed = 0.1f;

                TV_3DVECTOR dV2 = new TV_3DVECTOR();
                float s = frameTime * movementSpeed;
                Game.Math.TVVec3Scale(ref dV2, getDirection(statistics, targetPos), s);

                Game.Math.TVVec3Add(ref vec, statistics.Position, dV2);
                vec.y = landscape.GetHeight(vec.x, vec.z);
                statistics.Position = vec;
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 24
0
        //[Browsable(false)]
        //public override VECTOR3D Rotation { get; set; }

        public Particle(ICore core, string fileName)
            : base(core)
        {
            this.core = core;
            FileName  = fileName;
            Visible   = true;
            Name      = core.GetName <Particle>();

            TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);

            Position = new VECTOR3D(position.x, position.y, position.z);
            mesh     = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.particleBig), position.x, position.y,
                                                  position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);

            particle = core.Scene.CreateParticleSystem();
            particle.Load(fileName);
            particle.SetGlobalPosition(Position.X, Position.Y, Position.Z);
            particle.SetGlobalRotation(Rotation.X, Rotation.Y, Rotation.Z);
            particle.SetGlobalScale(Scale.X, Scale.Y, Scale.Z);

            UniqueId = mesh.GetMeshName();
        }
Esempio n. 25
0
        public SkySphere(ICore core)
            : base(core)
        {
            this.core = core;
            Texture   = Helpers.GetTextureSourceFromResource(core, Resources.defaultTexture);
            core.Atmosphere.SkySphere_Enable(true);
            core.Atmosphere.SkyBox_Enable(false);
            core.Atmosphere.SkySphere_SetScale(1, 1, 1);
            Name             = "SkySphere";
            UniqueId         = Name;
            Core.IsSkySphere = true;
            Renderable       = false;

            float scaleX = 0, scaleY = 0, scaleZ = 0;

            core.Atmosphere.SkySphere_GetScale(ref scaleX, ref scaleY, ref scaleZ);
            Scale = new VECTOR3D(scaleX, scaleY, scaleZ);

            TV_3DVECTOR rotation = core.Atmosphere.SkySphere_GetRotation();

            Rotation = new VECTOR3D(rotation.x, rotation.y, rotation.z);

            PolyCount = core.Atmosphere.SkySphere_GetPolyCount();
        }
Esempio n. 26
0
        private void MoveVertical(int mouseAbsoluteX, int mouseAbsoluteY)
        {
            if (selectedObject != null)
            {
                TVMesh mesh = selectedObject.GetMesh();
                float pozX = 0f;
                float pozY = 0f;
                int mouseY = 0;
                var newPosition = core.Globals.Vector3(0, 0, 0);

                //TV_PLANE plane = new TV_PLANE();
                //core.Camera.GetFrustumPlanes(ref plane);

                core.MathLibrary.Project3DPointTo2D(mesh.GetPosition(), ref pozX, ref pozY, true);
                mouseY = (int)Math.Round(pozY);
                newPosition = mesh.GetPosition();
                newPosition.y = newPosition.y + (mouseY - mouseAbsoluteY) * 0.007f;

                if (mousePosition3D.x == 0f && mousePosition3D.y == 0f && mousePosition3D.z == 0f)
                {
                    initialPosition = TrimVector(mesh.GetPosition());
                    core.MathLibrary.TVVec3Subtract(ref mousePosition3D, mesh.GetPosition(), newPosition);
                }
                newPosition = TrimVector(core.MathLibrary.VAdd(newPosition, mousePosition3D));

                SnapToGrid(newPosition);

                selectedObject.Position = new VECTOR3D(newPosition.x, newPosition.y, newPosition.z);
                selectedObject.Update();
                propertyGrid.SelectedObject = selectedObject;
            }
        }
Esempio n. 27
0
 public void SetDirection(TV_3DVECTOR direction)
 {
     SetDirection(direction.x, direction.y, direction.z);
 }
Esempio n. 28
0
 public Vector3D(TV_3DVECTOR vector)
     : this(vector.x, vector.y, vector.z)
 {
 }
Esempio n. 29
0
 public void SetPosition(TV_3DVECTOR position)
 {
     SetPosition(position.x, position.y, position.z);
 }
Esempio n. 30
0
 public void SetLookAt(TV_3DVECTOR lookAt)
 {
     SetLookAt(lookAt.x, lookAt.y, lookAt.z);
 }
Esempio n. 31
0
 public override void GetBoundingBox(ref TV_3DVECTOR min, ref TV_3DVECTOR max)
 {
 }
Esempio n. 32
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            this.Text = string.Format("{0} {1}", Helpers.PROGRAM_NAME, Helpers.PROGRAM_VERSION);
            Helpers.CreateDataPaths(Application.StartupPath);

            Settings = Helpers.LoadSettings();
            LoadObjectInObjectsTreeView(Path.Combine(Application.StartupPath, Settings.FolderBase));
            InitialiseSceneTreeView();

            core = new Core(pnlRenderer.Handle, Settings);
            selectedTool = Tool.None;
            mousePosition3D = core.Globals.Vector3(0, 0, 0);
            initialPosition = core.Globals.Vector3(0, 0, 0);
            sceneFileName = string.Empty;
            defaultProductName = Text;
            btnSnap.Checked = Settings.SnapToGrid;
            allMeshes = new List<Engine.Mesh>();

            Show();
            Focus();
            doLoop = true;

            MainLoop();
        }
Esempio n. 33
0
 private void Helper(TV_3DVECTOR position)
 {
     Helper(position, CONST_TV_COLORKEY.TV_COLORKEY_MAGENTA);
 }
Esempio n. 34
0
        private TV_3DVECTOR TrimVector(TV_3DVECTOR vector)
        {
            if (Settings.SnapToGrid)
            {
                vector.x = (float)Math.Round(vector.x);
                vector.y = (float)Math.Round(vector.y);
                vector.z = (float)Math.Round(vector.z);
            }

            return vector;
        }
Esempio n. 35
0
 public TV_3DVECTOR getPosition(string uniqueName)
 {
     TV_3DVECTOR pos = creatures[uniqueName].Statistics.Position;
     TV_3DVECTOR newPos = new TV_3DVECTOR(pos.x, landscape.GetHeight(pos.x, pos.z), pos.z);
     return newPos;
 }
Esempio n. 36
0
 public void SetPosition(float x, float y, float z)
 {
     Position = new TV_3DVECTOR(x, y, z);
     LightEngine.SetLightPosition(LightId, x, y, z);
 }
Esempio n. 37
0
 public void Load()
 {
     _camerapos = _gameManager.TvCamera.GetPosition();
 }
Esempio n. 38
0
 public VECTOR3D(TV_3DVECTOR vec)
 {
     this.x = vec.x;
     this.y = vec.y;
     this.z = vec.z;
 }
Esempio n. 39
0
        private void UpdateInput()
        {
            try
            {
                int mouseRelativeX = 0;
                int mouseRelativeY = 0;
                int mouseAbsoluteX = 0;
                int mouseAbsoluteY = 0;
                int mouseScroll = 0;
                bool mouseB1 = false;
                bool mouseB2 = false;
                bool mouseB3 = false;
                bool mouseB4 = false;

                core.Input.GetMouseState(ref mouseRelativeX, ref mouseRelativeY, ref mouseB1, ref mouseB2, ref mouseB3,
                                         ref mouseB4, ref mouseScroll);
                core.Input.GetAbsMouseState(ref mouseAbsoluteX, ref mouseAbsoluteY, ref mouseB1, ref mouseB2,
                                            ref mouseB3);
                core.CollisionResult = core.Scene.MousePick(mouseAbsoluteX, mouseAbsoluteY,
                                                            (int)CONST_TV_OBJECT_TYPE.TV_OBJECT_MESH);

                FPSCamera(0, 0, mouseScroll, false);
                if (mouseB1 && !core.PreviewingScene)
                {
                    if (selectedTool == Tool.None && core.CollisionResult.IsCollision())
                    {
                        DeselectAllObjects();

                        TVMesh colMesh = core.CollisionResult.GetCollisionMesh();
                        selectedObject = core.GetObjectByUniqueId(colMesh.GetMeshName());

                        selectedObject.Select();
                        propertyGrid.SelectedObject = selectedObject;
                    }

                    if (selectedObject != null)
                    {
                        if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTCONTROL) && !creatingObjectCopy)
                        {
                            creatingObjectCopy = true;
                            selectedObject = CreateObjectCopy(selectedObject);
                        }

                        switch (selectedTool)
                        {
                            case Tool.MoveHorizontal:
                                MoveHorizontal(mouseAbsoluteX, mouseAbsoluteY);
                                break;
                            case Tool.MoveVertical:
                                MoveVertical(mouseAbsoluteX, mouseAbsoluteY);
                                break;
                        }
                    }
                }
                else if (core.PreviewingScene)
                {
                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_ESCAPE))
                    {
                        core.PreviewingScene = false;
                        PrepareObjectsForPreview(false);
                        Thread.Sleep(200);
                    }
                    else if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_F6))
                    {
                        PreviewReset();
                    }
                    else
                    {
                        Cursor.Position = oldMousePosition;
                        pnlRenderer.Focus();
                        core.Engine.ShowWinCursor(false);
                        core.SoundFactory.StartAllSounds();
                        FPSCamera(mouseRelativeX, mouseRelativeY, mouseScroll, true);
                    }
                }
                else if (mouseB2)
                {
                    Cursor.Position = oldMousePosition;
                    pnlRenderer.Focus();
                    core.Engine.ShowWinCursor(false);
                    core.SoundFactory.StartAllSounds();
                    FPSCamera(mouseRelativeX, mouseRelativeY, mouseScroll, true);
                }
                else
                {
                    if (selectedTool != Tool.None)
                    {
                        DeselectAllObjects();

                        if (core.CollisionResult.IsCollision())
                        {
                            ChangeMouseCursor();
                            mousePosition3D = core.Globals.Vector3(0, 0, 0);
                            TVMesh colMesh = core.CollisionResult.GetCollisionMesh();
                            selectedObject = core.GetObjectByUniqueId(colMesh.GetMeshName());
                            selectedObject.Select();
                            propertyGrid.SelectedObject = selectedObject;
                        }
                        else
                        {
                            Cursor = Cursors.Default;
                        }
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_DELETE))
                    {
                        RemoveSelectedObject();
                    }
                    else if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_ESCAPE) ||
                             core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_SPACE))
                    {
                        core.PreviewingScene = false;
                        selectedTool = Tool.None;
                        Cursor = Cursors.Default;
                        DeselectAllObjects();
                    }
                    else if (!core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_LEFTCONTROL))
                    {
                        creatingObjectCopy = false;
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_Q))
                    {
                        SelectHorizontalTool();
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_E))
                    {
                        SelectVerticalTool();
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_C))
                    {
                        PutObjectOnGround();
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_F6))
                    {
                        StartPreview();
                    }

                    if (core.Input.IsKeyPressed(CONST_TV_KEY.TV_KEY_F5))
                    {
                        RunProgram();
                    }

                    oldMousePosition = Cursor.Position;
                    core.Engine.ShowWinCursor(true);
                    core.SoundFactory.StopAllSounds();
                    UpdateMenu();
                }

                // Update all objects if not scene preview.
                if (!core.PreviewingScene)
                    core.AllObjects.ForEach(o => o.Update());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 40
0
 private void setPosition(TV_3DVECTOR position)
 {
     tvActor.SetPosition(position.x, position.y, position.z);
 }
Esempio n. 41
0
 public void Move(TV_3DVECTOR target)
 {
     Move(target.x, target.y, target.z);
 }
Esempio n. 42
0
 public static Vector3 ToVector3(this TV_3DVECTOR vector)
 {
     return(new Vector3(vector.x, vector.y, vector.z));
 }
        //*** Render Method
        private void SetupScene(IntPtr hWnd)
        {
            TV_3DVECTOR Min = new TV_3DVECTOR();
            TV_3DVECTOR Max = new TV_3DVECTOR();
            TV_3DVECTOR Offset = new TV_3DVECTOR();
            TV_3DVECTOR SphereCenter = new TV_3DVECTOR();
            TV_3DVECTOR posVector = new TV_3DVECTOR();

            TV = new TVEngine();
            Scene = new TVScene();
            Cam = new TVCamera();
            TF = new TVTextureFactory();
            Mats = new TVMaterialFactory();
            Lights = new TVLightEngine();
            Maths = new TVMathLibrary();

            //Initialize the TV engine
            TV.SetDebugFile(Application.StartupPath + "\\debug.txt");
            TV.Init3DWindowed(hWnd, true);
            TV.SetSearchDirectory(Application.StartupPath);
            TV.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);  // use degree system

            Scene.SetBackgroundColor(0.6f, 0.6f, 0.6f);

            //Load the texture into the integer ID holder
            FloorTex = TF.LoadTexture("smallGrid.bmp", "Grid", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true);
            WallTex = TF.LoadTexture("smallGridWall.bmp", "Wall", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true);

            Room = Scene.CreateMeshBuilder("Room");
            Room.AddFloor(FloorTex, -300.0f, -300.0f, 300.0f, 300.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, -300.0f, 300.0f, 300.0f, 300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, 300.0f, -300.0f, -300.0f, -300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, 300.0f, 300.0f, 300.0f, -300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, -300.0f, -300.0f, -300.0f, 300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            //ShowVector("RoomLocal", Room.GetPosition());
            //ShowVector("RoomWorld", Room.GetWorldPosition(Room.GetPosition()));

            SensorNode = Scene.CreateMeshBuilder("SensorNode");
            SensorNode.LoadXFile("N70.X", true, true);
            SensorNode.SetParent(CONST_TV_NODETYPE.TV_NODETYPE_MESH, Room.GetIndex(), 1);
            SensorNode.SetPosition(0.0f, 150.0f, 0.0f);
            TV_3DVECTOR oriScale = SensorNode.GetScale();
            SensorNode.SetScale(oriScale.x, oriScale.y, oriScale.z * 1.5f);
            SensorNode.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL, 0, 1);
            SensorNode.SetRotation(90.0f, 0.0f, 0.0f);
            //SensorNode.GetBoundingBox(ref Min, ref Max, true);
            //SensorNode.ShowBoundingBox(true);
            //ShowVector("MoteLocal", SensorNode.GetPosition());
            //ShowVector("MoteWorld", Room.GetWorldPosition(SensorNode.GetPosition()));

            //WiimoteMesh = Scene.CreateMeshBuilder("Wiimote");
            //WiimoteMesh.LoadXFile("Wiimote.X", true, true);
            //TV_3DVECTOR oriScale = WiimoteMesh.GetScale();
            //WiimoteMesh.SetScale(oriScale.x * 0.15f, oriScale.y * 0.15f, oriScale.z * 0.15f);
            //WiimoteMesh.SetPosition(0.0f, 70.0f, 0.0f);
            //WiimoteMesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL, 0, 1);//Tell TV we want normal, per-vertex, lighting with 1 point light.

            Cam.SetParent(CONST_TV_NODETYPE.TV_NODETYPE_MESH, Room.GetIndex(), 0);
            Cam.SetPosition(0.0f, 250.0f, 200.0f);
            Cam.LookAtMesh(SensorNode);
            //ShowVector("CamLocal", Cam.GetPosition());
            //ShowVector("CamWorld", Room.GetWorldPosition(Cam.GetPosition()));

            //Create a point light. Again, these can be more complex.
            IDLight = Lights.CreatePointLight(new TV_3DVECTOR(0.0f, 250.0f, 200.0f), 0.9f, 0.9f, 0.9f, 250.0f);
            IDBackLight = Lights.CreatePointLight(new TV_3DVECTOR(0.0f, 250.0f, -200.0f), 0.1f, 0.1f, 0.1f, 250.0f);
            Lights.SetSpecularLighting(false);
        }
Esempio n. 44
0
 public void SetPosition(TV_3DVECTOR position)
 {
     SetPosition(position.x, position.y, position.z);
 }
 private void ShowVector(string name, TV_3DVECTOR vector)
 {
     MessageBox.Show(name + " X : " + vector.x + " Y : " + vector.y + " Z : " + vector.z);
 }
Esempio n. 46
0
 public VECTOR3D(TV_3DVECTOR vec)
 {
     this.x = vec.x;
     this.y = vec.y;
     this.z = vec.z;
 }
Esempio n. 47
0
        public override void Update(GameTime time)
        {
            TV_COLLISIONRESULT collResult = new TV_COLLISIONRESULT();
            if (mouseEvent.Click() &&
                Game.Scene.MousePickEx(inputManager.MouseAbsX, inputManager.MouseAbsY, ref collResult) &&
                !windowService.clickInWindowArea())
            {
                try
                {
                    controlService.turnToTargetDirection(playerService.getStatistics(), CollisionFactory.getDetectCollision(collResult));
                    targetPos = collResult.vCollisionImpact;
                }
                catch
                {

                }
            }
            if (controlService.goToTarget(playerService.getStatistics(), targetPos))
            {
                animationService.changeAnimation(CharacterAnimationState.RUN, CharacterName.PLAYER);
            }
            else
            {
                animationService.changeAnimation(CharacterAnimationState.IDLE, CharacterName.PLAYER);
            }
            base.Update(time);
        }
Esempio n. 48
0
        private void MoveHorizontal(int mouseAbsoluteX, int mouseAbsoluteY)
        {
            if (selectedObject != null)
            {
                TVMesh mesh = selectedObject.GetMesh();
                var vecNearRay = core.Globals.Vector3(0, 0, 0);
                var vecFarRay = core.Globals.Vector3(0, 0, 0);
                core.MathLibrary.GetMousePickVectors(mouseAbsoluteX, mouseAbsoluteY, ref vecNearRay, ref vecFarRay);
                TV_3DVECTOR newPosition = core.MathLibrary.IntersectionXZPlane(mesh.GetPosition().y, vecNearRay,
                                                                               vecFarRay);

                if (mousePosition3D.x == 0f && mousePosition3D.y == 0f && mousePosition3D.z == 0f)
                {
                    initialPosition = TrimVector(mesh.GetPosition());
                    core.MathLibrary.TVVec3Subtract(ref mousePosition3D, mesh.GetPosition(), newPosition);
                }
                newPosition = TrimVector(core.MathLibrary.VAdd(newPosition, mousePosition3D));

                SnapToGrid(newPosition);

                selectedObject.Position = new VECTOR3D(newPosition.x, newPosition.y, newPosition.z);
                selectedObject.Update();
                propertyGrid.SelectedObject = selectedObject;
            }
        }
Esempio n. 49
0
        //Metoda vracejici vytvoreny cylinder
        private TVMesh Cylinder(float Radius, float Height, int Sides, float xm, float ym, float zm, int textureVyskaNasobek, int textureSirkaNasobek)
        {
            TVMesh p = new TVMesh();
            p = Scene.CreateMeshBuilder();
            //Scene.SetRenderMode(CONST_TV_RENDERMODE.TV_LINE);

            double Theta;
            float Inc;
            float x, y, z;
            TV_3DVECTOR n;
            float tu, tv;
            float UStep;
            int sign;

            p.SetPrimitiveType(CONST_TV_PRIMITIVETYPE.TV_TRIANGLESTRIP);
            Inc = (float)((2 * Math.PI) / Sides);
            Theta = 0;
            UStep = (float)(1 / (float)Sides);
            tu = 0;
            sign = -1;

            //Making bottom cap
            for (int i = 1; i <= Sides; i++)
            {
                x = Radius * (float)Math.Cos(sign * Theta);
                y = Height;
                z = Radius * (float)Math.Sin(sign * Theta);

                tu = 0.5f * (float)Math.Cos(sign * Theta) + 0.5f;
                tv = 0.5f * (float)Math.Sin(sign * Theta) + 0.5f;

                p.AddVertex(x - xm, 0 - ym, z - zm, 0, -1, 0, tu, tv);

                if (sign == 1)
                    sign = -1;
                else
                {
                    sign = 1;
                    Theta = Theta + Inc;
                }

            }

            // Making cylinder
            for (int i = 0; i <= Sides; i++)
            {
                x = Radius * (float)Math.Cos(Theta);
                y = Height;
                z = Radius * (float)Math.Sin(Theta);

                n = new TV_3DVECTOR(x, 0, y);
                p.AddVertex(x - xm, 0 - ym, z - zm, n.x, n.y, n.z, 0, 0);
                p.AddVertex(x - xm, y - ym, z - zm, n.x, n.y, n.z, 0, 0);
                Theta = Theta + Inc;

                tu = tu + UStep * textureSirkaNasobek;

            }

            Theta = Math.PI;
            sign = 1;
            //Making top cap
            for (int i = 1; i <= Sides; i++)
            {
                x = Radius * (float)Math.Cos(sign * Theta);
                y = Height;
                z = Radius * (float)Math.Sin(sign * Theta);

                tu = 0.5f * (float)Math.Cos(sign * Theta) + 0.5f;
                tv = 0.5f * (float)Math.Sin(sign * Theta) + 0.5f;

                p.AddVertex(x - xm, y - ym, z - zm, 0, 1, 0, tu, tv);

                if (sign == 1)
                {
                    sign = -1;
                    Theta = Theta + Inc;
                }
                else
                    sign = 1;

            }

            return p;
        }
Esempio n. 50
0
 public void setCamera(TV_3DVECTOR position, TV_3DVECTOR lookAt)
 {
     setPosition(position);
     setlookAt(lookAt);
 }
Esempio n. 51
0
 public void Move(TV_3DVECTOR target)
 {
     Move(target.x, target.y, target.z);
 }
Esempio n. 52
0
 public void setlookAt(TV_3DVECTOR lookAt)
 {
     setlookAt(new Vector3D(lookAt));
 }
Esempio n. 53
0
 public void SetPosition(float x, float y, float z)
 {
     Position = new TV_3DVECTOR(x, y, z);
     LightEngine.SetLightPosition(LightId, x, y, z);
 }
Esempio n. 54
0
 public void setPosition(TV_3DVECTOR position)
 {
     setPosition(new Vector3D(position));
 }
Esempio n. 55
0
 public override void GetBoundingBox(ref TV_3DVECTOR min, ref TV_3DVECTOR max)
 {
 }
Esempio n. 56
0
 public TV_3DVECTOR GetRealPos(WorldPosition WorldPos)
 {
     TV_3DVECTOR RealPos = new TV_3DVECTOR();
     RealPos.y = WorldPos.TilePosY; //As always, the easiest first !
     RealPos.x = (WorldPos.TileX < 0 ? (WorldPos.TileX + 1) : WorldPos.TileX) * (256 * MapTile.TileSize) + WorldPos.TilePosX;
     RealPos.z = (WorldPos.TileZ < 0 ? (WorldPos.TileZ + 1) : WorldPos.TileZ) * (256 * MapTile.TileSize) + WorldPos.TilePosZ;
     return RealPos;
 }
 private void BaseForm_KeyDown(object sender, KeyEventArgs e)
 {
     TV_3DVECTOR targetVector = new TV_3DVECTOR();
     switch (e.KeyCode)
     {
         case Keys.Space:
             // set position and angle to Zero
             SensorNode.SetRotation(0.0f, 0.0f, 0.0f);
             break;
         case Keys.D1:
         case Keys.NumPad1:
             // change camera view : top view
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x, targetVector.y + 150.0f, targetVector.z);
             Lights.SetLightPosition(IDLight, targetVector.x, targetVector.y + 150.0f, targetVector.z);
             Lights.SetLightRange(IDLight, 150.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x, targetVector.y - 150.0f, targetVector.z);
             Lights.SetLightRange(IDBackLight, 150.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D2:
         case Keys.NumPad2:
             // change camera view : up 45 degree view
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x + 150.0f, targetVector.y + 100.0f, targetVector.z + 150.0f);
             Lights.SetLightPosition(IDLight, targetVector.x + 150.0f, targetVector.y + 100.0f, targetVector.z + 150.0f);
             Lights.SetLightRange(IDLight, 300.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x + 150.0f, targetVector.y + 100.0f, targetVector.z - 150.0f);
             Lights.SetLightRange(IDBackLight, 300.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D3:
         case Keys.NumPad3:
             // change camera view : up 45 degree close view
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x, targetVector.y + 100.0f, targetVector.z + 200.0f);
             Lights.SetLightPosition(IDLight, targetVector.x, targetVector.y + 100.0f, targetVector.z + 200.0f);
             Lights.SetLightRange(IDLight, 300.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x, targetVector.y + 100.0f, targetVector.z - 200.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D4:
         case Keys.NumPad4:
             // change camera view : right view
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x, targetVector.y, targetVector.z + 150.0f);
             Lights.SetLightPosition(IDLight, targetVector.x, targetVector.y, targetVector.z + 150.0f);
             Lights.SetLightRange(IDLight, 250.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x, targetVector.y, targetVector.z - 150.0f);
             Lights.SetLightRange(IDBackLight, 250.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D5:
         case Keys.NumPad5:
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x, targetVector.y, targetVector.z - 150.0f);
             Lights.SetLightPosition(IDLight, targetVector.x, targetVector.y, targetVector.z - 150.0f);
             Lights.SetLightRange(IDLight, 250.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x, targetVector.y, targetVector.z + 150.0f);
             Lights.SetLightRange(IDBackLight, 250.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D6:
         case Keys.NumPad6:
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x - 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightPosition(IDLight, targetVector.x - 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightRange(IDLight, 250.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x + 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightRange(IDBackLight, 250.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.D7:
         case Keys.NumPad7:
             targetVector = Room.GetWorldPosition(SensorNode.GetPosition());
             Cam.SetPosition(targetVector.x + 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightPosition(IDLight, targetVector.x + 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightRange(IDLight, 250.0f);
             Lights.SetLightPosition(IDBackLight, targetVector.x - 150.0f, targetVector.y, targetVector.z);
             Lights.SetLightRange(IDBackLight, 250.0f);
             Cam.LookAtMesh(SensorNode);
             break;
         case Keys.C:
             Room.RotateY(5.0f, true);
             break;
         case Keys.Z:
             Room.RotateY(-5.0f, true);
             break;
         case Keys.B:
             SensorNode.RotateY(5.0f, true);
             break;
         case Keys.M:
             SensorNode.RotateY(-5.0f, true);
             break;
         case Keys.H:
             SensorNode.RotateX(5.0f, true);
             break;
         case Keys.N:
             SensorNode.RotateX(-5.0f, true);
             break;
         case Keys.O:
             posLog.WriteLine("Break Point");
             break;
         case Keys.K:
             posLogFlag = true;
             posLog.WriteLine("Logging Start");
             break;
         case Keys.L:
             posLogFlag = false;
             posLog.WriteLine("Logging End");
             break;
         default:
             break;
     }
 }
Esempio n. 58
0
 public void SetLookAt(TV_3DVECTOR lookAt)
 {
     SetLookAt(lookAt.x, lookAt.y, lookAt.z);
 }
Esempio n. 59
0
 private float getDistance(TV_3DVECTOR player, MTV3D65.TV_3DVECTOR target)
 {
     float dis = Game.Math.GetDistance3D(player.x, player.y, player.z, target.x, target.y, target.z);
     return dis;
 }
Esempio n. 60
0
 private void Helper(TV_3DVECTOR position, CONST_TV_COLORKEY color)
 {
     TVMesh m = core.Scene.CreateMeshBuilder();
     m.CreateSphere(0.25f);
     m.SetColor(core.Globals.Colorkey(color));
     m.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
     m.SetPosition(position.x, position.y, position.z);
 }