Beispiel #1
0
void voxel_model::apply_transforms()
{
	invalidated_ = false;

	for(const Rotation& rotate : rotation_) {
		translate_geometry(rotate.translation_, rotate.children_only);
		if(rotate.src_pivot != -1) {
			rotate_geometry(pivots_[rotate.src_pivot].second, pivots_[rotate.dst_pivot].second, rotate.amount, rotate.children_only);
		}
	}

	for(const voxel_model_ptr& child : children_) {
		child->apply_transforms();
	}
}
Beispiel #2
0
void PtrFreeScene :: compile_geometry() {

  // clear vectors
  delete_array(mesh_ids);
  delete_array(vertexes);
  delete_array(normals);
  delete_array(colors);
  delete_array(uvs);
  delete_array(triangles);
  delete_array(mesh_descs);
  delete_array(mesh_first_triangle_offset);

  this->mesh_count = original_scene->objects.size();//data_set->meshes.size();

  // copy mesh_id_table
  // TODO check if this is valid
  //mesh_ids.resize(data_set->meshes.size());
  this->mesh_ids = new uint[data_set->totalTriangleCount];
  //this->mesh_ids = data_set->GetMeshIDTable();
  for(unsigned i = 0; i < data_set->totalTriangleCount; ++i)
    this->mesh_ids[i] = data_set->GetMeshIDTable()[i]; // TODO probably change this to a memcpy

  // get scene bsphere
  this->bsphere = data_set->GetPPMBSphere();

  // check used accelerator type
  if (accel_type == ppm::ACCEL_QBVH) {
    const lux_ext_mesh_list_t meshs = original_scene->objects;
    compile_mesh_first_triangle_offset(meshs);
    translate_geometry_qbvh(meshs);
  } else {
    cout << "here" << endl;
    translate_geometry();
//    throw string("Unsupported accelerator type ").append(config.accel_name);
  }

}