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: bool
Implementations§
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: Py<PyAny>,
max_bounce: Py<PyAny>,
switches: (u8, u8, u8, u8),
clip_near: 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: Py<PyAny>, max_bounce: Py<PyAny>, switches: (u8, u8, u8, u8), clip_near: 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_space
isfalse
18 *image_shape
- including ray position 9 *
image_shape
- including ray direction 9 *
image_shape
- including ray position 9 *
- if
camera_space
istrue
, 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_pixel
can be a single integer,- (same value for forward and backward)
- or tuple of 2 integers.
- (only
sample_per_pixel_backward
number 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_bounce
can be a single integer, or tuple of 2-4 integers.- The default value for
max_bounce_backward
is the same asmax_bounce_forward
. - The default value for
max_bounce_low_discrepancy
is0
. - The default value for
skip_bounce
is0
.
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_NONE
common::render::REFLECTION_SPECULAR_PHONG
common::render::REFLECTION_SPECULAR_BLINN_PHONG
common::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_PHONG
common::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BLINN_PHONG
common::render::REFLECTION_SPECULAR_TORRANCE_SPARROW_BECKMANN
clip_near
- clip near distance for cameraclip_near
can 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_backward
srand
- 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_space
istrue
- render image 3 *
image_shape
- render image 3 *
- if
camera_space
isfalse
, 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_shape
asRequestRayTracingForward
)
§Return
Return shape will be,
- if
camera_space
isfalse
forRequestRayTracingForward
task- 1st return value (3 + 3 + 3 + 1 + 3 + 1) *
texture_resolution
*texture_resolution
- (same
texture_resolution
asRequestRayTracingForward
) - 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_resolution
asRequestRayTracingForward
) - including d_envmap
- (same
- 1st return value (3 + 3 + 3 + 1 + 3 + 1) *
- if
camera_space
istrue
forRequestRayTracingForward
task, add another- 3rd return value 14 *
image_shape
(same shape asRequestRayTracingForward
)- including d_ray_texture
- 3rd return value 14 *
Trait Implementations§
source§impl HasPyGilRef for PyLibreDR
impl HasPyGilRef for PyLibreDR
§type AsRefTarget = PyCell<PyLibreDR>
type AsRefTarget = PyCell<PyLibreDR>
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
§type ThreadChecker = SendablePyClass<PyLibreDR>
type ThreadChecker = SendablePyClass<PyLibreDR>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§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<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
PyTypeInfo::type_object
will be replaced by PyTypeInfo::type_object_bound
in a future PyO3 version§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
PyTypeInfo::is_type_of
will be replaced by PyTypeInfo::is_type_of_bound
in a future PyO3 versionobject
is an instance of this type or a subclass of this type.§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
PyTypeInfo::is_exact_type_of
will be replaced by PyTypeInfo::is_exact_type_of_bound
in a future PyO3 versionobject
is an instance of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(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<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.