void GoBoard::AddStone(int point, int color) { int boardColor = color == S_BLACK? B_BLACK : B_WHITE; // int w = West(point); // int e = East(point); // int n = North(point); // int s = South(point); State.stones[point] = boardColor; if(West(point) != -1) { --State.numNeighboursEmpty[West(point)]; ++State.numNeighbours[color][West(point)]; } if(East(point) != -1) { --State.numNeighboursEmpty[East(point)]; ++State.numNeighbours[color][East(point)]; } if(North(point) != -1) { --State.numNeighboursEmpty[North(point)]; ++State.numNeighbours[color][North(point)]; } if(South(point) != -1) { --State.numNeighboursEmpty[South(point)]; ++State.numNeighbours[color][South(point)]; } UpdateBlocks(point,color); }
void FIndirectLightingCache::FinalizeUpdateInternal_RenderThread(FScene* Scene, FSceneRenderer& Renderer, TMap<FIntVector, FBlockUpdateInfo>& BlocksToUpdate, const TArray<FIndirectLightingCacheAllocation*>& TransitionsOverTimeToUpdate) { check(IsInRenderingThread()); if (IndirectLightingAllowed(Scene, Renderer)) { { SCOPE_CYCLE_COUNTER(STAT_UpdateIndirectLightingCacheBlocks); UpdateBlocks(Scene, Renderer.Views.GetData(), BlocksToUpdate); } { SCOPE_CYCLE_COUNTER(STAT_UpdateIndirectLightingCacheTransitions); UpdateTransitionsOverTime(TransitionsOverTimeToUpdate, Renderer.ViewFamily.DeltaWorldTime); } } if (GCacheDrawLightingSamples || Renderer.ViewFamily.EngineShowFlags.VolumeLightingSamples || GCacheDrawDirectionalShadowing) { FViewElementPDI DebugPDI(Renderer.Views.GetData(), NULL); for (int32 VolumeIndex = 0; VolumeIndex < Scene->PrecomputedLightVolumes.Num(); VolumeIndex++) { const FPrecomputedLightVolume* PrecomputedLightVolume = Scene->PrecomputedLightVolumes[VolumeIndex]; PrecomputedLightVolume->DebugDrawSamples(&DebugPDI, GCacheDrawDirectionalShadowing != 0); } } }
void SoniEngine::SetMode(int argMode) { switch (argMode) { case 0: { int flag = 0; if (mode != 0) flag = 1; mode = 0; if (flag) { // Make sure to reset connections and clear all blocks UpdateBlocks(); } break; } case 1: { int flag = 0; if (mode != 1) flag = 1; mode = 1; if (flag) { // Make sure to reset connections and clear all blocks UpdateBlocks(); } break; } default: { std::cout << argMode << " is not a valid mode. SetMode() call ignored.\n"; break; } } }
void FIndirectLightingCache::UpdateCache(FScene* Scene, FSceneRenderer& Renderer, bool bAllowUnbuiltPreview) { if (IsIndirectLightingCacheAllowed()) { bool bAnyViewAllowsIndirectLightingCache = false; for (int32 ViewIndex = 0; ViewIndex < Renderer.Views.Num(); ViewIndex++) { bAnyViewAllowsIndirectLightingCache |= Renderer.Views[ViewIndex].Family->EngineShowFlags.IndirectLightingCache; } if (bAnyViewAllowsIndirectLightingCache) { SCOPE_CYCLE_COUNTER(STAT_UpdateIndirectLightingCache); TMap<FIntVector, FBlockUpdateInfo> BlocksToUpdate; TArray<FIndirectLightingCacheAllocation*> TransitionsOverTimeToUpdate; if (bUpdateAllCacheEntries) { const uint32 PrimitiveCount = Scene->Primitives.Num(); for (uint32 PrimitiveIndex = 0; PrimitiveIndex < PrimitiveCount; ++PrimitiveIndex) { FPrimitiveSceneInfo* PrimitiveSceneInfo = Scene->Primitives[PrimitiveIndex]; UpdateCachePrimitive(Scene, PrimitiveSceneInfo, false, true, BlocksToUpdate, TransitionsOverTimeToUpdate); } } // Go over the views and operate on any relevant visible primitives for (int32 ViewIndex = 0; ViewIndex < Renderer.Views.Num(); ViewIndex++) { FViewInfo& View = Renderer.Views[ViewIndex]; if (!bUpdateAllCacheEntries) { for (FSceneSetBitIterator BitIt(View.PrimitiveVisibilityMap); BitIt; ++BitIt) { uint32 PrimitiveIndex = BitIt.GetIndex(); FPrimitiveSceneInfo* PrimitiveSceneInfo = Scene->Primitives[PrimitiveIndex]; const FPrimitiveViewRelevance& PrimitiveRelevance = View.PrimitiveViewRelevanceMap[PrimitiveIndex]; UpdateCachePrimitive(Scene, PrimitiveSceneInfo, bAllowUnbuiltPreview, PrimitiveRelevance.bOpaqueRelevance, BlocksToUpdate, TransitionsOverTimeToUpdate); } } UpdateTranslucentVolumeCache(View, BlocksToUpdate, TransitionsOverTimeToUpdate); } UpdateBlocks(Scene, Renderer.Views.GetTypedData(), BlocksToUpdate); UpdateTransitionsOverTime(TransitionsOverTimeToUpdate, Renderer.ViewFamily.DeltaWorldTime); if (GCacheDrawLightingSamples || Renderer.ViewFamily.EngineShowFlags.VolumeLightingSamples || GCacheDrawDirectionalShadowing) { FViewElementPDI DebugPDI(Renderer.Views.GetTypedData(), NULL); for (int32 VolumeIndex = 0; VolumeIndex < Scene->PrecomputedLightVolumes.Num(); VolumeIndex++) { const FPrecomputedLightVolume* PrecomputedLightVolume = Scene->PrecomputedLightVolumes[VolumeIndex]; PrecomputedLightVolume->DebugDrawSamples(&DebugPDI, GCacheDrawDirectionalShadowing != 0); } } } bUpdateAllCacheEntries = false; } }
void GoBoard::UpdateBlocks(const GoPoint p) { UpdateBlocks(Pos(p), p.color); }
void SoniEngine::UpdateFrame(TwoDArray<float> argIncomingFrame) { frameData = argIncomingFrame; UpdateBlocks(); }
// Update base data functions // -------------------------- void SoniEngine::UpdateData(std::vector<float> argData) { lineData = argData; UpdateBlocks(); }