| 68 | } |
| 69 | |
| 70 | void Decal::Draw(RenderContext& renderContext) |
| 71 | { |
| 72 | MaterialBase* material = Material; |
| 73 | if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Decals) && |
| 74 | EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer) && |
| 75 | material && |
| 76 | material->IsLoaded() && |
| 77 | material->IsDecal()) |
| 78 | { |
| 79 | // Check if decal is being culled |
| 80 | const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View); |
| 81 | const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(_sphere.Center - renderContext.View.Origin, (float)_sphere.Radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt; |
| 82 | if (Math::Square(DrawMinScreenSize * 0.5f) > screenRadiusSquared) |
| 83 | return; |
| 84 | |
| 85 | RenderDecalData data; |
| 86 | Transform transform = GetTransform(); |
| 87 | transform.Scale *= _size; |
| 88 | renderContext.View.GetWorldMatrix(transform, data.World); |
| 89 | data.SortOrder = SortOrder; |
| 90 | data.RenderLayersMask = RenderLayersMask; |
| 91 | data.Material = material; |
| 92 | renderContext.List->Decals.Add(data); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void Decal::Serialize(SerializeStream& stream, const void* otherObj) |
| 97 | { |
nothing calls this directly
no test coverage detected