/// <summary> /// Debug.Logs the number of hit positions from single/multiple optix sensors. Runs once. /// </summary> /// <param name="optixSensors"></param> public int ReturnNumberOfHitPositionsSingle(OptixSensor[] optixSensors) { CheckEnabledStatusChanged(); CheckMatrixChanged(); this.optixSensors = optixSensors; OptixLibraryInterface.SetAllSensorsFromUnity(optixSensors.Length, GetBaseValuesFromSensors(optixSensors)); int returnHitPositionCount; OptixLibraryInterface.SensorFireAndReturnHitCount(out returnHitPositionCount); return(returnHitPositionCount); }
/// <summary> /// Renders the hit positions from single/multiple optix sensors into a point cloud. Runs continually until stopped by EndRaytracing(). /// </summary> public void RenderPointCloudFromSensorsContinuous(OptixSensor[] optixSensors, OptixPointCloud optixPointCloud) { this.optixSensors = optixSensors; OptixLibraryInterface.SetAllSensorsFromUnity(optixSensors.Length, GetBaseValuesFromSensors(optixSensors)); if (isRaytracing) { Debug.LogWarning("Attempting to start raytracing even though it is already executing."); return; } if (optixSensors == null) { Debug.LogWarning("Cannot have optixSensors set to null. Cancelling raytracing."); return; } isRaytracing = true; StartCoroutine(RaytracingCoroutine(optixPointCloud)); }
// Check if any of the sensors have had a value in the optix sensor component changed private bool CheckOptixSensorComponentDirty() { bool updateSensors = false; for (int iSensor = 0; iSensor < optixSensors.Length; iSensor++) { if (optixSensors[iSensor].IsComponentDirty) { optixSensors[iSensor].IsComponentDirty = false; optixSensors[iSensor].IsTransformDirty = false; updateSensors = true; } } if (updateSensors) { OptixLibraryInterface.SetAllSensorsFromUnity(optixSensors.Length, GetBaseValuesFromSensors(optixSensors)); sceneChanged = true; return(true); } return(false); }