• 硬件遮挡查询


    先放下代码,未完待续。

     TraversalStack.Push(hierarchy.Root);
    
     while ( not TraversalStack.Empty() or not QueryQueue.Empty() ) {   
        //--PART 1: process finished occlusion queries   
        while (not QueryQueue.Empty() and [ResultAvailable(QueryQueue.Front()) or TraversalStack.Empty()] ) {    
            node = QueryQueue.Dequeue();     
            // wait if result not available    
            visiblePixels = GetOcclusionQueryResult(node);   
            if (visiblePixels > VisibilityThreshold) {     
                PullUpVisibility(node);       
                TraverseNode(node); 
            }  
        }    
        //--PART 2: hierarchical traversal    
        if ( not TraversalStack.Empty() )  {    
            node = TraversalStack.Pop();    
            if ( InsideViewFrustum(node) ) {      
                // identify previously visible nodes      
                wasVisible = node.visible and (node.lastVisited == frameID - 1);      
                // identify nodes that we cannot skip queries for       
                leafOrWasInvisible = not wasVisible or IsLeaf(node);     
                // reset node's visibility classification    
                node.visible = false;   
                // update node's visited flag   
                node.lastVisited = frameID;  
                // skip testing previously visible interior nodes  
                if ( leafOrWasInvisible ) {      
                    IssueOcclusionQuery(node);     
                    QueryQueue.Enqueue(node);    
                }        
                // always traverse a node if it was visible      
                if ( wasVisible ) TraverseNode(node);      
            }    
        }  
    }  
    
    TraverseNode(node) {   
        if ( IsLeaf(node) ) Render(node);   
        else TraversalStack.PushChildren(node);  
    }    
    
    PullUpVisibility(node) {    
        while (not node.visible) {     
            node.visible = true;    
            node = node.parent;    
        }  
    } 
    

      

  • 相关阅读:
    PHP面向对象之原型(trait)
    PHP面向对象之命名空间
    Javascript中的Copy()函数
    六、unique_lock取代lock_guard
    五、互斥量
    四、创建和等待多个线程
    三、线程传参
    二、线程的启动与结束 join与detach
    HTTP:常见状态码
    HTTP:简述URL、URN和URI
  • 原文地址:https://www.cnblogs.com/redips-l/p/12220830.html
Copyright © 2020-2023  润新知