private JsonManifest.View Capture( string base_image_name, Quaternion orientation, Vector3 position, Matrix4x4 reference_from_world, string export_path) { // Save initial camera state Vector3 initial_camera_position = color_camera_.transform.position; Quaternion initial_camera_rotation = color_camera_.transform.rotation; // Setup cameras color_camera_.transform.position = position; color_camera_.transform.rotation = orientation; depth_camera_.transform.position = position; depth_camera_.transform.rotation = orientation; // Write out color data string color_image_name = base_image_name + "_Color." + (IsHighDynamicRange() ? "exr" : "png"); color_camera_.ResetReplacementShader(); color_camera_.targetTexture = color_render_texture_; color_camera_.Render(); WriteImage(color_render_texture_, Texture2DFromDynamicRange(), PathCombine(export_path, color_image_name), true); // Write out depth data string depth_image_name = base_image_name + "_Depth.exr"; depth_camera_.SetReplacementShader(render_depth_shader_, "RenderType"); depth_camera_.targetTexture = depth_render_texture_; depth_camera_.Render(); WriteImage(depth_render_texture_, texture_fp32_, PathCombine(export_path, depth_image_name), false); // Record the capture results. JsonManifest.View view = new JsonManifest.View(); view.projective_camera.image_width = color_render_texture_.width; view.projective_camera.image_height = color_render_texture_.height; view.projective_camera.clip_from_eye_matrix = JsonManifest.MatrixToArray(color_camera_.projectionMatrix); view.projective_camera.world_from_eye_matrix = JsonManifest.MatrixToArray(reference_from_world * color_camera_.cameraToWorldMatrix); view.projective_camera.depth_type = "EYE_Z"; view.depth_image_file.color.path = color_image_name; view.depth_image_file.color.channel_0 = "R"; view.depth_image_file.color.channel_1 = "G"; view.depth_image_file.color.channel_2 = "B"; view.depth_image_file.color.channel_alpha = "CONSTANT_ONE"; view.depth_image_file.depth.path = depth_image_name; view.depth_image_file.depth.channel_0 = "R"; // Restore camera state color_camera_.transform.position = initial_camera_position; color_camera_.transform.rotation = initial_camera_rotation; return(view); }
/// <summary> /// This operation creates an end-of-day manifest that combines all trackable shipments into a single form that is scanned by the carrier /// as an acceptance of all the shipments. /// /// Things to Consider: /// * All shipments with the ADD_TO_MANIFEST option set to true are eligible for inclusion in the manifest. /// * A shipment is eligible for inclusion both on and before its shipment date. /// * If an eligible shipment is not included in a manifest request within 24 hours of the specified shipment date, it is automatically /// manifested. /// * Up to 5000 shipments can be included in a single manifest request. /// * Shipments, once manifested, cannot be re-manifested. /// * When creating the manifest, the MANIFEST_TYPE parameter parameter is not required. It can be either left out or set to NORMAL. /// * You can add shipments to the manifest by specifying Shipper ID, tracking numbers, or both: /// - If you specify Shipper ID, the form will include all eligible shipments created with that Shipper ID. To specify Shipper ID, /// add the SHIPPER_ID parameter to the parameters array. /// - If you specify tracking numbers, the form will include all eligible shipments with those tracking numbers.Specify tracking /// numbers in the parcelTrackingNumbers array. /// * If you specify both Shipper ID and tracking numbers, ensure the tracking numbers belong to the Shipper ID. /// * You can filter further by specifying an inductionPostalCode. When specified, the inductionPostalCode value in the manifest /// request must match the rates.inductionPostalCode value of the shipment.If a shipment has no rates.inductionPostalCode, the /// value in the manifest request must match the shipment’s fromAddress.postalCode. /// * If a manifest request contains shipments with different inductionPostalCode values, then a multi-page manifest is created, with one inductionPostalCode value per page. The pages are accessed via a single PDF. /// * Manifest documents retrieved through URLs are available for 24 hours after creation. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="request"></param> /// <param name="session"></param> /// <returns></returns> public async static Task <ShippingApiResponse <T> > CreateManifest <T>(T request, ISession session = null) where T : IManifest, new() { var manifestRequest = new JsonManifest <T>(request); return(await WebMethod.Post <T, JsonManifest <T> >("/shippingservices/v1/manifests", manifestRequest, session)); }