MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Render

Method Render

ogsr_engine/Layers/xrRender/WallmarksEngine.cpp:395–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void CWallmarksEngine::Render()
396{
397 ZoneScoped;
398
399 auto& dsgraph = RImplementation.get_imm_context();
400 auto& cmd_list = dsgraph.cmd_list;
401
402 // Projection and xform
403 Fmatrix proj = Device.mProject;
404 proj._43 -= ps_r__WallmarkSHIFT;
405 cmd_list.set_xform_world(Fidentity);
406 cmd_list.set_xform_project(proj);
407
408 Fvector mViewPos;
409 mViewPos.mad(Device.vCameraPosition, Device.vCameraDirection, ps_r__WallmarkSHIFT_V);
410 Fmatrix view;
411 view.build_camera_dir(mViewPos, Device.vCameraDirection, Device.vCameraTop);
412 cmd_list.set_xform_view(view);
413
414 Device.Statistic->RenderDUMP_WM.Begin();
415 Device.Statistic->RenderDUMP_WMS_Count = 0;
416 Device.Statistic->RenderDUMP_WMD_Count = 0;
417 Device.Statistic->RenderDUMP_WMT_Count = 0;
418
419 float ssaCLIP = r_ssaDISCARD / 4;
420
421 lock.Enter(); // Physics may add wallmarks in parallel with rendering
422
423 for (const auto& slot : marks)
424 {
425 u32 w_offset;
426 FVF::LIT *w_verts, *w_start;
427 BeginStream(hGeom, w_offset, w_verts, w_start);
428 // static wallmarks
429 for (auto w_it = slot->static_items.begin(); w_it != slot->static_items.end();)
430 {
431 static_wallmark* W = *w_it;
432 if (RImplementation.ViewBase.testSphere_dirty(W->bounds.P, W->bounds.R))
433 {
434 Device.Statistic->RenderDUMP_WMS_Count++;
435 float dst = Device.vCameraPosition.distance_to_sqr(W->bounds.P);
436 float ssa = W->bounds.R * W->bounds.R / dst;
437 if (ssa >= ssaCLIP)
438 {
439 u32 w_count = static_cast<u32>(w_verts - w_start);
440 if ((w_count + W->verts.size()) >= (MAX_TRIS * 3))
441 {
442 FlushStream(cmd_list, hGeom, slot->shader, w_offset, w_verts, w_start, FALSE);
443 BeginStream(hGeom, w_offset, w_verts, w_start);
444 }
445 static_wm_render(W, w_verts);
446 }
447 W->ttl -= 0.1f * Device.fTimeDelta; // visible wallmarks fade much slower
448 }
449 else
450 {
451 W->ttl -= Device.fTimeDelta;
452 }

Callers 1

FlushStreamFunction · 0.45

Calls 15

BeginStreamFunction · 0.85
FlushStreamFunction · 0.85
LogFunction · 0.85
build_camera_dirMethod · 0.80
testSphere_dirtyMethod · 0.80
distance_to_sqrMethod · 0.80
RenderWallmarkMethod · 0.80
LeaveMethod · 0.80
u32Enum · 0.70
madMethod · 0.45
BeginMethod · 0.45

Tested by

no test coverage detected