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


C++ Exporter::clear方法代码示例

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


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

示例1: update

void cApp::update(){
    
    if( frame == endframe ){
        frame = 1;
        simDirNum++;
        if( 40<=simDirNum ){
            printf("DONE\n");
            quit();
        }else{
            printf(" --- DONE\n");
            printf("start rendering : simDirNum = %02d ", simDirNum );

            int w = win_w*master_scale;
            int h = win_h*master_scale;
            mExp.clear();
            mExp.setup( w, h, 0, 3000, GL_RGB, renderDir/to_string(simDirNum), 0);
#ifdef RENDER
            mExp.startRender();
#endif
        }
    }
    fs::path & simDir = simDirList[simDirNum];
    
    RfImporterBin rfIn;

    char m[255];
    //sprintf(m, "Circle01_%05d.bin", frame );
    sprintf(m, "Binary_Loader02_%05d.bin", frame );
    
    string fileName = toString(m);

    fs::path simFilePath = simDir / fileName;
    rfIn.load( simFilePath.string() );
    
    mDg.mDot.reset();

    numParticle = rfIn.gNumParticles;
    const vector<float> &p = rfIn.pPosition;
    const vector<float> &v = rfIn.pVelocity;
    const vector<int> &pid = rfIn.pId;
    
    vector<Vec3f> pos;
    vector<ColorAf> col;
    vector<ColorAf> col4Line;

    float scale = 55.0f;
    
    for (int i=0; i<numParticle; i++) {
        
        float x = p[i*3+0] * scale;
        float y = p[i*3+2] * scale;
        float z = p[i*3+1] * scale;
        pos.push_back( Vec3f(x, y, z) );
        
        float vx = v[i*3+0];
        float vy = v[i*3+2];
        float vz = v[i*3+1];
        float vel = sqrt(vx*vx + vy*vy + vz*vz);
        float velRate = lmap(vel, 0.03f, 15.0f, 0.0f, 1.0f);
        int colorId = pid[i] % mColorSample1.size();

        ColorAf c = mColorSample1[colorId];
        c.r += 0.2;
        c.g += 0.2;
        c.b += 0.2;
        
        c.g += velRate*0.1;
        c.a = 0.95;
        
        col.push_back( c );

        if( bDrawLine ){
            ColorAf c2 = mColorSample2[colorId];
            c2.a = lmap(vel, 0.0f, 1.0f, 0.1f, 0.6f);
            col4Line.push_back( c2 );
        }
    }
    
    mDg.createDot( pos, col, 0.0 );

    if( bDrawLine ){
        int num_line = 1;//randFloat(1,3);
        int num_dupl = 1;//randFloat(1,3);
        int vertex_per_point = num_line * num_dupl * 2;
        vector<Vec3f> out;
        out.assign( pos.size()*vertex_per_point, Vec3f(-99999, -99999, -99999) );
        vector<ColorAf> outc;
        outc.assign( pos.size()*vertex_per_point, ColorAf(0,0,0,0) );
        
        TbbNpFinder npf;
        npf.findNearestPoints( &pos[0], &out[0], &col4Line[0], &outc[0], pos.size(), num_line, num_dupl );
        mDg.addLine(out, outc);
    }
}
开发者ID:stdmtb,项目名称:n9,代码行数:94,代码来源:cApp.cpp


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