| 629 | |
| 630 | static int ShadowFactor(Scene* scene) |
| 631 | { |
| 632 | float addLightsFactor = scene->MainLight()->NightEffect(); |
| 633 | float skyCoef = floatMin(scene->GetLandscape()->SkyThrough(), 0.6f); |
| 634 | float shadowFactor = skyCoef + 0.1f; |
| 635 | return toIntFloor(shadowFactor * (1 - addLightsFactor) * 255); |
| 636 | } |
| 637 | |
| 638 | int Scene::AdjustShadowComplexity(SortObjectList& objs) |
| 639 | { |
| 640 | #if 1 |
| 641 | int totalComplexity = 0; |
| 642 | |
| 643 | int shadowFactorI = ShadowFactor(this); |
| 644 | |
| 645 | for (int i = 0; i < objs.Size(); i++) |
| 646 | { |
| 647 | SortObject* oi = objs[i]; |
| 648 | Object* obj = oi->object; |
| 649 | LODShape* shape = oi->shape; |
| 650 | if (!shape) |
| 651 | { |
| 652 | continue; |
| 653 | } |
| 654 | if (!(shape->Special() & NoShadow) && oi->distance2 < Square(_shadowFogMaxRange) && shadowFactorI >= 12 && |
| 655 | obj->CastShadow()) |
| 656 | { |
| 657 | int level = LevelShadowFromDistance2(shape, oi->distance2, obj->Scale(), obj->Direction(), |
| 658 | _mainLight->ShadowDirection()); |
| 659 | if (level != LOD_INVISIBLE) |
| 660 | { |
| 661 | level = shape->FindNearestWithoutProperty(level, "lodnoshadow"); |
| 662 | if (level < 0) |
| 663 | { |
| 664 | level = LOD_INVISIBLE; |
| 665 | } |
| 666 | } |
| 667 | oi->shadowLOD = level; |
| 668 | } |
| 669 | else |
| 670 | { |
| 671 | oi->shadowLOD = LOD_INVISIBLE; |
| 672 | } |
| 673 | if (oi->shadowLOD != LOD_INVISIBLE) |
| 674 | { |
| 675 | // check number of faces in given level |
| 676 | Shape* level = shape->Level(oi->shadowLOD); |
| 677 | totalComplexity += level->NFaces(); |
| 678 | } |
| 679 | } |
| 680 | return totalComplexity; |
| 681 | #else |
| 682 | |
| 683 | float addLightsFactor = MainLight()->NightEffect(); |
| 684 | float skyCoef = floatMin(GetLandscape()->SkyThrough(), 0.6f); |
| 685 | float shadowFactor = skyCoef + 0.1f; |
| 686 | int shadowFactorI = toIntFloor(shadowFactor * (1 - addLightsFactor) * 255); |
| 687 | |
| 688 | for (int i = 0; i < objs.Size(); i++) |
nothing calls this directly
no test coverage detected