Exemple #1
0
void RDOPROCProcess::end()
{
	m_closed = true;
	if (getConditon())
	{
		getRunTime()->setCondition(getConditon()->getCalc());
	}
}
Exemple #2
0
bool RDOPROCProcess::setPrior(LPRDOFUNArithm& pPrior)
{
	LPILogic pRuntimeLogic = getRunTime();
	LPIPriority pPriority = pRuntimeLogic.object_dynamic_cast<IPriority>();
	if (pPriority)
	{
		return pPriority->setPrior(pPrior->createCalc());
	}
	return false;
}
 void
 CreatureManager::MakePointCache(const std::string& animation_name_in)
 {
     float store_run_time = getRunTime();
     auto cur_animation = animations[animation_name_in];
     if(cur_animation->hasCachePts())
     {
         // cache already generated, just exit
         return;
     }
     
     std::vector<glm::float32 *>& cache_pts_list = cur_animation->getCachePts();
     
     for(int i = (int)cur_animation->getStartTime(); i <= (int)cur_animation->getEndTime(); i++)
     {
         setRunTime((float)i);
         auto new_pts = new glm::float32[target_creature->GetTotalNumPoints() * 3];
         PoseCreature(animation_name_in, new_pts, getRunTime());
         
         cache_pts_list.push_back(new_pts);
     }
     
     setRunTime(store_run_time);
 }
    void
    CreatureManager::Update(float delta)
    {
        if(!is_playing)
        {
            return;
        }
        
        increRunTime(delta * time_scale);
        
        if(do_auto_blending)
        {
            ProcessAutoBlending();
			// process run times for blends
			increAutoBlendRuntimes(delta * time_scale);
        }
        
        if(do_blending)
        {
            for(int i = 0; i < 2; i++) {
				auto& cur_animation_name = active_blend_animation_names[i];
				auto& cur_animation = animations[cur_animation_name];
				auto& cur_animation_run_time = active_blend_run_times[cur_animation_name];

                if(cur_animation->hasCachePts())
                {
					cur_animation->poseFromCachePts(cur_animation_run_time, blend_render_pts[i], target_creature->GetTotalNumPoints());
                }
                else {
					UpdateRegionSwitches(active_blend_animation_names[i]);
					PoseCreature(active_blend_animation_names[i], blend_render_pts[i], cur_animation_run_time);
                }
            }
            
            for(int j = 0; j < target_creature->GetTotalNumPoints() * 3; j++)
            {
                glm::float32 * set_data = target_creature->GetRenderPts() + j;
                glm::float32 * read_data_1 = blend_render_pts[0] + j;
                glm::float32 * read_data_2 = blend_render_pts[1] + j;
                
                *set_data = ((1.0f - blending_factor) * (*read_data_1)) +
                (blending_factor * (*read_data_2));
            }
        }
        else {
            auto& cur_animation = animations[active_animation_name];
            if(cur_animation->hasCachePts())
            {
                cur_animation->poseFromCachePts(getRunTime(), target_creature->GetRenderPts(), target_creature->GetTotalNumPoints());

            }
            else {
                PoseCreature(active_animation_name, target_creature->GetRenderPts(), getRunTime());
            }
        }
        
        if(mirror_y)
        {
            glm::float32 * set_data = target_creature->GetRenderPts();
            for(int j = 0; j < target_creature->GetTotalNumPoints(); j++)
            {
                set_data[0] = -set_data[0];
                set_data += 3;
            }
        }
    }
Exemple #5
0
	/**@brief Function to log the run time to a std::ostream
	 * @param out The std::ostream to log the info to
	 */
	void logRunTime(std::ostream &out) {
		out << getRunTime() << std::endl;
	}
Exemple #6
0
int main(int argc, char **argv)
{
	#ifdef WIN32
		// Send all reports to STDOUT
		_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
		_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
		_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
		_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
		_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
		_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );

		// enable the options
		SET_CRT_DEBUG_FIELD( _CRTDBG_DELAY_FREE_MEM_DF );
		SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );
	#endif
		
	printf("int %d, short int %d, char %d, double %d, float %d, node %d\n",sizeof(int),sizeof(short int), sizeof(char), sizeof(double), sizeof(float), sizeof(svm_node));

	char input_file_name[FILENAME_LEN];    
	char model_file_name[FILENAME_LEN];
	const char *error_msg;

	parse_command_line(argc, argv, input_file_name, model_file_name);
    read_problem(input_file_name);
	param.modelFile = model_file_name;

	printf ("Finish reading input files!\n");

	error_msg = svm_check_parameter(&prob,&param);	

	#ifdef WIN32
		assert(_CrtCheckMemory());
	#endif

	if(error_msg)
	{
		fprintf(stderr,"Error: %s\n",error_msg);
		exit(1);
	}

    double duration;
	double start = getRunTime();
	if(cross_validation)
	{
		do_cross_validation();
	}
	else
	{
		printf("kernel: %d\n",param.kernel_type);
		model = svm_train(&prob,&param);
        double finish = getRunTime();	
        duration = (double)(finish - start);

    #ifdef WIN32
		assert(_CrtCheckMemory());
	#endif

		svm_save_model(model_file_name,model);
		svm_destroy_model(model);
	}
	
	printf("CPU Time = %f second\n", duration);
    FILE* fModel = fopen(model_file_name, "a+t");					// append mode
	fprintf(fModel, "CPU Time = %f second\n", duration);
	fclose(fModel);
	    
    svm_destroy_param(&param);
	free(prob.y);
	free(prob.x);
	free(x_space);

	#ifdef WIN32
		assert(_CrtCheckMemory());
	#endif

    return 0;
}