本文整理汇总了C++中Trail::render方法的典型用法代码示例。如果您正苦于以下问题:C++ Trail::render方法的具体用法?C++ Trail::render怎么用?C++ Trail::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trail
的用法示例。
在下文中一共展示了Trail::render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void Choreo3DApp::draw()
{
//gl::clear( ColorA::gray( background ) );
gl::clear(ColorAf(testBK));
//THIS MAY NEED TO BE CLEANED UP
vector<std::string> dataVector = {"CCL_JOINT_CCL3_00_skip10.json"};
if( CURRENT_DATA_SET != LOADED_DATA_SET){
// paused = true;
// jointList = {};
jointList = ccl::loadMotionCaptureFromJson(getAssetPath(dataVector[CURRENT_DATA_SET]));
FRAME_COUNT = 0;
TOTAL_FRAMES = jointList[0].jointPositions.size(); //SHOULD PROBABLY PUT A TRY/CATCH HERE
std::cout << "total frames: " << TOTAL_FRAMES << ", total joints:"<< jointList.size() << std::endl;
gl::VboMeshRef body = gl::VboMesh::create( geom::Sphere().subdivisions( 16 ).radius(4) );
//CREATE A CONTAINER TO STORE THE INITIAL POSITIONS FOR INITIALISING THE JOINTS
std::vector<glm::vec3> positions;
// CREATE THE SPHERES AT THE INITIAL JOINT LOCATIONS
for ( int i = 0; i < jointList.size(); ++i ) {
glm::vec3 jointAt = jointList[i].jointPositions[i];
float instanceX = jointAt.x;
float instanceY = jointAt.y;
float instanceZ = jointAt.z;
// float instanceZ = 0;
positions.push_back( vec3( instanceX, instanceY, instanceZ));
}
//std::cout << "positions: " << positions[0] << std::endl;
// create the VBO which will contain per-instance (rather than per-vertex) data
mInstanceDataVbo = gl::Vbo::create( GL_ARRAY_BUFFER, positions.size() * sizeof(vec3), positions.data(), GL_DYNAMIC_DRAW );
// we need a geom::BufferLayout to describe this data as mapping to the CUSTOM_0 semantic, and the 1 (rather than 0) as the last param indicates per-instance (rather than per-vertex)
geom::BufferLayout instanceDataLayout;
instanceDataLayout.append( geom::Attrib::CUSTOM_0, 3, 0, 0, 1 /* per instance */ );
//NOW ADD IT TO THE VBO MESH THAT WE INITIAL CREATED FOR THE BODY / SKELETON
body->appendVbo( instanceDataLayout, mInstanceDataVbo );
//FINALLY, BUILD THE BATCH, AND MAP THE CUSTOM_0 ATTRIBUTE TO THE "vInstancePosition" GLSL VERTEX ATTRIBUTE
mSphereBatch = gl::Batch::create( body, mGlsl, { { geom::Attrib::CUSTOM_0, "vInstancePosition" } } );
LOADED_DATA_SET = CURRENT_DATA_SET;
}
gl::setMatrices( mCamera );
if (showGrid)renderScene();
Color( dancerColor[0], dancerColor[1], dancerColor[2] );
//gl::ScopedModelMatrix modelScope;
if(markersActive)mSphereBatch->drawInstanced( jointList.size() );
if(skeletonActive)skeleton.renderSkeleton();
if(ribbonsActive)drawRibbons();
if(trailsActive)handTrail.render(dancerColor);
}