How Display and Iterate through vsSwitch Nodes and Masks

原创 2006年05月27日 21:26:00

 

 This example function illustrates how to :

 

How define vsSwitch::const_iterator_mask iterator to traverse through vsSwitch Nodes Masks
How to get the name of a vsSwitch node
How to display the address of a vsSwitch node
How vsSwitch node masks are stored as an stl::pair
How to retrieve the name of a vsSwitch node masks
How to retrieve the number of active children of a vsSwitch node mask
How to retrieve the vuVector of active children from vsSwitch::Mask
How to iterate through the vuVector of active children
How to retrieve and display the indices of the active children
How to use begin and end iterator more efficently
To use ++Val as pre-increment rather than Val++ post-increment
 
 
 
Code :
 
--
 

 

void

printSwitchDetails( vsSwitch *switchNode ){

// ---------------------------------------------------------

// Public Function                  

//

//  Quick and simple function to display switch node state

//

//  Assumes that switchNode is a valid vsSwitch Node

//

// ---------------------------------------------------------

 

    //

    // Sanity check we need a node

    //

    if( switchNode == NULL )

        return;

    

    

    //

    // For clarity grab the iterator's for start and end of the list

    //

    //

    // Note that getting the  'Start' and 'End ' iterator's outside 

    //       of the loop is generally considered more efficient than

    //       getting the iterators inside of the loops

    //

 

    vsSwitch::const_iterator_mask swIter = switchNode->begin_mask();

 

    vsSwitch::const_iterator_mask swEnd  = switchNode->end_mask();

 

    

    printf("Getting Masks for switch Node :  %s ( %p ) /n/n",  switchNode->getName(),  switchNode );

    

    //

    // Iterate through the Masks which a Vector containing a value pair

    //

    //     std::pair<vuString, vuVector<int> > where

    //     

    //     first  : is the name of the Mask if it has one

    //     

    //     second : is a vector of ints representing the active children

    //

    //

    // Firstly we step through the list of all the masks which is

    // vector of ( stl::pair<vuString, vuVector<int> > )

    //

    //

    // Note it is generally accepted that using the ++Iter (pre-increment) 

    //       with iterators is efficent that using iter++ (post-increment)

    //

 

    for (  ; swIter != swEnd; ++ swIter ) {

                   

        printf("   Mask : %s :  Number Active children = %d /n/n",

                      (*swIter).first.c_str(),

                      (*swIter).second.size() );

           

           

            //

            // The Second value of the pair is a Vector of Ints which represent

            // the active children for the mask

            //

            // So we need to grab and create some Interators of type vuVector<int>

            //   

 

            vuVector< int >::const_iterator  maskIt  =  (*swIter).second.begin();

 

 

            vuVector< int >::const_iterator  maskEnd =  (*swIter).second.end();

         

            //

            // Now step through and show the active childrend indices

            //

            for (  ; maskIt != maskEnd; ++ maskIt ) {     

                     

                printf( "       Child Index : = %d /n", *maskIt );

 

                } 

            

      }

 

} //  printSwitchDetails

 
 

How to distribute your own Android library through jCenter and Maven Central from Android Studio

In Android Studio, if you wish to include any library to your application. You could just simply add...

OGRE中级教程三 Mouse Picking(3D Object Selection) and SceneQuery Masks

英语水平有限,欢迎大家批评指正 本文并没有将原文全部翻译,只是将其中的一些知识点翻译总结了一下,想要查看详细讲解的话,可以到原文处看一下,附上英文原文地址:http://www.ogre3d.org...

Timeout Detection and Recovery of GPUs through (Microsoft Windows imposed time limit (TDR) was exce)

Timeout Detection and Recovery of GPUs through WDDM Updated: April 27, 2009 On This Page  Intro...

From movement tracks through events to places: Extracting and characterizing significant places from

文章:From movement tracks through events to places: Extracting and characterizing significant places f...

Shaders for Game Programmers and Artists(2) - Looking Through a Filter

渲染到 RenderTargetIn RenderMonkey, rendering to a temporary texture can be carried out using something...

Oracle ASM Advanced Tranning 5 —— Configure XDB for ASM Access Through FTP and HTML

Configure FTP and HTTP Ports Using DBMS_XDB Setup the ports to be used by http and ftp protocols ...

This chapter walks you through an example of single sign-on for intranet and extranet web users who

This chapter walks you through an example of single sign-on for intranet and extranet web users who ...

19. 12. 3. 用socket读写 Read and write through socket

import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net...

XPath(2) nodes, atomic value and sequence

In xPath1.0, evaluation of expression will return one of the four basic results, one is node-set the...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How Display and Iterate through vsSwitch Nodes and Masks
举报原因:
原因补充:

(最多只允许输入30个字)