void ApplicationClass::Update (void) { m_pSystem->UpdateTime(); //Update the system printf("FPS: %d \r", m_pSystem->FPS);//print the Frames per Second //Check if the objects models have been read static bool bObjectSelected = false; if(!bObjectSelected) { if(m_pModelManager->GetNumberOfInstances() > 0) { m_sSelectedObject = m_pModelManager->m_vInstance[0]->GetName(); bObjectSelected = true; } } //Arcball rotation if(m_bArcBall == true) ArcBall(); //First person camera movement if(m_bFPC == true) CameraRotation(); m_pBSMngr->Update(); m_pBBMngr->Update(); }
void AppClass::Update(void) { //Update the system so it knows how much time has passed since the last call m_pSystem->UpdateTime(); //Update the information on the Mesh manager I will not check for collision detection so the argument is false m_pMeshMngr->Update(); //Calculate the arcball ArcBall(); //Is the first person camera active? if (m_bFPC == true) CameraRotation(); //Modify model's ModelToWorld matrix m_pMeshMngr->SetModelMatrix(ToMatrix4(m_qArcBall), "Unikitty"); //Add a model to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Calculate Camera m_pCameraMngr->CalculateView(); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system so it knows how much time has passed since the last call m_pSystem->UpdateTime(); //Is the arcball active? if (m_bArcBall == true) ArcBall(); //Is the first person camera active? if (m_bFPC == true) CameraRotation(); //Calculate Camera m_pCameraMngr->CalculateView(); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); //Getting the time between calls float fCallTime = m_pSystem->LapClock(); //Counting the cumulative time static float fRunTime = 0.0f; fRunTime += fCallTime; //Earth Orbit static int nEarthOrbits = 0; //count the number of orbits //Earth Revolution static int nEarthRevolutions = 0; //Moon Orbit static int nMoonOrbits = 0; //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); printf("\rTime:%.2f[s] Day:%.2f[s] E_Orbits:%d E_Revolutions:%d M_Orbits:%d ", fRunTime, m_fDay, nEarthOrbits, nEarthRevolutions, nMoonOrbits); }
void AppClass::Update(void) { #pragma region Does not need changes //Sets the camera m_pCameraMngr->SetPositionTargetAndView(vector3(0.0f, 25.0f, 0.0f), vector3(0.0f, 0.0f, 0.0f), -REAXISZ); //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //This matrices will just orient the objects to the camera matrix4 rotateX = glm::rotate(IDENTITY_M4, 90.0f, vector3(1.0f, 0.0f, 0.0f)); matrix4 rotateY = glm::rotate(IDENTITY_M4, 90.0f, vector3(0.0f, 1.0f, 0.0f)); //This matrices will hold the relative transformation of the Moon and the Earth matrix4 distanceEarth = glm::translate(11.0f, 0.0f, 0.0f); matrix4 distanceMoon = glm::translate(2.0f, 0.0f, 0.0f); #pragma endregion #pragma region YOUR CODE GOES HERE //Calculate the position of the Earth m_m4Earth = glm::rotate(IDENTITY_M4, m_fEarthTimer, vector3(0.0f, 1.0f, 0.0f)); //Rotate earth around the moon. m_m4Earth *= distanceEarth; //Move earth to its solar orbit distance. m_m4Earth = glm::rotate(m_m4Earth, 90.0f, vector3(0.0f, 0.0f, 1.0f)); //Rotate earth sideways to align torus. m_m4Earth = glm::rotate(m_m4Earth, 360 * m_fEarthTimer, vector3(1.0f, 0.0f, 0.0f)); //Rotate earth 360 times/year. //Calculate the position of the Moon m_m4Moon = glm::translate(IDENTITY_M4, glm::vec3(m_m4Earth[3])); //Move the moon to the earth's position. m_m4Moon = glm::rotate(m_m4Moon, 360 * -m_fMoonTimer, vector3(0.0f, 1.0f, 0.0f)); //Rotate the moon at 1/28th the earth's rotation. m_m4Moon = glm::translate(m_m4Moon, vector3(2.0f, 0.0f, 0.0f)); //Translate the moon to its orbital distance. m_m4Moon = glm::rotate(m_m4Moon, 90.0f, vector3(0.0f, 0.0f, 1.0f)); //Rotate the moon sideways to align torus. #pragma endregion #pragma region Print info printf("Earth Day: %.3f, Moon Orbit: %.3f\r", m_fEarthTimer, m_fMoonTimer);//print the Frames per Second //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("Earth Day: ", REWHITE); m_pMeshMngr->PrintLine(std::to_string(m_fEarthTimer), REBLUE); m_pMeshMngr->Print("Moon Orbit: ", REWHITE); m_pMeshMngr->PrintLine(std::to_string(m_fMoonTimer), REBLUE); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); #pragma endregion m_fEarthTimer += .05;//Increase Moon timer m_fMoonTimer = m_fEarthTimer / 28.0f; //divide by the moon's day }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console //printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->PrintLine("Selection: Press Space for sound!"); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Setting the model matrix m_pMeshMngr->SetModelMatrix(m_mToWorld, "Steve"); //Adding the instance to the render list m_pMeshMngr->AddInstanceToRenderList("Steve"); int nFPS = m_pSystem->GetFPS(); m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("X:", REYELLOW); m_pMeshMngr->PrintLine(std::to_string(m_v3Orientation.x), RERED); m_pMeshMngr->Print("Y:", REYELLOW); m_pMeshMngr->PrintLine(std::to_string(m_v3Orientation.y), RERED); m_pMeshMngr->Print("Z:", REYELLOW); m_pMeshMngr->PrintLine(std::to_string(m_v3Orientation.z), RERED); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Getting the time between calls double fCallTime = m_pSystem->LapClock(); //Counting the cumulative time static double fRunTime = 0.0f; fRunTime += fCallTime; //Earth Orbit double fEarthHalfOrbTime = 182.5f * m_fDay; //Earths orbit around the sun lasts 365 days / half the time for 2 stops float fEarthHalfRevTime = 0.5f * m_fDay; // Move for Half a day float fMoonHalfOrbTime = 14.0f * m_fDay; //Moon's orbit is 28 earth days, so half the time for half a route //Setting the matrices m_pMeshMngr->SetModelMatrix(IDENTITY_M4, "Sun"); m_pMeshMngr->SetModelMatrix(IDENTITY_M4, "Earth"); m_pMeshMngr->SetModelMatrix(IDENTITY_M4, "Moon"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); static int nEarthOrbits = 0; static int nEarthRevolutions = 0; static int nMoonOrbits = 0; //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("Time:"); m_pMeshMngr->PrintLine(std::to_string(fRunTime)); m_pMeshMngr->Print("Day:"); m_pMeshMngr->PrintLine(std::to_string(m_fDay)); m_pMeshMngr->Print("E_Orbits:"); m_pMeshMngr->PrintLine(std::to_string(nEarthOrbits)); m_pMeshMngr->Print("E_Revolutions:"); m_pMeshMngr->PrintLine(std::to_string(nEarthRevolutions)); m_pMeshMngr->Print("M_Orbits:"); m_pMeshMngr->PrintLine(std::to_string(nMoonOrbits)); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Set the model matrix for the first model to be the arcball m_pMeshMngr->SetModelMatrix(ToMatrix4(m_qArcBall), "All"); m_pBall->Update(); if (m_pBall->IsColliding(m_pBoxT) || m_pBall->IsColliding(m_pBoxB)) { vector3 v3Velocity = m_pBall->GetVelocity(); v3Velocity.y *= -1; m_pBall->SetVelocity(v3Velocity); } if (m_pBall->IsColliding(m_pBoxR) || m_pBall->IsColliding(m_pBoxL)) { vector3 v3Velocity = m_pBall->GetVelocity(); v3Velocity.x *= -1; m_pBall->SetVelocity(v3Velocity); } if (m_pBall->IsColliding(m_pPalletR) || m_pBall->IsColliding(m_pPalletL)) { vector3 v3Velocity = m_pBall->GetVelocity(); v3Velocity.x *= -1; m_pBall->SetVelocity(v3Velocity); } //Add objects to the render list m_pBall->AddToRenderList(true); m_pBoxT->AddToRenderList(true); m_pBoxB->AddToRenderList(true); m_pBoxL->AddToRenderList(true); m_pBoxR->AddToRenderList(true); m_pPalletL->AddToRenderList(true); m_pPalletR->AddToRenderList(true); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("Selection: "); m_pMeshMngr->PrintLine(m_pMeshMngr->GetInstanceGroupName(m_selection.first, m_selection.second), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AKinectPlayerController::PawnPendingDestroy(APawn* P) { LastDeathLocation = P->GetActorLocation(); FVector CameraLocation = LastDeathLocation + FVector(0, 0, 300.0f); FRotator CameraRotation(-90.0f, 0.0f, 0.0f); FindDeathCameraSpot(CameraLocation, CameraRotation); Super::PawnPendingDestroy(P); ClientSetSpectatorCamera(CameraLocation, CameraRotation); }
void AppClass::Update(void) { //This matrices will just orient the objects to the camera (which is looking from matrix4 rotateX = glm::rotate(matrix4(IDENTITY), 90.0f, vector3(1.0f, 0.0f, 0.0f)); matrix4 rotateY = glm::rotate(matrix4(IDENTITY), 90.0f, vector3(0.0f, 1.0f, 0.0f)); //First person camera movement if (m_bFPC == true) CameraRotation(); printf("Earth Day: %.3f, Moon Day: %.3f\r", m_fEarthTimer, m_fMoonTimer);//print the Frames per Second }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Calculate delta and total times static double dTotalTime = 0.0; //Total time of the simulation double dDeltaTime = m_pSystem->LapClock(); //time difference between function calls dTotalTime += dDeltaTime; //Incrementing the time differences float fStartTime = 0.0f; float fEndTime = 5.0f; float fAngle = MapValue(static_cast<float>(dTotalTime), fStartTime, fEndTime, 0.0f, 360.0f); m_m4Steve = glm::rotate(IDENTITY_M4, fAngle, REAXISZ); static float fStartHeight = 0.0f; static float fEndHeight = 5.0f; float fPercent = MapValue(static_cast<float>(dTotalTime), fStartTime, fEndTime, 0.0f, 1.0f); float fHeight = glm::lerp(fStartHeight, fEndHeight, fPercent); m_m4Steve = m_m4Steve * glm::translate(vector3(0.0f, fHeight, 0.0f)); if (fPercent > 1.0f) { std::swap(fStartHeight, fEndHeight); dTotalTime = 0.0; } //Set the model matrix m_pMeshMngr->SetModelMatrix(m_m4Steve, "Steve"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("Seconds:"); m_pMeshMngr->PrintLine(std::to_string(dTotalTime), RERED); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Lets us know how much time has passed since the last call double fTimeSpan = m_pSystem->LapClock(); //cumulative time static double fRunTime = 0.0f; fRunTime += fTimeSpan; matrix4 mOrientation = glm::rotate(IDENTITY_M4, m_v3Rotation.x, vector3(1.0f, 0.0f, 0.0f)); mOrientation = mOrientation * glm::rotate(IDENTITY_M4, m_v3Rotation.y, vector3(0.0f, 1.0f, 0.0f)); mOrientation = mOrientation * glm::rotate(IDENTITY_M4, m_v3Rotation.z, vector3(0.0f, 0.0f, 1.0f)); vector3 v3Start(0.0f, 0.0f, 0.0f); vector3 v3End(0.0f, 90.0f, 0.0f); static float fDifference = 0.0f; fDifference += 0.1f; fDifference = MapValue(static_cast<float>(fRunTime), 0.0f, 10.0f, 0.0f, 1.0f); float fPosition = glm::lerp(v3Start, v3End, fDifference).y; mOrientation = glm::rotate(IDENTITY_M4, fPosition, vector3(0.0f, 1.0f, 0.0f)); m_pMeshMngr->SetModelMatrix(mOrientation, "Steve"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console //printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void ApplicationClass::Update (void) { m_pSystem->UpdateTime(); //Update the system //Arcball rotation if(m_bArcBall == true) ArcBall(); //First person camera movement if(m_bFPC == true) CameraRotation(); printf("FPS: %d \r", m_pSystem->FPS);//print the Frames per Second }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); //Set the model matrix to the Bounding Object m_pBOMngr->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Steve"), "Steve"); m_pBOMngr->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Creeper"), "Creeper"); m_pBOMngr->Update();//Update collision detection //m_pBOMngr->DisplaySphere(-1, REWHITE); m_pBOMngr->DisplayReAlligned(); //m_pBOMngr->DisplayOriented(-1, REWHITE); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); std::vector<int> list = m_pBOMngr->GetCollidingVector(0); m_pMeshMngr->Print("Object 0 colliding with: ", REBLUE); for (uint n = 0; n < list.size(); n++) { m_pMeshMngr->Print(std::to_string(list[n]) + " ", REYELLOW); } m_pMeshMngr->PrintLine(" "); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); dynamicsWorld->stepSimulation(1 / 60.0f, 1); btTransform trans; btVector3 position; btQuaternion orientation; vector3 v3Position; quaternion qOrientation; matrix4 mToWorld; for (int n = 0; n < m_nCubes; n++) { fallRigidBody[n]->getMotionState()->getWorldTransform(trans); position = trans.getOrigin(); orientation = trans.getRotation(); v3Position = vector3(position.getX(), position.getY(), position.getZ()); qOrientation = quaternion(orientation.getW(), orientation.getX(), orientation.getY(), orientation.getZ()); mToWorld = glm::translate(matrix4(1.0f), v3Position) * glm::mat4_cast(qOrientation); m_pMeshMngr->SetModelMatrix(mToWorld, n); } //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); // m_pMeshMngr->AddPlaneToQueue(glm::rotate(IDENTITY_M4, 90.0f, REAXISX) * glm::scale(vector3(100.0f)), REBLACK); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console //printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O3), "Zombie"); //set the matricies of the BO's m_pBOMngr->SetBOMatrix("Steve", m_pMeshMngr->GetModelMatrix("Steve")); m_pBOMngr->SetBOMatrix("Creeper", m_pMeshMngr->GetModelMatrix("Creeper")); m_pBOMngr->SetBOMatrix("Zombie", m_pMeshMngr->GetModelMatrix("Zombie")); //Check the Collisions of all of the Bounding Objects m_pBOMngr->CheckCollisions(); //Render Bounding Objects // **Like with the Mesh Manager, use the keyword "ALL" to render all stored BO's, // or use the name of a model to only render that one.** m_pBOMngr->RenderBoundingObjects("ALL"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); m_pBB1->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Steve")); m_pBB2->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Creeper")); //Add a representation of the Spheres to the render list vector3 v3Color = REWHITE; if (m_pBB1->IsColliding(m_pBB2)) v3Color = RERED; m_pMeshMngr->AddCubeToQueue(glm::translate(m_pBB1->GetCenterGlobal()) * glm::scale(m_pBB1->GetHalfWidthG() * 2.0f), v3Color, WIRE); m_pMeshMngr->AddCubeToQueue(glm::translate(m_pBB2->GetCenterGlobal()) * glm::scale(m_pBB2->GetHalfWidthG() * 2.0f), v3Color, WIRE); m_pMeshMngr->AddCubeToQueue(m_pBB1->GetModelMatrix() * glm::translate(IDENTITY_M4, m_pBB1->GetCenterLocal()) * glm::scale(m_pBB1->GetHalfWidth() * 2.0f), v3Color, WIRE); m_pMeshMngr->AddCubeToQueue(m_pBB2->GetModelMatrix() * glm::translate(IDENTITY_M4, m_pBB2->GetCenterLocal()) * glm::scale(m_pBB2->GetHalfWidth() * 2.0f), v3Color, WIRE); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system so it knows how much time has passed since the last call m_pSystem->UpdateTime(); //Is the arcball active? if (m_bArcBall == true) m_qArcBall = ArcBall(); //Is the first person camera active? if (m_bFPC == true) CameraRotation(); //Calculate Camera m_pCamera->CalculateView(); //print info into the console printf("FPS: %d \r", m_pSystem->GetFPS());//print the Frames per Second }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); // update spheres bs_Torus->UpdatePosition(m_v3Torus); bs_Cone->UpdatePosition(m_v3Cone); //First person camera movement if (m_bFPC == true) CameraRotation(); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); bool bAreColliding = false; //Collision check goes here m_pMeshMngr->Print("x:" + std::to_string( m_v3Center1.x ) + " ", RERED); m_pMeshMngr->Print("y:" + std::to_string(m_v3Center1.y) + " ", RERED); m_pMeshMngr->Print("z:" + std::to_string(m_v3Center1.z) + " ", RERED); m_pMeshMngr->PrintLine(""); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); if (bAreColliding) m_pMeshMngr->PrintLine("They are colliding! >_<", RERED); else m_pMeshMngr->PrintLine("They are not colliding! =)", REGREEN); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { #pragma region Does not need changes //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //This matrices will just orient the objects to the camera matrix4 rotateX = glm::rotate(IDENTITY_M4, 90.0f, vector3(1.0f, 0.0f, 0.0f)); matrix4 rotateY = glm::rotate(IDENTITY_M4, 90.0f, vector3(0.0f, 1.0f, 0.0f)); #pragma endregion #pragma region YOUR CODE GOES HERE #pragma endregion #pragma region Print info //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); #pragma endregion //renamed from earth/moon timers m_fFrames++; m_fTimeElapsed = m_fFrames / m_fSimulationSpeed; }
void AppClass::Update(void) { m_m4Cube = IDENTITY_M4; //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Set the model matrix for the first model to be the arcball m_pMeshMngr->SetModelMatrix(ToMatrix4(m_qArcBall), 0); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //camMngr->GetView(); camMngr->GetProjection(true); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console //printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("Selection: "); m_pMeshMngr->PrintLine(m_pMeshMngr->GetInstanceGroupName(m_selection.first, m_selection.second), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); boundingObject->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Steve"), 0); boundingObject->SetModelMatrix(m_pMeshMngr->GetModelMatrix("Creeper"), 1); boundingObject->CheckCollisions(); boundingObject->RenderAllBO(m_pMeshMngr); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("FPS: %d \r", nFPS);//print the Frames per Second //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //SafeDelete(m_pRoot); //m_pRoot = new OctantClass(3, 2); //m_pMeshMngr->SetVisibleBO(REBODISPLAY::BD_NONE, "ALL", true); //m_pMeshMngr->m_pModelMngr->CheckCollisions(BD_OB); m_pRoot->CheckCollisions(); m_pRoot->DisplayLeafs(); //m_pMeshMngr->SetVisibleAxis(true, "ALL", true); m_pMeshMngr->SetModelMatrix(m_m4Model * ToMatrix4(m_qArcBall), "Plane"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); if (m_bArcBall == true){ b_ArcBall = ArcBall(); } b_Torus->UpdootPosition(vector3(m_v3Torus.x, m_v3Torus.y, m_v3Torus.z)); b_Cone->UpdootPosition(vector3(m_v3Cone.x, m_v3Cone.y, m_v3Cone.z)); if (glm::distance(b_Torus->getCenter(), b_Cone->getCenter()) < b_Torus->getRadius() + b_Cone->getRadius()){ //is around cone for some reason m_pMeshMngr->AddSphereToQueue(glm::scale(glm::translate(glm::mat4_cast(b_ArcBall), b_Torus->getCenter()), vector3(b_Torus->getRadius() * 2.0f)), RERED, WIRE); //supposed to be on torus m_pMeshMngr->AddSphereToQueue(glm::scale(glm::translate(glm::mat4_cast(b_ArcBall), b_Cone->getCenter()), vector3(b_Cone->getRadius() * 2.0f)), RERED, WIRE); //Adds all loaded instance to the render list } else{ //is around cone for some reason m_pMeshMngr->AddSphereToQueue(glm::scale(glm::translate(glm::mat4_cast(b_ArcBall), b_Torus->getCenter()), vector3(b_Torus->getRadius() * 2.0f)), REWHITE, WIRE); //supposed to be on torus m_pMeshMngr->AddSphereToQueue(glm::scale(glm::translate(glm::mat4_cast(b_ArcBall), b_Cone->getCenter()), vector3(b_Cone->getRadius() * 2.0f)), REWHITE, WIRE); //Adds all loaded instance to the render list } m_pMeshMngr->AddInstanceToRenderList("ALL"); }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); //Set the model matrices for both objects and Bounding Spheres m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O1) * ToMatrix4(m_qArcBall), "Steve"); m_pMeshMngr->SetModelMatrix(glm::translate(m_v3O2), "Creeper"); //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); <<<<<<< HEAD
void AppClass::Update(void) { if (gameState == Start) { m_pMeshMngr->Print("Welcome to ", REWHITE); m_pMeshMngr->PrintLine("CHUPACABRA", RERED); m_pMeshMngr->PrintLine("", REWHITE); m_pMeshMngr->PrintLine("Controls:", REWHITE); m_pMeshMngr->PrintLine("-Click to throw golf balls in defense of your goat!", REWHITE); m_pMeshMngr->PrintLine("-Press Spacebar to start \'P\' to pause wile in-game", REWHITE); m_pMeshMngr->PrintLine("-GET A GOOD SCORE!!!", REWHITE); } else if (gameState == Game) { //Update the system's time m_pSystem->UpdateTime(); // std::cout << m_pSystem->LapClock(0) * 64.f; test expected frame-rate deltaTime = m_pSystem->LapClock(0); scaledDT = (float)(deltaTime * TIME_COEFFICIENT); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(false); //First person camera movement if (m_bFPC == true) CameraRotation(); ArcBall(); // navigate through the octtree chupManager->ClearIndices(); //m_pRoot->ClearList(); for (int i = 0; i < 8; i++) { pChild = m_pRoot->GetChild(i); //pChild->ClearList(); for (int j = 0; j < 8; j++) { pChild = m_pRoot->GetChild(i)->GetChild(j); pChild->ClearList(); // populate list FindChups(pChild); } } // check collisions in the now populated structure RecurseSO(m_pRoot); // update canyon canyonManager->Update(scaledDT); cameraFX->CameraBob(); for (int i = 0; i < chupManager->chups.size(); i++) { chupManager->chups[i].myBO->SetModelMatrix(glm::translate(chupManager->chups[i].position)); } //draw the projectiles for (int i = 0; i < player->projectiles.size(); i++) { player->projectiles.at(i).Move(scaledDT); m_pMeshMngr->AddSphereToQueue(glm::translate(IDENTITY_M4, player->projectiles.at(i).position) * glm::scale(vector3(1.0f, 1.0f, 1.0f))); player->projectiles.at(i).bounding->SetModelMatrix(glm::translate(player->projectiles.at(i).position)); //move those bounding objects } player->Countdown(scaledDT); // update chupacabras chupManager->Update(scaledDT); //Add a representation of the Spheres to the render list vector3 v3Color = REWHITE; m_pMeshMngr->PrintLine(player->ShowScore(), REWHITE); if (starting) { gameState = Start; starting = false; } } else if (gameState == Pause) { m_pMeshMngr->PrintLine("Paused", REWHITE); deltaTime = 0.0f; m_pMeshMngr->Update(false); } }
void AppClass::Update(void) { //Update the system's time m_pSystem->UpdateTime(); //Update the mesh manager's time without updating for collision detection m_pMeshMngr->Update(); //First person camera movement if (m_bFPC == true) CameraRotation(); //Call the arcball method ArcBall(); //Lets us know how much time has passed since the last call double fTimeSpan = m_pSystem->LapClock(); //cumulative time static double fRunTime = 0.0f; fRunTime += fTimeSpan; static int nIndex = 0; if (fRunTime > fDuration) { fRunTime = 0.0f; nIndex++; if (nIndex == static_cast<int>(m_lPositions.size())) { nIndex = 0; } } vector3 v3Vector1; vector3 v3Vector2; if (nIndex >= static_cast<int>(m_lPositions.size()) - 1) { v3Vector1 = m_lPositions[static_cast<int>(m_lPositions.size()) - 1]; v3Vector2 = m_lPositions[0]; } else { v3Vector1 = m_lPositions[nIndex]; v3Vector2 = m_lPositions[nIndex + 1]; } float fPercent = MapValue(static_cast<float>(fRunTime), 0.0f, fDuration, 0.0f, 1.0f); vector3 v3Position = glm::lerp(v3Vector1, v3Vector2, fPercent); m_pMeshMngr->SetModelMatrix(glm::translate(v3Position), "WallEye"); for (int i = 0; i < static_cast<int>(m_lPositions.size()); i++) { m_pMeshMngr->AddSphereToRenderList(glm::translate(m_lPositions[i]) * glm::scale(vector3(0.1f)), RERED, SOLID); } //Adds all loaded instance to the render list m_pMeshMngr->AddInstanceToRenderList("ALL"); //Indicate the FPS int nFPS = m_pSystem->GetFPS(); //print info into the console printf("\rfTimeSpan: %.3f, fRunSpan: %.3f, fDuration: %.3f ", fTimeSpan, fRunTime, fDuration); //Print info on the screen m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW); m_pMeshMngr->Print("nIndex: "); m_pMeshMngr->PrintLine(std::to_string(nIndex)); m_pMeshMngr->Print("fTimeSpan: "); m_pMeshMngr->PrintLine(std::to_string(fTimeSpan)); m_pMeshMngr->Print("fRunSpan: "); m_pMeshMngr->PrintLine(std::to_string(fRunTime)); m_pMeshMngr->Print("fDuration: "); m_pMeshMngr->PrintLine(std::to_string(fDuration)); m_pMeshMngr->Print("FPS:"); m_pMeshMngr->Print(std::to_string(nFPS), RERED); }