Struct libredr::LibreDR

source ·
pub struct LibreDR {
    connection: Connection,
}
Expand description

Rust interface for LibreDR client

Fields§

§connection: Connection

Implementations§

source§

impl LibreDR

source

pub async fn new(connect: String, unix: bool, tls: bool) -> Result<Self>

Construct LibreDR by connecting to LibreDR server
Return Error if connection failed

§Examples
async {
  let client_tcp = LibreDR::new(String::from("127.0.0.1:9001"), false, false).await?;
  let client_unix = LibreDR::new(String::from("/var/run/libredr_client.sock"), true, false).await?;
}
source

async fn try_recv_msg_response_data( &mut self, data_cache: &DataCache, ) -> Result<Message>

Receive messages, response RequestData task, until receive a different task

source

pub async fn ray_tracing_forward( &mut self, geometry: &Geometry, geometry_data_cache: &DataCache, ray: ArrayD<f32>, texture: Array3<f32>, envmap: Array4<f32>, sample_per_pixel: (usize, usize), max_bounce: (usize, usize, usize, usize), switches: (u8, u8, u8, u8), clip_near: (f32, f32, f32), camera_space: bool, requires_grad: bool, srand: i32, low_discrepancy: u32, ) -> Result<ArrayD<f32>>

Create a RequestRayTracingForward task and wait for response

§Arguments
§Return

Return shape will be,

  • if camera_space is true
    • render image 3 * image_shape
  • if camera_space is false, add another
    • ray texture coordinate 2 * image_shape
    • ray depth (Euclidean distance) 1 * image_shape
    • ray normal 3 * image_shape
source

pub async fn ray_tracing_backward( &mut self, d_ray: ArrayD<f32>, ) -> Result<(Array3<f32>, Array4<f32>, Option<ArrayD<f32>>)>

Create a RequestRayTracingBackward task and wait for response.

Must be called consecutive to a RequestRayTracingForward task with requires_grad set to true.
To create multiple RequestRayTracingForward tasks and backward together, multiple client connections are required.

§Arguments
§Return

Return shape will be,

source

pub async fn close(&mut self) -> Result<()>

Send Message::Close to server to close cleanly

Trait Implementations§

source§

impl Debug for LibreDR

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Ungil for T
where T: Send,