void Field::MakeLabyrinth() { srand (time(NULL)); for (int iii = 1; iii < g_HEIGHT-1; iii++) { for (int jjj = 1; jjj < g_WIDTH-1; jjj++) { int placePercentValue = rand() % 100; // 30% chance to place obstacle if (placePercentValue < 40) { F(iii, jjj).SetTileChar("╳"); // Random color //F(iii, jjj).SetColor(static_cast<Color>(rand() % (COLOR_COUNT - 1) + 1)); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); } } } for (int iii = 0; iii < g_HEIGHT; iii++) { for (int jjj = 0; jjj < g_WIDTH; jjj++) { SmothWalls(iii, jjj); } } }
void CDeflectorShield::Update(SEntityUpdateContext& ctx, int updateSlot) { if (updateSlot != 0) return; UpdateDeflectedEnergies(ctx.fFrameTime); DebugDraw(); }
void CPlayerStateSwim_WaterTestProxy::UpdateInWater(const CPlayer& player, const float frameTime) { FUNCTION_PROFILER(GetISystem(), PROFILE_GAME); const Matrix34& playerWorldTM = player.GetEntity()->GetWorldTM(); const Vec3 playerWorldPos = playerWorldTM.GetTranslation(); const Vec3 localReferencePos = GetLocalReferencePosition(player); const Vec3 worldReferencePos = playerWorldPos + (Quat(playerWorldTM) * localReferencePos); const bool shouldUpdate = ((gEnv->pTimer->GetCurrTime() - m_timeWaterLevelLastUpdated) > 0.3f ) || ((m_lastWaterLevelCheckPosition - playerWorldPos).len2() >= sqr(0.35f)) || (m_lastInternalState != m_internalState && m_internalState == eProxyInternalState_PartiallySubmerged); //Just entered partially emerged state if (shouldUpdate && !IsWaitingForBottomLevelResults()) { RayTestBottomLevel(player, worldReferencePos, s_rayLength); IPhysicalEntity* piPhysEntity = player.GetEntity()->GetPhysics(); UpdateWaterLevel( worldReferencePos, playerWorldPos, piPhysEntity ); if (m_waterLevel > WATER_LEVEL_UNKNOWN) { m_playerWaterLevel = (worldReferencePos.z - m_waterLevel); } else { m_playerWaterLevel = -WATER_LEVEL_UNKNOWN; m_bottomLevel = BOTTOM_LEVEL_UNKNOWN; m_headUnderwater = false; m_headComingOutOfWater = false; } } m_relativeBottomLevel = (m_bottomLevel > BOTTOM_LEVEL_UNKNOWN) ? m_waterLevel - m_bottomLevel : 0.0f; const float localHeadZ = player.GetLocalEyePos().z + 0.2f; const float worldHeadZ = playerWorldPos.z + localHeadZ; const bool headWasUnderWater = m_headUnderwater; m_headUnderwater = ((worldHeadZ - m_waterLevel) < 0.0f); m_headComingOutOfWater = headWasUnderWater && (!m_headUnderwater); if (m_internalState == eProxyInternalState_Swimming) { m_shouldSwim = ShouldSwim(max(localReferencePos.z, 1.3f)); } else { UpdateSubmergedFraction(localReferencePos.z, playerWorldPos.z, m_waterLevel); m_shouldSwim = ShouldSwim(max(localReferencePos.z, 1.3f)) && (m_swimmingTimer < - 0.5f); } #ifdef STATE_DEBUG DebugDraw(player, worldReferencePos); #endif }
void CBurnEffectManager::Update(float deltaTime) { TBurnPoints::iterator it = m_burnPoints.begin(); for (; it != m_burnPoints.end();) { SBurnPoint& burnPoint = *it; if (burnPoint.m_accumulationDelay > 0.0f) burnPoint.m_accumulationDelay -= deltaTime; else burnPoint.m_accumulation -= deltaTime * burnPoint.m_pBurnParams->m_dissipation; burnPoint.m_accumulation = SATURATE(burnPoint.m_accumulation); if (burnPoint.m_accumulation <= 0) { DestroyBurnEffect(&burnPoint); it = m_burnPoints.erase(it); } else { UpdateBurnEffect(&burnPoint); ++it; } } ApplySurroundingDamage(deltaTime); if (g_pGameCVars->pl_mike_debug) DebugDraw(); }
void Field::FillField() { for (int iii = 0; iii < g_HEIGHT; iii++) { for (int jjj = 0; jjj < g_WIDTH; jjj++) { //Corners drawing. if (iii == 0 && jjj == 0) { F(iii, jjj).SetTileChar("╔"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } if (iii == 0 && jjj == g_WIDTH-1) { F(iii, jjj).SetTileChar("╗"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } if (iii == g_HEIGHT-1 && jjj == 0) { F(iii, jjj).SetTileChar("╚"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } if (iii == g_HEIGHT-1 && jjj == g_WIDTH-1) { F(iii, jjj).SetTileChar("╝"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } //Horizontal pipes drawing. if ((iii == 0 || iii == g_HEIGHT-1) && (jjj > 0 && jjj < g_WIDTH-1)) { F(iii, jjj).SetTileChar("═"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } //Vertical pipes drawing. if ((jjj == 0 || jjj == g_WIDTH-1) && (iii > 0 && iii < g_HEIGHT-1)) { F(iii, jjj).SetTileChar("║"); F(iii, jjj).SetTilePassability(false); DebugDraw(iii, jjj); continue; } //All other floor tiles. F(iii, jjj).SetTileChar("+"); F(iii, jjj).SetTilePassability(true); } } MakeLabyrinth(); }
void CAutoAimManager::Update(float dt) { FUNCTION_PROFILER(GetISystem(), PROFILE_GAME); const int numAutoaimTargets = m_autoaimTargets.size(); //Update the autoaim positions for the entities for(int i = 0; i < numAutoaimTargets; i++) { UpdateTargetInfo(m_autoaimTargets[i], dt); } #if DEBUG_AUTOAIM_MANAGER if (g_autoAimManagerDebug) { DebugDraw(); } #endif }
// Description: // // Arguments: // // Return: // bool CPersonalRangeSignaling::Update( float fElapsedTime, uint32 uDebugOrder ) { CRY_ASSERT( m_bInit == true ); bool bRet = false; if(m_bEnabled) { if( uDebugOrder > 0 ) { DebugDraw( uDebugOrder ); } // Iterate all actors and check range to them IActorIteratorPtr pActorIt = CCryAction::GetCryAction()->GetIActorSystem()->CreateActorIterator(); while( IActor * pActor = pActorIt->Next() ) { EntityId entityId = pActor->GetEntityId(); if( entityId != GetEntityId() ) { // Skip over if not enabled IAIObject const* pAIObject = GetEntityAI(entityId); if (!pAIObject || pAIObject->IsEnabled()) { CheckActorRanges( pActor ); CheckActorAngles( pActor ); // Do check on target ranges MapTargetRanges::iterator itTargetRanges = m_mapTargetRanges.find(entityId); if (itTargetRanges != m_mapTargetRanges.end()) { CheckActorTargetRanges( pActor ); } } } } bRet = true; } return( bRet ); }
update_status ModuleCollision::Update() { Collider* c1; Collider* c2; for (uint i = 0; i < MAX_COLLIDERS; ++i) { // skip empty colliders if (colliders[i] == nullptr) continue; c1 = colliders[i]; // avoid checking collisions already checked for (uint k = i + 1; k < MAX_COLLIDERS; ++k) { // skip empty colliders if (colliders[k] == nullptr) continue; c2 = colliders[k]; if (c1->CheckCollision(c2->rect) == true) { c1->Checkparticle(c1, c2); if (matrix[c1->type][c2->type] && c1->callback) c1->callback->OnCollision(c1, c2); if (matrix[c2->type][c1->type] && c2->callback) c2->callback->OnCollision(c2, c1); } } } DebugDraw(); return UPDATE_CONTINUE; }
// Description: // // Arguments: // // Return: // bool CPersonalSignalTimer::Update( float fElapsedTime, uint32 uDebugOrder ) { CRY_ASSERT( m_bInit == true ); bool bRet = true; if( m_bEnabled == true ) { m_fTimer -= fElapsedTime; m_fTimerSinceLastReset += fElapsedTime; if( m_fTimer < 0.0f ) { SendSignal(); Reset(); } } if( uDebugOrder > 0 ) { DebugDraw( uDebugOrder ); } return( bRet ); }
/* ================ idPhysics_RigidBody::Evaluate Evaluate the impulse based rigid body physics. When a collision occurs an impulse is applied at the moment of impact but the remaining time after the collision is ignored. ================ */ bool idPhysics_RigidBody::Evaluate( int timeStepMSec, int endTimeMSec ) { rigidBodyPState_t next; idAngles angles; trace_t collision; idVec3 impulse; idEntity *ent; idVec3 oldOrigin, masterOrigin; idMat3 oldAxis, masterAxis; float timeStep; bool collided, cameToRest = false; timeStep = MS2SEC( timeStepMSec ); current.lastTimeStep = timeStep; if ( hasMaster ) { oldOrigin = current.i.position; oldAxis = current.i.orientation; self->GetMasterPosition( masterOrigin, masterAxis ); current.i.position = masterOrigin + current.localOrigin * masterAxis; if ( isOrientated ) { current.i.orientation = current.localAxis * masterAxis; } else { current.i.orientation = current.localAxis; } clipModel->Link( gameLocal.clip, self, clipModel->GetId(), current.i.position, current.i.orientation ); current.i.linearMomentum = mass * ( ( current.i.position - oldOrigin ) / timeStep ); current.i.angularMomentum = inertiaTensor * ( ( current.i.orientation * oldAxis.Transpose() ).ToAngularVelocity() / timeStep ); current.externalForce.Zero(); current.externalTorque.Zero(); return ( current.i.position != oldOrigin || current.i.orientation != oldAxis ); } // if the body is at rest if ( current.atRest >= 0 || timeStep <= 0.0f ) { DebugDraw(); return false; } // if putting the body to rest if ( dropToFloor ) { DropToFloorAndRest(); current.externalForce.Zero(); current.externalTorque.Zero(); return true; } #ifdef RB_TIMINGS timer_total.Start(); #endif // move the rigid body velocity into the frame of a pusher // current.i.linearMomentum -= current.pushVelocity.SubVec3( 0 ) * mass; // current.i.angularMomentum -= current.pushVelocity.SubVec3( 1 ) * inertiaTensor; clipModel->Unlink(); next = current; // calculate next position and orientation Integrate( timeStep, next ); #ifdef RB_TIMINGS timer_collision.Start(); #endif // check for collisions from the current to the next state collided = CheckForCollisions( timeStep, next, collision ); #ifdef RB_TIMINGS timer_collision.Stop(); #endif // set the new state current = next; if ( collided ) { // apply collision impulse if ( CollisionImpulse( collision, impulse ) ) { current.atRest = gameLocal.time; } } // update the position of the clip model clipModel->Link( gameLocal.clip, self, clipModel->GetId(), current.i.position, current.i.orientation ); DebugDraw(); if ( !noContact ) { #ifdef RB_TIMINGS timer_collision.Start(); #endif // get contacts EvaluateContacts(); #ifdef RB_TIMINGS timer_collision.Stop(); #endif // check if the body has come to rest if ( TestIfAtRest() ) { // put to rest Rest(); cameToRest = true; } else { // apply contact friction ContactFriction( timeStep ); } } if ( current.atRest < 0 ) { ActivateContactEntities(); } if ( collided ) { // if the rigid body didn't come to rest or the other entity is not at rest ent = gameLocal.entities[collision.c.entityNum]; if ( ent && ( !cameToRest || !ent->IsAtRest() ) ) { // apply impact to other entity ent->ApplyImpulse( self, collision.c.id, collision.c.point, -impulse ); } } // move the rigid body velocity back into the world frame // current.i.linearMomentum += current.pushVelocity.SubVec3( 0 ) * mass; // current.i.angularMomentum += current.pushVelocity.SubVec3( 1 ) * inertiaTensor; current.pushVelocity.Zero(); current.lastTimeStep = timeStep; current.externalForce.Zero(); current.externalTorque.Zero(); if ( IsOutsideWorld() ) { gameLocal.Warning( "rigid body moved outside world bounds for entity '%s' type '%s' at (%s)", self->name.c_str(), self->GetType()->classname, current.i.position.ToString(0) ); Rest(); } #ifdef RB_TIMINGS timer_total.Stop(); if ( rb_showTimings->integer == 1 ) { gameLocal.Printf( "%12s: t %u cd %u\n", self->name.c_str(), timer_total.Milliseconds(), timer_collision.Milliseconds() ); lastTimerReset = 0; } else if ( rb_showTimings->integer == 2 ) { numRigidBodies++; if ( endTimeMSec > lastTimerReset ) { gameLocal.Printf( "rb %d: t %u cd %u\n", numRigidBodies, timer_total.Milliseconds(), timer_collision.Milliseconds() ); } } if ( endTimeMSec > lastTimerReset ) { lastTimerReset = endTimeMSec; numRigidBodies = 0; timer_total.Clear(); timer_collision.Clear(); } #endif return true; }
/* ================ rvPhysics_Particle::Evaluate Evaluate the impulse based rigid body physics. When a collision occurs an impulse is applied at the moment of impact but the remaining time after the collision is ignored. ================ */ bool rvPhysics_Particle::Evaluate( int timeStepMSec, int endTimeMSec ) { particlePState_t next; float timeStep; float upspeed; timeStep = MS2SEC( timeStepMSec ); // if bound to a master if ( hasMaster ) { idVec3 masterOrigin; idMat3 masterAxis; idVec3 oldOrigin; oldOrigin = current.origin; self->GetMasterPosition( masterOrigin, masterAxis ); current.origin = masterOrigin + current.localOrigin * masterAxis; // RAVEN BEGIN // ddynerman: multiple clip worlds clipModel->Link( self, clipModel->GetId(), current.origin, current.localAxis * masterAxis ); // RAVEN END trace_t tr; gameLocal.Translation( self, tr, oldOrigin, current.origin, clipModel, clipModel->GetAxis(), clipMask, self ); if ( tr.fraction < 1.0f ) { self->Collide ( tr, current.origin - oldOrigin ); } DebugDraw(); return true; } // if the body is at rest if ( current.atRest >= 0 || timeStep <= 0.0f ) { DebugDraw(); return false; } // if putting the body to rest if ( dropToFloor ) { DropToFloorAndRest(); return true; } clipModel->Unlink(); // Determine if currently on the ground CheckGround ( ); // Determine the current upward velocity if ( gravityNormal != vec3_zero ) { upspeed = -( current.velocity * gravityNormal ); } else { upspeed = current.velocity.z; } // If not on the ground, or moving upwards, or bouncing and moving toward gravity then do a straight // forward slide move and gravity. if ( !current.onGround || upspeed > 1.0f || (bouncyness > 0.0f && upspeed < -PRT_BOUNCESTOP && !current.inWater) ) { // Force ground off when moving upward if ( upspeed > 0.0f ) { current.onGround = false; } SlideMove( current.origin, current.velocity, current.velocity * timeStep ); if ( current.onGround && upspeed < PRT_BOUNCESTOP ) { current.velocity -= ( current.velocity * gravityNormal ) * gravityNormal; } else { current.velocity += (gravityVector * timeStep); } } else { idVec3 delta; // Slow down due to friction ApplyFriction ( timeStep ); delta = current.velocity * timeStep; current.velocity -= ( current.velocity * gravityNormal ) * gravityNormal; if ( delta == vec3_origin ) { PutToRest( ); } else { SlideMove( current.origin, current.velocity, delta ); } } // update the position of the clip model // RAVEN BEGIN // ddynerman: multiple clip worlds clipModel->Link( self, clipModel->GetId(), current.origin, clipModel->GetAxis() ); // RAVEN END DebugDraw(); // get all the ground contacts EvaluateContacts(); current.pushVelocity.Zero(); if ( IsOutsideWorld() ) { gameLocal.Warning( "clip model outside world bounds for entity '%s' at (%s)", self->name.c_str(), current.origin.ToString(0) ); PutToRest(); } return true; }
/* * DebugDraw.cpp * * Created on: 17.09.2012 * Author: nopper */ #include "../../UsedLibs.h" #include "../../layer0/math/Matrix4x4.h" #include "LineGeometry.h" #include "LineGeometryManager.h" #include "DebugDraw.h" const DebugDraw DebugDraw::drawer = DebugDraw(); DebugDraw::DebugDraw() { } DebugDraw::~DebugDraw() { } void DebugDraw::draw(const Point4& start, const Point4& end, const Color& color) const { if (!LineGeometryManager::getInstance()->getLineGeometry("SingleLine").get()) { return; }
void CAICorpseManager::Update( const float frameTime ) { const uint32 maxCorpsesToUpdateThisFrame = 4; const float cullPhysicsDistanceSqr = g_pGameCVars->g_aiCorpses_CullPhysicsDistance * g_pGameCVars->g_aiCorpses_CullPhysicsDistance; const float forceDeleteDistanceSqr = g_pGameCVars->g_aiCorpses_ForceDeleteDistance * g_pGameCVars->g_aiCorpses_ForceDeleteDistance; if (m_lastUpdatedCorpseIdx >= (uint32)m_corpsesArray.size()) m_lastUpdatedCorpseIdx = 0; const CCamera& viewCamera = gEnv->pSystem->GetViewCamera(); CryFixedArray<EntityId, maxCorpsesToUpdateThisFrame> corpsesToDelete; const uint32 corpsesEndIdx = min(m_lastUpdatedCorpseIdx + maxCorpsesToUpdateThisFrame, (uint32)m_corpsesArray.size()); for(uint32 i = m_lastUpdatedCorpseIdx; i < corpsesEndIdx; ++i) { CorpseInfo& corpseInfo = m_corpsesArray[i]; IEntity* pCorpseEntity = corpseInfo.GetCorpseEntity(); if(pCorpseEntity != NULL) { AABB corpseBbox; pCorpseEntity->GetWorldBounds(corpseBbox); corpseBbox.Expand(Vec3(0.1f, 0.1f, 0.1f)); const Vec3 corpsePosition = corpseBbox.GetCenter(); const float distanceSqr = (corpsePosition - viewCamera.GetPosition()).len2(); const bool attemptDeleteFarAway = (distanceSqr > forceDeleteDistanceSqr); const bool cullPhysics = (distanceSqr > cullPhysicsDistanceSqr); const bool isVisible = viewCamera.IsAABBVisible_F(corpseBbox); corpseInfo.flags.SetFlags( CorpseInfo::eFlag_FarAway, attemptDeleteFarAway ); if(attemptDeleteFarAway && !isVisible) { corpsesToDelete.push_back(corpseInfo.corpseId); } else if(cullPhysics != corpseInfo.flags.AreAllFlagsActive( CorpseInfo::eFlag_PhysicsDisabled )) { IEntityPhysicalProxy* pCorpsePhysicsProxy = static_cast<IEntityPhysicalProxy*>(pCorpseEntity->GetProxy( ENTITY_PROXY_PHYSICS )); if (pCorpsePhysicsProxy != NULL) { //Simulate entity event to enable/disable physics SEntityEvent visibilityEvent; visibilityEvent.event = cullPhysics ? ENTITY_EVENT_HIDE : ENTITY_EVENT_UNHIDE; pCorpsePhysicsProxy->ProcessEvent( visibilityEvent ); if(cullPhysics == false) { IPhysicalEntity* pCorpsePhysics = pCorpseEntity->GetPhysics(); if(pCorpsePhysics != NULL) { pe_action_awake awakeAction; awakeAction.bAwake = 0; pCorpsePhysics->Action( &awakeAction ); } } } corpseInfo.flags.SetFlags( CorpseInfo::eFlag_PhysicsDisabled, cullPhysics ); } } else { //This should not happen, but in case remove the entity from the list GameWarning("AICorpseManager - Detected corpse with no entity, removing from list"); corpsesToDelete.push_back(corpseInfo.corpseId); } } m_lastUpdatedCorpseIdx = corpsesEndIdx; for(uint32 i = 0; i < (uint32)corpsesToDelete.size(); ++i) { RemoveCorpse(corpsesToDelete[i]); } DebugDraw(); }
int main(int argc, char** argv) { if(argc == 3) { festring Arg = festring(argv[1]); if(Arg == "-l") { highscore Input(argv[2]); if(!Input.GetSize()) { std::cout << "No games. No winners.\n"; } std::cout << std::endl; for(festring::sizetype c = 0; c < Input.GetSize(); ++c) std::cout << c + 1 << " " << Input.GetEntry(c).CStr() << " " << Input.GetScore(c) << "\n"; return 0; } else if(Arg == "-h") { return OutputHTML(argv[2]); } else if(Arg == "-d") { if(!DebugDraw(argv[2])) { std::cout << "\nProblem showing version number\n"; return 1; } return 0; } else return 1; } if(argc == 4) { highscore Input; Input.Load(argv[1]); if(!Input.CheckVersion()) { std::cout << "Version check not ok with " << argv[1] << std::endl; return 2; } highscore Output; Output.Load(argv[2]); if(!Output.CheckVersion()) { std::cout << "Version check not ok with " << argv[2] << std::endl; return 2; } if(!Input.MergeToFile(&Output)) std::cout << "\n All entries also found in " << argv[2] << ". Oh well.\n"; Output.Save(argv[3]); return 0; } std::cout << "\nTo list scores in highscore file:\n" " mihail -l [filename]" "\n\nTo merge 2 files\n" " mihail [1st input filename] [2nd input filename] [output filename]" "\n\nTo give version number of highscore file\n" " mihail -d [filename]\n" "Notice that first filename in merges gives also version number\n"; return 1; }
//------------------------------------------------------------------------ void CViewSystem::Update(float frameTime) { FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION); if (gEnv->IsDedicated()) return; CView* const __restrict pActiveView = static_cast<CView*>(GetActiveView()); TViewMap::const_iterator Iter(m_views.begin()); TViewMap::const_iterator const IterEnd(m_views.end()); for (; Iter != IterEnd; ++Iter) { CView* const __restrict pView = Iter->second; bool const bIsActive = (pView == pActiveView); pView->Update(frameTime, bIsActive); if (bIsActive) { CCamera &rCamera = pView->GetCamera(); pView->UpdateAudioListener(rCamera.GetMatrix()); SViewParams currentParams = *(pView->GetCurrentParams()); rCamera.SetJustActivated(currentParams.justActivated); currentParams.justActivated = false; pView->SetCurrentParams(currentParams); if (m_bOverridenCameraRotation) { // When camera rotation is overridden. Vec3 pos = rCamera.GetMatrix().GetTranslation(); Matrix34 camTM(m_overridenCameraRotation); camTM.SetTranslation(pos); rCamera.SetMatrix(camTM); } else { // Normal setting of the camera if (m_fCameraNoise > 0) { Matrix33 m = Matrix33(rCamera.GetMatrix()); m.OrthonormalizeFast(); Ang3 aAng1 = Ang3::GetAnglesXYZ(m); //Ang3 aAng2 = RAD2DEG(aAng1); Matrix34 camTM = rCamera.GetMatrix(); Vec3 pos = camTM.GetTranslation(); camTM.SetIdentity(); const float fScale = 0.1f; CPNoise3* pNoise = m_pSystem->GetNoiseGen(); float fRes = pNoise->Noise1D(gEnv->pTimer->GetCurrTime() * m_fCameraNoiseFrequency); aAng1.x += fRes * m_fCameraNoise * fScale; pos.z -= fRes * m_fCameraNoise * fScale; fRes = pNoise->Noise1D(17 + gEnv->pTimer->GetCurrTime() * m_fCameraNoiseFrequency); aAng1.y -= fRes * m_fCameraNoise * fScale; //aAng1.z+=fRes*0.025f; // left / right movement should be much less visible camTM.SetRotationXYZ(aAng1); camTM.SetTranslation(pos); rCamera.SetMatrix(camTM); } } m_pSystem->SetViewCamera(rCamera); } } // Display debug info on screen if (m_nViewSystemDebug) { DebugDraw(); } // perform dynamic color grading // Beni - Commented for console demo stuff /****************************************************************************************** if (!IsPlayingCutScene() && gEnv->pAISystem) { SAIDetectionLevels detection; gEnv->pAISystem->GetDetectionLevels(nullptr, detection); float factor = detection.puppetThreat; // marcok: magic numbers taken from Maciej's tweaked values (final - initial) { float percentage = (0.0851411f - 0.0509998f)/0.0509998f * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_GrainAmount", amount); gEnv->p3DEngine->SetPostEffectParam("ColorGrading_GrainAmount_Offset", amount*percentage); } { float percentage = (0.405521f - 0.256739f)/0.256739f * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_SharpenAmount", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_SharpenAmount_Offset", amount*percentage); } { float percentage = (0.14f - 0.11f)/0.11f * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_PhotoFilterColorDensity", amount); gEnv->p3DEngine->SetPostEffectParam("ColorGrading_PhotoFilterColorDensity_Offset", amount*percentage); } { float percentage = (234.984f - 244.983f)/244.983f * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_maxInput", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_maxInput_Offset", amount*percentage); } { float percentage = (239.984f - 247.209f)/247.209f * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_maxOutput", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_maxOutput_Offset", amount*percentage); } { Vec4 dest(0.0f/255.0f, 22.0f/255.0f, 33.0f/255.0f, 1.0f); Vec4 initial(2.0f/255.0f, 154.0f/255.0f, 226.0f/255.0f, 1.0f); Vec4 percentage = (dest - initial)/initial * factor; Vec4 amount; gEnv->p3DEngine->GetPostEffectParamVec4("clr_ColorGrading_SelectiveColor", amount); //gEnv->p3DEngine->SetPostEffectParamVec4("clr_ColorGrading_SelectiveColor_Offset", amount*percentage); } { float percentage = (-5.0083 - -1.99999)/-1.99999 * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_SelectiveColorCyans", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_SelectiveColorCyans_Offset", amount*percentage); } { float percentage = (10.0166 - -5.99999)/-5.99999 * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_SelectiveColorMagentas", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_SelectiveColorMagentas_Offset", amount*percentage); } { float percentage = (10.0166 - 1.99999)/1.99999 * factor; float amount = 0.0f; gEnv->p3DEngine->GetPostEffectParam("ColorGrading_SelectiveColorYellows", amount); //gEnv->p3DEngine->SetPostEffectParam("ColorGrading_SelectiveColorYellows_Offset", amount*percentage); } } ********************************************************************************************/ }