| 500 | } |
| 501 | |
| 502 | ISPCHairSet::ISPCHairSet (RTCDevice device, TutorialScene* scene_in, RTCGeometryType type, Ref<SceneGraph::HairSetNode> in) |
| 503 | : geom(CURVES), normals(nullptr), tangents(nullptr), dnormals(nullptr), hairs(nullptr), flags(nullptr), type(type) |
| 504 | { |
| 505 | geom.geometry = rtcNewGeometry(device, type); |
| 506 | |
| 507 | positions = (Vec3fa**) alignedUSMMalloc(sizeof(Vec3fa*)*in->numTimeSteps()); |
| 508 | for (size_t i=0; i<in->numTimeSteps(); i++) |
| 509 | positions[i] = (Vec3fa*) copyArrayToUSM(in->positions[i]); |
| 510 | |
| 511 | if (in->normals.size()) { |
| 512 | normals = (Vec3fa**) alignedUSMMalloc(sizeof(Vec3fa*)*in->numTimeSteps()); |
| 513 | for (size_t i=0; i<in->numTimeSteps(); i++) |
| 514 | normals[i] = copyArrayToUSM(in->normals[i]); |
| 515 | } |
| 516 | |
| 517 | if (in->tangents.size()) { |
| 518 | tangents = (Vec3fa**) alignedUSMMalloc(sizeof(Vec3fa*)*in->numTimeSteps()); |
| 519 | for (size_t i=0; i<in->numTimeSteps(); i++) |
| 520 | tangents[i] = (Vec3fa*) copyArrayToUSM(in->tangents[i]); |
| 521 | } |
| 522 | |
| 523 | if (in->dnormals.size()) { |
| 524 | dnormals = (Vec3fa**) alignedUSMMalloc(sizeof(Vec3fa*)*in->numTimeSteps()); |
| 525 | for (size_t i=0; i<in->numTimeSteps(); i++) |
| 526 | dnormals[i] = copyArrayToUSM(in->dnormals[i]); |
| 527 | } |
| 528 | |
| 529 | hairs = (ISPCHair*) copyArrayToUSM(in->hairs); |
| 530 | |
| 531 | if (in->flags.size()) |
| 532 | flags = (unsigned char*) copyArrayToUSM(in->flags); |
| 533 | |
| 534 | startTime = in->time_range.lower; |
| 535 | endTime = in->time_range.upper; |
| 536 | numTimeSteps = (unsigned) in->numTimeSteps(); |
| 537 | numVertices = (unsigned) in->numVertices(); |
| 538 | numHairs = (unsigned)in->numPrimitives(); |
| 539 | geom.materialID = scene_in->materialID(in->material); |
| 540 | tessellation_rate = in->tessellation_rate; |
| 541 | } |
| 542 | |
| 543 | ISPCHairSet::~ISPCHairSet() |
| 544 | { |
nothing calls this directly
no test coverage detected