| 339 | } |
| 340 | |
| 341 | void StaticModel::Draw(RenderContext& renderContext) |
| 342 | { |
| 343 | if (!Model || !Model->IsLoaded() || !Model->CanBeRendered()) |
| 344 | return; |
| 345 | if (renderContext.View.Pass == DrawPass::GlobalSDF) |
| 346 | { |
| 347 | if (EnumHasAnyFlags(_drawModes, DrawPass::GlobalSDF) && Model->SDF.Texture) |
| 348 | GlobalSignDistanceFieldPass::Instance()->RasterizeModelSDF(this, Model->SDF, _transform, _box); |
| 349 | return; |
| 350 | } |
| 351 | if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas) |
| 352 | { |
| 353 | if (EnumHasAnyFlags(_drawModes, DrawPass::GlobalSurfaceAtlas) && Model->SDF.Texture) |
| 354 | GlobalSurfaceAtlasPass::Instance()->RasterizeActor(this, this, _sphere, _transform, Model->LODs.Last().GetBox()); |
| 355 | return; |
| 356 | } |
| 357 | ACTOR_GET_WORLD_MATRIX(this, view, world); |
| 358 | GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world); |
| 359 | if (_vertexColorsDirty) |
| 360 | FlushVertexColors(); |
| 361 | |
| 362 | Mesh::DrawInfo draw; |
| 363 | draw.Buffer = &Entries; |
| 364 | draw.World = &world; |
| 365 | draw.DrawState = &_drawState; |
| 366 | draw.Deformation = _deformation; |
| 367 | draw.Lightmap = _scene ? _scene->LightmapsData.GetReadyLightmap(Lightmap.TextureIndex) : nullptr; |
| 368 | draw.LightmapUVs = &Lightmap.UVsArea; |
| 369 | draw.Flags = _staticFlags; |
| 370 | draw.DrawModes = _drawModes; |
| 371 | draw.Bounds = _sphere; |
| 372 | draw.Bounds.Center -= renderContext.View.Origin; |
| 373 | draw.PerInstanceRandom = GetPerInstanceRandom(); |
| 374 | draw.LODBias = _lodBias; |
| 375 | draw.ForcedLOD = _forcedLod; |
| 376 | draw.SortOrder = _sortOrder; |
| 377 | draw.VertexColors = _vertexColorsCount ? _vertexColorsBuffer : nullptr; |
| 378 | draw.SetStencilValue(_layer); |
| 379 | #if USE_EDITOR |
| 380 | if (HasStaticFlag(StaticFlags::Lightmap)) |
| 381 | draw.LightmapScale = _scaleInLightmap; |
| 382 | #endif |
| 383 | |
| 384 | Model->Draw(renderContext, draw); |
| 385 | |
| 386 | GEOMETRY_DRAW_STATE_EVENT_END(_drawState, world); |
| 387 | } |
| 388 | |
| 389 | void StaticModel::Draw(RenderContextBatch& renderContextBatch) |
| 390 | { |
nothing calls this directly
no test coverage detected