MCPcopy Create free account
hub / github.com/ad-si/LuaCAD / renderOcclusionQueryGoldfeather

Function renderOcclusionQueryGoldfeather

OpenCSG/src/renderGoldfeather.cpp:488–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486 }
487
488 static bool renderOcclusionQueryGoldfeather(const std::vector<Primitive*>& primitives)
489 {
490 scissor = new ScissorMemo;
491
492 unsigned int layer = 0;
493
494 scissor->setIntersected(primitives);
495 scissor->setCurrent(primitives);
496
497 OpenGL::OcclusionQuery* occlusionTest = 0;
498
499 bool retVal = true;
500
501 while (true) {
502 if (channelMgr->request() == NoChannel) {
503 channelMgr->free();
504 channelMgr->request();
505 }
506
507 scissor->store(channelMgr->current());
508 scissor->enableScissor();
509
510 if (!occlusionTest) {
511 occlusionTest = OpenGL::getOcclusionQuery(false);
512 if (!occlusionTest) {
513 retVal = false;
514 break;
515 }
516 }
517
518 channelMgr->renderToChannel(true);
519
520 glStencilMask(OpenGL::stencilMask);
521 glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
522
523 glDepthFunc(GL_ALWAYS);
524 glDepthMask(GL_TRUE);
525 glColor4ub(255, 255, 255, 255);
526
527 occlusionTest->beginQuery();
528 OpenGL::renderLayer(layer, primitives);
529 occlusionTest->endQuery();
530 // the fragment count query could occur here, but benches show that
531 // the algorithm is faster if the query is delayed.
532 glClear(GL_STENCIL_BUFFER_BIT);
533
534 parityTestAndDiscard(primitives, primitives, true, OpenGL::stencilMax);
535
536 unsigned int anyFragmentRendered = occlusionTest->getQueryResult();
537 if (!anyFragmentRendered) {
538 retVal = true;
539 break;
540 }
541
542 channelMgr->store(channelMgr->current(), primitives, layer);
543
544 scissor->disableScissor();
545

Callers 1

renderGoldfeatherFunction · 0.85

Calls 15

getOcclusionQueryFunction · 0.85
renderLayerFunction · 0.85
parityTestAndDiscardFunction · 0.85
setIntersectedMethod · 0.80
setCurrentMethod · 0.80
freeMethod · 0.80
currentMethod · 0.80
enableScissorMethod · 0.80
renderToChannelMethod · 0.80
beginQueryMethod · 0.80
endQueryMethod · 0.80
getQueryResultMethod · 0.80

Tested by

no test coverage detected