MCPcopy Create free account
hub / github.com/RenderKit/embree / ISPCHairSet

Method ISPCHairSet

tutorials/common/tutorial/scene_device.cpp:502–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 7

alignedUSMMallocFunction · 0.85
copyArrayToUSMFunction · 0.85
materialIDMethod · 0.80
numTimeStepsMethod · 0.45
sizeMethod · 0.45
numVerticesMethod · 0.45
numPrimitivesMethod · 0.45

Tested by

no test coverage detected