assert(shape.rows==color.rows||color.empty());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models, or, alternatively, it has to be a shape-only model.
assert(shape_instance.rows==color_instance.rows||color_instance.empty());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models, or, alternatively, it has to be a shape-only model.
// Assign the vertex colour information if it's not a shape-only model:
// Assign the vertex colour information if it's not a shape-only model:
if(!color.empty()){
if(!color_instance.empty()){
mesh.colors.resize(num_vertices);
mesh.colors.resize(num_vertices);
for(autoi=0;i<num_vertices;++i){
for(autoi=0;i<num_vertices;++i){
mesh.colors[i]=glm::tvec3<float>(color.at<float>(i*3+0),color.at<float>(i*3+1),color.at<float>(i*3+2));// order in hdf5: RGB. Order in OCV: BGR. But order in vertex.color: RGB
mesh.colors[i]=glm::tvec3<float>(color_instance.at<float>(i*3+0),color_instance.at<float>(i*3+1),color_instance.at<float>(i*3+2));// order in hdf5: RGB. Order in OCV: BGR. But order in vertex.color: RGB