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

Method Draw

Source/Engine/Level/Actors/Camera.cpp:353–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353void Camera::Draw(RenderContext& renderContext)
354{
355 if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::EditorSprites)
356 && renderContext.View.CullingFrustum.Intersects(_previewModelBox)
357 && _previewModel
358 && _previewModel->IsLoaded())
359 {
360 Matrix rot, tmp, world;
361 renderContext.View.GetWorldMatrix(_transform, tmp);
362 Matrix::RotationY(PI * -0.5f, rot);
363 Matrix::Multiply(rot, tmp, world);
364 GeometryDrawStateData drawState;
365 Mesh::DrawInfo draw;
366 draw.Buffer = &_previewModelBuffer;
367 draw.World = &world;
368 draw.DrawState = &drawState;
369 draw.Deformation = nullptr;
370 draw.Lightmap = nullptr;
371 draw.LightmapUVs = nullptr;
372 draw.Flags = StaticFlags::Transform;
373 draw.DrawModes = (DrawPass::Depth | DrawPass::GBuffer | DrawPass::Forward) & renderContext.View.Pass;
374 BoundingSphere::FromBox(_previewModelBox, draw.Bounds);
375 draw.Bounds.Center -= renderContext.View.Origin;
376 draw.PerInstanceRandom = GetPerInstanceRandom();
377 draw.StencilValue = 0;
378 draw.LODBias = 0;
379 draw.ForcedLOD = -1;
380 draw.SortOrder = 0;
381 draw.VertexColors = nullptr;
382 if (draw.DrawModes != DrawPass::None)
383 {
384 _previewModel->Draw(renderContext, draw);
385 }
386 }
387 // Load preview model if it doesnt exist. Ex: prefabs
388 else if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::EditorSprites) && !_previewModel)
389 {
390 _previewModel = Content::LoadAsyncInternal<Model>(TEXT("Editor/Camera/O_Camera"));
391 }
392}
393
394#include "Engine/Debug/DebugDraw.h"
395

Callers

nothing calls this directly

Calls 6

EnumHasAnyFlagsFunction · 0.85
RotationYFunction · 0.85
MultiplyFunction · 0.50
IntersectsMethod · 0.45
IsLoadedMethod · 0.45
GetWorldMatrixMethod · 0.45

Tested by

no test coverage detected