public override void execute(Avatar avatar) { beforeTransPos = -TransPos; avatar.Move(TransPos); }
public override void undo(Avatar avatar) { avatar.Move(beforeTransPos); logInfo = "撤销:" + logInfo; }
public void AvataronMove(FP speedRate, FP angle) { _avatarObj.Move(/*speedRate, */ angle); CBGlobalEventDispatcher.Instance.TriggerEvent <FP>(OperationID.JoystickMoveEvent, angle); }
public override void undo(Avatar avatar) { avatar.Move(-TransPos); }
public override void execute(Avatar avatar) { avatar.Move(TransPos); }
/// <summary> /// All drawing code goes here /// </summary> protected void DrawGLScene() { //Clear the screen and the OpenGl Buffers Gl.glClearStencil(0); Gl.glClearDepth(1.0); Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT | Gl.GL_STENCIL_BUFFER_BIT); DrawVideoBackground(); Gl.glLoadIdentity(); //Move Camera to 3rd Person View //Gl.glTranslatef(0.0f, -1.5f, avatar.ViewDistance); Gl.glTranslatef(0.0f, -1.0f, -3.5f); //Gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f); //Gl.glRotatef(avatar.ViewAngleX, 0.0f, 1.0f, 0.0f); //Gl.glRotatef(avatar.ViewAngleY, 1.0f, 0.0f, 0.0f); //Draw Avatar //avatar.Update(m_trackableList); if (m_drawAvatar) { if (m_drawAvatar3D)// When using the 3D avatar { Gl.glPushMatrix(); avatar3D.Draw(m_trackableList, m_jointList); Gl.glPopMatrix(); } else // When using the standard avatar { avatar.Draw(); } } //Move camera in preparation for drawing all world objects //Gl.glRotatef(-avatar.RotationAngle, 0.0f, 1.0f, 0.0f); //Draw collision models if set if (m_drawCollisionModels) { if (m_drawAvatar3D) // When using the 3D avatar { foreach (BoundingBox collisionModel in avatar3D.CollisionModel) { collisionModel.Draw(); } } else // When using the standard avatar { //avatar.CollisionModel.Draw(); if (StroMoHab_Objects.Objects.FilteredMarkerList.listOfMarkers.Count != 0) { avatar.leftFoot.CollisionModel.Draw(); } } } Gl.glTranslatef(avatar.X, avatar.Y, -avatar.Z); //Create temporary list to allow modification of master list during drawing. List <OpenGlObject> tempList = new List <OpenGlObject>(m_objectsToDraw.ObjectsToDraw); //Draw all objects in temporary list foreach (OpenGlObject currentObject in tempList) { currentObject.Draw(); currentObject.Move(); //currentObject.RotateX(1.0f); if (m_drawCollisionModels) { currentObject.CollisionModel.Draw(); } if (m_drawAvatar3D) // When using the 3D avatar { bool collisionOccured = false; foreach (BoundingBox collisionModel in avatar3D.CollisionModel) { bool collision = Collisions.HaveCollided(currentObject.CollisionModel, collisionModel, -avatar.X, avatar.Y, avatar.Z); if (collision) { collisionOccured = true; break; // If one collision has occured then don't need to check other models. } } if (collisionOccured) { //System.Diagnostics.Debug.WriteLine("OBJECT COLLISION!"); currentObject.Velocity.Y = 0.005f; } } else // When using the standard avatar { //Test for collisions if ((StroMoHab_Objects.Objects.FilteredMarkerList.listOfMarkers.Count == 2) && (m_useTrackables == false)) { bool CollisionOne = Collisions.HaveCollided(currentObject.CollisionModel, avatar.leftFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); bool CollisionTwo = Collisions.HaveCollided(currentObject.CollisionModel, avatar.rightFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); if (CollisionOne || CollisionTwo) { // System.Diagnostics.Debug.WriteLine("OBJECT COLLISION!"); currentObject.Velocity.Y = 0.005f; } } } if (currentObject is CompoundOpenGlObject) { foreach (BoundingBox collisionModel in ((CompoundOpenGlObject)currentObject).CollisionModel) { //Draw collision models if flag set if (m_drawCollisionModels) { collisionModel.Draw(); } //Test for collisions //if (Stromohab_MCE.FilteredMarkerList.listOfMarkers.Count != 0) //{ // bool collision = Collisions.HaveCollided(collisionModel, avatar.leftFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); // if (collision == true) // { // //System.Diagnostics.Debug.WriteLine("COLLISION!"); // avatar.Velocity.X = -avatar.Velocity.X * 10.0f; // avatar.Velocity.Y = -avatar.Velocity.Y; // //avatar.Velocity = new Vector3f(0.0f, 0.0f, 0.0f); // } // else // { // //System.Diagnostics.Debug.WriteLine("NO COLLISION"); // } //} } } } //Update Game Logic avatar.Move(); //m_VideoTextureManager.MoveToNextFrame(); //backgroundQuad.TextureNumber = m_VideoTextureManager.CurrentVideoTextureObject.TextureID; //avatar.RotateY(1.0f); }
/// <summary> /// All drawing code goes here /// </summary> protected void DrawGLScene() { //Clear the screen and the OpenGl Buffers Gl.glClearStencil(0); Gl.glClearDepth(1.0); Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT | Gl.GL_STENCIL_BUFFER_BIT); Gl.glMatrixMode(Gl.GL_MODELVIEW); Gl.glLoadIdentity(); if (_remoteDrawingList.VisualiserController.UseVideoBackground) { DrawVideoBackground(); } //Translate into the scene Gl.glTranslatef(0.0f, -1.5f, -3.5f); if (_remoteDrawingList.VisualiserController.Draw2Point5DAvatar) { //Draw the subject avatar.Draw(); } //reset view Gl.glLoadIdentity(); //Translate the amount the avatar has moved in Z, and translate the Y to give 3 person viewpoint. Gl.glTranslatef(0.0f, -1.5f, -avatar.Z); //Draw everything else if (_remoteDrawingList.VisualiserController.UseVirtualBackground) { //Create temporary list to allow modification of master list during drawing. List <OpenGlObject> tempObjectsToDrawList = new List <OpenGlObject>(_remoteDrawingList.ObjectsToDraw); foreach (OpenGlObject objectToDraw in tempObjectsToDrawList) { objectToDraw.Draw(); } } // //Move Camera to 3rd Person View // //Gl.glTranslatef(0.0f, -1.5f, avatar.ViewDistance); // //Gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f); // //Gl.glRotatef(avatar.ViewAngleX, 0.0f, 1.0f, 0.0f); // //Gl.glRotatef(avatar.ViewAngleY, 1.0f, 0.0f, 0.0f); // //Gl.glTranslatef(0.0f, 1.5f, 3.5f); // ////Draw Avatar // ////avatar.Update(m_trackableList); // //Marker testMarker = new Marker(); // //testMarker.xCoordinate = 0f; // //testMarker.yCoordinate = 0f; // //testMarker.zCoordinate = -5f; // //OpenGLMarker testOGLMarker = new OpenGLMarker(testMarker); // //testOGLMarker.Draw(); // //if (m_drawAvatar) // //{ // // if (m_drawAvatar3D)// When using the 3D avatar // // { // // avatar3D.Draw(m_trackableList, m_jointList); // // } // // else // When using the standard avatar // // avatar.Draw(); // //} // ////Move camera in preparation for drawing all world objects // ////Gl.glRotatef(-avatar.RotationAngle, 0.0f, 1.0f, 0.0f); // ////Draw collision models if set // //if (m_drawCollisionModels) // //{ // // if (m_drawAvatar3D) // When using the 3D avatar // // { // // foreach (BoundingBox collisionModel in avatar3D.CollisionModel) // // { // // collisionModel.Draw(); // // } // // } // // else // When using the standard avatar // // { // // //avatar.CollisionModel.Draw(); // // if (StroMoHab_Objects.Objects.FilteredMarkerList.listOfMarkers.Count != 0) // // { // // avatar.leftFoot.CollisionModel.Draw(); // // } // // } // //} // //Gl.glTranslatef(avatar.X, avatar.Y, -avatar.Z); // //Create temporary list to allow modification of master list during drawing. List <OpenGlObject> tempList = new List <OpenGlObject>(_remoteDrawingList.ObjectsToDraw); // //Draw all objects in temporary list //foreach (OpenGlObject currentObject in tempList) //{ // currentObject.Draw(); // currentObject.Move(); // //currentObject.RotateX(1.0f); // if (m_drawCollisionModels) // { // currentObject.CollisionModel.Draw(); // } // if (m_drawAvatar3D) // When using the 3D avatar // { // bool collisionOccured = false; // foreach (BoundingBox collisionModel in avatar3D.CollisionModel) // { // bool collision = Collisions.HaveCollided(currentObject.CollisionModel, collisionModel, -avatar.X, avatar.Y, avatar.Z); // if (collision) // { // collisionOccured = true; // break; // If one collision has occured then don't need to check other models. // } // } // if (collisionOccured) // { // //System.Diagnostics.Debug.WriteLine("OBJECT COLLISION!"); // currentObject.Velocity.Y = 0.005f; // } // } // else // When using the standard avatar // { // //Test for collisions // if ((StroMoHab_Objects.Objects.FilteredMarkerList.listOfMarkers.Count == 2) && (m_useTrackables == false)) // { // bool CollisionOne = Collisions.HaveCollided(currentObject.CollisionModel, avatar.leftFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); // bool CollisionTwo = Collisions.HaveCollided(currentObject.CollisionModel, avatar.rightFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); // if (CollisionOne || CollisionTwo) // { // // System.Diagnostics.Debug.WriteLine("OBJECT COLLISION!"); // currentObject.Velocity.Y = 0.005f; // } // } // } // if (currentObject is CompoundOpenGlObject) // { // foreach (BoundingBox collisionModel in ((CompoundOpenGlObject)currentObject).CollisionModel) // { // //Draw collision models if flag set // if (m_drawCollisionModels) // { // collisionModel.Draw(); // } // //Test for collisions // //if (Stromohab_MCE.FilteredMarkerList.listOfMarkers.Count != 0) // //{ // // bool collision = Collisions.HaveCollided(collisionModel, avatar.leftFoot.CollisionModel, -avatar.X, avatar.Y, avatar.Z); // // if (collision == true) // // { // // //System.Diagnostics.Debug.WriteLine("COLLISION!"); // // avatar.Velocity.X = -avatar.Velocity.X * 10.0f; // // avatar.Velocity.Y = -avatar.Velocity.Y; // // //avatar.Velocity = new Vector3f(0.0f, 0.0f, 0.0f); // // } // // else // // { // // //System.Diagnostics.Debug.WriteLine("NO COLLISION"); // // } // //} // } // } //} //Update Game Logic avatar.Move(); //avatar.RotateY(1.0f); }