pub struct PyLibreDR(pub(crate) LibreDR, pub(crate) String, pub(crate) bool, pub(crate) bool);Expand description
Python interface for LibreDR client
Tuple Fields§
§0: LibreDR§1: String§2: bool§3: boolImplementations§
Source§impl PyLibreDR
 
impl PyLibreDR
Sourcepub const MISS_NONE: u8 = 0u8
 
pub const MISS_NONE: u8 = 0u8
See render::MISS_NONE for details.
Sourcepub const MISS_ENVMAP: u8 = 1u8
 
pub const MISS_ENVMAP: u8 = 1u8
See render::MISS_ENVMAP for details.
Sourcepub const REFLECTION_NORMAL_FACE: u8 = 0u8
 
pub const REFLECTION_NORMAL_FACE: u8 = 0u8
See render::REFLECTION_NORMAL_FACE for details.
Sourcepub const REFLECTION_NORMAL_VERTEX: u8 = 1u8
 
pub const REFLECTION_NORMAL_VERTEX: u8 = 1u8
See render::REFLECTION_NORMAL_VERTEX for details.
Sourcepub const REFLECTION_NORMAL_TEXTURE: u8 = 2u8
 
pub const REFLECTION_NORMAL_TEXTURE: u8 = 2u8
See render::REFLECTION_NORMAL_TEXTURE for details.
Sourcepub const REFLECTION_DIFFUSE_NONE: u8 = 0u8
 
pub const REFLECTION_DIFFUSE_NONE: u8 = 0u8
See render::REFLECTION_DIFFUSE_NONE for details.
Sourcepub const REFLECTION_DIFFUSE_LAMBERTIAN: u8 = 1u8
 
pub const REFLECTION_DIFFUSE_LAMBERTIAN: u8 = 1u8
See render::REFLECTION_DIFFUSE_LAMBERTIAN for details.
Sourcepub const REFLECTION_SPECULAR_NONE: u8 = 0u8
 
pub const REFLECTION_SPECULAR_NONE: u8 = 0u8
See render::REFLECTION_SPECULAR_NONE for details.
Sourcepub const REFLECTION_SPECULAR_PHONG: u8 = 1u8
 
pub const REFLECTION_SPECULAR_PHONG: u8 = 1u8
See render::REFLECTION_SPECULAR_PHONG for details.
Sourcepub const REFLECTION_SPECULAR_BLINN_PHONG: u8 = 2u8
 
pub const REFLECTION_SPECULAR_BLINN_PHONG: u8 = 2u8
See render::REFLECTION_SPECULAR_BLINN_PHONG for details.
Sourcepub const REFLECTION_SPECULAR_TORRANCE_SPARROW_PHONG: u8 = 3u8
 
pub const REFLECTION_SPECULAR_TORRANCE_SPARROW_PHONG: u8 = 3u8
See render::REFLECTION_SPECULAR_TORRANCE_SPARROW_PHONG for details.
Sourcepub const REFLECTION_SPECULAR_TORRANCE_SPARROW_BLINN_PHONG: u8 = 4u8
 
pub const REFLECTION_SPECULAR_TORRANCE_SPARROW_BLINN_PHONG: u8 = 4u8
See render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BLINN_PHONG for details.
Sourcepub const REFLECTION_SPECULAR_TORRANCE_SPARROW_BECKMANN: u8 = 5u8
 
pub const REFLECTION_SPECULAR_TORRANCE_SPARROW_BECKMANN: u8 = 5u8
See render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BECKMANN for details.
Sourcepub fn py_new(
    py: Python<'_>,
    connect: String,
    unix: bool,
    tls: bool,
) -> Result<Self>
 
pub fn py_new( py: Python<'_>, connect: String, unix: bool, tls: bool, ) -> Result<Self>
Construct LibreDR by connecting to LibreDR server.
See LibreDR::new for details.
Sourcepub fn __getnewargs__(&self) -> (String, bool, bool)
 
pub fn __getnewargs__(&self) -> (String, bool, bool)
To allow pickle PyLibreDR object by reconnecting to the server.
Unpickled connection has different UUID.
Sourcepub fn py_ray_tracing_forward<'py>(
    &mut self,
    py: Python<'py>,
    geometry: &PyGeometry,
    ray: PyReadonlyArrayDyn<'_, f32>,
    texture: PyReadonlyArray3<'_, f32>,
    envmap: PyReadonlyArray4<'_, f32>,
    sample_per_pixel: Bound<'py, PyAny>,
    max_bounce: Bound<'py, PyAny>,
    switches: (u8, u8, u8, u8),
    clip_near: Bound<'py, PyAny>,
    camera_space: bool,
    requires_grad: bool,
    srand: i32,
    low_discrepancy: Option<u32>,
) -> Result<Bound<'py, PyArrayDyn<f32>>>
 
pub fn py_ray_tracing_forward<'py>( &mut self, py: Python<'py>, geometry: &PyGeometry, ray: PyReadonlyArrayDyn<'_, f32>, texture: PyReadonlyArray3<'_, f32>, envmap: PyReadonlyArray4<'_, f32>, sample_per_pixel: Bound<'py, PyAny>, max_bounce: Bound<'py, PyAny>, switches: (u8, u8, u8, u8), clip_near: Bound<'py, PyAny>, camera_space: bool, requires_grad: bool, srand: i32, low_discrepancy: Option<u32>, ) -> Result<Bound<'py, PyArrayDyn<f32>>>
Create a RequestRayTracingForward task and wait for response
§Arguments
ray- ray parameters- if 
camera_spaceisfalse18 *image_shape- including ray position 9 * 
image_shape - including ray direction 9 * 
image_shape 
 - including ray position 9 * 
 - if 
camera_spaceistrue, add another (1 + 14) channels- including ray depth 1 * 
image_shape(if depth <= 0, treat as hit miss) - including ray material 14 * 
image_shape 
 - including ray depth 1 * 
 
- if 
 texture- (3 + 3 + 3 + 1 + 3 + 1) *texture_resolution*texture_resolution(must be square image)- including normal + diffuse + specular + roughness + intensity + window
 
envmap- 3 * 6 *envmap_resolution*envmap_resolution- (must be box unwrapped 6 square images)
 
sample_per_pixel-sample_per_pixel_forward, (sample_per_pixel_backward)sample_per_pixelcan be a single integer,- (same value for forward and backward)
 
- or tuple of 2 integers.
- (only 
sample_per_pixel_backwardnumber of rays are stored for backward) - (must ensure 
sample_per_pixel_forward>=sample_per_pixel_backward) 
 - (only 
 
max_bounce-max_bounce_forward, (max_bounce_backward), (max_bounce_low_discrepancy), (skip_bounce)max_bouncecan be a single integer, or tuple of 2-4 integers.- The default value for 
max_bounce_backwardis the same asmax_bounce_forward. - The default value for 
max_bounce_low_discrepancyis0. - The default value for 
skip_bounceis0. 
switches- tuple of 4 switches to determine hit miss and reflection behavior- render::MISS_* - determine how to deal with ray hit miss
 - render::REFLECTION_NORMAL_* - determine how to get surface normal
 - render::REFLECTION_DIFFUSE_* - determine diffuse reflection model
 - render::REFLECTION_SPECULAR_* - determine specular reflection model
common::render::REFLECTION_SPECULAR_NONEcommon::render::REFLECTION_SPECULAR_PHONGcommon::render::REFLECTION_SPECULAR_BLINN_PHONGcommon::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_PHONGcommon::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BLINN_PHONGcommon::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BECKMANN
 
clip_near- clip near distance for cameraclip_nearcan be a single float number (same for all bounces),- or tuple of 3 float numbers (first bounce, second bounce, and other bounces)
 
camera_space- iftrue, the first bounce uses the depth and material given by the rayrequires_grad- iftrue, worker will save intermediate data, the next task must beray_tracing_backwardsrand- random seed- if srand >= 0, the same random seed is used for every pixel
 - if srand < 0, use different seed for each pixel
 
low_discrepancy- (optional) start id of Halton low discrepancy sequence.- The default value is the same as 
sample_per_pixel_forward. - if combine multiple rendered images to reduce noise, this value can be set to: 
1 *sample_per_pixel_forward, 2 *sample_per_pixel_forward, 3 *sample_per_pixel_forward, … 
- The default value is the same as 
 
§Return
Return shape will be,
- if 
camera_spaceistrue- render image 3 * 
image_shape 
 - render image 3 * 
 - if 
camera_spaceisfalse, add another- ray texture coordinate 2 * 
image_shape - ray depth (Euclidean distance) 1 * 
image_shape - ray normal 3 * 
image_shape 
 - ray texture coordinate 2 * 
 
Sourcepub fn py_ray_tracing_backward<'py>(
    &mut self,
    py: Python<'py>,
    d_ray: PyReadonlyArrayDyn<'_, f32>,
) -> Result<(Bound<'py, PyArray3<f32>>, Bound<'py, PyArray4<f32>>, Option<Bound<'py, PyArrayDyn<f32>>>)>
 
pub fn py_ray_tracing_backward<'py>( &mut self, py: Python<'py>, d_ray: PyReadonlyArrayDyn<'_, f32>, ) -> Result<(Bound<'py, PyArray3<f32>>, Bound<'py, PyArray4<f32>>, Option<Bound<'py, PyArrayDyn<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
d_ray- gradient of image 3 *image_shape(must ensure sameimage_shapeasRequestRayTracingForward)
§Return
Return shape will be,
- if 
camera_spaceisfalseforRequestRayTracingForwardtask- 1st return value (3 + 3 + 3 + 1 + 3 + 1) * 
texture_resolution*texture_resolution- (same 
texture_resolutionasRequestRayTracingForward) - including d_normal + d_diffuse + d_specular + d_roughness + d_intensity + d_window
 
 - (same 
 - 2nd return value 3 * 6 * 
envmap_resolution*envmap_resolution- (same 
envmap_resolutionasRequestRayTracingForward) - including d_envmap
 
 - (same 
 
 - 1st return value (3 + 3 + 3 + 1 + 3 + 1) * 
 - if 
camera_spaceistrueforRequestRayTracingForwardtask, add another- 3rd return value 14 * 
image_shape(same shape asRequestRayTracingForward)- including d_ray_texture
 
 
 - 3rd return value 14 * 
 
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for PyLibreDR
 
impl<'py> IntoPyObject<'py> for PyLibreDR
Source§impl PyClassBaseType for PyLibreDR
 
impl PyClassBaseType for PyLibreDR
type LayoutAsBase = PyClassObject<PyLibreDR>
type BaseNativeType = <PyLibreDR as PyClassImpl>::BaseNativeType
type Initializer = PyClassInitializer<PyLibreDR>
type PyClassMutability = <PyLibreDR as PyClassImpl>::PyClassMutability
Source§impl PyClassImpl for PyLibreDR
 
impl PyClassImpl for PyLibreDR
Source§const IS_BASETYPE: bool = true
 
const IS_BASETYPE: bool = true
Source§const IS_SUBCLASS: bool = false
 
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
 
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
 
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
 
const IS_IMMUTABLE_TYPE: bool = false
Source§type ThreadChecker = SendablePyClass<PyLibreDR>
 
type ThreadChecker = SendablePyClass<PyLibreDR>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
 
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
 
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<PyLibreDR> for PyClassImplCollector<PyLibreDR>
 
impl PyClassNewTextSignature<PyLibreDR> for PyClassImplCollector<PyLibreDR>
fn new_text_signature(self) -> Option<&'static str>
Source§impl PyMethods<PyLibreDR> for PyClassImplCollector<PyLibreDR>
 
impl PyMethods<PyLibreDR> for PyClassImplCollector<PyLibreDR>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PyLibreDR
 
impl PyTypeInfo for PyLibreDR
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
 
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
 
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
 
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
 
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for PyLibreDR
Auto Trait Implementations§
impl !Freeze for PyLibreDR
impl RefUnwindSafe for PyLibreDR
impl Send for PyLibreDR
impl Sync for PyLibreDR
impl Unpin for PyLibreDR
impl UnwindSafe for PyLibreDR
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
    T: IntoPyObject<'py>,
 
impl<'py, T> IntoPyObjectExt<'py> for Twhere
    T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
 
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
 
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
 
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<T> PyErrArguments for T
 
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
    T: PyTypeInfo,
 
impl<T> PyTypeCheck for Twhere
    T: PyTypeInfo,
§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.