VRay SDK for C++
Loading...
Searching...
No Matches
VRay::UVTextureSampler Class Reference

#include <vraysdk.hpp>

Public Member Functions

 UVTextureSampler (const UVTextureSampler &r)=delete
 
 UVTextureSampler (UVTextureSampler &&r) noexcept
 
UVTextureSampleroperator= (const UVTextureSampler &rhs)=delete
 
UVTextureSampleroperator= (UVTextureSampler &&rhs) noexcept
 
bool releaseRenderer (VRayRenderer &renderer)
 
bool sample (const PluginRef &pluginRef, float u, float v, AColor &result)
 
bool sample (const PluginRef &pluginRef, float u, float v, float &result)
 This method is an overload of sample(). It should be used with plugins whose output is a floating point number(float textures).
 
bool sample (const PluginRef &pluginRef, float u, float v, int &result)
 This method is an overload of sample(). It should be used with plugins whose output is an integer(int textures).
 
VRayImagesampleArea (const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
 
FloatList sampleAreaFloat (const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
 
IntList sampleAreaInt (const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
 
bool setupRenderer (VRayRenderer &renderer)
 

Detailed Description

A class which allows you to sample textures without starting a renderer. It is a simple and lightweight UV sampler which might not work with textures that require information which is obtained during the rendering process.

Member Function Documentation

◆ releaseRenderer()

bool VRay::UVTextureSampler::releaseRenderer ( VRayRenderer renderer)

This method releases the VRayRenderer(if there is any). Call this method with the VRayRenderer instance that you have used in setupRenderer(). After a successful execution of this method, the renderer instance will be restored to its normal state. This means that you will be able to modify plugins, load .vrscene files and etc.

Parameters
rendererThe released renderer.
Returns
true on success; false on failure(e.g. The VRayRenderer instance has already been released).

◆ sample()

bool VRay::UVTextureSampler::sample ( const PluginRef pluginRef,
float  u,
float  v,
AColor result 
)

This method samples the output of the given plugin at point (u, v). The plugin must be related to the VRayRenderer which has been used to set up the texture sampler.

Parameters
pluginRefThe plugin whose output(main or alternative) will be sampled and which returns AColor as a result.
uThe u-coordinate of the sample point.
vThe v-coordinate of the sample point.
resultThe result of the sampling.
Returns
The returned value indicates whether the sampling has been successful or not. true - on success and false - on failure.

◆ sampleArea()

VRayImage * VRay::UVTextureSampler::sampleArea ( const PluginRef pluginRef,
float  u_start,
float  u_end,
float  v_start,
float  v_end,
int  width,
int  height 
)

This method samples an area of the output of the given plugin. The sampled region(it is a rectangle) has dimensions: [u_start; u_end] x [v_start; v_end].

Parameters
pluginRefThe plugin whose output(main or alternative) will be sampled and which returns AColor as a result.
u_startThe u-coordinate from which to sample.
u_endThe u-coordinate to which to sample.
v_startThe v-coordinate from which to sample.
v_endThe v-coordinate to which to sample.
widthThe width of the resulting VRayImage.
heightThe height of the resulting VRayImage.
Returns
A VRayImage* with the result of the sampling. The image has dimensions: (width, height) on success or is nullptr on failure.

◆ sampleAreaFloat()

FloatList VRay::UVTextureSampler::sampleAreaFloat ( const PluginRef pluginRef,
float  u_start,
float  u_end,
float  v_start,
float  v_end,
int  width,
int  height 
)

This method samples an area of the output of the given plugin. The sampled region(it is a rectangle) has dimensions: [u_start; u_end] x [v_start; v_end].

Parameters
pluginRefThe plugin whose output(main or alternative) will be sampled and which returns float as a result(float textures).
u_startThe u-coordinate from which to sample.
u_endThe u-coordinate to which to sample.
v_startThe v-coordinate from which to sample.
v_endThe v-coordinate to which to sample.
widthThe width of the sample area, which determines the sample step(resolution) of the u-coordinate.
heightThe height of the sample area, which determines the sample step(resolution) of the v-coordinate.
Returns
FloatList with the result, which can be treated as a 2D array with dimensions: (height rows, width cols) on success or is empty on failure.

◆ sampleAreaInt()

IntList VRay::UVTextureSampler::sampleAreaInt ( const PluginRef pluginRef,
float  u_start,
float  u_end,
float  v_start,
float  v_end,
int  width,
int  height 
)

This method is almost the same as sampleAreaFloat(). The only difference is that it should be used with plugins whose output(main or alternative) returns int as a result(int textures).

◆ setupRenderer()

bool VRay::UVTextureSampler::setupRenderer ( VRayRenderer renderer)

This method prepares the passed renderer for sampling. It does not modify the passed renderer on failure. However, it does make the renderer unusable(outside the UVTextureSampler) on success. This means that the methods of the VRayRenderer instance won't do anything after a successful execution of this method. To get the renderer back, you have to call releaseRenderer() with the same VRayRenderer instance.

Parameters
rendererThe renderer which will be used for sampling.
Returns
true on success; false on failure(e.g. The sampler has already been initialized with a renderer).

The documentation for this class was generated from the following file: