void CChildView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { switch (nChar) { // set indices of corner case '0': m_cube->setCornerIndex(0); break; case '1': m_cube->setCornerIndex(1); break; case '2': m_cube->setCornerIndex(2); break; case '3': m_cube->setCornerIndex(3); break; case '4': m_cube->setCornerIndex(4); break; case '5': m_cube->setCornerIndex(5); break; case '6': m_cube->setCornerIndex(6); break; case '7': m_cube->setCornerIndex(7); break; // add impulse force case 37: // left m_cube->addImpulse(0); break; case 38: // up m_cube->addImpulse(1); break; case 39: // right m_cube->addImpulse(2); break; case 40: // down m_cube->addImpulse(3); break; case 'r': case 'R': ResetMatrix(); break; case VK_SPACE: if (m_nTimer==-1) { m_nTimer = SetTimer(1, 40, NULL); } else { KillTimer(m_nTimer); m_nTimer = -1; } } CShaderWnd::OnKeyDown(nChar, nRepCnt, nFlags); }
void setup() { ResetMatrix(); for(int i=0; i<18; i++) pinMode(i, OUTPUT); pinMode(18,INPUT); pinMode(19,INPUT); }
void setup() { ResetMatrix(); for(int i=0; i<18; i++) pinMode(i, OUTPUT); pinMode(18,INPUT); pinMode(19,INPUT); startX = analogRead(pinX); startY = analogRead(pinY); }
//============================================================================= int Epetra_SerialDenseSVD::SetMatrix(Epetra_SerialDenseMatrix & A_in) { ResetMatrix(); Matrix_ = &A_in; // Factor_ = &A_in; M_ = A_in.M(); N_ = A_in.N(); Min_MN_ = EPETRA_MIN(M_,N_); LDA_ = A_in.LDA(); // LDAF_ = LDA_; A_ = A_in.A(); // AF_ = A_in.A(); return(0); }
SimpleSoftBodyEntity(DemoEntityManager* const scene, const dVector& location) :DemoEntity(dGetIdentityMatrix(), NULL) ,m_body(NULL) { dMatrix matrix (dGetIdentityMatrix()); matrix.m_posit.m_x = location.m_x; matrix.m_posit.m_y = location.m_y; matrix.m_posit.m_z = location.m_z; ResetMatrix(*scene, matrix); // add an new entity to the world scene->Append(this); }
moTrackerSystemData::moTrackerSystemData() { m_ZoneW = 4; m_ZoneH = 4; _zonewf = 3.999999; _zonehf = 3.999999; m_Zones = m_ZoneW*m_ZoneH; m_PositionMatrix = new int [m_Zones]; m_MotionMatrix = new int [m_Zones]; m_AccelerationMatrix = new int [m_Zones]; m_CircularPositionMatrix = new int [m_Zones]; m_CircularMotionMatrix = new int [m_Zones]; m_Features.Init( 0, NULL ); m_nFeatures = 0; m_Distancias = NULL; m_Pares = NULL; nPares = 0; ResetMatrix(); }
void CChildView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { switch(nChar) { case 'r': case 'R': ResetMatrix(); break; case '1': glUniform1i( glGetUniformLocation(m_program, "diffuse_mat"), 0); InvalidateRect(NULL,FALSE); break; case '2': glUniform1i( glGetUniformLocation(m_program, "diffuse_mat"), 1); InvalidateRect(NULL,FALSE); break; } CShaderWnd::OnKeyDown(nChar, nRepCnt, nFlags); }
moTrackerSystemData::moTrackerSystemData( int ZoneW, int ZoneH ) { m_ZoneW = ZoneW; m_ZoneH = ZoneH; _zonewf = (float)(ZoneW) - 0.000001; _zonehf = (float)(ZoneH) - 0.000001; m_Zones = m_ZoneW*m_ZoneH; m_PositionMatrix = new int [m_Zones]; m_MotionMatrix = new int [m_Zones]; m_AccelerationMatrix = new int [m_Zones]; m_CircularPositionMatrix = new int [m_Zones]; m_CircularMotionMatrix = new int [m_Zones]; m_Features.Init( 0, NULL ); m_nFeatures = 0; m_Distancias = NULL; m_Pares = NULL; nPares = 0; ResetMatrix(); }
//============================================================================= Epetra_SerialDenseSVD::Epetra_SerialDenseSVD() : Epetra_Object("Epetra::SerialDenseSVD"), Epetra_CompObject(), Epetra_BLAS(), Epetra_LAPACK(), Transpose_(false), Factored_(false), Solved_(false), Inverted_(false), TRANS_('N'), M_(0), N_(0), Min_MN_(0), NRHS_(0), LDA_(0), LDAI_(0), LDB_(0), LDX_(0), INFO_(0), LWORK_(0), IWORK_(0), ANORM_(0.0), Matrix_(0), LHS_(0), RHS_(0), Inverse_(0), A_(0), AI_(0), WORK_(0), U_(0), S_(0), Vt_(0), B_(0), X_(0), UseTranspose_(false) { InitPointers(); ResetMatrix(); ResetVectors(); }
void DemoApplication::SmoothCamera::Reset (const Vector3& posit, const Quaternion& rotation) { Matrix4 matrix; matrix.makeTransform (posit, Vector3 (1.0f, 1.0f, 1.0f), rotation); matrix = matrix.transpose(); Matrix3 rot; matrix.extract3x3Matrix(rot); Radian rotX; Radian rotY; Radian rotZ; rot.ToEulerAnglesZYX (rotZ, rotY, rotX); m_cameraYawAngle = rotY; m_cameraPitchAngle = rotX; m_cameraTranslation = posit; ResetMatrix (&matrix[0][0]); // Matrix4 cameraMatrix; // InterplateMatrix (0.0f, cameraMatrix[0]); }
BasicCarEntity (DemoEntityManager* const scene, CustomVehicleControllerManager* const manager, const dMatrix& location, const BasciCarParameters& parameters) :DemoEntity (dGetIdentityMatrix(), NULL) ,m_tireaLigmentMatrix (dYawMatrix(3.141592f * 90.0f / 180.0f)) ,m_controller(NULL) ,m_helpKey (true) ,m_gearUpKey (false) ,m_gearDownKey (false) ,m_reverseGear (false) ,m_engineKeySwitch(false) ,m_automaticTransmission(true) ,m_engineKeySwitchCounter(0) ,m_engineOldKeyState(false) ,m_engineRPMOn(false) { // add this entity to the scene for rendering scene->Append(this); // place entity in the world ResetMatrix (*scene, location); NewtonWorld* const world = scene->GetNewton(); // create the vehicle collision shape NewtonCollision* const chassisCollision = CreateChassisCollision (world); // caret the visual mesh form the collision shape DemoMesh* const visualMesh = new DemoMesh ("vehicle chassis", chassisCollision, "metal_30.tga", "metal_30.tga", "metal_30.tga"); SetMesh (visualMesh, dGetIdentityMatrix()); visualMesh->Release(); // create the coordinate system dMatrix chassisMatrix; chassisMatrix.m_front = dVector (1.0f, 0.0f, 0.0f, 0.0f); // this is the vehicle direction of travel chassisMatrix.m_up = dVector (0.0f, 1.0f, 0.0f, 0.0f); // this is the downward vehicle direction chassisMatrix.m_right = chassisMatrix.m_front * chassisMatrix.m_up; // this is in the side vehicle direction (the plane of the wheels) chassisMatrix.m_posit = dVector (0.0f, 0.0f, 0.0f, 1.0f); // create a default vehicle controller m_controller = manager->CreateVehicle (chassisCollision, chassisMatrix, parameters.MASS, dVector (0.0f, DEMO_GRAVITY, 0.0f, 0.0f)); // get body the vehicle rigid body and set the Newton rigid body physics properties NewtonBody* const body = m_controller->GetBody(); // set the user data NewtonBodySetUserData(body, this); // set the transform callback NewtonBodySetTransformCallback (body, DemoEntity::TransformCallback); // set the standard force and torque call back NewtonBodySetForceAndTorqueCallback(body, PhysicsApplyGravityForce); // set the player matrix NewtonBodySetMatrix(body, &location[0][0]); // destroy the collision helper shape NewtonDestroyCollision(chassisCollision); // map the gear to a look up table: gear 0 is reverse, gea 1 is neutral, gear 1 is first, gear 2 is second and so on for (int i = 0; i < int ((sizeof (m_gearMap) / sizeof (m_gearMap[0]))); i ++) { m_gearMap[i] = i; } m_gearMap[0] = 1; m_gearMap[1] = 0; }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Summary: Updates the player! Parameters: [in] _elapsedTime - the time passed since the last frame. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ bool CPlayer::Update( float _elapsedTime ) { static bool once = false; // Timer for death animation. if( m_DeathTimer > 0.0f ) { m_DeathTimer -= _elapsedTime; m_StopAnimSwitching = true; if( GetLives() <= 1 ) { if( !once ) { GetAnimationManager()->SwitchAnimation(CAssetManager::GetInstance()->GetAnimation(ET_PLAYER, PL_LOSE), 0.5f); AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::STOP_MX_TRACK_04); AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::STOP_MX_TRACK_03); AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::STOP_MX_TRACK_02); AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::STOP_MX_TRACK_01); AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_MX_TRACK_02); SetLives(0); once = true; } } else { GetAnimationManager()->SwitchAnimation(CAssetManager::GetInstance()->GetAnimation(ET_PLAYER, PL_DEATH), 0.3f); } if(m_DeathTimer <= 0.0f) { SetIsDying(true); SetKillScreen(true); once = false; if( GetLives() == 0 ) { m_DeathTimer = 0.0f; return true; } m_ResetWave = true; m_DeathTimer = 0.0f; } GetAnimationManager()->Update(_elapsedTime, &GetRenderNode()); return true; } if(this->GetHealth() <= 25) { m_LowHPTimer += _elapsedTime; if(m_LowHPTimer > 1.5f) { m_LowHPTimer = 0.0f; // AudioSystemWwise::GetInstance()->PostEvent(AK::EVENTS::PLAY_FX_2D_BEEP); } } if(this->m_HealthPickup >= 0.0f) { static bool healthpickupcolor = false; if(healthpickupcolor) { //GetRenderNode().hTextureDiffuse = CAssetManager::GetInstance()->GetObjData(ET_PLAYER).m_DiffuseHandle; GetRenderNode().SetDiffuseTextureHandle( CAssetManager::GetInstance()->GetObjData(ET_SMALLENEMY).m_DiffuseHandle ); } else { GetRenderNode().SetDiffuseTextureHandle( CAssetManager::GetInstance()->GetObjData(ET_PLAYER).m_DiffuseHandle ); } m_HealthPickup -= HEALTH_PICKUP_BLINKING_TIME; healthpickupcolor = !healthpickupcolor; } else { GetRenderNode().SetDiffuseTextureHandle( CAssetManager::GetInstance()->GetObjData(ET_PLAYER).m_DiffuseHandle ); } if( GetIsDying() ) { SetIsDying(false); SetKillScreen(false); //m_StopAnimSwitching = false; Vec3f direction; glsLoadVector3(direction, 0.0f, 0.0f, 0.0f); glsCopyVector3(*GetPosition(), direction); GetRenderNode().SetPosition( direction ); ResetMatrix(); } // Vec3f direction; // glsLoadVector3(direction, 0.0f, 0.0f, 0.0f); // // Gets the two distances between the north and south pole (possibly in need of optimizations later). // float SDist = glsGetDistance3(direction, GetRenderNode().m_vPosition); // glsLoadVector3(direction, 0.0f, 150.0f, 0.0f); // float NDist = glsGetDistance3(direction, GetRenderNode().m_vPosition); // // finds the shortest one so it can travel to that one // bool HeadinNorth = NDist < SDist ; // // resets the vector if heading to the south // if(!HeadinNorth) // glsLoadVector3(direction, 0.0f, 0.0f, 0.0f); // // gets the directional vector // glsSubtractVectors3(direction, direction, GetRenderNode().m_vPosition); // glsNormalizeVector3(direction); // glsScaleVector3(direction, 30.0f * _elapsedTime); // // // moves the player by that direction by elapsedTime // glsAddVectors3(GetRenderNode().m_vPosition, GetRenderNode().m_vPosition, direction); // // if the distance is small enough the player stops moving // //glsLoadVector3(direction, 0.0f, 0.0f, 0.0f); // if( (HeadinNorth ? NDist : SDist) <= 0.5f ) // { // SetIsDying(false); // m_StopAnimSwitching = false; // ResetMatrix(); // GetAnimationManager()->SwitchAnimation(CAssetManager::GetInstance()->GetAnimation(ET_PLAYER, PL_IDLE), 0.01f); // } // // copying the player's new position% // glsCopyVector3(*this->GetPosition(), GetRenderNode().m_vPosition); // // // remaking the player's up vector // Vec3f world = { 0.0f, 75.0f, 0.0f }; // glsSubtractVectors3(direction, world, GetRenderNode().m_vPosition); // glsNormalizeVector3(direction); // glsCopyVector3(GetRenderNode().m_vUp, direction); // glsCrossProduct3( this->GetRenderNode().m_vForward, this->GetRenderNode().m_vRight, this->GetRenderNode().m_vUp ); // glsNormalizeVector3( this->GetRenderNode().m_vForward ); // glsCrossProduct3( this->GetRenderNode().m_vRight, this->GetRenderNode().m_vUp, this->GetRenderNode().m_vForward ); // glsNormalizeVector3( this->GetRenderNode().m_vRight ); // // returing out so no other calcualtions are done. // GetAnimationManager()->Update(_elapsedTime, &GetRenderNode()); // return true; //} if( m_PullTimer > 0.0f ) m_PullTimer -= _elapsedTime; else if( m_PullTimer < 0.0f ) m_PullTimer = 0.0f; if( m_PushTimer > 0.0f ) m_PushTimer -= _elapsedTime; else if( m_PushTimer < 0.0f ) m_PushTimer = 0.0f; m_Gun.AddTime(_elapsedTime); // Orient the movement glsCopyVector3(m_MoveUp, this->GetRenderNode().GetUpVector()); glsCrossProduct3( m_MoveForward, m_MoveRight, m_MoveUp ); glsNormalizeVector3( m_MoveForward ); glsCrossProduct3( m_MoveRight, m_MoveUp, m_MoveForward ); glsNormalizeVector3( m_MoveRight ); // Update the velocities. UpdateVelocity(); m_PosXOffset += (*this->GetVelocity())[0] * _elapsedTime; m_PosYOffset += (*this->GetVelocity())[1] * _elapsedTime; // Call parents update CLivingEntity::Update(_elapsedTime); // Update player specific data. // Player position GetRenderNode().SetPosition( ((const float *)(*GetPosition())) ); if( m_JumpTimer > 0.0f ) { m_JumpTimer -= _elapsedTime; } else if( m_JumpTimer < 0.0f ) m_JumpTimer = 0.0f; ////////////////////////////////////////////// // Debug Code ////////////////////////////////////////////// //if( GetAsyncKeyState('P') & 0x01 ) //{ // std::cout << "HUD INFO:\n"; // std::cout << "HP : " << this->GetHealth() << '/' << MAX_HP_PLAYER << std::endl; // std::cout << "Lives : " << this->GetLives() << std::endl; // std::cout << "Ammo : " << this->GetGun().GetShotTotal() << std::endl; // std::cout << "Curr Gun : " << this->GetGun().GetConsumed() << std::endl; //} //HAX //AUTH: Ryan //Desc: feedback for player hurt, replace with animation / effect later //Date: ???? static float hurtTimer = 0.0f; if(m_Hurt) { GetRenderNode().SetColor(1.0f, 0.2f, 0.2f, 1.0f); hurtTimer += _elapsedTime; if(hurtTimer >= 0.5f) { //this->GetRenderNode().hTextureDiffuse = CAssetManager::GetInstance()->GetObjData(ET_PLAYER).m_DiffuseHandle; GetRenderNode().SetColor(1.0f, 1.0f, 1.0f, 1.0f); hurtTimer = 0.0f; m_Hurt = false; } } glsCopyVector3(((Sphere*)this->GetCollisionEntity())->m_Center, this->GetRenderNode().GetPosition()); return true; }