示例#1
0
 public void loadTutorial(TVCamera tvCamera)
 {
     if (tvCamera.isOn())
     {
         loadMission("example-mission.xml");
     }
 }
示例#2
0
 public Viewport(System.Windows.Forms.IWin32Window window, string name)
 {
     viewport = Engine.TV3DEngine.CreateViewport(window.Handle.ToInt32(), name);
     viewport.SetAutoResize(true);
     camera       = viewport.GetCamera();
     strivecamera = new Camera(camera);
 }
示例#3
0
 public void pauseGameClickedTVStart(TVCamera tvCamera)
 {
     // TODO!
     if (false && tvCamera.isOn())
     {
         pauseGame();
     }
 }
示例#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());
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TVCamera_MouseDown(object sender, MouseEventArgs e)
        {
            TreeNode node = TVCamera.GetNodeAt(e.X, e.Y);

            if (node != null)
            {
                TVCamera.SelectedNode = node;
            }
        }
示例#6
0
        private void TVCamera_DragDrop(object sender, DragEventArgs e)
        {
            TreeNode moveNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
            //根据鼠标坐标确定要移动到的目标节点
            Point    pt;
            TreeNode targetNode;

            pt         = ((TreeView)(sender)).PointToClient(new Point(e.X, e.Y));
            targetNode = TVCamera.GetNodeAt(pt);
        }
示例#7
0
文件: Camera.cs 项目: zulis/Cubica
        public override void Initialize()
        {
            camera = CameraFactory.GetCamera(0);
            camera.SetPosition(0, 15, -25);
            camera.SetLookAt(0, 0, 0);

            // Register object in Lua.
            ScriptManager.SetGlobal("Camera", this);
            ScriptManager.RegisterCustomFunctions(this);
        }
示例#8
0
文件: Camera.cs 项目: zulis/Cubica
        public override void Initialize()
        {
            camera = CameraFactory.GetCamera(0);
            camera.SetPosition(0, 15, -25);
            camera.SetLookAt(0, 0, 0);

            // Register object in Lua.
            ScriptManager.SetGlobal("Camera", this);
            ScriptManager.RegisterCustomFunctions(this);
        }
示例#9
0
        public void Terminate()
        {
            if (TV3DEngine != null)
            {
                TV3DEngine.ReleaseAll();
            }
            TV3DEngine = null;
            if (TV3DScene != null)
            {
                TV3DScene.DestroyAllMeshes();
            }
            TV3DScene = null;
            if (TexFactory != null)
            {
                TexFactory.DeleteAll();
            }
            TexFactory = null;
            if (Screen2DImmediate != null)
            {
                Screen2DImmediate = null;
            }
            Screen2DText = null;
            if (LightEngine != null)
            {
                LightEngine.DeleteAllLights();
            }
            LightEngine = null;
            Gl          = null;

            Camera = null;
            if (Atmosphere != null)
            {
                Atmosphere.Unload();
            }
            Atmosphere = null;
            if (Input != null)
            {
                Input.UnloadDevices();
            }
            Input = null;
        }
示例#10
0
        /// <summary>
        /// Initialise the scene
        /// </summary>
        /// <param name="window">The IWin32Window to render to.  System.Windows.Forms.Form implements IWin32Window</param>
        /// <param name="target">The render target</param>
        /// <param name="resolution">The resolution to render in</param>
        public void Initialise(IWin32Window window, EnumRenderTarget target, Resolution resolution)
        {
            if (TV3DEngine != null)
            {
                Terminate();
            }
            TV3DEngine = new TVEngine();
            try {
                Engine.TV3DEngine.Init3DWindowedMode(window.Handle.ToInt32(), true);
                //TV3DEngine.Init3DFullscreen( 800, 600, 16, true, false, CONST_TV_DEPTHMODE.TV_DEPTHBUFFER_BESTBUFFER, 1, 0 );
                _renderTarget = window;
            }
            catch (Exception e) {
                throw new EngineInitialisationException(e);
            }
            TV3DEngine.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);
            TV3DEngine.SetVSync(true);
            TV3DEngine.DisplayFPS = true;
            TV3DScene             = new TVScene();
            TV3DScene.SetDepthBuffer(CONST_TV_DEPTHBUFFER.TV_WBUFFER);
            //TV3DScene.SetRenderMode( CONST_TV_RENDERMODE.TV_LINE );
            TV3DScene.SetTextureFilter(CONST_TV_TEXTUREFILTER.TV_FILTER_ANISOTROPIC);
            TexFactory        = new TVTextureFactory();
            Screen2DImmediate = new TVScreen2DImmediate();

            // TODO: this hax setting is to allow for clearing part of a rendersurface
            // would be nice if there is a better way....
            Screen2DImmediate.SETTINGS_SetBlendingMode(DxVBLibA.CONST_D3DBLEND.D3DBLEND_ZERO, DxVBLibA.CONST_D3DBLEND.D3DBLEND_ONE, false);

            Screen2DText = new TVScreen2DText();
            LightEngine  = new TVLightEngine();
            Gl           = new TVGlobals();
            Camera       = new TVCamera();
            Atmosphere   = new TVAtmosphere();
            Atmosphere.Fog_SetParameters(100F, 10000F, 0.0005F);
            Atmosphere.Fog_Enable(true);
            Input     = new TVInputEngine();
            FontIndex = Screen2DText.TextureFont_Create("font", "Verdana", 20, true, false, false, false);
        }
        //*** 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);
        }
示例#12
0
 public Camera(TVCamera camera)
 {
     _tvcamera = camera;
 }
示例#13
0
        public void Init3D2()
        {
            tv.GetViewport().SetAutoResize(true);
            tv.DisplayFPS(true);
            tv.SetVSync(true);

            scene = new TVScene();

            input = new TVInputEngine();
            input.Initialize(true, true);

            camera = new TVCamera();
            camera = scene.GetCamera();
            camera.SetViewFrustum(45, 1000, 0.1f);
            camera.SetPosition(0, 5, -20);
            camera.SetLookAt(0, 3, 0);

            viewport = new TVViewport();
        }
示例#14
0
		public Viewport( System.Windows.Forms.IWin32Window window, string name ) {
			viewport = Engine.TV3DEngine.CreateViewport( window.Handle.ToInt32(), name );
			viewport.SetAutoResize( true );
			camera = viewport.GetCamera();
			strivecamera = new Camera( camera );
		}
示例#15
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());
 }
示例#16
0
        private void Robot_Load(object sender, EventArgs e)
        {
            //Tracking
            //pictureBox27.Load(Application.StartupPath + "\\Resources\\image1.jpg");
            /////3D
            lights = new TVLightEngine();
            globals = new TVGlobals();
            atmosphere = new TVAtmosphere();
            maths = new TVMathLibrary();
            materialfactory = new TVMaterialFactory();
            texturefactory = new TVTextureFactory();
            tv = new TVEngine();
            physics = new TVPhysics();

            //Setup TV
            tv.SetDebugMode(true, true);
            tv.SetDebugFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\debugfile.txt");
            tv.SetAntialiasing(true, CONST_TV_MULTISAMPLE_TYPE.TV_MULTISAMPLE_2_SAMPLES);

            //Enter Your Beta Username And Password Here
            //tv.SetBetaKey("", "");

            tv.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);
            //tv.Init3DWindowed(this.Handle, true);
            tv.Init3DWindowed(this.pictureBox3D.Handle, true);
            tv.GetViewport().SetAutoResize(true);
            tv.DisplayFPS(true);
            tv.SetVSync(true);

            scene = new TVScene();

            input = new TVInputEngine();
            input.Initialize(true, true);

            camera = new TVCamera();
            camera = scene.GetCamera();
            camera.SetViewFrustum(45, 1000, 0.1f);
            camera.SetPosition(0, 5, -20);
            camera.SetLookAt(0, 3, 0);

            viewport = new TVViewport();
            viewport = tv.CreateViewport(this.Handle, "viewport");
            viewport.SetCamera(camera);
            viewport.SetBackgroundColor(Color.Blue.ToArgb());
            bDoLoop = true;

            InitSound();
            InitMaterials();
            InitTextures();
            InitFonts();
            InitShaders();
            InitEnvironment();
            InitPhysics();
            InitLandscape();
            InitObjects();
            InitLights();
            InitPhysicsMaterials();
            Init2DText();

            this.Show();
            this.Focus();

            GameLoop();

            tv = null;

            this.Close();
            //// /3D

            groupComPortDefault.Enabled             = false;
            groupComPortSettings.Enabled            = false;
            groupTcpClientServerSettings.Enabled    = false;
            groupTcpClientServerDefault.Enabled     = false;
            groupDirectionAndMotion.Enabled         = false;
            groupCameraRotation.Enabled             = false;
            groupCameraRot2.Enabled                 = false;
            groupAdvencedSuppDevices.Enabled        = false;
            groupJoystickInit.Enabled               = false;
            labelCommunicationType.Text             = null;
            labelConnectingStatus.Text              = null;
            labelJoystickName.Text                  = null;
            SetMap();
            Maps.SelectedItem = "TUKE";

            //Full Screen
            Options op = new Options();
            op = op.ReadOptionsFromFile();
            this.combo_method.SelectedIndex = op.Scale;
            this.combo_streams.SelectedIndex = op.Streams;
            this.textBox1.Text = op.Text;
            //this.lbl_foreColor.BackColor = ColorTranslator.FromHtml(op.ForeColor);
        }
示例#17
0
        // Close current file
        private void CloseFile()
        {
            Camera camera = cameraWindow.Camera;

            if (camera != null)
            {
                // detach camera from camera window
                cameraWindow.Camera = null;

                // signal camera to stop
                camera.SignalToStop();
                // wait for the camera
                camera.WaitForStop();

                camera = null;

                if (detector != null)
                    detector.Reset();
            }

            intervalsToSave = 0;
        }
示例#18
0
 public override void Load()
 {
     camera = new TVCamera();
     base.Load();
 }
示例#19
0
		public void Terminate() {
			if(TV3DEngine != null)
				TV3DEngine.ReleaseAll();
			TV3DEngine = null;
			if(TV3DScene != null)
				TV3DScene.DestroyAllMeshes();
			TV3DScene = null;
			if(TexFactory != null)
				TexFactory.DeleteAll();
			TexFactory = null;
			if(Screen2DImmediate != null)
				Screen2DImmediate = null;
			Screen2DText = null;
			if(LightEngine != null)
				LightEngine.DeleteAllLights();
			LightEngine = null;
			Gl = null;
			
			Camera = null;
			if(Atmosphere != null)
				Atmosphere.Unload();
			Atmosphere = null;
			if(Input != null)
				Input.UnloadDevices();
			Input = null;
		}
示例#20
0
		/// <summary>
		/// Initialise the scene
		/// </summary>
		/// <param name="window">The IWin32Window to render to.  System.Windows.Forms.Form implements IWin32Window</param>
		/// <param name="target">The render target</param>
		/// <param name="resolution">The resolution to render in</param>
		public void Initialise(IWin32Window window, EnumRenderTarget target, Resolution resolution) {
			if ( TV3DEngine != null ) {
				Terminate();
			}
			TV3DEngine = new TVEngine();
			try {
				Engine.TV3DEngine.Init3DWindowedMode(window.Handle.ToInt32(), true);
				//TV3DEngine.Init3DFullscreen( 800, 600, 16, true, false, CONST_TV_DEPTHMODE.TV_DEPTHBUFFER_BESTBUFFER, 1, 0 );
				_renderTarget = window;
			}
			catch(Exception e) {
				throw new EngineInitialisationException(e);
			}
			TV3DEngine.SetAngleSystem( CONST_TV_ANGLE.TV_ANGLE_DEGREE );
			TV3DEngine.SetVSync( true );
			TV3DEngine.DisplayFPS = true;
			TV3DScene = new TVScene();
			TV3DScene.SetDepthBuffer( CONST_TV_DEPTHBUFFER.TV_WBUFFER );
			//TV3DScene.SetRenderMode( CONST_TV_RENDERMODE.TV_LINE );
			TV3DScene.SetTextureFilter( CONST_TV_TEXTUREFILTER.TV_FILTER_ANISOTROPIC );
			TexFactory = new TVTextureFactory();
			Screen2DImmediate = new TVScreen2DImmediate();

			// TODO: this hax setting is to allow for clearing part of a rendersurface
			// would be nice if there is a better way....
			Screen2DImmediate.SETTINGS_SetBlendingMode( DxVBLibA.CONST_D3DBLEND.D3DBLEND_ZERO, DxVBLibA.CONST_D3DBLEND.D3DBLEND_ONE, false );

			Screen2DText = new TVScreen2DText();
			LightEngine = new TVLightEngine();
			Gl = new TVGlobals();
			Camera = new TVCamera();
			Atmosphere = new TVAtmosphere();
			Atmosphere.Fog_SetParameters( 100F, 10000F, 0.0005F );
			Atmosphere.Fog_Enable( true );
			Input = new TVInputEngine();
			FontIndex = Screen2DText.TextureFont_Create("font", "Verdana", 20, true, false, false, false);
		}
示例#21
0
		public  Camera( TVCamera camera ) {
			_tvcamera = camera;
		}