MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Draw

Method Draw

Source/Engine/UI/SpriteRender.cpp:122–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void SpriteRender::Draw(RenderContext& renderContext)
123{
124 if (renderContext.View.Pass == DrawPass::GlobalSDF || renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas)
125 return;
126 if (!Material || !Material->IsLoaded() || !_quadModel || !_quadModel->IsLoaded())
127 return;
128 auto model = _quadModel.As<Model>();
129 if (model->GetLoadedLODs() == 0)
130 return;
131 const auto& view = (renderContext.LodProxyView ? *renderContext.LodProxyView : renderContext.View);
132 Matrix m1, m2, m3, world;
133 Matrix::Scaling(_size.X, _size.Y, 1.0f, m2);
134 Matrix::RotationY(PI, m3);
135 Matrix::Multiply(m2, m3, m1);
136 if (FaceCamera)
137 {
138 Matrix::Billboard(_transform.Translation - view.Origin, view.Position, Vector3::Up, view.Direction, m2);
139 Matrix::Multiply(m1, m2, m3);
140 Matrix::Scaling(_transform.Scale, m1);
141 Matrix::Multiply(m1, m3, world);
142 }
143 else
144 {
145 view.GetWorldMatrix(_transform, m2);
146 Matrix::Multiply(m1, m2, world);
147 }
148 model->LODs[0].Draw(renderContext, _materialInstance, world, GetStaticFlags(), false, DrawModes, GetPerInstanceRandom(), SortOrder);
149}
150
151void SpriteRender::Serialize(SerializeStream& stream, const void* otherObj)
152{

Callers

nothing calls this directly

Calls 6

ScalingFunction · 0.85
RotationYFunction · 0.85
GetStaticFlagsFunction · 0.85
MultiplyFunction · 0.50
IsLoadedMethod · 0.45
GetWorldMatrixMethod · 0.45

Tested by

no test coverage detected