| 1883 | object->SetTransform(pos.Transform()); |
| 1884 | object->SetPosition(object->PositionModelToWorld(shape->BoundingCenter())); |
| 1885 | // ObjectForDrawing(object,-1,(ENGINE_CONFIG.reflections&REFL_OBJECT)!=0); |
| 1886 | |
| 1887 | object->SetConstantColor(color); |
| 1888 | object->SetScale(size); |
| 1889 | ObjectForDrawing(object); |
| 1890 | } |
| 1891 | |
| 1892 | void Scene::DrawExShadow(SortObject* oi) |
| 1893 | { |
| 1894 | // calculate position of the shadow of the object top |
| 1895 | Object* obj = oi->object; |
| 1896 | if (!obj) |
| 1897 | { |
| 1898 | return; |
| 1899 | } |
| 1900 | int level = oi->shadowLOD; |
| 1901 | LODShapeWithShadow* shape = oi->shape; |
| 1902 | Vector3Val objPos = obj->Position(); |
| 1903 | Point3 shadowPos = objPos; |
| 1904 | const FrameBase& pos = *obj; |
| 1905 | |
| 1906 | if (!ShadowPos(objPos, shadowPos, _mainLight)) |
| 1907 | { |
| 1908 | return; |
| 1909 | } |
| 1910 | |
| 1911 | Ref<Shape> sShape = obj->PrepareShadow(level, shadowPos, pos); |
| 1912 | // check bbox clipping and occlusion |
| 1913 | |
| 1914 | // per object clipping possible - bounding sphere was recalculated |
| 1915 | if (!sShape) |
| 1916 | { |
| 1917 | return; // no shadow |
| 1918 | } |
| 1919 | if (sShape->NPos() <= 0) |
| 1920 | { |
| 1921 | return; |
| 1922 | } |
| 1923 | |
| 1924 | float bRadius = sShape->BSphereRadius() * pos.Scale(); |
| 1925 | Vector3Val bCenterM = sShape->BSphereCenter(); |
| 1926 | Vector3Val bCenter = pos.PositionModelToWorld(bCenterM); |
| 1927 | // try to clip bounding sphere |
| 1928 | // if whole bounding sphere is out, object is already skipped |
| 1929 | if (GScene->GetCamera()->IsClipped(bCenter, bRadius, 1)) |
| 1930 | { |
| 1931 | return; |
| 1932 | } |
| 1933 | ClipFlags clipFlags = GScene->GetCamera()->MayBeClipped(bCenter, bRadius, 1); |
| 1934 | if (EnableObjOcc) |
| 1935 | { |
| 1936 | bool occluded = false; |
| 1937 | if (shape->CanBeOccluded()) |
| 1938 | { |
| 1939 | if (FarEnoughForOcclusion(oi)) |
| 1940 | { |
| 1941 | // check occlusion - bbox recalculation |
| 1942 | Vector3 minMax[2]; |
nothing calls this directly
no test coverage detected