| 12 | #include "Engine/Audio/AudioSource.h" |
| 13 | |
| 14 | float TexturesStreamingHandler::CalculateTargetQuality(StreamableResource* resource, double currentTime) |
| 15 | { |
| 16 | ASSERT(resource); |
| 17 | auto& texture = *(StreamingTexture*)resource; |
| 18 | const TextureHeader& header = *texture.GetHeader(); |
| 19 | float result = 1.0f; |
| 20 | if (header.TextureGroup >= 0 && header.TextureGroup < Streaming::TextureGroups.Count()) |
| 21 | { |
| 22 | // Quality based on texture group settings |
| 23 | const TextureGroup& group = Streaming::TextureGroups[header.TextureGroup]; |
| 24 | result = group.Quality; |
| 25 | |
| 26 | // Drop quality if invisible |
| 27 | const double lastRenderTime = texture.GetTexture()->LastRenderTime; |
| 28 | if (lastRenderTime < 0 || group.TimeToInvisible <= (float)(currentTime - lastRenderTime)) |
| 29 | { |
| 30 | result *= group.QualityIfInvisible; |
| 31 | } |
| 32 | } |
| 33 | return result; |
| 34 | } |
| 35 | |
| 36 | int32 TexturesStreamingHandler::CalculateResidency(StreamableResource* resource, float quality) |
| 37 | { |
no test coverage detected