当前位置: 首页>>代码示例>>C++>>正文


C++ Trail::update方法代码示例

本文整理汇总了C++中Trail::update方法的典型用法代码示例。如果您正苦于以下问题:C++ Trail::update方法的具体用法?C++ Trail::update怎么用?C++ Trail::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trail的用法示例。


在下文中一共展示了Trail::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateApp

//--------------------------------------------------------------
void testApp::updateApp(){
	
	ofPoint * pos;
	Trail *trail;
	
	bool bInsideLetter;
	
	vector<ofPoint> growings;
	
	for(int i=0; i<trails.size(); i++){
		
		trail = &trails[i];
		pos = &trail->position;
		
		// If trail isn't in a letter yet
		if(trail->letterId == -1) {
			
			trail->update(screenBounds);
			
			if(!ofInsidePoly( trail->position, screenBounds.getVertices() )){
				trails.erase(trails.begin()+i);
				i--;
				continue;
			}
			
			// look if it has found a letter now
			for(int j=0; j<letters.size(); j++){
				if( ofInsidePoly( *pos, letters[j].getVertices() ) ) {
					trail->letterId = j;
				}
			}
		}
		else {
			
			trail->update(letters[trail->letterId]);
			
			if (trails[i].bActive) {
				growings.push_back(trails[i].position);
			}
		}
	}
	
	triangle.clear();
	if(growings.size()>=3)
		triangle.triangulate( growings, growings.size() );
}
开发者ID:kikko,项目名称:ofApps,代码行数:47,代码来源:testApp.cpp

示例2: newPos

void Choreo3DApp::update()
{
    setFrameRate(frameRate);
    
    //DISABLE CAMERA INTERACTION IF MOUSE IS OVER UI REGION
    if (getMousePos().x > 3 * getWindowWidth()/4. && camActive)
    {
        camActive = false;
        mCamUi.disconnect();
        mCamUi.disable();
        cout << "disabling camera UI" << endl;
    } else {
        if (!camActive)
        {
            mCamUi.connect(getWindow());
            mCamUi.enable();
        }
        camActive = true;
        cout << "enabling camera UI" << endl;
    }
    
    mGlsl->uniform("uColor", markerColour );
    
    if (!paused)
    {
        
        
        //UPDATE POSITIONS
        //MAP INSTANCE DATA TO VBO
        //WRITE NEW POSITIONS
        //UNMAP
        
        glm::vec3 *newPositions = (glm::vec3*)mInstanceDataVbo->mapReplace();
        
        for( int i = 0; i < jointList.size(); ++i )
        {
            
            float instanceX = jointList[i].jointPositions[FRAME_COUNT].x;
            float instanceY = jointList[i].jointPositions[FRAME_COUNT].y;
            float instanceZ = jointList[i].jointPositions[FRAME_COUNT].z;
            
            vec3 newPos(vec3(instanceX,instanceY, instanceZ)); //CREATE A NEW VEC3 FOR UPDATING THE VBO
            
            framePositions[i] = newPos;
            
        }
        
        //REPLACE VEC3s IN VBO BY INCREMENTING THE POINTER
        for (int i = 0; i < framePositions.size(); i++){
            *newPositions++ = framePositions[i];
        }
        
        handTrail.update(framePositions[26], dancerColor);
        
        //    std::cout << framePositions[17] << std::endl;
        
        
        skeleton.update(framePositions);

        
        mInstanceDataVbo->unmap();
        // std::cout << "position: " << positions[0] << std::endl;
        
        if (ribbonsActive)updateRibbons();
        
        //MANUALLY INCREMENT THE FRAME, IF THE FRAME_COUNT EXCEEDS TOTAL FRAMES, RESET THE COUNTER
        if (FRAME_COUNT < TOTAL_FRAMES)
        {
            FRAME_COUNT += 1;
        } else {
            FRAME_COUNT = 0;
        }
        
        //std::cout << getAverageFps() << std:: endl;
        // std::cout << "frame rate: " << getAverageFps() << ", frame count: " << FRAME_COUNT << std::endl;
        
        //define changed color
      //  Color temp = Color(dancerColor[0],dancerColor[1],dancerColor[2]);
        
        
        mCurrentFrame++; //MANUALLY ADVANCE THE CURRENT FRAME - WITH RESPECT TO THE DANCERS
    
    }
    
    updateGui();
}
开发者ID:Craigson,项目名称:Choreo3D,代码行数:86,代码来源:Chore3DApp.cpp


注:本文中的Trail::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。