VRay SDK for C++
Loading...
Searching...
No Matches
vraysdk.hpp
1#ifndef _VRAY_SDK_HPP_
2#define _VRAY_SDK_HPP_
3
4#if !defined(_M_AMD64) && !defined(__amd64__) && !defined(_M_ARM64) && !defined(__aarch64__)
5 #error "V-Ray supports only 64-bit architectures"
6#endif
7
8#ifndef VRAY_NOTHROW
9 #include "vraythrow.hpp"
10#endif
11
12#include "errcodes.h"
13
14#include <new>
15#include <cmath>
16#include <utility>
17#include <cstdint>
18#include <cstddef>
19#include <cstdio>
20#include <cstdlib>
21#include <cstring>
22#include <string>
23#include <sstream>
24#include <vector>
25#include <fstream>
26#include <atomic>
27
28#include "_vraysdk_utils.hpp"
29
30#define VRAY_MINIMUM2(a, b) ((a) < (b) ? (a) : (b))
31#define VRAY_MAXIMUM2(a, b) ((a) > (b) ? (a) : (b))
32#define VRAY_MAXIMUM3(a, b, c) VRAY_MAXIMUM2(VRAY_MAXIMUM2(a, b), c)
33#define VRAY_MAXIMUM4(a, b, c, d) VRAY_MAXIMUM2(VRAY_MAXIMUM3(a, b, c), d)
34
35class QWidget;
36#if defined(VRAY_ALLOW_UNSAFE_NATIVE_HANDLE) || (!defined(_WIN32) && !defined(__APPLE__))
37 typedef void* NativeWindowHandle;
38 typedef void* NativeWidgetHandle;
39#else
40 #ifdef _WIN32
41 #ifndef _WINDEF_
42 typedef struct HWND__ *HWND;
43 #endif
44 typedef HWND NativeWindowHandle;
45 typedef HWND NativeWidgetHandle;
46 #elif __APPLE__
47 #ifdef __OBJC__
48 #define VRAY_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname
49 #else
50 #define VRAY_FORWARD_DECLARE_OBJC_CLASS(classname) typedef struct objc_object classname
51 #endif
52 VRAY_FORWARD_DECLARE_OBJC_CLASS(NSWindow);
53 typedef NSWindow *NativeWindowHandle;
54 VRAY_FORWARD_DECLARE_OBJC_CLASS(NSView);
55 typedef NSView *NativeWidgetHandle;
56 #endif
57#endif
58
59namespace VRay {
60
61namespace Internal {
62 inline float linear_to_srgb(float x) {
63 if (x <= 0.0031308f) {
64 x *= 12.92f;
65 } else {
66 x = 1.055f*powf(x, 1.0f/2.4f)-0.055f;
67 }
68 return x;
69 }
70 inline float srgb_to_linear(float x) {
71 if (x < 0.04045f) {
72 x /= 12.92f;
73 } else {
74 x = powf((x+0.055f)/1.055f, 2.4f);
75 }
76 return x;
77 }
78
79 inline float interpolate(float x, float a, float b) noexcept {
80 return (b - a) * x + a;
81 }
82}
83
84#ifdef _MSC_VER
85# pragma warning(push)
86# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
87#endif // _MSC_VER
88
89#ifdef _MSC_VER
90# define VRAY_DEPRECATED(msg) __declspec(deprecated(msg))
91#else // unix
92// GCC <= 4.4 doesn't support the optional message parameter
93# if defined(__clang__) || COMPILER_VERSION >= 450
94# define VRAY_DEPRECATED(msg) __attribute__((deprecated(msg)))
95# else
96# define VRAY_DEPRECATED(msg) __attribute__((deprecated))
97# endif
98#endif // _MSC_VER
99
100#ifdef VRAY_SDK_INTEROPERABILITY
101 struct Vector;
102 struct Color;
103 namespace VUtils {
104 class Value;
105 class CharString;
106 struct TraceTransform;
107 template<class T> struct PtrArray;
115 }
116#endif // VRAY_SDK_INTEROPERABILITY
117
119 enum RendererState {
120 FATAL_ERROR = -1,
121 IDLE_INITIALIZED,
122 IDLE_STOPPED,
123 IDLE_ERROR,
124 IDLE_FRAME_DONE,
125 IDLE_DONE,
126 PREPARING,
127 RENDERING,
128 RENDERING_PAUSED,
129 RENDERING_AWAITING_CHANGES,
130 };
131
132 enum AddHostsResult {
133 FAILED_TO_RESOLVE = -2,
134 RENDERER_ERROR = -1,
135 FAILED_TO_CONNECT = 0,
136 SUCCESSFULLY_ADDED = 1,
137 SUCCESS_BUT_NO_WORK = 2,
138 };
139
140 enum Type {
141
142 // Plugin Property Types
143 TYPE_INT = 0,
144 TYPE_FLOAT = 1,
145 TYPE_DOUBLE = 2,
146 TYPE_BOOL = 3,
147 TYPE_VECTOR = 4,
148 TYPE_COLOR = 5,
149 TYPE_ACOLOR = 6,
150 TYPE_MATRIX = 7,
151 TYPE_TRANSFORM = 8,
152
153 TYPE_STRING = 9,
154 TYPE_PLUGIN = 10,
155 TYPE_TEXTURE = 11,
156 TYPE_LIST = 12,
157 TYPE_TEXTUREFLOAT = 13,
158 TYPE_TEXTUREINT = 14,
159 TYPE_TEXTUREVECTOR = 15,
160 TYPE_TEXTUREMATRIX = 16,
161 TYPE_TEXTURETRANSFORM = 17,
162
163 // List types
164 TYPE_GENERAL_LIST = TYPE_LIST,
165
166 // Typed Lists
167 TYPE_TYPED_LIST_BASE = 100,
168 TYPE_INT_LIST = TYPE_TYPED_LIST_BASE + TYPE_INT,
169 TYPE_FLOAT_LIST = TYPE_TYPED_LIST_BASE + TYPE_FLOAT,
170 TYPE_DOUBLE_LIST = TYPE_TYPED_LIST_BASE + TYPE_DOUBLE,
171 TYPE_BOOL_LIST = TYPE_TYPED_LIST_BASE + TYPE_BOOL,
172 TYPE_VECTOR_LIST = TYPE_TYPED_LIST_BASE + TYPE_VECTOR,
173 TYPE_COLOR_LIST = TYPE_TYPED_LIST_BASE + TYPE_COLOR,
174 TYPE_ACOLOR_LIST = TYPE_TYPED_LIST_BASE + TYPE_ACOLOR,
175 TYPE_MATRIX_LIST = TYPE_TYPED_LIST_BASE + TYPE_MATRIX,
176 TYPE_TRANSFORM_LIST = TYPE_TYPED_LIST_BASE + TYPE_TRANSFORM,
177 TYPE_STRING_LIST = TYPE_TYPED_LIST_BASE + TYPE_STRING,
178 TYPE_PLUGIN_LIST = TYPE_TYPED_LIST_BASE + TYPE_PLUGIN,
179 TYPE_TEXTURE_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTURE,
180 TYPE_TEXTUREFLOAT_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTUREFLOAT,
181 TYPE_TEXTUREINT_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTUREINT,
182 TYPE_TEXTUREVECTOR_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTUREVECTOR,
183 TYPE_TEXTUREMATRIX_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTUREMATRIX,
184 TYPE_TEXTURETRANSFORM_LIST = TYPE_TYPED_LIST_BASE + TYPE_TEXTURETRANSFORM,
185
186 // Output (multi-texture) Property Types
187 TYPE_OUTPUTTEXTURE = 1000,
188 TYPE_OUTPUTTEXTUREFLOAT = 1001,
189 TYPE_OUTPUTTEXTUREINT = 1002,
190 TYPE_OUTPUTTEXTUREVECTOR = 1003,
191 TYPE_OUTPUTTEXTUREMATRIX = 1004,
192 TYPE_OUTPUTTEXTURETRANSFORM = 1005,
193
194 TYPE_UNSPECIFIED = 10000,
195
196 TYPE_ERROR = -1
197 };
198
200 enum MessageLevel {
201 MessageError = 0,
202 MessageWarning = 1,
203 MessageInfo = 2,
204 MessageDebug = 3
205 };
206
207 enum LicenseUserStatus : int {
208 Disabled = 0,
209 QueryFailure = 1,
210 NoActiveUser = 2,
211 ActiveUserPresent = 3,
212 };
213
215 enum ImagePassType {
216 ImagePass_Final = 0,
217 ImagePass_LightCache = 1,
218 ImagePass_IrradianceMap = 2,
219 };
220
222 enum DefaultsPreset {
223 quality_draft,
224 quality_low,
225 quality_medium,
226 quality_high,
227 quality_veryHigh,
228 };
229
231 enum VFBRenderElementType {
232 renderElementType_lightMix=0,
233 renderElementType_denoiser,
234
235 renderElementType_last
236 };
237
240 {
241 int x0, y0, x1, y1;
242
243 ImageRegion(int x = 0, int y = 0, int w = 0, int h = 0) {
244 set(x, y, w, h);
245 }
246
247 void set(int x, int y, int w, int h) {
248 x0 = x;
249 y0 = y;
250 x1 = x + w;
251 y1 = y + h;
252 }
253
254 void setX(int x) {
255 x0 = x;
256 }
257
258 void setY(int y) {
259 y0 = y;
260 }
261
262 void setWidth(int width) {
263 x1 = x0 + width;
264 }
265
266 void setHeight(int height) {
267 y1 = y0 + height;
268 }
269
270 int getX() const {
271 return x0;
272 }
273
274 int getY() const {
275 return y0;
276 }
277
278 int getWidth() const {
279 return x1 - x0;
280 }
281
282 int getHeight() const {
283 return y1 - y0;
284 }
285 };
286
287 typedef unsigned long long InstanceId; // FOR INTERNAL USE ONLY
288 typedef unsigned long long PluginTypeId; // FOR INTERNAL USE ONLY
289 constexpr InstanceId NO_ID = InstanceId(-1);
290 constexpr PluginTypeId NO_TYPE_ID = PluginTypeId(-1);
291
292 namespace Internal {
293 static_assert(sizeof(InstanceId) == 8, "InstanceId should be 8 bytes long");
294 static_assert(sizeof(PluginTypeId) == 8, "PluginTypeId should be 8 bytes long");
295
296 constexpr int INSTANCE_ID_BITS = 48;
297
298 // A helper function to combine InstanceId and PluginTypeId by truncating InstanceId to INSTANCE_ID_BITS (48) bits
299 // and combine and set typeIdIdx in the remaining higher (sizeof(InstanceId) - INSTANCE_ID_BITS) (64-48 = 16) bits.
300 inline InstanceId combineInstanceIdAndTypeIndex(InstanceId id, int typeIdIdx) {
301 return (id & ((InstanceId(1) << INSTANCE_ID_BITS) - 1)) | (InstanceId(typeIdIdx) << INSTANCE_ID_BITS);
302 }
303 }
304
305 typedef int LayerUID; // FOR INTERNAL USE ONLY
306 const LayerUID NO_LAYER_ID = -1;
307
309 namespace VFBLayerProperty {
312 enum Type {
313 IntEnum = -1,
314 Bool,
315 Int,
316 Float,
317 Color,
318 String,
331 Stream
332 };
333
334 enum Flags {
335 NoFlags = 0,
336 Internal = (1 << 0),
337 Hidden = (1 << 1),
338 EnumRadioButtons = (1 << 2),
339 EnumComboBox = (1 << 3),
340
343 Command = (1 << 4),
344
348
349 Transient = (1 << 6),
350 ReadOnly = (1 << 7),
353 NoCustomStyleTag = (1 << 10),
354 NonResettable = (1 << 11),
355 NoUndo = (1 << 12),
356 Advanced = 1 << 13,
357
358 HasPipetteTool = 1 << 14,
359
361 Const = 1 << 15,
362
366
368 Stretched = 1 << 17
369 };
370
380 };
381
386 };
387
393 };
394
401 char fontFace[100];
402 };
403
438
442
444 };
445 };
446
447 typedef unsigned char byte;
448 typedef signed char sbyte;
449 typedef int RGB32;
450 typedef int Bool;
451
452 class VRayRenderer;
453 class Value;
454 struct Color;
455 struct AColor;
456 struct Vector;
457 struct Transform;
458 class Plugin;
459
460 typedef std::vector<int> IntList;
461 typedef std::vector<float> FloatList;
462 typedef std::vector<Color> ColorList;
463 typedef std::vector<Vector> VectorList;
464 typedef std::vector<Transform> TransformList;
465 typedef std::vector<Value> ValueList;
466 typedef std::vector<std::string> StringList;
467 typedef std::vector<Plugin> PluginList;
468
471
472 protected:
473 MemoryBuffer() {}
475
476 public:
477 const void* getData() const {
478 return static_cast<const void*>(this);
479 }
480 void* getData() {
481 return static_cast<void*>(this);
482 }
483 void operator delete(void* ptr);
484 };
485
487 class Png : public MemoryBuffer {};
489 class Jpeg : public MemoryBuffer {};
491 class VFBState : public MemoryBuffer {};
492
493 #pragma pack(push, 1)
494
497 unsigned short bfType;
498 unsigned bfSize;
499 unsigned bfReserved;
500 unsigned bfOffBits;
501 };
502
505 unsigned biSize;
506 int biWidth;
507 int biHeight;
508 unsigned short biPlanes;
509 unsigned short biBitCount;
510 unsigned biCompression;
511 unsigned biSizeImage;
512 int biXPelsPerMeter;
513 int biYPelsPerMeter;
514 unsigned biClrUsed;
515 unsigned biClrImportant;
516 };
517
520 void* getPixels() const {
521 return (byte*)this + bfOffBits;
522 }
523
524 unsigned getRowStride() const {
525 return (getWidth()*(biBitCount/8) + 3) & ~3;
526 }
527
528 int getWidth() const {
529 return abs(biWidth);
530 }
531
532 int getHeight() const {
533 return abs(biHeight);
534 }
535
536 int getBitsPerPixel() const {
537 return biBitCount;
538 }
539 };
540
542 class Bmp : public BmpHeader, public MemoryBuffer {};
543
544#pragma pack(pop)
545
548 struct VRayImage {
549 static VRayImage* create(int width, int height);
550 void operator delete (void *bmp);
551 VRayImage* clone() const;
552
553 int getWidth() const;
554 int getHeight() const;
555 bool getSize(int& width, int& height) const;
556
558 VRayImage* getCropped(int x, int y, int width, int height) const;
559
561 VRayImage* getResized(int width, int height) const;
562
564 VRayImage* getResizedCropped(int srcX, int srcY, int srcWidth, int srcHeight, int dstWidth, int dstHeight) const;
565
568 VRayImage* getDownscaled(int width, int height) const;
569
572 VRayImage* getDownscaledCropped(int srcX, int srcY, int srcWidth, int srcHeight, int dstWidth, int dstHeight) const;
573
576 VRayImage* getFitIn(int width, int height) const;
577
580 VRayImage* getFitOut(int width, int height) const;
581
584 VRayImage* getCutIn(int width, int height) const;
585
587 static VRayImage* createFromBmp(const void* buffer, size_t size = 0);
589 static VRayImage* createFromBmp(const VRayRenderer& renderer, const void* buffer, size_t size = 0);
590
592 static VRayImage* createFromPng(const void* buffer, size_t size);
594 static VRayImage* createFromPng(const VRayRenderer& renderer, const void* buffer, size_t size);
595
597 static VRayImage* createFromJpeg(const void* buffer, size_t size);
599 static VRayImage* createFromJpeg(const VRayRenderer& renderer, const void* buffer, size_t size);
600
603 bgra_byte = 0,
607 };
608
610 static VRayImage* createFromRawData(const void* buffer, size_t size, IntList_DataType dataType, int width, int height);
611
614 static VRayImage* load(const char* fileName);
616 static VRayImage* load(const std::string& fileName);
617
620 static void loadSize(const char* fileName, int& width, int& height);
622 static void loadSize(const std::string& fileName, int& width, int& height);
623
626 bool setGamma(float gamma);
627
630 float getGamma() const;
631
639 bool changeSRGB(bool apply = true);
640
646 bool changeGamma(float gamma);
647
648 enum WhiteBalanceMode {
649 WHITE_BALANCE_NONE,
650 WHITE_BALANCE_AVERAGE,
651 WHITE_BALANCE_WEIGHTED_AVERAGE,
652 WHITE_BALANCE_HIGHLIGHTS
653 };
654
656 AColor calculateWhiteBalanceMultiplier(WhiteBalanceMode mode) const;
657
658 enum DrawMode {
661 };
662
665 bool draw(const VRayImage* image, int x, int y, DrawMode mode = DRAW_MODE_COPY);
666
667 bool addColor(const Color& color);
668 bool addColor(const AColor& color);
669 bool mulColor(const AColor& color);
670 bool changeExposure(float ev);
671 bool changeContrast(float contrast);
672 bool makeNegative();
673
674 bool saveToBmp(const char* fileName, bool preserveAlpha = false, bool swapChannels = false) const;
675 bool saveToBmp(const char* fileName, const VRayRenderer& renderer, bool preserveAlpha = false, bool swapChannels = false) const;
676 bool saveToBmp(const std::string& fileName, bool preserveAlpha = false, bool swapChannels = false) const;
677 bool saveToBmp(const std::string& fileName, const VRayRenderer& renderer, bool preserveAlpha = false, bool swapChannels = false) const;
678
679 bool saveToPng(const char* fileName, bool preserveAlpha = false, int bitsPerChannel = 8) const;
680 bool saveToPng(const char* fileName, const VRayRenderer& renderer, bool preserveAlpha = false, int bitsPerChannel = 8) const;
681 bool saveToPng(const std::string& fileName, bool preserveAlpha = false, int bitsPerChannel = 8) const;
682 bool saveToPng(const std::string& fileName, const VRayRenderer& renderer, bool preserveAlpha = false, int bitsPerChannel = 8) const;
683
684 bool saveToJpeg(const char* fileName, int quality = 0) const;
685 bool saveToJpeg(const char* fileName, const VRayRenderer& renderer, int quality = 0) const;
686 bool saveToJpeg(const std::string& fileName, int quality = 0) const;
687 bool saveToJpeg(const std::string& fileName, const VRayRenderer& renderer, int quality = 0) const;
688
689 bool saveToTiff(const char* fileName, int bitsPerChannel = 16) const;
690 bool saveToTiff(const char* fileName, const VRayRenderer& renderer, int bitsPerChannel = 16) const;
691 bool saveToTiff(const std::string& fileName, int bitsPerChannel = 16) const;
692 bool saveToTiff(const std::string& fileName, const VRayRenderer& renderer, int bitsPerChannel = 16) const;
693
694 bool saveToExr(const char* fileName) const;
695 bool saveToExr(const char* fileName, const VRayRenderer& renderer) const;
696 bool saveToExr(const std::string& fileName) const;
697 bool saveToExr(const std::string& fileName, const VRayRenderer& renderer) const;
698
700 Bmp* compressToBmp(bool preserveAlpha = false, bool swapChannels = false) const;
702 Bmp* compressToBmp(size_t& size, bool preserveAlpha = false, bool swapChannels = false) const;
704 Bmp* compressToBmp(const VRayRenderer& renderer, bool preserveAlpha = false, bool swapChannels = false) const;
706 Bmp* compressToBmp(size_t& size, const VRayRenderer& renderer, bool preserveAlpha = false, bool swapChannels = false) const;
707
709 Png* compressToPng(bool preserveAlpha = false) const;
711 Png* compressToPng(size_t& size, bool preserveAlpha = false) const;
713 Png* compressToPng(const VRayRenderer& renderer, bool preserveAlpha = false) const;
715 Png* compressToPng(size_t& size, const VRayRenderer& renderer, bool preserveAlpha = false) const;
716
718 Jpeg* compressToJpeg(int quality = 0) const;
720 Jpeg* compressToJpeg(size_t& size, int quality = 0) const;
722 Jpeg* compressToJpeg(const VRayRenderer& renderer, int quality = 0) const;
724 Jpeg* compressToJpeg(size_t& size, const VRayRenderer& renderer, int quality = 0) const;
725
739 MemoryBuffer* toBitmapData(size_t& size, bool preserveAlpha = false, bool swapChannels = false, bool reverseY = false, int stride = 0, int alphaValue = -1) const;
740
741 IntList toIntList(IntList_DataType type) const;
742
746 AColor* getPixelData(size_t& count);
748 const AColor* getPixelData() const;
750 const AColor* getPixelData(size_t& count) const;
751
752 private:
753 VRayImage();
754 VRayImage(const VRayImage&);
755 VRayImage& operator=(const VRayImage &image);
756 };
757
760 VRayImage* img;
761 LocalVRayImage(const LocalVRayImage& img);
762 LocalVRayImage& operator=(const LocalVRayImage& img);
763
764 public:
765 LocalVRayImage(VRayImage* img) : img(img) {}
766
767 operator VRayImage* () {
768 return img;
769 }
770
771 VRayImage* operator->() {
772 return img;
773 }
774
775 VRayImage& operator*() {
776 return *img;
777 }
778
779 LocalVRayImage& operator=(VRayImage* image) {
780 delete img;
781 img = image;
782 return *this;
783 }
784
786 delete img;
787 }
788 };
789
793 int asInt;
794
795 struct {
796 bool multipleFiles : 1;
797 bool skipAlpha : 1;
798 bool frameNumber : 1;
799 bool noAlpha : 1;
800 bool singleChannel : 1;
801 bool skipRGB : 1;
804 bool multiChannel : 1;
806 };
807
808 ImageWriterFlags() : asInt() {}
809 } flags;
810
811 enum CompressionType {
812 DEFAULT,
813 NO_COMPRESSION,
814 RUN_LENGTH,
815 ZIP_SCANLINE,
816 ZIP_BLOCK,
817 PIZ,
818 PXR24,
819 B44,
820 B44A,
821 DWAA,
822 DWAB
824
826
828 };
829
831 struct Vector {
832 union {
833 struct { float x, y, z; };
834 float f[3];
835 };
836
837 Vector(const Vector&) noexcept = default;
838 Vector(Vector&&) noexcept = default;
839 Vector& operator=(const Vector&) noexcept = default;
840 Vector& operator=(Vector&&) noexcept = default;
841
842 Vector() noexcept : x(), y(), z() {}
843
844 template <typename T1, typename T2, typename T3>
845 Vector(T1 x, T2 y, T3 z) noexcept : x(float(x)), y(float(y)), z(float(z)) {}
846
847 template <typename T>
848 explicit Vector(T value) noexcept : x(float(value)), y(float(value)), z(float(value)) {}
849
850 std::string toString() const;
851
853 template <typename T1, typename T2, typename T3>
854 Vector& set(T1 x_, T2 y_, T3 z_) noexcept {
855 x = float(x_), y = float(y_), z = float(z_);
856 return *this;
857 }
858
860 Vector& makeZero(void) noexcept {
861 z = y = x = 0;
862 return *this;
863 }
864
866 Vector& operator +=(const Vector &other) noexcept {
867 x += other.x, y += other.y, z += other.z;
868 return *this;
869 }
870
872 Vector& operator -=(const Vector &other) noexcept {
873 x -= other.x, y -= other.y, z -= other.z;
874 return *this;
875 }
876
878 Vector& operator *=(int factor) noexcept {
879 x *= float(factor), y *= float(factor), z *= float(factor);
880 return *this;
881 }
882
884 Vector& operator *=(float factor) noexcept {
885 x *= factor, y *= factor, z *= factor;
886 return *this;
887 }
888
890 Vector& operator *=(double factor) noexcept {
891 x *= float(factor), y *= float(factor), z*=float(factor);
892 return *this;
893 }
894
896 Vector& operator /=(int divisor) noexcept {
897 x/=float(divisor); y/=float(divisor); z/=float(divisor);
898 return *this;
899 }
900
902 Vector& operator /=(float divisor) noexcept {
903 x/=divisor; y/=divisor; z/=divisor;
904 return *this;
905 }
906
908 Vector& operator /=(double divisor) noexcept {
909 x/=float(divisor); y/=float(divisor); z/=float(divisor);
910 return *this;
911 }
912
914 Vector operator -(void) const noexcept {
915 return Vector(-x, -y, -z);
916 }
917
919 float& operator [](const int index) noexcept {
920 return f[index];
921 }
922
924 const float& operator [](const int index) const noexcept {
925 return f[index];
926 }
927
929 float length(void) const noexcept {
930 return sqrtf(x*x + y*y + z*z);
931 }
932
934 float lengthSqr(void) const noexcept {
935 return x*x + y*y + z*z;
936 }
937
939 void rotate(const Vector &axis) noexcept;
940 };
941
944 inline Vector operator *(const Vector &a, int factor) noexcept {
945 Vector res(a);
946 res *= factor;
947 return res;
948 }
949
952 inline Vector operator *(const Vector &a, float factor) noexcept {
953 Vector res(a);
954 res *= factor;
955 return res;
956 }
957
960 inline Vector operator *(const Vector &a, double factor) noexcept {
961 Vector res(a);
962 res *= factor;
963 return res;
964 }
965
968 inline Vector operator *(int factor, const Vector &a) {
969 Vector res(a);
970 res *= factor;
971 return res;
972 }
973
976 inline Vector operator *(float factor, const Vector &a) noexcept {
977 Vector res(a);
978 res *= factor;
979 return res;
980 }
981
984 inline Vector operator *(double factor, const Vector &a) noexcept {
985 Vector res(a);
986 res *= factor;
987 return res;
988 }
989
992 inline Vector operator /(const Vector &a, int factor) noexcept {
993 Vector res(a);
994 res /= factor;
995 return res;
996 }
997
1000 inline Vector operator /(const Vector &a, float factor) noexcept {
1001 Vector res(a);
1002 res /= factor;
1003 return res;
1004 }
1005
1008 inline Vector operator /(const Vector &a, double factor) noexcept {
1009 Vector res(a);
1010 res /= factor;
1011 return res;
1012 }
1013
1016 inline double operator *(const Vector &a, const Vector &b) noexcept {
1017 return double(a.x)*double(b.x) + double(a.y)*double(b.y) + double(a.z)*double(b.z);
1018 }
1019
1022 inline Vector operator +(const Vector &a, const Vector &b) noexcept {
1023 Vector res(a);
1024 res += b;
1025 return res;
1026 }
1027
1030 inline Vector operator -(const Vector &a, const Vector &b) noexcept {
1031 Vector res(a);
1032 res -= b;
1033 return res;
1034 }
1035
1038 inline Vector operator /(const Vector &a, const Vector &b) noexcept {
1039 return Vector(a.x/b.x, a.y/b.y, a.z/b.z);
1040 }
1041
1044 inline Vector mul(const Vector &a, const Vector &b) noexcept {
1045 return Vector(a.x*b.x, a.y*b.y, a.z*b.z);
1046 }
1047
1050 inline bool operator !=(const Vector &a, const Vector &b) noexcept {
1051 return a.x != b.x || a.y != b.y || a.z != b.z;
1052 }
1053
1057 inline bool operator ==(const Vector &a, const Vector &b) noexcept {
1058 return a.x == b.x && a.y == b.y && a.z == b.z;
1059 }
1060
1063 inline Vector operator ^(const Vector &a, const Vector &b) noexcept {
1064 return Vector(
1065 double(a.y)*double(b.z) - double(b.y)*double(a.z),
1066 double(a.z)*double(b.x) - double(b.z)*double(a.x),
1067 double(a.x)*double(b.y) - double(b.x)*double(a.y)
1068 );
1069 }
1070
1073 inline double mixed(const Vector &a, const Vector &b, const Vector &c) noexcept {
1074 return
1075 (double(a.y)*double(b.z) - double(b.y)*double(a.z))*double(c.x)+
1076 (double(a.z)*double(b.x) - double(b.z)*double(a.x))*double(c.y)+
1077 (double(a.x)*double(b.y) - double(b.x)*double(a.y))*double(c.z);
1078 }
1079
1082 inline Vector normalize(const Vector &a) noexcept {
1083 return a/a.length();
1084 }
1085
1088 inline float length(const Vector &a) noexcept {
1089 return a.length();
1090 }
1091
1094 inline float lengthSqr(const Vector &a) noexcept {
1095 return a.lengthSqr();
1096 }
1097
1100 inline void Vector::rotate(const Vector &axis) noexcept {
1101 float oldLen = length();
1102
1103 Vector d = axis ^ (*this);
1104 d += (*this);
1105
1106 float newLen = d.length();
1107 if (newLen > 1e-6f)
1108 (*this) = d*oldLen/newLen;
1109 }
1110
1113 inline Vector rotate(const Vector &v, const Vector &axis) noexcept {
1114 Vector r(v);
1115 r.rotate(axis);
1116 return r;
1117 }
1118
1119 inline std::ostream& operator <<(std::ostream& stream, const Vector& vector) {
1120 stream << "Vector(" << vector.x << ", " << vector.y << ", " << vector.z << ")";
1121 return stream;
1122 }
1123
1124 inline std::string Vector::toString() const {
1125 std::ostringstream stream;
1126 stream << *this;
1127 return stream.str();
1128 }
1129
1130 struct Matrix;
1132 struct Color {
1133 union {
1134 struct { float r, g, b; };
1135 float rgb[3];
1136 };
1137
1138 Color(const Color&) noexcept = default;
1139 Color(Color&&) noexcept = default;
1140 Color& operator=(const Color&) noexcept = default;
1141 Color& operator=(Color&&) noexcept = default;
1142
1143 Color() noexcept : r(), g(), b() {}
1144
1145 template <typename T1, typename T2, typename T3>
1146 Color(T1 r, T2 g, T3 b) noexcept : r(float(r)), g(float(g)), b(float(b)) {}
1147
1148 template <typename T>
1149 explicit Color(const T& value) noexcept : r(float(value)), g(float(value)), b(float(value)) {}
1150
1153 CIE, sRGB, ACEScg
1154 };
1155
1157 static Color fromTemperature(float temperature, RGBColorSpace colorSpace = sRGB);
1158
1160 float getClosestTemperature(RGBColorSpace colorSpace = sRGB) const;
1161
1163 float getClosestTemperatureAndColor(Color& closestColor, RGBColorSpace colorSpace = sRGB) const;
1164
1170 static Matrix getRGBtoRGBmatrix(RGBColorSpace srcColorSpace, RGBColorSpace dstColorSpace);
1171
1173 float getIntensity() const noexcept {
1174 return (r + g + b) * (1.0f / 3.0f);
1175 }
1176
1178 float getLuminance() const noexcept {
1179 const float RED_LUMINANCE_COMPONENT = 0.3f;
1180 const float GREEN_LUMINANCE_COMPONENT = 0.59f;
1181 const float BLUE_LUMINANCE_COMPONENT = 0.11f;
1182 return RED_LUMINANCE_COMPONENT * r + GREEN_LUMINANCE_COMPONENT * g + BLUE_LUMINANCE_COMPONENT * b;
1183 }
1184
1186 float getLengthSquared() const noexcept {
1187 return r * r + g * g + b * b;
1188 }
1189
1191 float getLength() const noexcept {
1192 return sqrtf(r * r + g * g + b * b);
1193 }
1194
1196 float getPower() const {
1197 return r + g + b;
1198 }
1199
1202 void setSaturation(float k) noexcept {
1203 if (k == 1.0f) return;
1204 float grey = (r + g + b) / 3.0f;
1205 r = Internal::interpolate(k, grey, r);
1206 g = Internal::interpolate(k, grey, g);
1207 b = Internal::interpolate(k, grey, b);
1208 }
1209
1213 void setContrast(float k, float middle = 0.5f) noexcept {
1214 if (k == 1.0f) return;
1215 r = (r - middle) * k + middle;
1216 g = (g - middle) * k + middle;
1217 b = (b - middle) * k + middle;
1218 }
1219
1221 Color getWhiteComplement() const noexcept {
1222 return Color(std::fmaxf(0.0f, 1.0f - r), std::fmaxf(0.0f, 1.0f - g), std::fmaxf(0.0f, 1.0f - b));
1223 }
1224
1227 void makeWhiteComplement() noexcept {
1228 r = std::fmaxf(0.0f, 1.0f - r);
1229 g = std::fmaxf(0.0f, 1.0f - g);
1230 b = std::fmaxf(0.0f, 1.0f - b);
1231 }
1232
1233 std::string toString() const;
1234
1237 void operator +=(const Color &c) noexcept {
1238 r += c.r;
1239 g += c.g;
1240 b += c.b;
1241 }
1242
1245 void operator -=(const Color &c) noexcept {
1246 r -= c.r;
1247 g -= c.g;
1248 b -= c.b;
1249 }
1250
1253 void operator *=(const Color &c) noexcept {
1254 r *= c.r;
1255 g *= c.g;
1256 b *= c.b;
1257 }
1258
1261 void operator *=(int factor) noexcept {
1262 float f = static_cast<float>(factor);
1263 r *= f;
1264 g *= f;
1265 b *= f;
1266 }
1267
1270 void operator *=(float factor) noexcept {
1271 r *= factor;
1272 g *= factor;
1273 b *= factor;
1274 }
1275
1278 void operator *=(double factor) noexcept {
1279 float f = static_cast<float>(factor);
1280 r *= f;
1281 g *= f;
1282 b *= f;
1283 }
1284
1287 void operator /=(const Color &c) noexcept {
1288 r /= c.r;
1289 g /= c.g;
1290 b /= c.b;
1291 }
1292
1295 void operator /=(int factor) noexcept {
1296 float f = static_cast<float>(factor);
1297 r /= f;
1298 g /= f;
1299 b /= f;
1300 }
1301
1304 void operator /=(float factor) noexcept {
1305 r /= factor;
1306 g /= factor;
1307 b /= factor;
1308 }
1309
1312 void operator /=(double factor) noexcept {
1313 float f = static_cast<float>(factor);
1314 r /= f;
1315 g /= f;
1316 b /= f;
1317 }
1318
1320 float maxComponentValue() const noexcept {
1321 const float rg = r > g ? r : g;
1322 return rg > b ? rg : b;
1323 }
1324
1327 Color color2 = Color(r, g, b);
1328 color2.r = Internal::srgb_to_linear(color2.r);
1329 color2.g = Internal::srgb_to_linear(color2.g);
1330 color2.b = Internal::srgb_to_linear(color2.b);
1331 return color2;
1332 }
1333
1336 Color color2 = Color(r, g, b);
1337 color2.r = Internal::linear_to_srgb(color2.r);
1338 color2.g = Internal::linear_to_srgb(color2.g);
1339 color2.b = Internal::linear_to_srgb(color2.b);
1340 return color2;
1341 }
1342
1343 };
1344
1345 std::ostream& operator <<(std::ostream& stream, const Color& color);
1346
1348 inline Color operator +(const Color& a, const Color& b) noexcept {
1349 return Color(
1350 a.r + b.r,
1351 a.g + b.g,
1352 a.b + b.b
1353 );
1354 }
1355
1357 inline Color operator -(const Color& a, const Color& b) noexcept {
1358 return Color(
1359 a.r - b.r,
1360 a.g - b.g,
1361 a.b - b.b
1362 );
1363 }
1364
1366 inline Color operator *(const Color& a, const Color& b) noexcept {
1367 return Color(
1368 a.r * b.r,
1369 a.g * b.g,
1370 a.b * b.b
1371 );
1372 }
1373
1377 inline Color operator *(const Color& a, int factor) noexcept {
1378 float f = static_cast<float>(factor);
1379 return Color(a.r * f, a.g * f, a.b * f);
1380 }
1381
1385 inline Color operator *(const Color& a, float factor) noexcept {
1386 return Color(a.r * factor, a.g * factor, a.b * factor);
1387 }
1388
1392 inline Color operator *(const Color& a, double factor) noexcept {
1393 float f = static_cast<float>(factor);
1394 return Color(a.r * f, a.g * f, a.b * f);
1395 }
1396
1400 inline Color operator *(int factor, const Color& a) noexcept {
1401 return a * float(factor);
1402 }
1403
1407 inline Color operator *(float factor, const Color& a) noexcept {
1408 return a * factor;
1409 }
1410
1414 inline Color operator *(double factor, const Color& a) noexcept {
1415 return a * float(factor);
1416 }
1417
1419 inline Color operator /(const Color& a, const Color& b) noexcept {
1420 return Color(a.r / b.r, a.g / b.g, a.b / b.b);
1421 }
1422
1426 inline Color operator /(const Color& a, int factor) noexcept {
1427 float f = static_cast<float>(factor);
1428 return Color(a.r / f, a.g / f, a.b / f);
1429 }
1430
1434 inline Color operator /(const Color& a, float factor) noexcept {
1435 return Color(a.r / factor, a.g / factor, a.b / factor);
1436 }
1437
1441 inline Color operator /(const Color& a, double factor) noexcept {
1442 float f = static_cast<float>(factor);
1443 return Color(a.r / f, a.g / f, a.b / f);
1444 }
1445
1448 inline bool operator !=(const Color& a, const Color& b) noexcept {
1449 return a.r != b.r || a.g != b.g || a.b != b.b;
1450 }
1451
1455 inline bool operator ==(const Color& a, const Color& b) noexcept {
1456 return a.r == b.r && a.g == b.g && a.b == b.b;
1457 }
1458
1460 struct AColor {
1461 Color color;
1462 float alpha;
1463
1464 AColor(const AColor&) noexcept = default;
1465 AColor(AColor&&) noexcept = default;
1466 AColor& operator=(const AColor&) noexcept = default;
1467 AColor& operator=(AColor&&) noexcept = default;
1468
1469 AColor() noexcept : color(), alpha() {}
1470
1471 template <typename T>
1472 AColor(Color c, T a) noexcept : color(c), alpha(float(a)) {}
1473
1474 template <typename T1, typename T2, typename T3>
1475 AColor(T1 r, T2 g, T3 b) noexcept : color(r, g, b), alpha(1.0f) {}
1476
1477 template <typename T1, typename T2, typename T3, typename T4>
1478 AColor(T1 r, T2 g, T3 b, T4 a) noexcept : color(r, g, b), alpha(float(a)) {}
1479
1480 template <typename T>
1481 explicit AColor(const T& value) noexcept : color(value), alpha(1) {}
1482
1483 std::string toString() const ;
1484
1487 void operator +=(const AColor& c) noexcept {
1488 color += c.color;
1489 alpha += c.alpha;
1490 }
1491
1494 void operator -=(const AColor& c) noexcept {
1495 color -= c.color;
1496 alpha -= c.alpha;
1497 }
1498
1501 void operator *=(const AColor& c) noexcept {
1502 color *= c.color;
1503 alpha *= c.alpha;
1504 }
1505
1508 void operator *=(int factor) noexcept {
1509 color *= float(factor);
1510 alpha *= float(factor);
1511 }
1512
1515 void operator *=(float factor) noexcept {
1516 color *= factor;
1517 alpha *= factor;
1518 }
1519
1522 void operator *=(double factor) noexcept {
1523 color *= float(factor);
1524 alpha *= float(factor);
1525 }
1526
1529 void operator /=(const AColor& c) noexcept {
1530 color /= c.color;
1531 alpha /= c.alpha;
1532 }
1533
1536 void operator /=(int factor) noexcept {
1537 color /= float(factor);
1538 alpha /= float(factor);
1539 }
1540
1543 void operator /=(float factor) noexcept {
1544 color /= factor;
1545 alpha /= factor;
1546 }
1547
1550 void operator /=(double factor) noexcept {
1551 color /= float(factor);
1552 alpha /= float(factor);
1553 }
1554
1556 float getLength() const noexcept {
1557 return sqrtf(color.getLengthSquared() + alpha * alpha);
1558 }
1559
1561 float getLengthSquared() const noexcept {
1562 return color.getLengthSquared() + alpha * alpha;
1563 }
1564
1566 AColor getWhiteComplement() const noexcept {
1567 return AColor(color.getWhiteComplement(), std::fmaxf(0.0f, 1.0f - alpha));
1568 }
1569
1572 void makeWhiteComplement() noexcept {
1573 color.makeWhiteComplement();
1574 alpha = std::fmaxf(0.0f, 1.0f - alpha);
1575 }
1576
1578 float maxComponentValue() const noexcept {
1579 return color.maxComponentValue();
1580 }
1581
1583 AColor fromSRGB() const noexcept {
1584 return AColor(
1585 Internal::srgb_to_linear(color.r),
1586 Internal::srgb_to_linear(color.g),
1587 Internal::srgb_to_linear(color.b),
1588 alpha
1589 );
1590 }
1591
1593 AColor toSRGB() const noexcept {
1594 return AColor(
1595 Internal::linear_to_srgb(color.r),
1596 Internal::linear_to_srgb(color.g),
1597 Internal::linear_to_srgb(color.b),
1598 alpha
1599 );
1600 }
1601
1602 };
1603
1604 inline std::ostream& operator <<(std::ostream& stream, const AColor& acolor) {
1605 stream << "AColor(" << acolor.color.r << ", " << acolor.color.g << ", " << acolor.color.b << ", " << acolor.alpha << ")";
1606 return stream;
1607 }
1608
1609 inline std::string AColor::toString() const {
1610 std::ostringstream stream;
1611 stream << *this;
1612 return stream.str();
1613 }
1614
1616 inline AColor operator +(const AColor& a, const AColor& b) noexcept {
1617 return AColor(
1618 a.color + b.color,
1619 a.alpha + b.alpha
1620 );
1621 }
1622
1624 inline AColor operator -(const AColor& a, const AColor& b) noexcept {
1625 return AColor(
1626 a.color - b.color,
1627 a.alpha - b.alpha
1628 );
1629 }
1630
1632 inline AColor operator *(const AColor& a, const AColor& b) noexcept {
1633 return AColor(
1634 a.color * b.color,
1635 a.alpha * b.alpha
1636 );
1637 }
1638
1642 inline AColor operator *(const AColor& a, int factor) noexcept {
1643 return AColor(
1644 a.color * float(factor),
1645 a.alpha * float(factor)
1646 );
1647 }
1648
1652 inline AColor operator *(const AColor& a, float factor) noexcept {
1653 return AColor(
1654 a.color * factor,
1655 a.alpha * factor
1656 );
1657 }
1658
1662 inline AColor operator *(const AColor& a, double factor) noexcept {
1663 return AColor(
1664 a.color * float(factor),
1665 a.alpha * float(factor)
1666 );
1667 }
1668
1672 inline AColor operator *(int factor, const AColor& a) noexcept {
1673 return a * float(factor);
1674 }
1675
1679 inline AColor operator *(float factor, const AColor& a) noexcept {
1680 return a * factor;
1681 }
1682
1686 inline AColor operator *(double factor, const AColor& a) noexcept {
1687 return a * float(factor);
1688 }
1689
1691 inline AColor operator /(const AColor& a, const AColor& b) noexcept {
1692 return AColor(
1693 a.color / b.color,
1694 a.alpha / b.alpha
1695 );
1696 }
1697
1701 inline AColor operator /(const AColor& a, int factor) noexcept {
1702 return AColor(
1703 a.color / float(factor),
1704 a.alpha / float(factor)
1705 );
1706 }
1707
1711 inline AColor operator /(const AColor& a, float factor) noexcept {
1712 return AColor(
1713 a.color / factor,
1714 a.alpha / factor
1715 );
1716 }
1717
1721 inline AColor operator /(const AColor& a, double factor) noexcept {
1722 return AColor(
1723 a.color / float(factor),
1724 a.alpha / float(factor)
1725 );
1726 }
1727
1730 inline bool operator !=(const AColor& a, const AColor& b) noexcept {
1731 return a.color != b.color || a.alpha != b.alpha;
1732 }
1733
1737 inline bool operator ==(const AColor& a, const AColor& b) noexcept {
1738 return a.color == b.color && a.alpha == b.alpha;
1739 }
1740
1742 struct Matrix {
1743 Vector v0, v1, v2;
1744
1745 std::string toString() const;
1746
1748 Vector& operator [](const int index) noexcept {
1749 return (&v0)[index];
1750 }
1751
1753 const Vector& operator [](const int index) const noexcept {
1754 return (&v0)[index];
1755 }
1756
1758 Matrix() noexcept = default;
1759
1760 Matrix(const Matrix&) noexcept = default;
1761 Matrix(Matrix&&) noexcept = default;
1762 Matrix& operator=(const Matrix&) noexcept = default;
1763 Matrix& operator=(Matrix&&) noexcept = default;
1764
1766 explicit Matrix(float value) noexcept : v0(value, 0, 0), v1(0 ,value, 0), v2(0, 0, value) {}
1767
1769 explicit Matrix(Vector diagonal) noexcept : v0(diagonal.x, 0, 0), v1(0, diagonal.y, 0), v2(0, 0, diagonal.z) {}
1770
1775 Matrix(const Vector &a, const Vector &b, const Vector &c) noexcept : v0(a), v1(b), v2(c) {}
1776
1779 //Matrix(const Matrix& other) noexcept : v0(other.v0), v1(other.v1), v2(other.v2) {}
1780
1785 void set(const Vector &a, const Vector &b, const Vector &c) noexcept {
1786 v0 = a, v1 = b, v2 = c;
1787 }
1788
1790 void set(float value) noexcept {
1791 v0.set(value, 0, 0);
1792 v1.set(0, value, 0);
1793 v2.set(0, 0, value);
1794 }
1795
1798 void set(const Matrix& other) noexcept {
1799 v0 = other.v0;
1800 v1 = other.v1;
1801 v2 = other.v2;
1802 }
1803
1807 void setCol(const int i, const Vector &a) noexcept {
1808 (*this)[i] = a;
1809 }
1810
1814 void setRow(const int i, const Vector &a) noexcept {
1815 (*this)[0][i] = a.x, (*this)[1][i] = a.y, (*this)[2][i]=a.z;
1816 }
1817
1819 void makeZero(void) noexcept {
1820 v0.makeZero();
1821 v1.makeZero();
1822 v2.makeZero();
1823 }
1824
1826 void makeIdentity(void) noexcept {
1827 v0.set(1.0f, 0.0f, 0.0f);
1828 v1.set(0.0f, 1.0f, 0.0f);
1829 v2.set(0.0f, 0.0f, 1.0f);
1830 }
1831
1834 void makeDiagonal(const Vector &a) noexcept {
1835 v0.set(a.x, 0.0f, 0.0f);
1836 v1.set(0.0f, a.y, 0.0f);
1837 v2.set(0.0f, 0.0f, a.z);
1838 }
1839
1840 void makeOuterProduct(const Vector &a, const Vector &b) noexcept {
1841 v0 = a.x*b;
1842 v1 = a.y*b;
1843 v2 = a.z*b;
1844 }
1845
1847 void makeTranspose(void) noexcept {
1848 float t;
1849 t = v0[1], v0[1] = v1[0], v1[0] = t;
1850 t = v0[2], v0[2] = v2[0], v2[0] = t;
1851 t = v1[2], v1[2] = v2[1], v2[1] = t;
1852 }
1853
1857 bool makeInverse(void) noexcept {
1858 Matrix r;
1859 double d = mixed(v0, v1, v2);
1860 bool ret = true;
1861 if (d) {
1862 r.setRow(0, (v1^v2)/d);
1863 r.setRow(1, (v2^v0)/d);
1864 r.setRow(2, (v0^v1)/d);
1865 } else {
1866 r.makeZero();
1867 ret = false;
1868 }
1869 *this = r;
1870 return ret;
1871 }
1872
1873 void addDiagonal(const Vector &a) noexcept {
1874 v0[0] += a[0];
1875 v1[1] += a[1];
1876 v2[2] += a[2];
1877 }
1878
1879 void addTranspose(const Matrix &b) noexcept {
1880 v0[0] += b.v0[0];
1881 v0[1] += b.v1[0];
1882 v0[2] += b.v2[0];
1883
1884 v1[0] += b.v0[1];
1885 v1[1] += b.v1[1];
1886 v1[2] += b.v2[1];
1887
1888 v2[0] += b.v0[2];
1889 v2[1] += b.v1[2];
1890 v2[2] += b.v2[2];
1891 }
1892
1894 void operator *=(float x) noexcept {
1895 v0 *= x, v1 *= x, v2 *= x;
1896 }
1897
1899 void operator /=(float x) noexcept {
1900 v0 /= x, v1 /= x, v2 /= x;
1901 }
1902
1905 void operator +=(const Matrix &m) noexcept {
1906 v0 += m.v0;
1907 v1 += m.v1;
1908 v2 += m.v2;
1909 }
1910
1913 void operator -=(const Matrix &m) noexcept {
1914 v0-=m.v0;
1915 v1-=m.v1;
1916 v2-=m.v2;
1917 }
1918
1920 void rotate(const Vector &axis) noexcept {
1921 v0.rotate(axis);
1922 v1.rotate(axis);
1923 v2.rotate(axis);
1924 }
1925
1926 void makeOrthogonal(void) noexcept {
1927 Matrix t;
1928 t.v0 = normalize(v0);
1929 t.v1 = normalize(v2 ^ v0);
1930 t.v2 = t.v0 ^ t.v1;
1931 v0 = length(v0) * t.v0;
1932 v1 = length(v1) * t.v1;
1933 v2 = length(v2) * t.v2;
1934 }
1935
1936 void makeOrthonormal(void) noexcept {
1937 v0 = normalize(v0);
1938 v1 = normalize(v2 ^ v0);
1939 v2 = normalize(v0 ^ v1);
1940 }
1941 };
1942
1945 inline Matrix inverse(const Matrix &m) noexcept {
1946 Matrix r;
1947 double d = m.v0*(m.v1^m.v2);
1948 r.setRow(0, (m.v1^m.v2)/d);
1949 r.setRow(1, (m.v2^m.v0)/d);
1950 r.setRow(2, (m.v0^m.v1)/d);
1951 return r;
1952 }
1953
1956 inline Vector operator *(const Vector &a, const Matrix &m) noexcept {
1957 return Vector(a*m.v0, a*m.v1, a*m.v2);
1958 }
1959
1962 inline Vector operator *(const Matrix &m, const Vector &a) noexcept {
1963 return a.x*m.v0 + a.y*m.v1 + a.z*m.v2;
1964 }
1965
1968 inline Matrix operator ^(const Matrix &m, const Vector &a) noexcept {
1969 return Matrix(m.v0^a, m.v1^a, m.v2^a);
1970 }
1971
1974 inline Matrix operator ^(const Vector &a, const Matrix &m) noexcept {
1975 return Matrix(a^m.v0, a^m.v1, a^m.v2);
1976 }
1977
1980 inline Matrix operator *(const Matrix &m, float x) noexcept {
1981 return Matrix(m.v0*x, m.v1*x, m.v2*x);
1982 }
1983
1986 inline Matrix operator *(float x, const Matrix &m) noexcept {
1987 return Matrix(x*m.v0, x*m.v1, x*m.v2);
1988 }
1989
1992 inline Matrix operator /(const Matrix &m, float x) noexcept {
1993 return Matrix(m.v0/x, m.v1/x, m.v2/x);
1994 }
1995
1998 inline float operator /(float x, const Matrix &m) noexcept {
1999 return x / float(m.v0*(m.v1^m.v2));
2000 }
2001
2004 inline Matrix operator +(const Matrix &a, const Matrix &b) noexcept {
2005 return Matrix(a.v0 + b.v0, a.v1 + b.v1, a.v2 + b.v2);
2006 }
2007
2010 inline Matrix operator -(const Matrix &a, const Matrix &b) noexcept {
2011 return Matrix(a.v0 - b.v0, a.v1 - b.v1, a.v2 - b.v2);
2012 }
2013
2016 inline Matrix operator *(const Matrix &a, const Matrix &b) noexcept {
2017 Matrix r(
2018 Vector(
2019 a.v0[0]*b.v0[0]+a.v1[0]*b.v0[1]+a.v2[0]*b.v0[2],
2020 a.v0[1]*b.v0[0]+a.v1[1]*b.v0[1]+a.v2[1]*b.v0[2],
2021 a.v0[2]*b.v0[0]+a.v1[2]*b.v0[1]+a.v2[2]*b.v0[2]),
2022 Vector(
2023 a.v0[0]*b.v1[0]+a.v1[0]*b.v1[1]+a.v2[0]*b.v1[2],
2024 a.v0[1]*b.v1[0]+a.v1[1]*b.v1[1]+a.v2[1]*b.v1[2],
2025 a.v0[2]*b.v1[0]+a.v1[2]*b.v1[1]+a.v2[2]*b.v1[2]),
2026 Vector(
2027 a.v0[0]*b.v2[0]+a.v1[0]*b.v2[1]+a.v2[0]*b.v2[2],
2028 a.v0[1]*b.v2[0]+a.v1[1]*b.v2[1]+a.v2[1]*b.v2[2],
2029 a.v0[2]*b.v2[0]+a.v1[2]*b.v2[1]+a.v2[2]*b.v2[2])
2030 );
2031 return r;
2032 }
2033
2036 inline bool operator !=(const Matrix &a, const Matrix &b) noexcept {
2037 return a.v0 != b.v0 || a.v1 != b.v1 || a.v2 != b.v2;
2038 }
2039
2043 inline bool operator ==(const Matrix &a, const Matrix &b) noexcept {
2044 return a.v0 == b.v0 && a.v1 == b.v1 && a.v2 == b.v2;
2045 }
2046
2049 inline Matrix operator -(const Matrix &a) noexcept {
2050 return Matrix(-a.v0, -a.v1, -a.v2);
2051 }
2052
2053 inline Matrix outerProductMatrix(const Vector &a, const Vector &b) noexcept {
2054 return Matrix(a.x*b, a.y*b, a.z*b);
2055 }
2056
2058 inline Matrix transpose(const Matrix &m) noexcept {
2059 return Matrix(
2060 Vector(m.v0[0], m.v1[0], m.v2[0]),
2061 Vector(m.v0[1], m.v1[1], m.v2[1]),
2062 Vector(m.v0[2], m.v1[2], m.v2[2]));
2063 }
2064
2067 inline Matrix rotate(const Matrix &m, const Vector &axis) noexcept {
2068 return Matrix(rotate(m.v0, axis), rotate(m.v1, axis), rotate(m.v2, axis));
2069 }
2070
2073 inline Matrix normalize(const Matrix &m) noexcept {
2074 Vector v0 = normalize(m.v0);
2075 Vector v1 = normalize(m.v2^m.v0);
2076 return Matrix(v0, v1, v0^v1);
2077 }
2078
2081 inline Matrix noScale(const Matrix &m) noexcept {
2082 return Matrix(normalize(m.v0), normalize(m.v1), normalize(m.v2));
2083 }
2084
2087 inline Vector scale(const Matrix &m) noexcept {
2088 return Vector(m[0].length(), m[1].length(), m[2].length());
2089 }
2090
2093 inline Vector rotationAngles(const Matrix& m) noexcept {
2094 const Matrix mns = noScale(m);
2095
2096 /*the 3x3 matrix, starting from identity and given random rotational angles, x,y and z looks like this:
2097 | cy*cz -cy*sz sy |
2098 | sx*sy*cz + cx*cz -sx*sy*sz + cx*cz -sx*cy |
2099 | -cx*sy*cz + sx*sz cx*sy*sz + sx*cz cx*cy |
2100
2101 where the alignment are in V-Ray terms. The Euler angles, with a bit of simplification:
2102 x = atan(-(-sx*cy)/cx*cy) = atan(-a21/a22)
2103 y = asin(sy) = asin(a20)
2104 z = atan(-(-cy*sz)/cy*cz) = atan(-a10/a00)
2105 */
2106
2107 //atan2 will only raise an error if both arguments are 0, which should never happen
2108 //equivalent to a scale of zero
2109 return Vector(
2110 atan2(-mns[2][1], mns[2][2]),
2111 asin(mns[2][0]),
2112 atan2(-mns[1][0], mns[0][0])
2113 );
2114 }
2115
2119 inline Matrix makeRotationMatrixX(float xrot) noexcept {
2120 const float s = sin(xrot);
2121 const float c = cos(xrot);
2122 return Matrix(Vector(1.0f, 0.0f, 0.0f), Vector(0, c, s), Vector(0, -s, c));
2123 }
2124
2128 inline Matrix makeRotationMatrixY(float yrot) noexcept {
2129 const float s = sin(yrot);
2130 const float c = cos(yrot);
2131 return Matrix(Vector(c, 0, -s), Vector(0.0f, 1.0f, 0.0f), Vector(s, 0, c));
2132 }
2133
2137 inline Matrix makeRotationMatrixZ(float zrot) noexcept {
2138 const float s = sin(zrot);
2139 const float c = cos(zrot);
2140 return Matrix(Vector(c, s, 0), Vector(-s, c, 0), Vector(0.0f, 0.0f, 1.0f));
2141 }
2142
2144 inline Matrix normalTransformMatrix(const Matrix &m) noexcept {
2145 return Matrix(m[1]^m[2], m[2]^m[0], m[0]^m[1]);
2146 }
2147
2149 inline Matrix normalTransformMatrixX(const Matrix &m, bool &DlessThanZero ) noexcept {
2150 if((m[0]^m[1])*m[2] < 0){
2151 DlessThanZero = true;
2152 return Matrix(m[2]^m[1], m[0]^m[2], m[1]^m[0]);
2153 }
2154 DlessThanZero = false;
2155 return Matrix(m[1]^m[2], m[2]^m[0], m[0]^m[1]);
2156 }
2157
2158 inline std::ostream& operator <<(std::ostream& stream, const Matrix& matrix) {
2159 stream << "Matrix(" << matrix.v0 << ", " << matrix.v1 << ", " << matrix.v2 << ")";
2160 return stream;
2161 }
2162
2163 inline std::string Matrix::toString() const {
2164 std::ostringstream stream;
2165 stream << *this;
2166 return stream.str();
2167 }
2168
2170 struct Transform {
2171 Matrix matrix;
2172 Vector offset;
2173
2175 Transform() noexcept = default;
2176
2177 Transform(const Transform&) noexcept = default;
2178 Transform(Transform&&) noexcept = default;
2179 Transform& operator=(const Transform&) noexcept = default;
2180 Transform& operator=(Transform&&) noexcept = default;
2181
2185 Transform(const Matrix& matrix, const Vector& offset) noexcept : matrix(matrix), offset(offset) {}
2186
2190 Transform(int i) noexcept {
2191 if (i == 1) makeIdentity();
2192 if (i == 0) makeZero();
2193 }
2194
2196 void makeZero(void) noexcept {
2197 matrix.makeZero();
2198 offset.makeZero();
2199 }
2200
2202 void makeIdentity(void) noexcept {
2203 matrix.makeIdentity();
2204 offset.makeZero();
2205 }
2206
2208 void operator *=(float x) noexcept {
2209 matrix *= x;
2210 offset *= x;
2211 }
2212
2214 void operator +=(const Transform &tm) noexcept {
2215 matrix += tm.matrix;
2216 offset += tm.offset;
2217 }
2218
2220 void operator -=(const Transform &tm) noexcept {
2221 matrix -= tm.matrix;
2222 offset -= tm.offset;
2223 }
2224
2227 Vector transformVec(const Vector &a) const noexcept {
2228 return matrix * a;
2229 }
2230
2232 void makeInverse(void) noexcept {
2233 matrix.makeInverse();
2234 offset = -matrix * offset;
2235 }
2236
2237 std::string toString() const;
2238 };
2239
2242 inline bool operator !=(const Transform &a, const Transform &b) noexcept {
2243 return a.matrix != b.matrix || a.offset != b.offset;
2244 }
2245
2249 inline bool operator ==(const Transform &a, const Transform &b) noexcept {
2250 return a.matrix == b.matrix && a.offset == b.offset;
2251 }
2252
2255 inline Transform operator -(const Transform &tm) noexcept {
2256 return Transform(-tm.matrix, -tm.offset);
2257 }
2258
2261 inline Transform operator *(const Transform &tm, float x) noexcept {
2262 return Transform(tm.matrix * x, tm.offset * x);
2263 }
2264
2267 inline Transform operator *(float x, const Transform &tm) noexcept {
2268 return Transform(x * tm.matrix, x * tm.offset);
2269 }
2270
2273 inline Transform operator /(const Transform &tm, float x) noexcept {
2274 return Transform(tm.matrix / x, tm.offset / x);
2275 }
2276
2279 inline Transform operator +(const Transform &a, const Transform &b) noexcept {
2280 return Transform(a.matrix + b.matrix, a.offset + b.offset);
2281 }
2282
2285 inline Transform operator -(const Transform &a, const Transform &b) noexcept {
2286 return Transform(a.matrix - b.matrix, a.offset - b.offset);
2287 }
2288
2291 inline Transform operator *(const Transform &a, const Transform &b) noexcept {
2292 return Transform(a.matrix * b.matrix, a.matrix * b.offset + a.offset);
2293 }
2294
2297 inline Vector operator *(const Transform &tm, const Vector &a) noexcept {
2298 return tm.matrix * a + tm.offset;
2299 }
2300
2303 inline Vector inverseTransform(const Vector &a, const Transform &tm) noexcept {
2304 return (a - tm.offset) * tm.matrix;
2305 }
2306
2307 inline std::ostream& operator <<(std::ostream& stream, const Transform& transform) {
2308 stream << "Transform(" << transform.matrix << ", " << transform.offset << ")";
2309 return stream;
2310 }
2311
2312 inline std::string Transform::toString() const {
2313 std::ostringstream stream;
2314 stream << *this;
2315 return stream.str();
2316 }
2317
2320 std::vector<Transform> transforms;
2321 std::vector<int> keyFrames;
2322
2323 AnimatedTransform() noexcept = default;
2324 AnimatedTransform(const AnimatedTransform&) = default;
2325 AnimatedTransform(AnimatedTransform&&) noexcept = default;
2326 AnimatedTransform& operator=(const AnimatedTransform&) = default;
2327 AnimatedTransform& operator=(AnimatedTransform&&) noexcept = default;
2328
2329 AnimatedTransform(const std::vector<Transform>& transforms, const std::vector<int>& keyFrames) noexcept
2331 AnimatedTransform(std::vector<Transform>&& transforms, std::vector<int>&& keyFrames) noexcept
2332 : transforms(std::move(transforms)), keyFrames(std::move(keyFrames)) {}
2333 };
2334
2335 typedef int RGB32;
2336
2337 struct RendererOptions;
2338 class PluginMeta;
2339 class PropertyMeta;
2340 class PropertyRuntimeMeta;
2341 class UIGuides;
2342 struct Box;
2343 struct RenderSizeParams;
2344
2345 namespace Internal {
2346 const float DEFAULT_FPS = 24.0f;
2347 const float DEFAULT_POINT_SIZE = 2.2f;
2348 const long long READ_DATA_STRUCT_VERSION = 5; // added numFrames / hasVelocityChannel / hairVelocities / particleVelocities
2349 const long long READ_PARAMS_STRUCT_VERSION = 2; // updated struct layout
2350 const long long CREATE_PARAMS_STRUCT_VERSION = 7; // added bakeTransforms
2351 const long long GEOM_MESH_DATA_STRUCT_VERSION = 2; // added hair / particles
2352 const long long ENABLE_DRCLIENT_PARAMS_STRUCT_VERSION = 0; // initial version
2353 const long long LIVE_LINK_CLIENT_PARAMS_STRUCT_VERSION = 0; // initial version
2354 const long long SCATTER_READ_PARAMS_STRUCT_VERSION = 0; // initial version
2355 class VRayRendererNative;
2356 class BinaryValueParser;
2357 class BinaryValueBuilder;
2358 struct MeshFileDataParser;
2359 }
2360
2367
2369 : doColorCorrect(false)
2370 , stripAlpha(false)
2371 , flipImage(false)
2372 {}
2373 };
2374
2377 friend class RenderElements;
2378
2379 public:
2381 enum Type {
2382 NONE = -1,
2383
2397
2403
2406
2409
2413
2416
2419
2422
2424
2426
2428
2430
2434
2437
2440
2446
2449
2454
2456
2459
2470
2472
2473 USER=1000,
2474
2475 COVERAGE = USER + 5001,
2477 MULTIMATTE = USER + 5004,
2480 EXTRA_TEX = USER + 5007,
2483 };
2484
2493 };
2494
2497 PF_DEFAULT = -1,
2503
2508
2513 };
2514
2516 struct Info {
2517 const char *name;
2520 };
2521
2522 private:
2523 const VRayRenderer* renderer;
2524 InstanceId pluginID;
2525 std::string name;
2526 Type type;
2527 BinaryFormat binaryFormat;
2528 PixelFormat defaultPixelFormat;
2529
2530 RenderElement(const VRayRenderer* renderer, Type type, const Plugin &plugin);
2531 static PixelFormat binaryFormatToPixelFormat(BinaryFormat binFormat);
2532
2533 size_t getData_internal(int layer, InstanceId alphaPluginID, void** data, PixelFormat format = PF_DEFAULT, bool rgbOrder = false, const ImageRegion* rgn = NULL) const;
2534
2535 public:
2537 RenderElement() : renderer(NULL), pluginID(NO_ID), type(NONE), binaryFormat(BF_FLOAT), defaultPixelFormat(PF_DEFAULT) {}
2538
2541
2543 std::string getName() const {
2544 return name;
2545 }
2546
2548 Type getType() const {
2549 return type;
2550 }
2551
2554 return binaryFormat;
2555 }
2556
2559 return defaultPixelFormat;
2560 }
2561
2565 : alphaChannelPlugin(NULL)
2566 , useDefaultAlpha(false)
2567 , format(PF_DEFAULT)
2568 , rgbOrder(false)
2569 , region(nullptr)
2570 , layerIndex(0)
2571 {}
2572
2579 bool flipImage = false; //<! Flip image top-bottom.
2580 };
2581
2587 size_t getData(void** data, const GetDataOptions &options) const;
2588
2594 size_t getDataIntoBuffer(const GetDataOptions &options, void* data) const;
2595
2597 static void releaseData(void* data);
2598
2604 VRayImage* getImage(const ImageRegion* rgn = NULL, int layerIndex = 0) const;
2605
2611 VRayImage* getImage(const GetImageOptions &options, int layerIndex = 0) const;
2612
2614 std::string getMetadata() const;
2615
2620 operator bool () const {
2621 return pluginID != NO_ID;
2622 }
2623 };
2624
2627 friend class VRayRenderer;
2628
2629 VRayRenderer& renderer;
2630
2631 RenderElements(VRayRenderer& renderer);
2632 RenderElements& operator=(const RenderElements&);
2633
2634 public:
2639 RenderElement add(RenderElement::Type type, const char* displayName, const char* instanceName);
2640
2644
2647 std::vector<RenderElement> getAll(RenderElement::Type type) const;
2648 };
2649
2653 std::string pluginType;
2655 std::string fileNameSuffix;
2656 };
2657
2660 int start, end, step;
2661 };
2662
2665 long long deviceHandle;
2666 long long platform;
2667
2668 std::string name;
2669
2671 struct {
2675 };
2676
2678 enum Type {
2680 deviceType_CPU = (1 << 1),
2681 deviceType_GPU = (1 << 2),
2682 deviceType_ACCEL = (1 << 3),
2683 };
2684
2693
2695 int busId;
2699
2701 };
2702
2706 std::vector<ComputeDeviceInfo> getComputeDevicesMetal();
2707
2711 std::vector<ComputeDeviceInfo> getComputeDevicesOptix();
2712
2719 std::vector<ComputeDeviceInfo> getComputeDevicesCUDA();
2720
2724 std::vector<ComputeDeviceInfo> getComputeDevicesDenoiser();
2725
2729 bool setComputeDevicesMetal(const std::vector<int>& indices);
2730
2734 bool setComputeDevicesOptix(const std::vector<int>& indices);
2735
2739 bool setComputeDevicesCUDA(const std::vector<int>& indices);
2740
2744 bool setComputeDevicesDenoiser(const std::vector<int>& indices);
2745
2749 bool setComputeDevicesEnvironmentVariable();
2750
2754 unsigned elapsedTicks;
2758 float currentProgress;
2759
2761 std::string name;
2763 float freeMem;
2764 float totalMem;
2765 };
2766
2767 std::vector<ComputeDeviceStatistics> computeDevices;
2768
2770 const char* name;
2771 unsigned long long usage;
2772 };
2773
2774 std::vector<ComputeDeviceMemoryType> computeDevicesMemUsage;
2775 };
2776
2777 typedef std::vector<int> IntList;
2778 typedef std::vector<float> FloatList;
2779 typedef std::vector<Color> ColorList;
2780 typedef std::vector<Vector> VectorList;
2781 typedef std::vector<Value> ValueList;
2782 typedef std::vector<std::string> StringList;
2783
2785 struct ObjectInfo {
2786 std::string name;
2787 int id;
2789 int vEnd;
2790 };
2791
2793 struct VoxelInfo {
2797 };
2798
2800 struct Box {
2803
2806 void expand(const Vector& point) {
2807 pmin = Vector(
2808 VRAY_MINIMUM2(pmin.x, point.x),
2809 VRAY_MINIMUM2(pmin.y, point.y),
2810 VRAY_MINIMUM2(pmin.z, point.z)
2811 );
2812 pmax = Vector(
2813 VRAY_MAXIMUM2(pmax.x, point.x),
2814 VRAY_MAXIMUM2(pmax.y, point.y),
2815 VRAY_MAXIMUM2(pmax.z, point.z)
2816 );
2817 }
2818
2821 void expand(const Box& box) {
2822 pmin = Vector(
2823 VRAY_MINIMUM2(pmin.x, box.pmin.x),
2824 VRAY_MINIMUM2(pmin.y, box.pmin.y),
2825 VRAY_MINIMUM2(pmin.z, box.pmin.z)
2826 );
2827 pmax = Vector(
2828 VRAY_MAXIMUM2(pmax.x, box.pmax.x),
2829 VRAY_MAXIMUM2(pmax.y, box.pmax.y),
2830 VRAY_MAXIMUM2(pmax.z, box.pmax.z)
2831 );
2832 }
2833
2834 std::string toString() const;
2835 };
2836
2837 inline std::ostream& operator <<(std::ostream& stream, const Box& box) {
2838 stream << "Box(min: " << box.pmin << ", max: " << box.pmax << ")";
2839 return stream;
2840 }
2841
2842 inline std::string Box::toString() const {
2843 std::ostringstream stream;
2844 stream << *this;
2845 return stream.str();
2846 }
2847
2852 friend class GeomUtils;
2853 public:
2855 GaussianReadData(GaussianReadData&& rhs) noexcept;
2856 GaussianReadData& operator=(GaussianReadData&& rhs) noexcept;
2858
2861
2863 Vector getPosition(unsigned index) const;
2864
2866 Color getAverageColor(unsigned index) const;
2867
2869 const Box& getPreviewBoundingBox() const { return previewBBox; }
2870
2871 private:
2872 GaussianReadData(const GaussianReadData&) = delete;
2873 GaussianReadData& operator=(const GaussianReadData&) = delete;
2874
2876 void* handle;
2878 Box previewBBox;
2879 };
2880
2885 public:
2886 enum ReadFlags {
2887 MESH_VERTICES = (1 << 4),
2888 MESH_NORMALS = (1 << 5),
2889 MESH_MTLIDS = (1 << 6),
2890 MESH_VELOCITIES = (1 << 7),
2891 MESH_UVS = (1 << 8),
2892 MESH_SHADERS = (1 << 9),
2893 MESH_OBJECTINFOS = (1 << 10),
2894 MESH_HAIROBJECTINFOS = (1 << 11),
2895 MESH_PARTICLEOBJECTINFOS = (1 << 12),
2896 MESH_HAIRGEOMETRY = (1 << 13),
2897 MESH_PARTICLESGEOMETRY = (1 << 14),
2898 MESH_GEOMETRYMESHESBBOXES = (1 << 15),
2899 MESH_HAIROBJECTBBOXES = (1 << 16),
2900 MESH_PARTICLEOBJECTBBOXES = (1 << 17),
2901 MESH_ALL = MESH_VERTICES | MESH_NORMALS | MESH_VELOCITIES | MESH_MTLIDS | MESH_UVS | MESH_SHADERS |
2902 MESH_OBJECTINFOS | MESH_HAIROBJECTINFOS | MESH_PARTICLEOBJECTINFOS | MESH_HAIRGEOMETRY | MESH_PARTICLESGEOMETRY |
2903 MESH_GEOMETRYMESHESBBOXES | MESH_HAIROBJECTBBOXES | MESH_PARTICLEOBJECTBBOXES,
2904 };
2905
2907 ProxyReadData(int flags=MESH_ALL);
2908
2910 void setFlags(int flags) { d.flags = flags; }
2911
2913 const std::vector<Vector> &getVertices() const { return vertices; }
2914
2916 const std::vector<int> &getVertexIndices() const { return indices; }
2917
2919 const std::vector<Vector> &getNormals() const { return normals; }
2920
2922 const std::vector<int> &getNormalIndices() const { return normalIndices; }
2923
2925 const std::vector<int> &getMaterialIDs() const { return materialIDs; }
2926
2928 const std::vector<int> &getEdgeVisibility() const { return edgeVisibility; }
2929
2931 const std::vector<Vector> &getVelocities() const { return velocities; }
2932
2934 int getUVSetsCount() const;
2935
2937 std::vector<int> getUVOriginalIndices() const;
2938
2940 std::string getUVSetName(int setIndex) const;
2941
2943 size_t getUVValuesCount(int setIndex) const;
2944
2946 size_t getUVValueIndicesCount(int setIndex) const;
2947
2949 const Vector * getUVValues(int setIndex) const;
2950
2952 const int * getUVValueIndices(int setIndex) const;
2953
2955 int getShadersCount() const;
2956
2958 std::string getShaderName(int shaderIndex) const;
2959
2961 int getShaderID(int shaderIndex) const;
2962
2965
2967 ObjectInfo getMeshObjectInfo(int meshIndex) const;
2968
2971
2973 ObjectInfo getHairObjectInfo(int meshIndex) const;
2974
2977
2979 ObjectInfo getParticleObjectInfo(int meshIndex) const;
2980
2982 VoxelInfo getMeshVoxelInfo(int meshIndex) const;
2983
2985 VoxelInfo getHairVoxelInfo(int meshIndex) const;
2986
2988 VoxelInfo getParticleVoxelInfo(int meshIndex) const;
2989
2991 const std::vector<Vector> &getHairVertices() const { return hairVertices; }
2992
2994 const std::vector<int> &getHairVerticesPerStrand() const { return hairVerticesPerStrand; }
2995
2997 const std::vector<float> &getHairWidths() const { return hairWidths; }
2998
3000 const std::vector<Vector> &getParticleVertices() const { return particleVertices; }
3001
3003 const std::vector<float> &getParticleWidths() const { return particleWidths; }
3004
3007
3010
3012 int getNumFrames() const;
3013
3016
3018 std::vector<Vector> getVoxelVertices(int voxelIndex) const;
3019
3021 std::vector<int> getVoxelVertexIndices(int voxelIndex) const;
3022
3024 const std::vector<int> &getVoxelVerticesStartIndices() const { return voxelVerticesStartIndices; }
3025
3027 const std::vector<int> &getVoxelVertexIndicesStartIndices() const { return voxelVertexIndicesStartIndices; }
3028
3030 std::vector<Vector> getVoxelNormals(int voxelIndex) const;
3031
3033 std::vector<int> getVoxelNormalIndices(int voxelIndex) const;
3034
3036 const std::vector<int> &getVoxelNormalsStartIndices() const { return voxelNormalsStartIndices; }
3037
3039 const std::vector<int> &getVoxelNormalIndicesStartIndices() const { return voxelNormalIndicesStartIndices; }
3040
3042 std::vector<int> getVoxelMaterialIDs(int voxelIndex) const;
3043
3045 const std::vector<int> &getVoxelMaterialIDsStartIndices() const { return voxelMaterialIDsStartIndices; }
3046
3048 std::vector<int> getVoxelEdgeVisibility(int voxelIndex) const;
3049
3051 std::vector<Vector> getVoxelVelocities(int voxelIndex) const;
3052
3054 const std::vector<int> &getVoxelVelocitiesStartIndices() const { return voxelVelocitiesStartIndices; }
3055
3057 std::vector<Vector> getVoxelUVValues(int voxelIndex, int setIndex) const;
3058
3060 std::vector<int> getVoxelUVValueIndices(int voxelIndex, int setIndex) const;
3061
3063 const std::vector<int> &getVoxelUVValuesStartIndices() const { return voxelUVValuesStartIndices; }
3064
3066 const std::vector<int> &getVoxelUVValueIndicesStartIndices() const { return voxelUVValueIndicesStartIndices; }
3067
3069 const std::vector<Vector> &getUVValues() const { return uvValues; }
3070
3072 const std::vector<int> &getUVValueIndices() const { return uvValueIndices; }
3073
3076
3079
3081 const std::vector<int> &getHairVerticesStartIndices() const { return hairVerticesStartIndices; }
3082
3084 const std::vector<int> &getHairVerticesPerStrandStartIndices() const { return hairVerticesPerStrandStartIndices; }
3085
3087 const std::vector<int> &getHairWidthsStartIndices() const { return hairWidthsStartIndices; }
3088
3090 const std::vector<int> &getHairVelocitiesStartIndices() const { return hairVelocitiesStartIndices; }
3091
3093 const std::vector<int> &getParticleVerticesStartIndices() const { return particleVerticesStartIndices; }
3094
3096 const std::vector<int> &getParticleWidthsStartIndices() const { return particleWidthsStartIndices; }
3097
3099 const std::vector<int> &getParticleVelocitiesStartIndices() const { return particleVelocitiesStartIndices; }
3100
3102 std::vector<Vector> getHairVoxelVertices(int hairVoxelIndex) const;
3103
3105 std::vector<int> getHairVoxelVerticesPerStrand(int hairVoxelIndex) const;
3106
3108 std::vector<float> getHairVoxelWidths(int hairVoxelIndex) const;
3109
3111 std::vector<Vector> getHairVoxelVelocities(int hairVoxelIndex) const;
3112
3114 std::vector<Vector> getParticleVoxelVertices(int particleVoxelIndex) const;
3115
3117 std::vector<float> getParticleVoxelWidths(int particleVoxelIndex) const;
3118
3120 std::vector<Vector> getParticleVoxelVelocities(int particleVoxelIndex) const;
3121
3126 std::vector<int> getArrayOfLengths(const int* startIndices, int elementsCount, int objectCount) const;
3127
3133 std::vector<int> getArrayOfLengths(const int* startIndices, int elementsCount, int objectCount, int uvSetsCount) const;
3134
3140 int getLengthFromStartIndex(int objectIndex, const int* startIndices, int elementsCount, int objectCount) const;
3141
3149 int getLengthFromStartIndex(int objectIndex, int setIndex, const int* startIndices, int elementsCount, int objectCount, int uvSetsCount) const;
3150
3152 const std::vector<Box> &getGeometryVoxelsBBoxes() const { return geometryVoxelsBBoxes; }
3153
3155 const std::vector<Box> &getHairVoxelsBBoxes() const { return hairVoxelsBBoxes; }
3156
3158 const std::vector<Box> &getParticleVoxelsBBoxes() const { return particleVoxelsBBoxes; }
3159
3161 Box getGeometryVoxelBBox(int voxelIndex) const;
3162
3164 Box getHairVoxelBBox(int hairVoxelIndex) const;
3165
3167 Box getParticleVoxelBBox(int particleVoxelIndex) const;
3168
3170 const std::vector<Color> &getVoxelInfoWireColor() const { return voxelInfoWireColor; }
3171
3173 const std::vector<Bool> &getVoxelInfoSmoothed() const { return voxelInfoSmoothed; }
3174
3176 const std::vector<Bool> &getVoxelInfoFlipNormals() const { return voxelInfoFlipNormals; }
3177
3180
3181 private:
3182 friend class VRayRenderer;
3183 friend class Proxy;
3184 void allocateArrays();
3185 std::vector<Vector> getArrayElement (int objectIndex, const int* startIndices, const VectorList& list, int elementsCount, size_t objectCount) const;
3186 std::vector<int> getArrayElement (int objectIndex, const int* startIndices, const int* primaryStartIndices, const IntList& list, int elementsCount, size_t objectCount) const;
3187 std::vector<int> getArrayElement (int objectIndex, const int* startIndices, const IntList& list, int elementsCount, size_t objectCount) const;
3188 std::vector<float> getArrayElement (int objectIndex, const int* startIndices, const FloatList& list, int elementsCount, size_t objectCount) const;
3189 std::vector<Vector> getArrayElement (int objectIndex, int setIndex, const int* startIndices, const VectorList& list, int elementsCount, size_t objectCount, size_t uvSetsCount) const;
3190 std::vector<int> getArrayElement (int objectIndex, int setIndex, const int* startIndices, const int* primaryStartIndices, const IntList& list, int elementsCount, int primaryElementsCount, size_t objectCount, size_t uvSetsCount) const;
3191
3192 struct Internal {
3193 long long version;
3194 union {
3195 long long int flags;
3196 struct {
3197 bool maxToMayaTM : 1;
3198 bool mayaToMaxTM : 1;
3199 bool reserved_bit2 : 1;
3200 bool reserved_bit3 : 1;
3201 bool use_vertices : 1;
3202 bool use_normals : 1;
3203 bool use_mtlIDs : 1;
3204 bool use_velocities : 1;
3205 bool use_UVs : 1;
3206 bool use_shaders : 1;
3207 bool use_objectInfos : 1;
3208 bool use_hairObjectInfos : 1;
3209 bool use_particleObjectInfos : 1;
3210 bool use_hair : 1;
3211 bool use_particles : 1;
3212 bool use_geometryVoxelsBBoxes : 1;
3213 bool use_hairVoxelsBBoxes : 1;
3214 bool use_particleVoxelsBBoxes : 1;
3215 };
3216 };
3217
3218 float* vertices;
3219 size_t vertices_count;
3220 int* indices;
3221 size_t indices_count;
3222 float* normals;
3223 size_t normals_count;
3224 int* normalIndices;
3225 size_t normalIndices_count;
3226 int* materialIDs;
3227 size_t materialIDs_count;
3228 float* velocities;
3229 size_t velocities_count;
3230
3231 char* uvSetNames;
3232 float* uvValues;
3233 int* uvValueIndices;
3234 size_t uvSets_count;
3235 size_t uvSetNames_length;
3236 int uvSetIndices[100];
3237 size_t uvValues_counts[100];
3238 size_t uvValueIndices_counts[100];
3239
3240 char* shaderNames;
3241 int* shaderIds;
3242 size_t shaders_count;
3243 size_t shaderNames_length;
3244
3245 char* objectInfoNames;
3246 int* objectInfoIds;
3247 int* objectInfoVBegins;
3248 int* objectInfoVEnds;
3249 size_t objectInfos_count;
3250 size_t objectInfoNames_length;
3251
3252 char* hairObjectInfoNames;
3253 int* hairObjectInfoIds;
3254 int* hairObjectInfoVBegins;
3255 int* hairObjectInfoVEnds;
3256 size_t hairObjectInfos_count;
3257 size_t hairObjectInfoNames_length;
3258
3259 char* particleObjectInfoNames;
3260 int* particleObjectInfoIds;
3261 int* particleObjectInfoVBegins;
3262 int* particleObjectInfoVEnds;
3263 size_t particleObjectInfos_count;
3264 size_t particleObjectInfoNames_length;
3265
3266 float* hairVertices;
3267 size_t hairVertices_count;
3268 int* hairVerticesPerStrand;
3269 size_t hairVerticesPerStrand_count;
3270 float* particleVertices;
3271 size_t particlesVertices_count;
3272
3273 int* voxelVerticesStartIndices;
3274 int* voxelVertexIndicesStartIndices;
3275 int* voxelNormalsStartIndices;
3276 int* voxelNormalIndicesStartIndices;
3277 int* voxelMaterialIDsStartIndices;
3278 int* voxelVelocitiesStartIndices;
3279 int* voxelUVValuesStartIndices;
3280 int* voxelUVValueIndicesStartIndices;
3281
3282 float* geometryVoxelsBBoxes;
3283 float* hairVoxelsBBoxes;
3284 float* particleVoxelsBBoxes;
3285
3286 int* hairVerticesStartIndices;
3287 int* hairVerticesPerStrandStartIndices;
3288 int* particleVerticesStartIndices;
3289
3290 size_t geometryVoxels_count;
3291 size_t hairVoxels_count;
3292 size_t particleVoxels_count;
3293
3294 size_t totalUVvalues;
3295 size_t totalUVindices;
3296
3297 int* edgeVisibility;
3298
3299 Color* voxelInfoWireColor;
3300 int* voxelInfoSmoothed;
3301 int* voxelInfoFlipNormals;
3302 size_t voxelInfoObjects_count;
3303
3304 float* hairWidths;
3305 size_t hairWidths_count;
3306 int* hairWidthsStartIndices;
3307 float* particleWidths;
3308 size_t particleWidths_count;
3309 int* particleWidthsStartIndices;
3310
3311 int numFrames;
3312 Bool hasVelocityChannel;
3313
3314 float* hairVelocities;
3315 size_t hairVelocities_count;
3316 int* hairVelocitiesStartIndices;
3317 float* particleVelocities;
3318 size_t particleVelocities_count;
3319 int* particleVelocitiesStartIndices;
3320 } d;
3321
3322 std::vector<Vector> vertices;
3323 std::vector<int> indices;
3324 std::vector<Vector> normals;
3325 std::vector<int> normalIndices;
3326 std::vector<int> materialIDs;
3327 std::vector<Vector> velocities;
3328 std::vector<char> uvSetNames;
3329 std::vector<Vector> uvValues;
3330 std::vector<int> uvValueIndices;
3331 std::vector<char> shaderNames;
3332 std::vector<int> shaderIds;
3333 std::vector<char> objectInfoNames;
3334 std::vector<int> objectInfoIds;
3335 std::vector<int> objectInfoVBegins;
3336 std::vector<int> objectInfoVEnds;
3337 std::vector<char> hairObjectInfoNames;
3338 std::vector<int> hairObjectInfoIds;
3339 std::vector<int> hairObjectInfoVBegins;
3340 std::vector<int> hairObjectInfoVEnds;
3341 std::vector<char> particleObjectInfoNames;
3342 std::vector<int> particleObjectInfoIds;
3343 std::vector<int> particleObjectInfoVBegins;
3344 std::vector<int> particleObjectInfoVEnds;
3345 std::vector<Vector> hairVertices;
3346 std::vector<int> hairVerticesPerStrand;
3347 std::vector<Vector> particleVertices;
3348 std::vector<int> voxelVerticesStartIndices;
3349 std::vector<int> voxelVertexIndicesStartIndices;
3350 std::vector<int> voxelNormalsStartIndices;
3351 std::vector<int> voxelNormalIndicesStartIndices;
3352 std::vector<int> voxelMaterialIDsStartIndices;
3353 std::vector<int> voxelVelocitiesStartIndices;
3354 std::vector<int> voxelUVValuesStartIndices;
3355 std::vector<int> voxelUVValueIndicesStartIndices;
3356 std::vector<Box> geometryVoxelsBBoxes;
3357 std::vector<Box> hairVoxelsBBoxes;
3358 std::vector<Box> particleVoxelsBBoxes;
3359 std::vector<int> hairVerticesStartIndices;
3360 std::vector<int> hairVerticesPerStrandStartIndices;
3361 std::vector<int> particleVerticesStartIndices;
3362 std::vector<int> edgeVisibility;
3363 std::vector<Color> voxelInfoWireColor;
3364 std::vector<Bool> voxelInfoSmoothed;
3365 std::vector<Bool> voxelInfoFlipNormals;
3366 std::vector<float> hairWidths;
3367 std::vector<int> hairWidthsStartIndices;
3368 std::vector<float> particleWidths;
3369 std::vector<int> particleWidthsStartIndices;
3370 std::vector<Vector> hairVelocities;
3371 std::vector<int> hairVelocitiesStartIndices;
3372 std::vector<Vector> particleVelocities;
3373 std::vector<int> particleVelocitiesStartIndices;
3374 };
3375
3378 union TiMe {
3379 private:
3380 int64_t asInt;
3381 double asDouble;
3382 explicit TiMe(int64_t time) : asInt(time) {}
3383 public:
3385 TiMe() : asInt(-1) {}
3387 explicit TiMe(double time) : asDouble(time) {}
3389 operator double() { return asDouble; }
3393 static double Default() { return TiMe(int64_t(-1)).asDouble; }
3397 static double None() { return TiMe(int64_t(-2)).asDouble; }
3398 };
3399
3423
3425
3426 std::string destination;
3434
3435 std::vector<std::string> objectNames;
3436 std::vector<int> objectIDs;
3437 std::string customPreviewFile;
3438 std::vector<Color> voxelInfoWireColor;
3439 std::vector<Bool> voxelInfoSmoothed;
3440 std::vector<Bool> voxelInfoFlipNormals;
3441
3447 };
3448
3451 std::string file;
3452 std::string object_path;
3462 float fps;
3472
3474 };
3475
3479 std::string outputFileName;
3480
3483
3488
3493
3496 {}
3497 };
3498
3499 class LightUtils;
3500
3504 friend LightUtils;
3505 public:
3506 LuminaireFieldReadPreviewData() : luminaireFieldHandle(nullptr) {}
3508
3510 bool isValid() const;
3513 bool useConvexHull() const;
3517 std::vector<Vector> getConvexHullVertices() const;
3519 std::vector<int> getConvexHullTriangles() const;
3520 private:
3521 void* luminaireFieldHandle;
3522 };
3523
3525 struct {
3526 unsigned char revision;
3527 unsigned char minor;
3528 unsigned short major;
3529 };
3530 unsigned allFields;
3531
3532 #ifdef _MSC_VER
3533 #pragma warning(disable : 4996)
3534 #endif
3535 std::string toString() const {
3536 std::string str;
3537 str.resize(15);
3538 int n = std::snprintf(&str[0], str.size() - 1, "%u.%02u.%02u", major, minor, revision);
3539 str.resize(n);
3540 return str;
3541 }
3542 #ifdef _MSC_VER
3543 #pragma warning(default : 4996)
3544 #endif
3545 };
3546 typedef VersionUnion VRayVersion;
3547 typedef VersionUnion APIVersion;
3548
3549 inline std::ostream& operator <<(std::ostream& stream, const VRayVersion& version) {
3550 stream << version.toString();
3551 return stream;
3552 }
3553
3556 static const int useParentTimes = (1 << 0);
3557 static const int useObjectID = (1 << 1);
3558 static const int usePrimaryVisibility = (1 << 2);
3559 static const int useUserAttributes = (1 << 3);
3560 static const int useParentTimesAtleastForGeometry = (1 << 4);
3562 static const int useMaterial = (1 << 5);
3563 static const int useGeometry = (1 << 6);
3564 static const int useMapChannels = (1 << 7);
3565 static const int useSkipCryptomatte = (1 << 8);
3566 static const int useRenderIDOverride = (1 << 9);
3567 static const int useUserAttributesBin = (1 << 10);
3568 static const int useObjectProperties = (1<<11);
3569 };
3570
3571 struct ScannedMaterialParams;
3572 struct ScannedMaterialPreset;
3573
3578 float ISO;
3580 };
3581} // namespace VRay
3582
3583// internal function declarations
3584#include "_vraysdk_import.hpp"
3585
3586namespace VRay {
3587 namespace Language {
3588 constexpr const char* EN_US = "en-US";
3589 constexpr const char* ZH_CN = "zh-CN";
3590 }
3591
3594
3597 ThemeStyleAuto = 0,
3598 ThemeStyleStandalone,
3599 ThemeStyle3dsMax,
3600 ThemeStyle3dsMaxQt,
3601 ThemeStyleMaya,
3602 };
3603
3605
3606 union {
3607 int flags;
3608 struct {
3618 bool useVfbLog : 1;
3627 };
3628 };
3629
3632 void* parentWindowHandle;
3633
3634 std::string pluginLibraryPath;
3635
3636 std::string vfbLanguage;
3637
3639 : vfbDrawStyle(ThemeStyleAuto)
3640 , flags(0)
3641 , parentWindowHandle()
3642 {
3643 enableFrameBuffer = true;
3644 showFrameBuffer = true;
3645 useDefaultVfbTheme = true;
3646 useVfbLog = true;
3647 }
3648
3649 RendererOptions(const RendererOptions& options) = default;
3650 RendererOptions(RendererOptions&& options) = default;
3651
3652 RendererOptions& operator=(const RendererOptions& options) = default;
3653 RendererOptions& operator=(RendererOptions&& options) = default;
3654
3655 void swap(RendererOptions& options);
3656 };
3657
3660 std::string dispatcher;
3661 std::string httpProxy;
3662 union {
3663 int flags;
3664 struct {
3669 bool immediatelyForwardReadySplitBucketSubunits : 1;
3670 };
3671 };
3675
3677 : flags(0)
3678 , connectTimeout(10)
3679 , upstreamChannels(3)
3680 , verboseLevel(3) {
3681 pipelinedUpstream = true;
3683 }
3684 };
3685
3687 std::string hosts; // can either be an empty string or host[:port]
3688 std::string vantageFile; // absolute path to .vantage file
3689 };
3690
3693 enum class Mode {
3694 Off = 0,
3695 Simple,
3696 Full,
3697 Process,
3698 };
3699
3702 enum FileType : int {
3705 };
3706
3709 std::string outputDirectory;
3710 std::string htmlTemplatePath;
3711 std::string productName;
3712 std::string productVersion;
3713 std::string sceneName;
3714
3716 mode = Mode::Off;
3717 maxDepth = 1;
3718 }
3719 };
3720
3721
3722#if !defined(VRAY_RUNTIME_LOAD_PRIMARY) && !defined(VRAY_RUNTIME_LOAD_SECONDARY)
3725 class VRayInit {
3726 VRayInit(VRayInit&); // copy construction disabled
3727
3728 public:
3729 VRayInit() {
3730 Internal::VRay_incrementModuleReferenceCounter();
3731 }
3732
3734 explicit VRayInit(bool enableFrameBuffer) {
3735 Internal::VRay_incrementModuleReferenceCounter();
3736 Internal::VRay_enableFrameBuffer(enableFrameBuffer);
3737 }
3738
3739#ifdef _WIN32
3742 void setUseParentEventLoop() {
3743 Internal::VRay_blendFrameBuffer();
3744 }
3745#endif // _WIN32
3746
3750 void setGUIMessageProcessing(bool enableMessageProcessing) {
3751 Internal::VRay_GUIMessageProcessing(enableMessageProcessing);
3752 }
3753
3754 ~VRayInit() {
3755 Internal::VRay_LicenseManager_releaseLicense();
3756 }
3757 };
3758
3759#elif defined(VRAY_RUNTIME_LOAD_PRIMARY)
3762 class VRayInit {
3763 VRayInit(VRayInit&); // copy construction disabled
3764
3765 public:
3769 explicit VRayInit(const char* const libraryFileName) {
3770 initialize(libraryFileName);
3771 if (Internal::VRay_incrementModuleReferenceCounter) Internal::VRay_incrementModuleReferenceCounter();
3772 }
3773
3778 VRayInit(const char* const libraryFileName, bool enableFrameBuffer) {
3779 initialize(libraryFileName);
3780 if (Internal::VRay_incrementModuleReferenceCounter) Internal::VRay_incrementModuleReferenceCounter();
3781 if (Internal::VRay_enableFrameBuffer) Internal::VRay_enableFrameBuffer(enableFrameBuffer);
3782 }
3783
3784#ifdef _WIN32
3787 void setUseParentEventLoop() {
3788 Internal::VRay_blendFrameBuffer();
3789 }
3790#endif // _WIN32
3791
3795 void setGUIMessageProcessing(bool enableMessageProcessing) {
3796 Internal::VRay_GUIMessageProcessing(enableMessageProcessing);
3797 }
3798
3799 ~VRayInit() {
3800 if (Internal::VRay_LicenseManager_releaseLicense)
3801 Internal::VRay_LicenseManager_releaseLicense();
3802 release();
3803 }
3804
3805 operator bool () const {
3806 return !!hLib;
3807 }
3808
3810 std::string getSDKLibraryErrorString() const {
3811 return errString;
3812 }
3813
3814 protected:
3815 VRayInit() {}
3816
3817 Internal::HModule hLib;
3818 std::string errString;
3819
3820#ifdef VRAY_NOTHROW
3821 void makeError(const std::string &errMsg) {
3822 errString = errMsg;
3823 hLib = nullptr;
3824 }
3825#endif // VRAY_NOTHROW
3826
3827 void initialize(const char* libraryFileName);
3828 void importFunctions();
3829
3830 void release() {
3831 if (hLib)
3832#ifdef _WIN32
3833 Internal::FreeLibrary(hLib);
3834#else
3835 Internal::dlclose(hLib);
3836#endif // _WIN32
3837 }
3838 };
3839#endif // #if !defined(VRAY_RUNTIME_LOAD_PRIMARY) && !defined(VRAY_RUNTIME_LOAD_SECONDARY)
3840
3843 inline bool isDR2() {
3844 return !!Internal::VRay_isDR2();
3845 }
3846
3848 inline APIVersion getAPIVersion() {
3849 APIVersion ver;
3850 ver.allFields = Internal::VRay_getSDKVersion();
3851 return ver;
3852 }
3853
3855 inline VRayVersion getVRayVersion() {
3856 VRayVersion ver;
3857 ver.allFields = Internal::VRay_getVRayVersion();
3858 return ver;
3859 }
3860
3862 inline const char* getVRayVersionDetails() {
3863 return Internal::VRay_getVRayVersionDetails();
3864 }
3865
3868 inline const char* getMaterialLibraryPath() {
3869 return Internal::VRay_getMaterialLibraryPath();
3870 }
3871
3874 std::string serverName;
3876 std::string proxyName;
3877 int proxyPort;
3878 std::string username;
3879 std::string password;
3880
3881 std::string serverName1;
3882 int serverPort1;
3883
3884 std::string serverName2;
3885 int serverPort2;
3886
3887 std::string proxyUserName;
3888 std::string proxyPassword;
3889
3890 LicenseServerSettings(void) {
3891 serverPort = 0;
3892 proxyPort = 0;
3893 serverPort1 = 0;
3894 serverPort2 = 0;
3895 }
3896 };
3897
3903 inline int setLicenseServers(const LicenseServerSettings& settings);
3904
3908 inline void setUSDProvider(const char* usdProvider);
3909
3910 class Error {
3911
3912 protected:
3913 ErrorCode errorCode;
3914
3915 public:
3916 Error(int errorCode = SUCCESS) : errorCode(static_cast<ErrorCode>(errorCode)) {
3917 }
3918
3919 Error(ErrorCode errorCode) : errorCode(errorCode) {
3920 }
3921
3922 bool error() const {
3923 return errorCode != SUCCESS;
3924 }
3925
3926 ErrorCode getCode() const {
3927 return errorCode;
3928 }
3929
3930 const char* toString() const {
3931 return Internal::VRay_getErrorTextStringFromErrorCode(errorCode);
3932 }
3933
3934 friend inline bool operator==(const Error& err0, const Error& err1) {
3935 return err0.errorCode == err1.errorCode;
3936 }
3937
3938 friend inline bool operator!=(const Error& err0, const Error& err1) {
3939 return err0.errorCode != err1.errorCode;
3940 }
3941
3942 friend inline bool operator==(const Error& err, ErrorCode errCode) {
3943 return err.errorCode == errCode;
3944 }
3945
3946 friend inline bool operator==(ErrorCode errCode, const Error& err) {
3947 return errCode == err.errorCode;
3948 }
3949
3950 friend inline bool operator!=(const Error& err, ErrorCode errCode) {
3951 return err.errorCode != errCode;
3952 }
3953
3954 friend inline bool operator!=(ErrorCode errCode, const Error& err) {
3955 return errCode != err.errorCode;
3956 }
3957
3958 };
3959
3960 inline std::ostream& operator <<(std::ostream& stream, const Error& err) {
3961 stream << err.toString();
3962 return stream;
3963 }
3964
3967 std::string fileName;
3968 std::string errorText;
3969 int fileLine;
3970 };
3971
3974 LicenseError::VRLAuthError errorCode;
3975
3976 ScannedMaterialLicenseError(LicenseError::VRLAuthError errorCode = LicenseError::vrlauth_noError)
3977 : errorCode(errorCode) {}
3978
3979 bool error() const {
3980 return errorCode != LicenseError::vrlauth_noError;
3981 }
3982
3983 const char* toString() const;
3984 };
3985
3986
3989 enum Plain {
3990 PL_NONE = 0,
3993 PL_TRIPLANAR = 3
3995
3997 VRSM_PAINT = 0,
3999 VRSM_CCMULT = 2
4001
4004 CH_PAINT_MASK = 1 << VRSM_PAINT,
4005 CH_FILTER_MASK = 1 << VRSM_FILTER,
4006 CH_CCMULT_MASK = 1 << VRSM_CCMULT
4007 };
4008
4010 CS_SRGB = 0,
4012 CS_PP = 2
4014
4016 TP_ENABLED = 1,
4019 };
4020
4021 Plain plain;
4022 float invgamma;
4024 float depthMul;
4029 float bumpmul;
4032 float cutoff;
4034 int dome;
4035 float multdirect, multrefl, multgi;
4039 float ccior;
4041 float ccbump;
4046 float retrace;
4055 float ccmul;
4059 float ccglossy;
4061 float sssmul;
4062
4064 };
4065
4070 bool encodeScannedMaterialParams(const ScannedMaterialParams& mtlParams, IntList& paramBlock);
4071
4078 bool encodeScannedMaterialParams(const ScannedMaterialParams& mtlParams, IntList& paramBlock, ScannedMaterialLicenseError& licError);
4079
4083 unsigned getScannedMaterialUILicense();
4084
4089 unsigned getScannedMaterialUILicense(ScannedMaterialLicenseError& licError);
4090
4094 unsigned releaseScannedMaterialUILicense();
4095
4105 SMF_PS = 4
4107
4108 float ccior;
4109 int plain;
4110 float bumpmul;
4112 float depthmul;
4113 float ccbump;
4114 float orggls;
4117 float free4, free5, free6;
4118 float ccmul;
4119 float shdhmul;
4120 float shdmul;
4123 float specbell;
4124 float specmul;
4125 float free7;
4126 float scratchdens;
4127 float fuzzy;
4128 float topvLs_A;
4129 float topvLs_B;
4131 float indmul;
4133 float thickness;
4135 float transpf;
4136 float lfsizecm;
4137
4139 };
4140
4142 union {
4143 void* handle;
4144 int err;
4145 } u;
4146
4147 void createThis(const char* pluginLibPath);
4148
4149 public:
4150 enum Error {
4151 NO_ERR = 0,
4152 BAD_LIBRARY_FILE = 1,
4153 SDK_BROKEN = 3
4154 };
4155
4156 explicit ScannedMaterialInfo(const char* pluginLibPath = NULL);
4157 explicit ScannedMaterialInfo(const std::string& pluginLibPath);
4159
4163 Error getError() const;
4164
4168 operator bool() const;
4169
4172 bool operator!() const;
4173
4178 bool getInfo(const char* filename, std::string& info) const;
4179
4181 bool getInfo(const std::string& filename, std::string& info) const;
4182
4183
4188 bool getPreset(const char* filename, ScannedMaterialPreset& result) const;
4189
4191 bool getPreset(const std::string& filename, ScannedMaterialPreset& result) const;
4192 };
4193
4194 namespace VUtils {
4195 class Value;
4196 }
4197 namespace Internal {
4198 class Access;
4199 class BinaryValueParser;
4200 }
4201
4202 enum PluginCategory {
4203 category_bitmap = 0,
4204 category_bsdf,
4205 category_geometric_object,
4206 category_geometry_source,
4207 category_light,
4208 category_material,
4209 category_render_channel,
4210 category_render_view,
4211 category_settings,
4212 category_texture,
4213 category_texture_float,
4214 category_texture_int,
4215 category_texture_matrix,
4216 category_texture_transform,
4217 category_texture_vector,
4218 category_uvwgen,
4219 category_volumetric,
4220
4221 category_last //used for enumerating all possible plugin categories
4222 };
4223
4226 union {
4227 struct {
4231 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isBitmap : 1;
4232 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isBsdf : 1;
4233 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isGeometric_object : 1;
4234 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isGeometry_source : 1;
4235 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isLight : 1;
4236 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isMaterial : 1;
4237 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isRender_channel : 1;
4238 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isRender_view : 1;
4239 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isSettings : 1;
4240 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture : 1;
4241 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture_float : 1;
4242 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture_int : 1;
4243 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture_matrix : 1;
4244 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture_transform : 1;
4245 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isTexture_vector : 1;
4246 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isUvwgen : 1;
4247 VRAY_DEPRECATED("Do not use! Use the accessor methods instead!") bool isVolumetric : 1;
4248 };
4249 unsigned long long pluginCategoryField;
4250 };
4251
4252 bool operator==(const PluginCategories& categories) const noexcept {
4253 return pluginCategoryField == categories.pluginCategoryField;
4254 }
4255
4256 bool operator!=(const PluginCategories& categories) const noexcept {
4257 return pluginCategoryField != categories.pluginCategoryField;
4258 }
4259
4261 bool hasBitmapCategory() const { return (pluginCategoryField & (1ull << category_bitmap)) != 0; }
4262 void setBitmapCategory() { pluginCategoryField |= 1ull << category_bitmap; }
4263 void resetBitmapCategory() { pluginCategoryField &= ~(1ull << category_bitmap); }
4264
4266 bool hasBsdfCategory() const { return (pluginCategoryField & (1ull << category_bsdf)) != 0; }
4267 void setBsdfCategory() { pluginCategoryField |= 1ull << category_bsdf; }
4268 void resetBsdfCategory() { pluginCategoryField &= ~(1ull << category_bsdf); }
4269
4271 bool hasGeometricObjectCategory() const { return (pluginCategoryField & (1ull << category_geometric_object)) != 0; }
4272 void setGeometricObjectCategory() { pluginCategoryField |= 1ull << category_geometric_object; }
4273 void resetGeometricObjectCategory() { pluginCategoryField &= ~(1ull << category_geometric_object); }
4274
4276 bool hasGeometrySourceCategory() const { return (pluginCategoryField & (1ull << category_geometry_source)) != 0; }
4277 void setGeometrySourceCategory() { pluginCategoryField |= 1ull << category_geometry_source; }
4278 void resetGeometrySourceCategory() { pluginCategoryField &= ~(1ull << category_geometry_source); }
4279
4281 bool hasLightCategory() const { return (pluginCategoryField & (1ull << category_light)) != 0; }
4282 void setLightCategory() { pluginCategoryField |= 1ull << category_light; }
4283 void resetLightCategory() { pluginCategoryField &= ~(1ull << category_light); }
4284
4286 bool hasMaterialCategory() const { return (pluginCategoryField & (1ull << category_material)) != 0; }
4287 void setMaterialCategory() { pluginCategoryField |= 1ull << category_material; }
4288 void resetMaterialCategory() { pluginCategoryField &= ~(1ull << category_material); }
4289
4291 bool hasRenderChannelCategory() const { return (pluginCategoryField & (1ull << category_render_channel)) != 0; }
4292 void setRenderChannelCategory() { pluginCategoryField |= 1ull << category_render_channel; }
4293 void resetRenderChannelCategory() { pluginCategoryField &= ~(1ull << category_render_channel); }
4294
4296 bool hasRenderViewCategory() const { return (pluginCategoryField & (1ull << category_render_view)) != 0; }
4297 void setRenderViewCategory() { pluginCategoryField |= 1ull << category_render_view; }
4298 void resetRenderViewCategory() { pluginCategoryField &= ~(1ull << category_render_view); }
4299
4301 bool hasSettingsCategory() const { return (pluginCategoryField & (1ull << category_settings)) != 0; }
4302 void setSettingsCategory() { pluginCategoryField |= 1ull << category_settings; }
4303 void resetSettingsCategory() { pluginCategoryField &= ~(1ull << category_settings); }
4304
4306 bool hasTextureCategory() const { return (pluginCategoryField & (1ull << category_texture)) != 0; }
4307 void setTextureCategory() { pluginCategoryField |= 1ull << category_texture; }
4308 void resetTextureCategory() { pluginCategoryField &= ~(1ull << category_texture); }
4309
4311 bool hasTextureFloatCategory() const { return (pluginCategoryField & (1ull << category_texture_float)) != 0; }
4312 void setTextureFloatCategory() { pluginCategoryField |= 1ull << category_texture_float; }
4313 void resetTextureFloatCategory() { pluginCategoryField &= ~(1ull << category_texture_float); }
4314
4316 bool hasTextureIntCategory() const { return (pluginCategoryField & (1ull << category_texture_int)) != 0; }
4317 void setTextureIntCategory() { pluginCategoryField |= 1ull << category_texture_int; }
4318 void resetTextureIntCategory() { pluginCategoryField &= ~(1ull << category_texture_int); }
4319
4321 bool hasTextureMatrixCategory() const { return (pluginCategoryField & (1ull << category_texture_matrix)) != 0; }
4322 void setTextureMatrixCategory() { pluginCategoryField |= 1ull << category_texture_matrix; }
4323 void resetTextureMatrixCategory() { pluginCategoryField &= ~(1ull << category_texture_matrix); }
4324
4326 bool hasTextureTransformCategory() const { return (pluginCategoryField & (1ull << category_texture_transform)) != 0; }
4327 void setTextureTransformCategory() { pluginCategoryField |= 1ull << category_texture_transform; }
4328 void resetTextureTransformCategory() { pluginCategoryField &= ~(1ull << category_texture_transform); }
4329
4331 bool hasTextureVectorCategory() const { return (pluginCategoryField & (1ull << category_texture_vector)) != 0; }
4332 void setTextureVectorCategory() { pluginCategoryField |= 1ull << category_texture_vector; }
4333 void resetTextureVectorCategory() { pluginCategoryField &= ~(1ull << category_texture_vector); }
4334
4336 bool hasUvwgenCategory() const { return (pluginCategoryField & (1ull << category_uvwgen)) != 0; }
4337 void setUvwgenCategory() { pluginCategoryField |= 1ull << category_uvwgen; }
4338 void resetUvwgenCategory() { pluginCategoryField &= ~(1ull << category_uvwgen); }
4339
4341 bool hasVolumetricCategory() const { return (pluginCategoryField & (1ull << category_volumetric)) != 0; }
4342 void setVolumetricCategory() { pluginCategoryField |= 1ull << category_volumetric; }
4343 void resetVolumetricCategory() { pluginCategoryField &= ~(1ull << category_volumetric); }
4344
4345 PluginCategories() { clear(); }
4346
4347 void clear() { pluginCategoryField = 0; }
4348
4349 bool hasCategory(PluginCategory category) const {
4350 return (pluginCategoryField & (1ull << category)) != 0;
4351 }
4352
4353 void setCategory(PluginCategory category, bool value) {
4354 const long long msk = 1ll << category;
4355 const long long val = -static_cast<long long>(value);
4356 pluginCategoryField = (pluginCategoryField | (msk & val)) & (~msk | val);
4357 }
4358
4360 std::vector<PluginCategory> getAll() const;
4361 };
4362
4363 template<class T>
4364 class PluginRefT;
4365
4369 class Plugin {
4370 friend class VRayRenderer;
4371 friend class PropertyRuntimeMeta;
4372 friend class VUtils::Value;
4373 friend class Internal::Access;
4374 friend class Internal::BinaryValueParser;
4375 friend class Internal::BinaryValueBuilder;
4376
4377 protected:
4378 const VRayRenderer* pRenderer;
4379 InstanceId internalId;
4380 InstanceId id() const {
4381 constexpr int shift = sizeof(InstanceId) * 8 - Internal::INSTANCE_ID_BITS;
4382 return static_cast<signed long long>(internalId << shift) >> shift;
4383 }
4384
4385 Plugin(VRayRenderer& renderer, const char* name);
4386 Plugin(VRayRenderer& renderer, InstanceId id) noexcept;
4387 Plugin(VRayRenderer& renderer, InstanceId id, PluginTypeId typeId) noexcept;
4388 Plugin(VRayRenderer& renderer, InstanceId id, int typeIdIdx) noexcept;
4389
4390 template<typename T, int TYPE>
4391 bool setValueAtTimeTemplate(const char* propertyName, const T& value, double time);
4392
4393 template<typename T, int TYPE>
4394 bool setArrayAtTimeTemplate(const char* propertyName, size_t count, const T& value, double time);
4395
4396 template<typename LengthFn, typename PointerFn>
4397 bool setStringArrayTemplate(const char *propertyName, size_t count, LengthFn lengthAt, PointerFn pointerAt, double time);
4398
4399 public:
4401 Plugin() noexcept : pRenderer(), internalId(NO_ID) {}
4402
4404 Plugin(const Plugin &plugin) noexcept;
4405
4407 Plugin& operator=(const Plugin &plugin) noexcept;
4408
4410 bool operator==(const Plugin &plugin) const noexcept;
4411
4413 bool operator!=(const Plugin &plugin) const noexcept;
4414
4416 void swap(Plugin &plugin) noexcept;
4417
4420 bool isEmpty() const noexcept;
4421
4424 bool isNotEmpty() const noexcept;
4425
4430 bool isValid() const;
4431
4433 VRayRenderer* getRenderer() const noexcept;
4434
4436 unsigned long long getIntegerID() const noexcept;
4437
4441 const char* getName() const;
4442
4446 bool setName(const char* newName);
4447
4449 bool setName(const std::string& newName);
4450
4452 const char* getType() const;
4453
4455 PluginTypeId getTypeId() const noexcept;
4456
4458 std::string toString() const;
4459
4463
4467
4470 PropertyRuntimeMeta getPropertyRuntimeMeta(const char* propertyName) const;
4472 PropertyRuntimeMeta getPropertyRuntimeMeta(const std::string& propertyName) const;
4473
4476 std::string getValueAsString(const char* propertyName, double time = TiMe::Default()) const;
4478 std::string getValueAsString(const std::string& propertyName, double time = TiMe::Default()) const;
4479
4483 std::string getValueAsString(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4485 std::string getValueAsString(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4486
4491 bool setValueAsString(const char* propertyName, const char* value);
4493 bool setValueAsString(const char* propertyName, const std::string& value);
4494
4496 bool setValueAsString(const std::string& propertyName, const char* value);
4498 bool setValueAsString(const std::string& propertyName, const std::string& value);
4499
4501 bool getBool(const char* propertyName, double time = TiMe::Default()) const;
4503 bool getBool(const std::string& propertyName, double time = TiMe::Default()) const;
4504
4508 bool getBool(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4510 bool getBool(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4511
4514 int getInt(const char* propertyName, double time = TiMe::Default()) const;
4516 int getInt(const std::string& propertyName, double time = TiMe::Default()) const;
4517
4521 int getInt(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4523 int getInt(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4524
4526 float getFloat(const char* propertyName, double time = TiMe::Default()) const;
4528 float getFloat(const std::string& propertyName, double time = TiMe::Default()) const;
4529
4533 float getFloat(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4535 float getFloat(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4536
4538 double getDouble(const char* propertyName, double time = TiMe::Default()) const;
4540 double getDouble(const std::string& propertyName, double time = TiMe::Default()) const;
4541
4545 double getDouble(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4547 double getDouble(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4548
4550 Color getColor(const char* propertyName, double time = TiMe::Default()) const;
4552 Color getColor(const std::string& propertyName, double time = TiMe::Default()) const;
4553
4557 Color getColor(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4559 Color getColor(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4560
4562 AColor getAColor(const char* propertyName, double time = TiMe::Default()) const;
4564 AColor getAColor(const std::string& propertyName, double time = TiMe::Default()) const;
4565
4569 AColor getAColor(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4571 AColor getAColor(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4572
4574 Vector getVector(const char* propertyName, double time = TiMe::Default()) const;
4576 Vector getVector(const std::string& propertyName, double time = TiMe::Default()) const;
4577
4581 Vector getVector(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4583 Vector getVector(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4584
4586 Matrix getMatrix(const char* propertyName, double time = TiMe::Default()) const;
4588 Matrix getMatrix(const std::string& propertyName, double time = TiMe::Default()) const;
4589
4593 Matrix getMatrix(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4595 Matrix getMatrix(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4596
4598 Transform getTransform(const char* propertyName, double time = TiMe::Default()) const;
4600 Transform getTransform(const std::string& propertyName, double time = TiMe::Default()) const;
4601
4605 Transform getTransform(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4607 Transform getTransform(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4608
4610 PluginRefT<Plugin> getPlugin(const char* propertyName, double time = TiMe::Default()) const;
4612 PluginRefT<Plugin> getPlugin(const std::string& propertyName, double time = TiMe::Default()) const;
4613
4617 PluginRefT<Plugin> getPlugin(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4619 PluginRefT<Plugin> getPlugin(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4620
4622 std::string getString(const char* propertyName, double time = TiMe::Default()) const;
4624 std::string getString(const std::string& propertyName, double time = TiMe::Default()) const;
4625
4629 std::string getString(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4631 std::string getString(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4632
4634 IntList getIntList(const char* propertyName, double time = TiMe::Default()) const;
4636 IntList getIntList(const std::string& propertyName, double time = TiMe::Default()) const;
4637
4641 IntList getIntList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4643 IntList getIntList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4644
4646 FloatList getFloatList(const char* propertyName, double time = TiMe::Default()) const;
4648 FloatList getFloatList(const std::string& propertyName, double time = TiMe::Default()) const;
4649
4653 FloatList getFloatList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4655 FloatList getFloatList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4656
4658 ColorList getColorList(const char* propertyName, double time = TiMe::Default()) const;
4660 ColorList getColorList(const std::string& propertyName, double time = TiMe::Default()) const;
4661
4665 ColorList getColorList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4667 ColorList getColorList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4668
4670 VectorList getVectorList(const char* propertyName, double time = TiMe::Default()) const;
4672 VectorList getVectorList(const std::string& propertyName, double time = TiMe::Default()) const;
4673
4677 VectorList getVectorList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4679 VectorList getVectorList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4680
4682 TransformList getTransformList(const char* propertyName, double time = TiMe::Default()) const;
4684 TransformList getTransformList(const std::string& propertyName, double time = TiMe::Default()) const;
4685
4689 TransformList getTransformList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4691 TransformList getTransformList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4692
4694 ValueList getValueList(const char* propertyName, double time = TiMe::Default()) const;
4696 ValueList getValueList(const std::string& propertyName, double time = TiMe::Default()) const;
4697
4701 ValueList getValueList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4703 ValueList getValueList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4704
4706 StringList getStringList(const char* propertyName, double time = TiMe::Default()) const;
4708 StringList getStringList(const std::string& propertyName, double time = TiMe::Default()) const;
4709
4713 StringList getStringList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4715 StringList getStringList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4716
4718 PluginList getPluginList(const char* propertyName, double time = TiMe::Default()) const;
4720 PluginList getPluginList(const std::string& propertyName, double time = TiMe::Default()) const;
4721
4725 PluginList getPluginList(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4727 PluginList getPluginList(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4728
4731 Value getValue(const char* propertyName, double time = TiMe::Default()) const;
4733 Value getValue(const std::string& propertyName, double time = TiMe::Default()) const;
4734
4739 Value getValue(const char* propertyName, bool& ok, double time = TiMe::Default()) const;
4741 Value getValue(const std::string& propertyName, bool& ok, double time = TiMe::Default()) const;
4742
4745 bool isPropertyAnimated(const char* propertyName) const;
4747 bool isPropertyAnimated(const std::string& propertyName) const;
4748
4751 std::vector<double> getKeyframeTimes(const char* propertyName) const;
4753 std::vector<double> getKeyframeTimes(const std::string& propertyName) const;
4754
4758 std::vector<double> getKeyframeTimes(const char* propertyName, bool& ok) const;
4760 std::vector<double> getKeyframeTimes(const std::string& propertyName, bool& ok) const;
4761
4764 bool setValue(const char* propertyName, const bool value, double time = TiMe::Default());
4766 bool setValue(const std::string& propertyName, const bool value, double time = TiMe::Default());
4767
4770 bool setValue(const char* propertyName, const int value, double time = TiMe::Default());
4772 bool setValue(const std::string& propertyName, const int value, double time = TiMe::Default());
4773
4776 bool setValue(const char* propertyName, const float value, double time = TiMe::Default());
4778 bool setValue(const std::string& propertyName, const float value, double time = TiMe::Default());
4779
4782 bool setValue(const char* propertyName, const double value, double time = TiMe::Default());
4784 bool setValue(const std::string& propertyName, const double value, double time = TiMe::Default());
4785
4788 bool setValue(const char* propertyName, const Color& value, double time = TiMe::Default());
4790 bool setValue(const std::string& propertyName, const Color& value, double time = TiMe::Default());
4791
4794 bool setValue(const char* propertyName, const AColor& value, double time = TiMe::Default());
4796 bool setValue(const std::string& propertyName, const AColor& value, double time = TiMe::Default());
4797
4800 bool setValue(const char* propertyName, const Vector& value, double time = TiMe::Default());
4802 bool setValue(const std::string& propertyName, const Vector& value, double time = TiMe::Default());
4803
4806 bool setValue(const char* propertyName, const Matrix& value, double time = TiMe::Default());
4808 bool setValue(const std::string& propertyName, const Matrix& value, double time = TiMe::Default());
4809
4812 bool setValue(const char* propertyName, const Transform& transform, double time = TiMe::Default());
4814 bool setValue(const std::string& propertyName, const Transform& transform, double time = TiMe::Default());
4815
4818 bool setValue(const char* propertyName, const PluginRefT<Plugin>& pluginRef, double time = TiMe::Default());
4820 bool setValue(const std::string& propertyName, const PluginRefT<Plugin>& pluginRef, double time = TiMe::Default());
4821
4824 bool setValue(const char* propertyName, const char* str, double time = TiMe::Default());
4826 bool setValue(const std::string& propertyName, const char* str, double time = TiMe::Default());
4827
4830 bool setValue(const char* propertyName, const std::string& str, double time = TiMe::Default());
4832 bool setValue(const std::string& propertyName, const std::string& str, double time = TiMe::Default());
4833
4836 bool setValue(const char* propertyName, const Value& value, double time = TiMe::Default());
4838 bool setValue(const std::string& propertyName, const Value& value, double time = TiMe::Default());
4840 bool setValue(const char* propertyName, Value&& value, double time = TiMe::Default());
4842 bool setValue(const std::string& propertyName, Value&& value, double time = TiMe::Default());
4843
4846 bool setValue(const char* propertyName, const ValueList& value, double time = TiMe::Default());
4848 bool setValue(const std::string& propertyName, const ValueList& value, double time = TiMe::Default());
4850 bool setValue(const char* propertyName, ValueList&& value, double time = TiMe::Default());
4852 bool setValue(const std::string& propertyName, ValueList&& value, double time = TiMe::Default());
4854 template<size_t count> bool setValue(const char* propertyName, const Value(&arr)[count], double time = TiMe::Default());
4856 template<size_t count> bool setValue(const std::string& propertyName, const Value(&arr)[count], double time = TiMe::Default());
4858 template<size_t count> bool setValue(const char* propertyName, Value(&&arr)[count], double time = TiMe::Default());
4860 template<size_t count> bool setValue(const std::string& propertyName, Value(&&arr)[count], double time = TiMe::Default());
4861
4864 bool setValue(const char* propertyName, const IntList& value, double time = TiMe::Default());
4866 bool setValue(const std::string& propertyName, const IntList& value, double time = TiMe::Default());
4868 bool setValue(const char* propertyName, IntList&& value, double time = TiMe::Default());
4870 bool setValue(const std::string& propertyName, IntList&& value, double time = TiMe::Default());
4871
4874 bool setValue(const char* propertyName, const FloatList& value, double time = TiMe::Default());
4876 bool setValue(const std::string& propertyName, const FloatList& value, double time = TiMe::Default());
4878 bool setValue(const char* propertyName, FloatList&& value, double time = TiMe::Default());
4880 bool setValue(const std::string& propertyName, FloatList&& value, double time = TiMe::Default());
4881
4884 bool setValue(const char* propertyName, const VectorList& value, double time = TiMe::Default());
4886 bool setValue(const std::string& propertyName, const VectorList& value, double time = TiMe::Default());
4888 bool setValue(const char* propertyName, VectorList&& value, double time = TiMe::Default());
4890 bool setValue(const std::string& propertyName, VectorList&& value, double time = TiMe::Default());
4891
4894 bool setValue(const char* propertyName, const ColorList& value, double time = TiMe::Default());
4896 bool setValue(const std::string& propertyName, const ColorList& value, double time = TiMe::Default());
4898 bool setValue(const char* propertyName, ColorList&& value, double time = TiMe::Default());
4900 bool setValue(const std::string& propertyName, ColorList&& value, double time = TiMe::Default());
4901
4904 bool setValue(const char* propertyName, const TransformList& value, double time = TiMe::Default());
4906 bool setValue(const std::string& propertyName, const TransformList& value, double time = TiMe::Default());
4907
4910 bool setValue(const char* propertyName, const StringList& value, double time = TiMe::Default());
4912 bool setValue(const std::string& propertyName, const StringList& value, double time = TiMe::Default());
4913
4916 bool setValue(const char* propertyName, const PluginList& value, double time = TiMe::Default());
4918 bool setValue(const std::string& propertyName, const PluginList& value, double time = TiMe::Default());
4919
4922 bool setArray(const char* propertyName, const int data[], size_t count, double time = TiMe::Default());
4924 bool setArray(const std::string& propertyName, const int data[], size_t count, double time = TiMe::Default());
4925
4929 bool setArray(const char* propertyName, const float data[], size_t count, double time = TiMe::Default());
4931 bool setArray(const std::string& propertyName, const float data[], size_t count, double time = TiMe::Default());
4932
4937 bool setArray(const char* propertyName, const double data[], size_t count, double time = TiMe::Default());
4939 bool setArray(const std::string& propertyName, const double data[], size_t count, double time = TiMe::Default());
4940
4943 bool setArray(const char* propertyName, const Vector data[], size_t count, double time = TiMe::Default());
4945 bool setArray(const std::string& propertyName, const Vector data[], size_t count, double time = TiMe::Default());
4946
4949 bool setArray(const char* propertyName, const Color data[], size_t count, double time = TiMe::Default());
4951 bool setArray(const std::string& propertyName, const Color data[], size_t count, double time = TiMe::Default());
4952
4955 bool setArray(const char* propertyName, const Transform data[], size_t count, double time = TiMe::Default());
4957 bool setArray(const std::string& propertyName, const Transform data[], size_t count, double time = TiMe::Default());
4958
4961 bool setArray(const char* propertyName, const std::string data[], size_t count, double time = TiMe::Default());
4963 bool setArray(const std::string& propertyName, const std::string data[], size_t count, double time = TiMe::Default());
4965 bool setArray(const char* propertyName, const char* const data[], size_t count, double time = TiMe::Default());
4967 bool setArray(const std::string& propertyName, const char* const data[], size_t count, double time = TiMe::Default());
4968
4971 bool setArray(const char* propertyName, const Plugin plugins[], size_t count, double time = TiMe::Default());
4973 bool setArray(const std::string& propertyName, const Plugin plugins[], size_t count, double time = TiMe::Default());
4974
4977 bool setArray(const char* propertyName, const Value values[], size_t count, double time = TiMe::Default());
4979 bool setArray(const std::string& propertyName, const Value values[], size_t count, double time = TiMe::Default());
4980
4984 bool setArray(const char* propertyName, Value valuesToMove[], size_t count, double time = TiMe::Default());
4986 bool setArray(const std::string& propertyName, Value valuesToMove[], size_t count, double time = TiMe::Default());
4987
4991 bool setValue(const char* propertyName, const void* data, size_t size, double time = TiMe::Default());
4993 bool setValue(const std::string& propertyName, const void* data, size_t size, double time = TiMe::Default());
4994
4995 friend std::ostream& operator <<(std::ostream& stream, const Plugin& plugin);
4996
4997#ifdef VRAY_SDK_INTEROPERABILITY
4998 bool setValueAsStringAtTime(const char* propertyName, const char* value, double time);
4999 bool setValueAsStringAtTime(const char* propertyName, const std::string& value, double time);
5000 bool setValueAsStringAtTime(const std::string& propertyName, const char* value, double time);
5001 bool setValueAsStringAtTime(const std::string& propertyName, const std::string& value, double time);
5002 bool setValueAtTime(const char* propertyName, const bool value, double time);
5003 bool setValueAtTime(const std::string& propertyName, const bool value, double time);
5004 bool setValueAtTime(const char* propertyName, const int value, double time);
5005 bool setValueAtTime(const std::string& propertyName, const int value, double time);
5006 bool setValueAtTime(const char* propertyName, const float value, double time);
5007 bool setValueAtTime(const std::string& propertyName, const float value, double time);
5008 bool setValueAtTime(const char* propertyName, const double value, double time);
5009 bool setValueAtTime(const std::string& propertyName, const double value, double time);
5010 bool setValueAtTime(const char* propertyName, const Color& value, double time);
5011 bool setValueAtTime(const std::string& propertyName, const Color& value, double time);
5012 bool setValueAtTime(const char* propertyName, const AColor& value, double time);
5013 bool setValueAtTime(const std::string& propertyName, const AColor& value, double time);
5014 bool setValueAtTime(const char* propertyName, const Vector& value, double time);
5015 bool setValueAtTime(const std::string& propertyName, const Vector& value, double time);
5016 bool setValueAtTime(const char* propertyName, const Matrix& value, double time);
5017 bool setValueAtTime(const std::string& propertyName, const Matrix& value, double time);
5018 bool setValueAtTime(const char* propertyName, const Transform& transform, double time);
5019 bool setValueAtTime(const std::string& propertyName, const Transform& transform, double time);
5020 bool setValueAtTime(const char* propertyName, const PluginRefT<Plugin>& pluginRef, double time);
5021 bool setValueAtTime(const std::string& propertyName, const PluginRefT<Plugin>& pluginRef, double time);
5022 bool setValueAtTime(const char* propertyName, const char* str, double time);
5023 bool setValueAtTime(const std::string& propertyName, const char* str, double time);
5024 bool setValueAtTime(const char* propertyName, const std::string& str, double time);
5025 bool setValueAtTime(const std::string& propertyName, const std::string& str, double time);
5026 bool setValueAtTime(const char* propertyName, const Value& value, double time);
5027 bool setValueAtTime(const std::string& propertyName, const Value& value, double time);
5028 bool setValueAtTime(const char* propertyName, const ValueList& value, double time);
5029 bool setValueAtTime(const std::string& propertyName, const ValueList& value, double time);
5030 bool setValueAtTime(const char* propertyName, const IntList& value, double time);
5031 bool setValueAtTime(const std::string& propertyName, const IntList& value, double time);
5032 bool setValueAtTime(const char* propertyName, const FloatList& value, double time);
5033 bool setValueAtTime(const std::string& propertyName, const FloatList& value, double time);
5034 bool setValueAtTime(const char* propertyName, const VectorList& value, double time);
5035 bool setValueAtTime(const std::string& propertyName, const VectorList& value, double time);
5036 bool setValueAtTime(const char* propertyName, const ColorList& value, double time);
5037 bool setValueAtTime(const std::string& propertyName, const ColorList& value, double time);
5038 bool setValueAtTime(const char* propertyName, const PluginList& value, double time);
5039 bool setValueAtTime(const std::string& propertyName, const PluginList& value, double time);
5040 bool setValueAtTime(const char* propertyName, const StringList& value, double time);
5041 bool setValueAtTime(const std::string& propertyName, const StringList& value, double time);
5042 bool setArrayAtTime(const char* propertyName, const int data[], size_t count, double time);
5043 bool setArrayAtTime(const std::string& propertyName, const int data[], size_t count, double time);
5044 bool setArrayAtTime(const char* propertyName, const float data[], size_t count, double time);
5045 bool setArrayAtTime(const std::string& propertyName, const float data[], size_t count, double time);
5046 bool setArrayAtTime(const char* propertyName, const double data[], size_t count, double time);
5047 bool setArrayAtTime(const std::string& propertyName, const double data[], size_t count, double time);
5048 bool setArrayAtTime(const char* propertyName, const Vector data[], size_t count, double time);
5049 bool setArrayAtTime(const std::string& propertyName, const Vector data[], size_t count, double time);
5050 bool setArrayAtTime(const char* propertyName, const Color data[], size_t count, double time);
5051 bool setArrayAtTime(const std::string& propertyName, const Color data[], size_t count, double time);
5052 bool setArrayAtTime(const char* propertyName, const Plugin data[], size_t count, double time);
5053 bool setArrayAtTime(const std::string& propertyName, const Plugin data[], size_t count, double time);
5054 bool setArrayAtTime(const char* propertyName, const std::string data[], size_t count, double time);
5055 bool setArrayAtTime(const std::string& propertyName, const std::string data[], size_t count, double time);
5056 bool setValueAtTime(const char* propertyName, const void* data, size_t size, double time);
5057 bool setValueAtTime(const std::string& propertyName, const void* data, size_t size, double time);
5058
5059
5060 VUtils::IntRefList getIntRefList(const char* propertyName);
5061 VUtils::IntRefList getIntRefList(const char* propertyName, bool& ok);
5062 VUtils::IntRefList getIntRefListAtTime(const char* propertyName, double time);
5063 VUtils::IntRefList getIntRefListAtTime(const char* propertyName, double time, bool& ok);
5064 VUtils::IntRefList getIntRefList(const std::string& propertyName);
5065 VUtils::IntRefList getIntRefList(const std::string& propertyName, bool& ok);
5066 VUtils::IntRefList getIntRefListAtTime(const std::string& propertyName, double time);
5067 VUtils::IntRefList getIntRefListAtTime(const std::string& propertyName, double time, bool& ok);
5068
5069 VUtils::FloatRefList getFloatRefList(const char* propertyName);
5070 VUtils::FloatRefList getFloatRefList(const char* propertyName, bool& ok);
5071 VUtils::FloatRefList getFloatRefListAtTime(const char* propertyName, double time);
5072 VUtils::FloatRefList getFloatRefListAtTime(const char* propertyName, double time, bool& ok);
5073 VUtils::FloatRefList getFloatRefList(const std::string& propertyName);
5074 VUtils::FloatRefList getFloatRefList(const std::string& propertyName, bool& ok);
5075 VUtils::FloatRefList getFloatRefListAtTime(const std::string& propertyName, double time);
5076 VUtils::FloatRefList getFloatRefListAtTime(const std::string& propertyName, double time, bool& ok);
5077
5078 VUtils::VectorRefList getVectorRefList(const char* propertyName);
5079 VUtils::VectorRefList getVectorRefList(const char* propertyName, bool& ok);
5080 VUtils::VectorRefList getVectorRefListAtTime(const char* propertyName, double time);
5081 VUtils::VectorRefList getVectorRefListAtTime(const char* propertyName, double time, bool& ok);
5082 VUtils::VectorRefList getVectorRefList(const std::string& propertyName);
5083 VUtils::VectorRefList getVectorRefList(const std::string& propertyName, bool& ok);
5084 VUtils::VectorRefList getVectorRefListAtTime(const std::string& propertyName, double time);
5085 VUtils::VectorRefList getVectorRefListAtTime(const std::string& propertyName, double time, bool& ok);
5086
5087 VUtils::ColorRefList getColorRefList(const char* propertyName);
5088 VUtils::ColorRefList getColorRefList(const char* propertyName, bool& ok);
5089 VUtils::ColorRefList getColorRefListAtTime(const char* propertyName, double time);
5090 VUtils::ColorRefList getColorRefListAtTime(const char* propertyName, double time, bool& ok);
5091 VUtils::ColorRefList getColorRefList(const std::string& propertyName);
5092 VUtils::ColorRefList getColorRefList(const std::string& propertyName, bool& ok);
5093 VUtils::ColorRefList getColorRefListAtTime(const std::string& propertyName, double time);
5094 VUtils::ColorRefList getColorRefListAtTime(const std::string& propertyName, double time, bool& ok);
5095
5096 VUtils::ValueRefList getValueRefList(const char* propertyName);
5097 VUtils::ValueRefList getValueRefList(const char* propertyName, bool& ok);
5098 VUtils::ValueRefList getValueRefListAtTime(const char* propertyName, double time);
5099 VUtils::ValueRefList getValueRefListAtTime(const char* propertyName, double time, bool& ok);
5100 VUtils::ValueRefList getValueRefList(const std::string& propertyName);
5101 VUtils::ValueRefList getValueRefList(const std::string& propertyName, bool& ok);
5102 VUtils::ValueRefList getValueRefListAtTime(const std::string& propertyName, double time);
5103 VUtils::ValueRefList getValueRefListAtTime(const std::string& propertyName, double time, bool& ok);
5104
5105 VUtils::CharStringRefList getStringRefList(const char* propertyName);
5106 VUtils::CharStringRefList getStringRefList(const char* propertyName, bool& ok);
5107 VUtils::CharStringRefList getStringRefListAtTime(const char* propertyName, double time);
5108 VUtils::CharStringRefList getStringRefListAtTime(const char* propertyName, double time, bool& ok);
5109 VUtils::CharStringRefList getStringRefList(const std::string& propertyName);
5110 VUtils::CharStringRefList getStringRefList(const std::string& propertyName, bool& ok);
5111 VUtils::CharStringRefList getStringRefListAtTime(const std::string& propertyName, double time);
5112 VUtils::CharStringRefList getStringRefListAtTime(const std::string& propertyName, double time, bool& ok);
5113
5114 VUtils::CharString getCharString(const char* propertyName);
5115 VUtils::CharString getCharString(const char* propertyName, bool& ok);
5116 VUtils::CharString getCharStringAtTime(const char* propertyName, double time);
5117 VUtils::CharString getCharStringAtTime(const char* propertyName, double time, bool& ok);
5118 VUtils::CharString getCharString(const std::string& propertyName);
5119 VUtils::CharString getCharString(const std::string& propertyName, bool& ok);
5120 VUtils::CharString getCharStringAtTime(const std::string& propertyName, double time);
5121 VUtils::CharString getCharStringAtTime(const std::string& propertyName, double time, bool& ok);
5122
5123 bool setValue(const char* propertyName, const VUtils::IntRefList& intList);
5124 bool setValueAtTime(const char* propertyName, const VUtils::IntRefList& intList, double time);
5125 bool setValue(const std::string& propertyName, const VUtils::IntRefList& intList);
5126 bool setValueAtTime(const std::string& propertyName, const VUtils::IntRefList& intList, double time);
5127
5128 bool setValue(const char* propertyName, const VUtils::FloatRefList& floatList);
5129 bool setValueAtTime(const char* propertyName, const VUtils::FloatRefList& floatList, double time);
5130 bool setValue(const std::string& propertyName, const VUtils::FloatRefList& floatList);
5131 bool setValueAtTime(const std::string& propertyName, const VUtils::FloatRefList& floatList, double time);
5132
5133 bool setValue(const char* propertyName, const VUtils::VectorRefList& vectorList);
5134 bool setValueAtTime(const char* propertyName, const VUtils::VectorRefList& vectorList, double time);
5135 bool setValue(const std::string& propertyName, const VUtils::VectorRefList& vectorList);
5136 bool setValueAtTime(const std::string& propertyName, const VUtils::VectorRefList& vectorList, double time);
5137
5138 bool setValue(const char* propertyName, const VUtils::ColorRefList& colorList);
5139 bool setValueAtTime(const char* propertyName, const VUtils::ColorRefList& colorList, double time);
5140 bool setValue(const std::string& propertyName, const VUtils::ColorRefList& colorList);
5141 bool setValueAtTime(const std::string& propertyName, const VUtils::ColorRefList& colorList, double time);
5142
5143 bool setValue(const char* propertyName, const VUtils::TransformRefList& transformList);
5144 bool setValueAtTime(const char* propertyName, const VUtils::TransformRefList& transformList, double time);
5145 bool setValue(const std::string& propertyName, const VUtils::TransformRefList& transformList);
5146 bool setValueAtTime(const std::string& propertyName, const VUtils::TransformRefList& transformList, double time);
5147
5148 bool setValue(const char* propertyName, const VUtils::CharStringRefList& stringList);
5149 bool setValueAtTime(const char* propertyName, const VUtils::CharStringRefList& stringList, double time);
5150 bool setValue(const std::string& propertyName, const VUtils::CharStringRefList& stringList);
5151 bool setValueAtTime(const std::string& propertyName, const VUtils::CharStringRefList& stringList, double time);
5152
5153 bool setValue(const char* propertyName, const VUtils::ValueRefList& valueList);
5154 bool setValueAtTime(const char* propertyName, const VUtils::ValueRefList& valueList, double time);
5155 bool setValue(const std::string& propertyName, const VUtils::ValueRefList& valueList);
5156 bool setValueAtTime(const std::string& propertyName, const VUtils::ValueRefList& valueList, double time);
5157
5158 bool setValue(const char* propertyName, const VUtils::CharString& str);
5159 bool setValueAtTime(const char* propertyName, const VUtils::CharString& str, double time);
5160 bool setValue(const std::string& propertyName, const VUtils::CharString& str);
5161 bool setValueAtTime(const std::string& propertyName, const VUtils::CharString& str, double time);
5162#endif // VRAY_SDK_INTEROPERABILITY
5163 };
5164
5167 template<>
5168 class PluginRefT<Plugin> : public Plugin {
5169 friend class VRayRenderer;
5170 template<class T> friend class PluginRefT;
5171 friend class Value;
5172 friend class Internal::BinaryValueBuilder;
5173 friend class UVTextureSampler;
5174
5175 int outPropIdx;
5176
5177 protected:
5178 PluginRefT(VRayRenderer& renderer, InstanceId id, const char* outPropertyName);
5179 PluginRefT(VRayRenderer& renderer, InstanceId id, int outPropertyIndex) noexcept;
5180
5181 int getOutputIndex() const noexcept { return outPropIdx; }
5182
5183 public:
5185 PluginRefT() noexcept : outPropIdx(0) {}
5186
5188 PluginRefT(const Plugin &plugin) noexcept : Plugin(plugin), outPropIdx(0) {}
5189
5191 PluginRefT(const PluginRefT &plugin) noexcept : Plugin(plugin), outPropIdx(plugin.outPropIdx) {}
5192
5194 template<class T>
5195 PluginRefT(const PluginRefT<T> &plugin) noexcept : Plugin(plugin), outPropIdx(plugin.outPropIdx) {}
5196
5198 PluginRefT(const Plugin &plugin, const char* outPropertyName);
5199
5201 template<class T>
5202 PluginRefT& operator=(const PluginRefT<T> &plugin) noexcept;
5203
5205 template<class T>
5206 bool operator==(const PluginRefT<T> &plugin) const noexcept;
5207
5209 bool operator==(const Plugin &plugin) const noexcept;
5210
5212 void swap(PluginRefT &plugin) noexcept;
5213
5215 bool isOutputValid() const noexcept {
5216 return outPropIdx >= 0;
5217 }
5218
5221 const char* getOutputName() const;
5222
5224 std::string toString() const;
5225
5226 friend std::ostream& operator <<(std::ostream& stream, const PluginRefT& pluginRef);
5227 };
5228
5230
5240 template<class T>
5241 class PluginRefT : public T {
5242 friend class VRayRenderer;
5243 friend class PluginRefT<Plugin>;
5244
5245 int outPropIdx;
5246
5247 PluginRefT(VRayRenderer& renderer, InstanceId id, const char* outPropertyName);
5248
5249 public:
5251 PluginRefT() noexcept : outPropIdx(0) {}
5252
5254 PluginRefT(const T &plugin) noexcept : T(plugin), outPropIdx(0) {}
5255
5257 PluginRefT(const PluginRefT &plugin) noexcept : T(plugin), outPropIdx(plugin.outPropIdx) {}
5258
5260 PluginRefT(const T &plugin, const char* outPropertyName);
5261
5262 template<class X>
5263 PluginRefT(const PluginRefT<X> &plugin) noexcept : T(static_cast<X>(plugin)), outPropIdx(static_cast<PluginRef>(plugin).outPropIdx) {}
5264
5265 template<class X>
5266 PluginRefT(const X &plugin) noexcept : T(static_cast<X>(plugin)), outPropIdx(0) {}
5267
5269 PluginRefT& operator=(const PluginRefT &plugin) noexcept;
5270
5272 bool operator==(const PluginRefT &plugin) const noexcept;
5273
5275 bool operator==(const PluginRefT<Plugin> &plugin) const noexcept;
5276
5278 bool operator==(const Plugin &plugin) const noexcept;
5279
5281 void swap(PluginRefT &plugin) noexcept;
5282
5284 bool isOutputValid() const noexcept {
5285 return outPropIdx >= 0;
5286 }
5287
5290 const char* getOutputName() const;
5291
5293 std::string toString() const;
5294
5295 template<class U>
5296 friend std::ostream& operator <<(std::ostream& stream, const PluginRefT<U>& pluginRef);
5297 };
5298
5300 class Value {
5301 friend class Internal::BinaryValueParser;
5302 friend class Internal::BinaryValueBuilder;
5303 friend struct Internal::MeshFileDataParser;
5304 friend std::ostream& operator<<(std::ostream& stream, const Value& value);
5305
5306 protected:
5307 union {
5308 char val[VRAY_MAXIMUM4(sizeof(Transform), sizeof(std::string), sizeof(ValueList), sizeof(PluginRef))];
5309 void* alignment;
5310 };
5311 Type type;
5312
5313 explicit Value(Type type) noexcept;
5314
5315 void copyValue(const Value& value);
5316 void moveValue(Value&& value) noexcept;
5317 void swapValue(Value& value) noexcept;
5318 void destroyValue() noexcept;
5319 template<typename T, Type TYPE> void constructOnly_() noexcept;
5320 template<typename T, Type TYPE> void constructListWithIterators_(const T* first, const T* last);
5321 template<typename T, Type TYPE, bool noExcept> void constructWithValue_(T&& value) noexcept(noExcept);
5322 template<typename T, Type TYPE> void setToValue_(T&& value);
5323 template<typename T> T& interpretAs_();
5324 template<typename T> const T& interpretAs_() const;
5325 template<typename T, Type TYPE> T& viewAs_();
5326 template<typename T, Type TYPE> const T& viewAs_() const;
5327 template<typename T, Type TYPE> T getValue_() const;
5328 Value(VRayRenderer* renderer, InstanceId id, int outIdx) noexcept;
5329
5330 public:
5332 Value() noexcept;
5333
5334 Value(const Value& value);
5335 Value(Value&& value) noexcept;
5336
5337 explicit Value(int value) noexcept;
5338 explicit Value(float value) noexcept;
5339 explicit Value(double value) noexcept;
5340 explicit Value(bool value) noexcept;
5341 explicit Value(const Color& value) noexcept;
5342 explicit Value(const AColor& value) noexcept;
5343 explicit Value(const Vector& value) noexcept;
5344 explicit Value(const Matrix& value) noexcept;
5345 explicit Value(const Transform& value) noexcept;
5346 explicit Value(const IntList& value);
5347 explicit Value(IntList&& value) noexcept;
5348 explicit Value(const FloatList& value);
5349 explicit Value(FloatList&& value) noexcept;
5350 explicit Value(const VectorList& value);
5351 explicit Value(VectorList&& value) noexcept;
5352 explicit Value(const ColorList& value);
5353 explicit Value(ColorList&& value) noexcept;
5354 explicit Value(TransformList&& value) noexcept;
5355 explicit Value(const TransformList& value);
5356 explicit Value(const ValueList& value);
5357 explicit Value(ValueList&& value) noexcept;
5358 explicit Value(const StringList& value);
5359 explicit Value(StringList&& value) noexcept;
5360 explicit Value(const PluginList& value);
5361 explicit Value(PluginList&& value) noexcept;
5362 explicit Value(const char* value);
5363 explicit Value(const std::string& value);
5364 explicit Value(std::string&& value) noexcept;
5365 explicit Value(const PluginRef& value) noexcept;
5366 Value(const int* values, size_t count);
5367 Value(const float* values, size_t count);
5368 Value(const Vector* values, size_t count);
5369 Value(const Color* values, size_t count);
5370 Value(const Transform* values, size_t count);
5371 Value(const Plugin* values, size_t count);
5372 Value(const Value* values, size_t count);
5373 template<size_t count> explicit Value(const int(&arr)[count]);
5374 template<size_t count> explicit Value(const float(&arr)[count]);
5375 template<size_t count> explicit Value(const Vector(&arr)[count]);
5376 template<size_t count> explicit Value(const Color(&arr)[count]);
5377 template<size_t count> explicit Value(const Transform(&arr)[count]);
5378 template<size_t count> explicit Value(const Plugin(&arr)[count]);
5379 template<size_t count> explicit Value(const Value(&arr)[count]);
5380 template<size_t count> explicit Value(Value(&&arr)[count]);
5381
5383 static Value Unspecified() noexcept;
5384
5385 ~Value() noexcept;
5386
5387 void swap(Value& value) noexcept;
5388
5389 Value& operator=(const Value& value);
5390 Value& operator=(Value&& value) noexcept;
5391 bool operator==(const Value& value) const noexcept;
5392 bool operator!=(const Value& value) const noexcept;
5393
5395 Type getType() const noexcept;
5396
5398 size_t getCount() const;
5399
5401 bool isList() const;
5402
5404 void set(int value);
5405
5407 void set(float value);
5408
5410 void set(double value);
5411
5413 void set(bool value);
5414
5416 void set(const Color& value);
5417
5419 void set(const AColor& value);
5420
5422 void set(const Vector& value);
5423
5425 void set(const Matrix& value);
5426
5428 void set(const Transform& value);
5429
5431 void set(const Plugin& value);
5432
5434 void set(const PluginRef& value);
5435
5437 void set(const char* value);
5438
5440 void set(const std::string& value);
5441
5443 void set(std::string&& value);
5444
5446 void set(const IntList& value);
5447
5449 void set(IntList&& value);
5450
5452 void set(const FloatList& value);
5453
5455 void set(FloatList&& value);
5456
5458 void set(const ColorList& value);
5459
5461 void set(ColorList&& value);
5462
5464 void set(const VectorList& value);
5465
5467 void set(VectorList&& value);
5468
5470 void set(const TransformList& value);
5471
5473 void set(TransformList&& value);
5474
5476 void set(const ValueList& value);
5477
5479 void set(ValueList&& value);
5480
5482 void set(const StringList& value);
5483
5485 void set(StringList&& value);
5486
5488 void set(const PluginList& value);
5489
5491 void set(PluginList&& value);
5492
5494 void set(const int* values, size_t count);
5495
5497 void set(const float* values, size_t count);
5498
5500 void set(const Vector* values, size_t count);
5501
5503 void set(const Color* values, size_t count);
5504
5506 void set(const Transform* values, size_t count);
5507
5509 void set(const std::string* values, size_t count);
5510
5513 template<typename T> T& as();
5514
5517 template<typename T> const T& as() const;
5518
5522 template<typename T> T get() const;
5523
5525 int getInt() const;
5526
5528 float getFloat() const;
5529
5531 double getDouble() const;
5532
5534 bool getBool() const;
5535
5538
5541
5544
5547
5550
5553 IntList getIntList() const;
5554
5557 FloatList getFloatList() const;
5558
5561 ColorList getColorList() const;
5562
5565 VectorList getVectorList() const;
5566
5569 TransformList getTransformList() const;
5570
5573 ValueList getValueList() const;
5574
5577 StringList getStringList() const;
5578
5581 PluginList getPluginList() const;
5582
5584 std::string getString() const;
5585
5588
5591
5594 Value& operator[](int i);
5595
5598 const Value operator[](int i) const;
5599
5601 bool isOK() const;
5602
5604 bool isBad() const;
5605
5607 const char* getStringType() const;
5608
5610 std::string toString() const;
5611
5612 private:
5614 std::ostream& toString(std::ostream& stream) const;
5615 };
5616
5617 std::ostream& operator <<(std::ostream& stream, const IntList& list);
5618 std::ostream& operator <<(std::ostream& stream, const FloatList& list);
5619 std::ostream& operator <<(std::ostream& stream, const VectorList& list);
5620 std::ostream& operator <<(std::ostream& stream, const ColorList& list);
5621 std::ostream& operator <<(std::ostream& stream, const TransformList& list);
5622 std::ostream& operator <<(std::ostream& stream, const ValueList& list);
5623 std::ostream& operator <<(std::ostream& stream, const StringList& list);
5624 std::ostream& operator <<(std::ostream& stream, const PluginList& list);
5625 std::ostream& operator <<(std::ostream& stream, const Value& value);
5626
5638
5647
5649 std::vector<SubFileInfo> subFileInfos;
5650
5652 std::vector<Plugin> pluginExportList;
5653
5655 std::vector<std::string> additionalIncludeFiles;
5656
5658 std::string hostAppString;
5659
5666
5670 std::string sceneBasePath;
5673
5675 : compressed(true)
5676 , hexArrays(true)
5677 , hexTransforms(false)
5678 , renderElementsSeparateFolders(false)
5679 , printHeader(true)
5680 , currentFrameOnly(false)
5681 , incremental(false)
5682 , appendFrameSuffix(false)
5683 , stripPaths(false)
5684 , leftInterval(0.0)
5685 , rightInterval(0.0)
5686 , vrdataExport(false)
5687 , vrdataSmallBufferSizeLimit(2048)
5688 , vrdataFileSizeLimitMiB(0)
5689 , vrfilesExport(false)
5690 , vrfilesComputeHashes(false)
5691 {}
5692 };
5693
5696 ValueList vertices;
5697 ValueList faces;
5698 ValueList normals;
5699 ValueList faceNormals;
5700 ValueList velocities;
5701 ValueList faceMtlIDs;
5702 ValueList mapChannels;
5703 ValueList mapChNames;
5704 ValueList shaderNames;
5705 ValueList edgeVisibility;
5706 ValueList hairVertices;
5708 ValueList hairWidths;
5710 ValueList particleWidths;
5711 };
5712
5715 Plugin plugin;
5716 double distance;
5717 int mtlID;
5718 };
5719
5720 enum VFBMenuItemType {
5721 normal,
5722 checkbox
5723 };
5724
5727 int id;
5728 VFBMenuItemType type;
5730 bool enabled;
5731 std::string text;
5732 };
5733
5735 // Crop region
5742
5743 // Image size
5746
5747 // Render region
5752
5753 enum RenderSizesBitmask {
5754 RS_NONE = 0,
5755 RS_IMG_SIZE = 1 << 0,
5756 RS_RENDER_RGN = 1 << 1,
5757 RS_CROP_RGN = 1 << 2
5758 };
5760 };
5761
5763 Plugin plugin;
5766 bool enabled;
5767 mutable bool isApplied;
5768 };
5769
5770 namespace Util {
5771 enum ReasonsForAutoRename {
5773 NO_AUTO_RENAME = 0,
5776 NO_OVERWRITE_NO_EXISTING_PLUGIN_BUT_INVALID_PLUGIN_NAME,
5779 NO_OVERWRITE_BUT_EXISTING_PLUGIN_WITH_NAME,
5782 OVERWRITE_EXISTING_PLUGIN_WITH_NAME_BUT_DIFFERENT_TYPE
5783 };
5784
5789 std::string name;
5790
5795
5799
5806
5808 this->skipOnlyCurrentPlugin = false;
5809 this->skipAllSuccessorsOfCurrentPlugin = false;
5810 this->overwriteExistingPlugin = false;
5811 }
5812
5813 PreCreateCallbackOptions(const char* name, const bool skipOnlyCurrentPlugin = false, const bool skipAllSuccessorsOfCurrentPlugin = false, const bool overwriteExistingPlugin = false) {
5814 if (name) {
5815 this->name = name;
5816 }
5817 this->skipOnlyCurrentPlugin = skipOnlyCurrentPlugin;
5818 this->skipAllSuccessorsOfCurrentPlugin = skipAllSuccessorsOfCurrentPlugin;
5819 this->overwriteExistingPlugin = overwriteExistingPlugin;
5820 }
5821
5822 PreCreateCallbackOptions(const std::string& name, const bool skipOnlyCurrentPlugin = false, const bool skipAllSuccessorsOfCurrentPlugin = false, const bool overwriteExistingPlugin = false) {
5823 if (!name.empty()) {
5824 this->name = name;
5825 }
5826 this->skipOnlyCurrentPlugin = skipOnlyCurrentPlugin;
5827 this->skipAllSuccessorsOfCurrentPlugin = skipAllSuccessorsOfCurrentPlugin;
5828 this->overwriteExistingPlugin = overwriteExistingPlugin;
5829 }
5830 };
5831
5864 int copyPlugins(
5865 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5866 const std::vector<Plugin>& includeListOfPlugins, const std::vector<Plugin>& excludeListOfPlugins,
5867 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5868 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
5869 const void* userData = nullptr);
5870
5902 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5903 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
5904 int copyPlugins(
5905 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5906 const std::vector<Plugin>& includeListOfPlugins, const std::vector<Plugin>& excludeListOfPlugins,
5907 T& obj,
5908 const void* userData = nullptr);
5909
5935 int copyPlugins(
5936 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5937 const char* pluginType,
5938 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5939 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
5940 const void* userData = nullptr);
5941
5943 int copyPlugins(
5944 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5945 const std::string& pluginType,
5946 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5947 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
5948 const void* userData = nullptr);
5949
5951 int copyPlugins(
5952 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5953 const PluginTypeId& pluginTypeId,
5954 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5955 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
5956 const void* userData = nullptr);
5957
5959 template<class PluginType>
5960 int copyPlugins(
5961 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5962 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5963 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
5964 const void* userData = nullptr);
5965
5989 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5990 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
5991 int copyPlugins(
5992 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
5993 const char* pluginType,
5994 T& obj,
5995 const void* userData = nullptr);
5996
5998 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
5999 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6000 int copyPlugins(
6001 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6002 const std::string& pluginType,
6003 T& obj,
6004 const void* userData = nullptr);
6005
6007 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6008 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6009 int copyPlugins(
6010 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6011 const PluginTypeId& pluginTypeId,
6012 T& obj,
6013 const void* userData = nullptr);
6014
6016 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6017 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6018 class PluginType>
6019 int copyPlugins(
6020 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6021 T& obj,
6022 const void* userData = nullptr);
6023 }
6024
6036 friend class Plugin;
6037 template<class P> friend class PluginRefT;
6038 friend class PluginMeta;
6039 friend class PropertyMeta;
6040 friend class PropertyRuntimeMeta;
6041 friend class UIGuides;
6042 friend class RenderElement;
6043 friend class RenderElements;
6044 friend class LocalPng;
6045 friend class LocalJpeg;
6046 friend class LocalBmp;
6047 friend class Internal::Access;
6048
6049 friend int Util::copyPlugins(
6050 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6051 const std::vector<Plugin>& includeListOfPlugins, const std::vector<Plugin>& excludeListOfPlugins,
6052 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6053 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6054 const void* userData);
6055
6056 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6057 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6058 friend int Util::copyPlugins(
6059 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6060 const std::vector<Plugin>& includeListOfPlugins, const std::vector<Plugin>& excludeListOfPlugins,
6061 T& obj,
6062 const void* userData);
6063
6064 friend int Util::copyPlugins(
6065 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6066 const char* pluginType,
6067 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6068 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6069 const void* userData);
6070
6071 friend int Util::copyPlugins(
6072 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6073 const std::string& pluginType,
6074 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6075 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6076 const void* userData);
6077
6078 friend int Util::copyPlugins(
6079 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6080 const PluginTypeId& pluginTypeId,
6081 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6082 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6083 const void* userData);
6084
6085 template<class PluginType>
6086 friend int Util::copyPlugins(
6087 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6088 Util::PreCreateCallbackOptions(*preCreateCallback)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6089 void(*postCreateCallback)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6090 const void* userData);
6091
6092 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6093 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6094 friend int Util::copyPlugins(
6095 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6096 const char* pluginType,
6097 T& obj,
6098 const void* userData);
6099
6100 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6101 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6102 friend int Util::copyPlugins(
6103 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6104 const std::string& pluginType,
6105 T& obj,
6106 const void* userData);
6107
6108 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6109 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6110 friend int Util::copyPlugins(
6111 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6112 const PluginTypeId& pluginTypeId,
6113 T& obj,
6114 const void* userData);
6115
6116 template<class T, Util::PreCreateCallbackOptions(T::* TMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6117 void(T::* TMethod1)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*),
6118 class PluginType>
6119 friend int Util::copyPlugins(
6120 VRayRenderer& srcRenderer, VRayRenderer& dstRenderer,
6121 T& obj,
6122 const void* userData);
6123
6124 // We need to keep these methods private and they need also access to protected renderer methods
6125 static void pluginCopyParamsPreCreateCallback(const InstanceId srcPluginID, Internal::PreCreateCallbackOptions* opts, void* info);
6126 static void pluginCopyParamsPostCreateCallback(
6127 const InstanceId dstPluginID, const char* srcPluginName,
6128 Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName,
6129 void* info);
6130
6131 class PluginCopyParamsCreateDelegate {
6132 typedef Util::PreCreateCallbackOptions(*tstubPre)(void* pobject, VRayRenderer& dstRenderer, Plugin& srcPlugin, void* userObj);
6133 typedef Util::PreCreateCallbackOptions(*tfuncPre)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void* userObj);
6134
6135 typedef void (*tstubPost)(void* pobject, Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void* userObj);
6136 typedef void (*tfuncPost)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void* userObj);
6137
6138 void* pobject;
6139 union tmethodPre {
6140 tstubPre pstubPre;
6141 tfuncPre pfuncPre;
6142 tmethodPre() : pstubPre() {}
6143 tmethodPre(tstubPre pstubPre) : pstubPre(pstubPre) {}
6144 tmethodPre(tfuncPre pfuncPre) : pfuncPre(pfuncPre) {}
6145 } pmethodPre;
6146
6147 union tmethodPost {
6148 tstubPost pstubPost;
6149 tfuncPost pfuncPost;
6150 tmethodPost() : pstubPost() {}
6151 tmethodPost(tstubPost pstubPost) : pstubPost(pstubPost) {}
6152 tmethodPost(tfuncPost pfuncPost) : pfuncPost(pfuncPost) {}
6153 } pmethodPost;
6154
6155 void* puserObj;
6156 VRayRenderer* srcRenderer;
6157 VRayRenderer* dstRenderer;
6158
6159 template <class T, Util::PreCreateCallbackOptions(T::* PreCreateTMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void* puserObj)>
6160 static Util::PreCreateCallbackOptions method_stubPre(void* pobject, VRayRenderer& dstRenderer, Plugin& srcPlugin, void* puserObj) {
6161 T* p = static_cast<T*>(pobject);
6162 return (p->*PreCreateTMethod)(dstRenderer, srcPlugin, puserObj);
6163 }
6164
6165 template <class T, void(T::* PostCreateTMethod)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void* puserObj)>
6166 static void method_stubPost(void* pobject, Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void* puserObj) {
6167 T* p = static_cast<T*>(pobject);
6168 (p->*PostCreateTMethod)(dstPlugin, srcPluginName, autoRenamedResult, preCreateCallbackReturnedName, puserObj);
6169 }
6170
6171 PluginCopyParamsCreateDelegate(tfuncPre pfuncPre, tfuncPost pfuncPost, void* puserObj, VRayRenderer* srcRenderer, VRayRenderer* dstRenderer) :
6172 pobject(), pmethodPre(pfuncPre), pmethodPost(pfuncPost), puserObj(puserObj), srcRenderer(srcRenderer), dstRenderer(dstRenderer) {}
6173 PluginCopyParamsCreateDelegate(void* pobject, tstubPre pstubPre, tstubPost pstubPost, void* puserObj, VRayRenderer* srcRenderer, VRayRenderer* dstRenderer) :
6174 pobject(pobject), pmethodPre(pstubPre), pmethodPost(pstubPost), puserObj(puserObj), srcRenderer(srcRenderer), dstRenderer(dstRenderer) {}
6175
6176 public:
6177 template <class T, Util::PreCreateCallbackOptions(T::* PreCreateTMethod)(VRayRenderer& dstRenderer, Plugin& srcPlugin, void*),
6178 void(T::* PostCreateTMethod)(Plugin& dstPlugin, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName, void*)>
6179 static PluginCopyParamsCreateDelegate from_method(T* pobject, void* puserObj, VRayRenderer* srcRenderer, VRayRenderer* dstRenderer) {
6180 return PluginCopyParamsCreateDelegate(pobject, &method_stubPre<T, PreCreateTMethod>, &method_stubPost<T, PostCreateTMethod>, puserObj, srcRenderer, dstRenderer);
6181 }
6182
6183 static PluginCopyParamsCreateDelegate from_function(tfuncPre pfuncPre, tfuncPost pfuncPost, void* puserObj, VRayRenderer* srcRenderer, VRayRenderer* dstRenderer) {
6184 return PluginCopyParamsCreateDelegate(pfuncPre, pfuncPost, puserObj, srcRenderer, dstRenderer);
6185 }
6186
6187 Util::PreCreateCallbackOptions operator()(const InstanceId& srcPluginID) const {
6188 Plugin srcPlugin = srcRenderer->getPlugin_internal(srcPluginID);
6189 return pobject ? (*pmethodPre.pstubPre)(pobject, *dstRenderer, srcPlugin, puserObj) : (*pmethodPre.pfuncPre)(*dstRenderer, srcPlugin, puserObj);
6190 }
6191
6192 void operator()(const InstanceId& dstPluginID, const char* srcPluginName, Util::ReasonsForAutoRename autoRenamedResult, const char* preCreateCallbackReturnedName) const {
6193 Plugin dstPlugin = dstRenderer->getPlugin_internal(dstPluginID);
6194 pobject ? (*pmethodPost.pstubPost)(pobject, dstPlugin, srcPluginName, autoRenamedResult, preCreateCallbackReturnedName, puserObj) :
6195 (*pmethodPost.pfuncPost)(dstPlugin, srcPluginName, autoRenamedResult, preCreateCallbackReturnedName, puserObj);
6196 }
6197 };
6198
6202 VRayRenderer(const VRayRenderer&);
6203 VRayRenderer& operator=(const VRayRenderer&);
6204
6205 class PluginFilterDelegate {
6206 typedef bool (*tstub)(void* pobject, VRayRenderer& renderer, const char* type, std::string& name, void* userObj);
6207 typedef bool (*tfunc)(VRayRenderer& renderer, const char* type, std::string& name, void* userObj);
6208
6209 void *pobject;
6210 union tmethod {
6211 tstub pstub;
6212 tfunc pfunc;
6213 tmethod() : pstub() {}
6214 tmethod(tstub pstub) : pstub(pstub) {}
6215 tmethod(tfunc pfunc) : pfunc(pfunc) {}
6216 } pmethod;
6217 void *puserObj;
6218 VRayRenderer &renderer;
6219
6220 template <class T, bool (T::*TMethod)(VRayRenderer&, const char* type, std::string& name, void* puserObj)>
6221 static bool method_stub(void* pobject, VRayRenderer& renderer, const char* type, std::string& name, void *puserObj) {
6222 T* p = static_cast<T*>(pobject);
6223 return (p->*TMethod)(renderer, type, name, puserObj);
6224 }
6225
6226 PluginFilterDelegate(tfunc pfunc, void *puserObj, VRayRenderer& renderer) : pobject(), pmethod(pfunc), puserObj(puserObj), renderer(renderer) {}
6227 PluginFilterDelegate(void *pobject, tstub pstub, void *puserObj, VRayRenderer& renderer) : pobject(pobject), pmethod(pstub), puserObj(puserObj), renderer(renderer) {}
6228
6229 public:
6230 template <class T, bool (T::*TMethod)(VRayRenderer&, const char*, std::string&, void*)>
6231 static PluginFilterDelegate from_method(T* pobject, void *puserObj, VRayRenderer& renderer) {
6232 return PluginFilterDelegate(pobject, &method_stub<T, TMethod>, puserObj, renderer);
6233 }
6234
6235 static PluginFilterDelegate from_function(tfunc pfunc, void *puserObj, VRayRenderer& renderer) {
6236 return PluginFilterDelegate(pfunc, puserObj, renderer);
6237 }
6238
6239 bool operator()(const char* type, std::string& name) const {
6240 return pobject ? (*pmethod.pstub)(pobject, renderer, type, name, puserObj) : (*pmethod.pfunc)(renderer, type, name, puserObj);
6241 }
6242 };
6243
6244 template<class T, void (T::*TMethod)(VRayRenderer&, RendererState oldState, RendererState newState, double instant, void* userData)>
6245 static void stateChangedCallbackT(const Internal::StateChangedParams* params);
6246 static void stateChangedCallback(const Internal::StateChangedParams* params);
6247
6248 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
6249 static void rendererCloseCallbackT(const Internal::CallbackParamsBase* params);
6250 static void rendererCloseCallback(const Internal::CallbackParamsBase* params);
6251
6252 template<class T, void (T::*TMethod)(VRayRenderer&, VRayImage* img, unsigned long long changeIndex, ImagePassType pass, double instant, void* userData)>
6253 static void progressiveImageUpdatedCallbackT(const Internal::ImageUpdatedParams* params);
6254 static void progressiveImageUpdatedCallback(const Internal::ImageUpdatedParams* params);
6255
6256 template<class T, void (T::*TMethod)(VRayRenderer& renderer, const char* msg, MessageLevel level, double instant, void* userData)>
6257 static void logMessageCallbackT(const Internal::LogMessageParams* params);
6258 static void logMessageCallback(const Internal::LogMessageParams* params);
6259
6260 template<class T, void (T::*TMethod)(VRayRenderer& renderer, const char* msg, int errorCode, LicenseUserStatus userStatus, double instant, void* userData)>
6261 static void licenseErrorCallbackT(const Internal::LicenseErrorParams* params);
6262 static void licenseErrorCallback(const Internal::LicenseErrorParams* params);
6263
6264 template<class T, void (T::*TMethod)(VRayRenderer& renderer, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData)>
6265 static void bucketInitCallbackT(const Internal::BucketInitParams* params);
6266 static void bucketInitCallback(const Internal::BucketInitParams* params);
6267
6268 template<class T, void (T::*TMethod)(VRayRenderer& renderer, int x, int y, const char* host, VRayImage* image, ImagePassType pass, double instant, void* userData)>
6269 static void bucketReadyCallbackT(const Internal::BucketReadyParams* params);
6270 template<class T, void (T::*TMethod)(VRayRenderer& renderer, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData)>
6271 static void bucketReadyCallback1T(const Internal::BucketReadyParams* params);
6272 static void bucketReadyCallback(const Internal::BucketReadyParams* params);
6273 static void bucketReadyCallback1(const Internal::BucketReadyParams* params);
6274
6275 template<class T, void (T::*TMethod)(VRayRenderer&, const char* msg, int elementNumber, int elementsCount, double instant, void* userData)>
6276 static void progressCallbackT(const Internal::ProgressParams* params);
6277 static void progressCallback(const Internal::ProgressParams* params);
6278
6279 template<class T, void (T::*TMethod)(VRayRenderer&, const char* propName, double instant, void* userData)>
6280 static void renderViewChangedCallbackT(const Internal::RenderViewChangedParams* params);
6281 static void renderViewChangedCallback(const Internal::RenderViewChangedParams* params);
6282
6283 template<class T, void (T::*TMethod)(VRayRenderer&, bool isRendering, double instant, void* userData)>
6284 static void vfbRenderLastCallbackT(const Internal::RenderLastParams* params);
6285 static void vfbRenderLastCallback(const Internal::RenderLastParams* params);
6286
6287 template<class T, void (T::*TMethod)(VRayRenderer&, const char* hostName, double instant, void* userData)>
6288 static void drHostConnectedCallbackT(const Internal::ConnectParams* params);
6289 static void drHostConnectedCallback(const Internal::ConnectParams* params);
6290
6291 template<class T, void(T::*TMethod)(VRayRenderer&, int commandId, int x, int y, void* userData)>
6292 static void vfbContextMenuSelectedCallbackT(const Internal::VFBContextMenuSelectedParams* params);
6293 static void vfbContextMenuSelectedCallback(const Internal::VFBContextMenuSelectedParams* params);
6294
6295 static char* pluginFilterCallback(const char* pluginType, const char* pluginName, void* userObject);
6296 static void deleteTempStringCallback(char*, size_t, std::string* str);
6297
6298
6299 template<class T, void(T::*TMethod)(VRayRenderer&, VRayImage* img, void* userData)>
6300 static void manualDenoiseCallbackT(VRayImage* img, void* info);
6301 static void manualDenoiseCallback(VRayImage* img, void* info);
6302
6303 template<class T, int(T::*TMethod)(VRayRenderer&, const std::vector<LightMixChange>& lightMixChanges, double instant, void* userData)>
6304 static int lightMixTransferToSceneCallbackT(Internal::LightMixCallbackParams* params);
6305 static int lightMixTransferToSceneCallback(Internal::LightMixCallbackParams* params);
6306 void transferToScenePreCallback(std::vector<LightMixChange>& changes, const Internal::LightMixCallbackParams* params);
6307 void transferToScenePostCallback(const std::vector<LightMixChange>& changes, Internal::LightMixCallbackParams* params);
6308
6309 template<class T, int(T::*TMethod)(VRayRenderer&, const std::vector<std::string>& fileList, double instant, void* userData)>
6310 static int uploadToCollaborationCallbackT(Internal::UploadToCollaborationParams* params);
6311 static int uploadToCollaborationCallback(Internal::UploadToCollaborationParams* params);
6312 void uploadToCollaborationPreCallback(std::vector<std::string>& fileList, const Internal::UploadToCollaborationParams* params);
6313
6314 template<class T, void (T::* TMethod)(VRayRenderer&, int enabled, int mode, int selectionLocked, double instant, void* userData)>
6315 static void debugShadingCallbackT(const Internal::DebugShadingCallbackParams* params);
6316 static void debugShadingCallback(const Internal::DebugShadingCallbackParams* params);
6317
6318 template<class T, void(T::*TMethod)(VRayRenderer&, const std::string &outputFile, int fileType, double instant, void* userData)>
6319 static void vrayProfilerWriteCallbackT(const Internal::VRayProfilerWriteParams* params);
6320 static void vrayProfilerWriteCallback(const Internal::VRayProfilerWriteParams* params);
6321
6322 template<class T, bool (T::*TMethod)(VRayRenderer&, VFBRenderElementType type, double instant, void* userData)>
6323 static int vfbAddRenderElementToSceneT(const Internal::AddRenderElementToSceneParams* params);
6324 static int vfbAddRenderElementToScene(const Internal::AddRenderElementToSceneParams* params);
6325
6326 public:
6327 typedef void* InstanceHandleType;
6328
6330 class VFB {
6331 friend class UVTextureSampler;
6332
6333 Internal::VRayRendererNative *rendererNative;
6334 bool autoCommit;
6335 friend class VRayRenderer;
6336 friend class LayerManager;
6337 VFB() : autoCommit(true), layerManager(*this) {}
6338 VFB(const VFB&);
6339 VFB& operator=(const VFB&);
6340 public:
6344 void show(bool show, bool setFocus = true);
6345
6347 bool isShown() const;
6348
6351
6353 void enableInteractivity(bool enable = true);
6354
6357
6359 void enableConfirmation(bool enable = true);
6360
6363
6365 void setPosition(int x, int y);
6366
6368 void setPositionAndSize(int x, int y, int w, int h);
6369
6371 bool getPositionAndSize(int& x, int& y, int& w, int& h) const;
6372
6380 VFBState* getState(size_t& dataSize, bool includeMain = true, bool includeHistory = true) const;
6381
6389 void setState(const void* vfbStateData, size_t dataSize, bool setMain = true, bool setHistory = true);
6390
6393 std::string getSettings() const;
6394
6398 int setSettings(const char *json);
6399
6402 std::string getLayers() const;
6403
6407 int setLayers(const char *json);
6408
6409 // Forward declaration.
6410 class LayerManager;
6411
6413 class Layer {
6414 friend class LayerManager;
6415 public:
6416
6420 int getIntegerID() const;
6421
6424
6427 bool isValid() const;
6428
6433 int getUniqueTreePathID(std::string& treePathUID) const;
6434
6438 int getClass(std::string& layerClass) const;
6439
6443 int getEnabled(bool& isEnabled) const;
6447 int setEnabled(const bool enabled);
6448
6452 int canDelete(bool& isDeletable) const;
6453
6457
6461 int getUserName(std::string& layerName) const;
6462
6466 int setUserName(const char* layerName);
6468 int setUserName(const std::string& layerName);
6469
6473 int getChildrenCount(int& childrenCount) const;
6476 std::vector<Layer> getChildren() const;
6480 Layer getChild(const int childIndex) const;
6481
6485 int getOpacity(float& opacity) const;
6489 int setOpacity(const float opacity) const;
6490
6494 int canBlend(bool& isBlendable) const;
6502 int setBlendMode(const VFBLayerProperty::BlendMode blendMode) const;
6503
6507 int getLayerPropertiesCount(int& propsCount) const;
6511 int getLayerPropertyNames(std::vector<std::string>& propNames) const;
6512
6517 int getLayerPropertyDisplayName(const char* propName, std::string& displayName) const;
6519 int getLayerPropertyDisplayName(const std::string& propName, std::string& displayName) const;
6520
6524 int resetLayerPropertyToDefault(const char* propName);
6526 int resetLayerPropertyToDefault(const std::string& propName);
6527
6531 int getLayerPropertiesReadOnly(std::vector<std::string>& values) const;
6532
6537 int isLayerPropertyReadOnly(const char* propName, bool& isReadOnly) const;
6539 int isLayerPropertyReadOnly(const std::string& propName, bool& isReadOnly) const;
6540
6545 int getLayerPropertiesOfType(const VFBLayerProperty::Type type, std::vector<std::string>& values) const;
6546
6551 int getLayerPropertyType(const char* propName, VFBLayerProperty::Type& type) const;
6553 int getLayerPropertyType(const std::string& propName, VFBLayerProperty::Type& type) const;
6554
6556
6561 int getLayerPropertyFlags(const char* propName, int& flags) const;
6563 int getLayerPropertyFlags(const std::string& propName, int& flags) const;
6564
6566
6571 int getLayerPropertyBoolValue(const char* propName, bool& value) const;
6573 int getLayerPropertyBoolValue(const std::string& propName, bool& value) const;
6574
6579 int setLayerPropertyBoolValue(const char* propName, const bool value);
6581 int setLayerPropertyBoolValue(const std::string& propName, const bool value);
6582
6587 int getLayerPropertyIntValue(const char* propName, int& value) const;
6589 int getLayerPropertyIntValue(const std::string& propName, int& value) const;
6590
6595 int setLayerPropertyIntValue(const char* propName, const int value);
6597 int setLayerPropertyIntValue(const std::string& propName, const int value);
6598
6600
6604 int getLayerEnumProperties(std::vector<std::string>& values) const;
6605
6610 int getLayerPropertyIntEnumValues(const char* propName, std::vector<std::string>& values) const;
6612 int getLayerPropertyIntEnumValues(const std::string& propName, std::vector<std::string>& values) const;
6613
6618 int getLayerPropertyIntEnumLabel(const char* propName, std::string& valueLabel) const;
6620 int getLayerPropertyIntEnumLabel(const std::string& propName, std::string& valueLabel) const;
6621
6626 int setLayerPropertyIntByEnumLabel(const char* propName, const char* label);
6628 int setLayerPropertyIntByEnumLabel(const char* propName, const std::string& label);
6630 int setLayerPropertyIntByEnumLabel(const std::string& propName, const char* label);
6632 int setLayerPropertyIntByEnumLabel(const std::string& propName, const std::string& label);
6633
6638 int getLayerPropertyIntEnumIndex(const char* propName, int& enumIndex) const;
6640 int getLayerPropertyIntEnumIndex(const std::string& propName, int& enumIndex) const;
6641
6646 int setLayerPropertyIntByEnumIndex(const char* propName, const int enumIndex);
6648 int setLayerPropertyIntByEnumIndex(const std::string& propName, const int enumIndex);
6649
6651
6656 int getLayerPropertyFloatValue(const char* propName, float& value) const;
6658 int getLayerPropertyFloatValue(const std::string& propName, float& value) const;
6659
6664 int setLayerPropertyFloatValue(const char* propName, const float value);
6666 int setLayerPropertyFloatValue(const std::string& propName, const float value);
6667
6672 int getLayerPropertyStringValue(const char* propName, std::string& value) const;
6674 int getLayerPropertyStringValue(const std::string& propName, std::string& value) const;
6675
6680 int setLayerPropertyStringValue(const char* propName, const char* value);
6682 int setLayerPropertyStringValue(const std::string& propName, const char* value);
6683
6688 int getLayerPropertyColorValue(const char* propName, Color& value) const;
6690 int getLayerPropertyColorValue(const std::string& propName, Color& value) const;
6691
6696 int setLayerPropertyColorValue(const char* propName, const Color& value);
6698 int setLayerPropertyColorValue(const std::string& propName, const Color& value);
6699
6704 int getLayerPropertyStampRawStringValue(const char* propName, std::string& value) const;
6706 int getLayerPropertyStampRawStringValue(const std::string& propName, std::string& value) const;
6707
6712 int setLayerPropertyStampRawStringValue(const char* propName, const char* value);
6714 int setLayerPropertyStampRawStringValue(const char* propName, const std::string& value);
6716 int setLayerPropertyStampRawStringValue(const std::string& propName, const char* value);
6718 int setLayerPropertyStampRawStringValue(const std::string& propName, const std::string& value);
6719
6726 int getLayerPropertyStampFontDescValue(const std::string& propName, VFBLayerProperty::StampFontDesc& value) const;
6727
6734 int setLayerPropertyStampFontDescValue(const std::string& propName, const VFBLayerProperty::StampFontDesc& value);
6735
6736 Layer() = delete;
6737
6738 Layer& operator=(const Layer& rhs) {
6739 if (this != &rhs) {
6740 if (&myLayerManager == &rhs.myLayerManager) {
6741 layerUID = rhs.layerUID;
6742 }
6743 }
6744 return *this;
6745 }
6746
6747 bool operator==(const Layer& rhs) const {
6748 return layerUID == rhs.layerUID && &myLayerManager == &rhs.myLayerManager;
6749 }
6750 protected:
6751 Layer(const int& layerUID, const LayerManager& layerManager) :
6752 layerUID(layerUID), myLayerManager(layerManager){
6753 };
6754
6755 void invalidateLayer() const {
6756 layerUID = NO_LAYER_ID;
6757 }
6758 private:
6759 const LayerManager& myLayerManager;
6760 mutable LayerUID layerUID;
6761 };
6762
6778 friend class Layer;
6779 friend class VFB;
6780 public:
6782
6784 VFB& getVFB() const;
6785
6790 void reset();
6791
6794 int getLayersCount() const;
6795
6798 std::vector<Layer> getAllLayersAsLayerObjects() const;
6799
6802 std::vector<std::string> getCreatableLayerClasses() const;
6803
6809 int loadAllLayers(const char* filename);
6811 int loadAllLayers(const std::string& filename);
6812
6816 int saveAllLayers(const char* filename) const;
6818 int saveAllLayers(const std::string& filename) const;
6819
6823 int bakeLayersToLUT(const char* filename) const;
6825 int bakeLayersToLUT(const std::string& filename) const;
6826
6829 std::string getAllLayers() const;
6830
6836 int setAllLayers(const char* json);
6838 int setAllLayers(const std::string& json);
6839
6865 Layer createLayer(const char* layerClass, const Layer& parent);
6867 Layer createLayer(const std::string& layerClass, const Layer& parent);
6868
6874 int deleteLayer(Layer& layer);
6875
6877
6902
6904
6908 std::vector<Layer> findAllLayersWithLayerClass(const char* layerClass) const;
6910 std::vector<Layer> findAllLayersWithLayerClass(const std::string& layerClass) const;
6911
6915 std::vector<Layer> findAllLayersWithUserName(const char* userName) const;
6917 std::vector<Layer> findAllLayersWithUserName(const std::string& userName) const;
6918
6921 std::vector<Layer> getAllEnabledLayers() const;
6922
6925 std::vector<Layer> getAllBlendableLayers() const;
6926
6928
6931
6935
6938
6939 LayerManager() = delete;
6940
6941 LayerManager(const LayerManager& rhs) = delete;
6942
6943 LayerManager& operator=(const LayerManager& rhs) = delete;
6944
6945 ~LayerManager() {
6946 void* original = errMsgHandle.exchange(nullptr);
6947 if (original) {
6948 Internal::releaseCharString(&original);
6949 }
6950 }
6951
6953 std::string getLastError() const {
6954 void* original = (void*)errMsgHandle;
6955 return Internal::getCharStringContent(&original);
6956 }
6957 protected:
6958 LayerManager(VRayRenderer::VFB& vfb) : myVfb(vfb), errMsgHandle(nullptr) {}
6959
6960 Internal::VRayRendererNative* getNativeRenderer() const {
6961 return myVfb.rendererNative;
6962 }
6963
6964#ifndef VRAY_NOTHROW
6965 void handleError(void*& errorMsgHandlePtr, const bool throwException = true) const {
6966 const char* errstr = nullptr;
6967 if (throwException) {
6968 errstr = Internal::getCharStringContent(&errorMsgHandlePtr);
6969 }
6970 void* oldErr = errMsgHandle.exchange(errorMsgHandlePtr);
6971 Internal::releaseCharString(&oldErr);
6972 if (throwException) {
6973 throw VFBLayerErr(errstr);
6974 }
6975 }
6976#else
6977 void handleError(void*& errorMsgHandlePtr, const bool throwException = false) const {
6978 void* oldErr = errMsgHandle.exchange(errorMsgHandlePtr);
6979 Internal::releaseCharString(&oldErr);
6980 }
6981#endif
6982
6983 void getLayerListAndReleaseIDs(std::vector<Layer>& layers, LayerUID*& layerIDs, const int len) const {
6984 layers.reserve(len);
6985 for (int i = 0; i < len; i++) {
6986 layers.push_back(Layer(layerIDs[i], *this));
6987 }
6988 Internal::C_memory_free(layerIDs);
6989 }
6990
6991 static void getStringListAndReleaseCharStars(std::vector<std::string>& words, char*& cStyleWords, const int len) {
6992 words.reserve(len);
6993 const char* curr = cStyleWords;
6994 for (int i = 0; i < len; i++) {
6995 words.emplace_back(curr);
6996 curr += words[i].size() + 1;
6997 }
6998 Internal::C_memory_free(cStyleWords);
6999 }
7000
7001 Layer getCommonLayer(int (*layerLoader)(Internal::VRayRendererNative* renderer, LayerUID* layerID, void** errorMsgHandlePtr)) const {
7002 LayerUID layerID = NO_LAYER_ID;
7003 void* errorMsgHandlePtr = nullptr;
7004 int err = layerLoader(myVfb.rendererNative, &layerID, &errorMsgHandlePtr);
7005 if (err != 0) {
7006 handleError(errorMsgHandlePtr);
7007 return Layer(NO_LAYER_ID, *this);
7008 }
7009 return Layer(layerID, *this);
7010 }
7011
7012 private:
7013 const VRayRenderer::VFB& myVfb;
7014 mutable std::atomic<void*> errMsgHandle;
7015 } layerManager;
7016
7017
7021
7027 VFBState* getPersistentState(size_t& dataSize) const;
7028
7033 void setPersistentState(const void* vfbPersistentStateData, size_t dataSize);
7034
7040 VRAY_DEPRECATED("getWindowHandle in unsafe and deprecated - use getNativeHandle or getQWidget instead")
7041 void* getWindowHandle() const;
7042
7048 NativeWidgetHandle getNativeHandle() const;
7049
7051 QWidget* getQWidget() const;
7052
7057 VRAY_DEPRECATED("setParentWindow in unsafe and deprecated - use setNativeParentWindow or setQWidgetParent instead")
7058 void setParentWindow(void* hWnd);
7059
7065 void setNativeParentWindow(NativeWindowHandle handle);
7066
7069 void setQWidgetParent(QWidget* parentWidget);
7070
7075 bool getMinimumSize(int& w, int& h) const;
7076
7080 bool loadColorCorrectionsPreset(const char* filename);
7081
7083 bool loadColorCorrectionsPreset(const std::string& filename);
7084
7088 bool saveColorCorrectionsPreset(const char* filename) const;
7089
7091 bool saveColorCorrectionsPreset(const std::string& filename) const;
7092
7096 bool setTitlePrefix(const char* prefix);
7097
7099 bool setTitlePrefix(const std::string& prefix);
7100
7104 bool setProjectPath(const char *projectPath);
7105
7107 bool setProjectPath(const std::string& projectPath);
7108
7111 void enableProgressBar(bool enable = true);
7112
7116 void setProgressText(const char *text);
7117
7119 void setProgressText(const std::string& text);
7120
7124 void setProgressValue(float value = -1.0f);
7125
7130 void setProgressTextAndValue(const char *text, float value);
7131
7133 void setProgressTextAndValue(const std::string& text, float value);
7134
7139 bool fillSettingsVFB(const char* instanceName = NULL);
7140
7142 bool fillSettingsVFB(const std::string& instanceName);
7143
7147 bool applySettingsVFB();
7148
7152 bool loadImage(const char* filename);
7153
7155 bool loadImage(const std::string& filename);
7156
7159 bool saveImage(const char* fileName) const;
7160
7162 bool saveImage(const std::string& fileName) const;
7163
7167 bool saveImage(const char* fileName, const ImageWriterOptions& options) const;
7168
7170 bool saveImage(const std::string& fileName, const ImageWriterOptions& options) const;
7171
7173 void clearImage();
7174
7177 void setUpdateAvailable(bool available);
7178
7182 void logMessage(MessageLevel level, const char* message);
7183
7185 void logMessage(MessageLevel level, const std::string& message);
7186
7192 void appendAdditionalStyleSheet(const char *styleSheet);
7193
7194 } vfb;
7195
7196 enum RenderMode {
7197 RENDER_MODE_PRODUCTION = -1,
7198 RENDER_MODE_INTERACTIVE = 0,
7199 RENDER_MODE_INTERACTIVE_CUDA = 4,
7200 RENDER_MODE_INTERACTIVE_OPTIX = 7,
7201 RENDER_MODE_INTERACTIVE_METAL = 8,
7202 RENDER_MODE_PRODUCTION_CUDA = 104,
7203 RENDER_MODE_PRODUCTION_OPTIX = 107,
7204 RENDER_MODE_PRODUCTION_METAL = 108,
7205 };
7206
7208 static bool isInactiveState(RendererState value) { return value <= IDLE_DONE; }
7209
7211 static bool isActiveState(RendererState value) { return !isInactiveState(value); }
7212
7216 return Internal::VRay_VRayRenderer_halfResolutionMode
7217 (getNativeRenderer());
7218 }
7219 private:
7220 LicenseError licErr;
7221 PluginTypeId* pluginTypeIds; // PluginTypeId LUT allocated in the VRayRenderer constructor, freed in the VRayRenderer destructor
7222 int pluginTypeIdsCount; // Number of plugin classes and the size of the pluginTypeIds LUT
7223
7224 void createInstance(const Internal::RendererOptions_internal* options);
7225 int findPluginIdIndex(PluginTypeId typeId) const;
7226
7227 public:
7231
7234 VRayRenderer(const RendererOptions &rendererOptions);
7235
7240 explicit VRayRenderer(InstanceHandleType handle);
7241
7244
7248 InstanceHandleType getInstanceHandle() const;
7249
7252 operator bool() const;
7253
7256 bool operator!() const;
7257
7260
7263
7265 LicenseError getLicenseError() const;
7266
7269
7273 bool setRenderMode(RenderMode mode);
7274
7276 RenderMode getRenderMode() const;
7277
7280
7286 int setBitmapCache(bool onOff);
7287
7291 bool setInteractiveSampleLevel(int samplesPerPixel);
7292
7296 bool setInteractiveNoiseThreshold(float threshold);
7297
7301 bool setInteractiveTimeout(int timeoutMsec);
7302
7306 void setKeepInteractiveRunning(bool keepRunning);
7307
7310
7318
7321
7329 bool setDREnabled(bool drEnabled, bool enableBroadcastListener = true);
7330
7333 bool getDREnabled() const;
7334
7336 int getNumThreads() const;
7337
7342 bool setNumThreads(int numThreads);
7343
7348 bool enableDRClient(const EnableDRClientParams& enableParams);
7349
7354
7357 bool isDRClientEnabled() const;
7358
7364
7367 UPType_int = 0,
7368 UPType_bool = 1,
7369 UPType_double = 2,
7370 UPType_float = 3,
7371 UPType_string = 4,
7372 UPType_vector = 5,
7373 UPType_color = 6
7374 };
7375
7378 const char* propName;
7379 UserPropertyType type;
7380 union {
7381 int vint;
7382 bool vbool;
7383 double vdouble;
7384 float vfloat;
7385 const char* vstring;
7386 float vvector[3];
7387 };
7388 };
7389
7390 // Information passed with userCameraChanged
7392 // Name of the VRay plugin whose property was changed. Can be nullptr if
7393 // the property changed comes from a Vantage default and is not associated
7394 // with an existing scene plugin, e.g. a scene without a physical camera plugin
7395 const char* camName;
7396 // Information about the actual parameter that was changed and its new value
7397 const UserPropertyChanged* prop;
7398 };
7399
7400 // Information passed with userLightChanged
7402 // Name of the VRay plugin whose property was changed. Can be nullptr if
7403 // the property changed comes from a Vantage default and is not associated
7404 // with an existing scene plugin
7405 const char* lightName;
7406 // Information about the actual parameter that was changed and its new value
7407 const UserPropertyChanged* prop;
7408 };
7409
7410 enum UserSceneManipType { USMType_Transform_Set = 0, USMType_Show = 1, USMType_Hide = 2 };
7411
7412 enum UserSceneNodeObjectType { USNOType_Node = 0, USNOType_Camera = 1, USNOType_Light = 2 };
7413
7414 // Information passed with userNodeChanged
7416 // Name of the VRay plugin whose property is changed with this operation.
7417 // This can be one of the light plugins, the render view, one of the camera
7418 // plugins, or a geometry node
7419 const char* objName;
7420 // Type of manipulation that occurred
7421 UserSceneManipType umt;
7422 // The general kind of object passed with objName
7423 UserSceneNodeObjectType objType;
7424 // If the type of manipulation is transform, the matrix and vector that describe
7425 // the transformation (i.e. the 'transform' plugin parameter). This should be
7426 // regarded as an offset to the current position/rotation and is in Vantage
7427 // world coordinates
7428 Transform moveTm;
7429 };
7430
7437 void setUserCameraChangedCB(void(*cb) (const UserCameraChanged* info, void* userData), void* userData);
7438
7445 void setUserLightChangedCB(void(*cb) (const UserLightChanged* info, void* userData), void* userData);
7446
7454 void setUserNodeChangedCB(void(*cb) (const UserNodeChanged* info, void* userData), void* userData);
7455
7458 bool getInProcess() const;
7459
7465 bool setInProcess(bool inProcess);
7466
7472 bool setImprovedDefaultSettings(DefaultsPreset preset=quality_medium);
7473
7476 int getCurrentFrame() const;
7477
7482 bool setCurrentFrame(int frame);
7483
7486 double getCurrentTime() const;
7487
7490 bool setCurrentTime(double time);
7491
7494
7496 bool clearPropertyValuesUpToTime(double time, PluginCategories categories);
7497
7500 void useAnimatedValues(bool on);
7501
7504
7507
7509 Box getBoundingBox(bool& ok) const;
7510
7513 bool setCamera(const Plugin& plugin);
7514
7517
7519 void setCameraName(const char* name);
7520
7522 const char* getCameraName() const;
7523
7526
7529 bool pause() const;
7530
7533 bool resume() const;
7534
7536 bool getImageSize(int& width, int& height) const;
7537
7540 bool setImageSize(int width, int height, bool resetCropRegion = true, bool resetRenderRegion = true);
7541
7544 bool getRenderRegion(int& rgnLeft, int& rgnTop, int& rgnWidth, int& rgnHeight) const;
7545
7551 bool setRenderRegion(int rgnLeft, int rgnTop, int rgnWidth, int rgnHeight);
7552
7554 bool getCropRegion(int& srcWidth, int& srcHeight, float& rgnLeft, float& rgnTop, float& rgnWidth, float& rgnHeight) const;
7555
7561 bool setCropRegion(int srcWidth, int srcHeight, float rgnLeft, float rgnTop);
7562
7568 bool setCropRegion(int srcWidth, int srcHeight, float rgnLeft, float rgnTop, float rgnWidth, float rgnHeight);
7569
7573 bool setRenderSizes(const RenderSizeParams& sizes, bool regionButtonState);
7574
7578 bool getRenderSizes(RenderSizeParams& sizes, bool& regionButtonState) const;
7579
7584 int load(const char* fileName);
7585
7587 int load(const std::string& fileName);
7588
7593 int loadAsText(const char* text);
7594
7596 int loadAsText(const std::string& text);
7597
7599 int loadAsText(std::string&& text);
7600
7609 template<typename T = void>
7610 int loadAsText(const char* text, size_t length, void(*freeFn)(char* text, size_t size, T* holderObject) = NULL, T* holderObject = NULL);
7611
7616 int append(const char* fileName, bool drSendNameOnly = false);
7617
7619 int append(const std::string& fileName, bool drSendNameOnly = false);
7620
7626 int append(const std::vector<const char*> &fileNames);
7627
7629 int append(const std::vector<std::string> &fileNames);
7630
7633 int appendAsText(const char* text);
7634
7636 int appendAsText(const std::string& text);
7637
7639 int appendAsText(std::string&& text);
7640
7646 int appendAsText(const std::vector<const char*> &sceneTexts);
7647
7649 int appendAsText(const std::vector<std::string> &sceneTexts);
7650
7659 template<typename T = void>
7660 int appendAsText(const char* text, size_t length, void(*freeFn)(char* text, size_t size, T* holderObject) = NULL, T* holderObject = NULL);
7661
7671 int loadFiltered(const char* fileName, bool (*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7672
7674 int loadFiltered(const std::string& fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7675
7687 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7688 int loadFiltered(const char* fileName, T& obj, const void* userData = NULL);
7689
7691 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7692 int loadFiltered(const std::string& fileName, T& obj, const void* userData = NULL);
7693
7703 int appendFiltered(const char* fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7704
7706 int appendFiltered(const std::string& fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7707
7719 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7720 int appendFiltered(const char* fileName, T& obj, const void* userData = NULL);
7721
7723 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7724 int appendFiltered(const std::string& fileName, T& obj, const void* userData = NULL);
7725
7738 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7739 int appendFiltered(const std::vector<const char*> &fileNames, T& obj, const void* userData = NULL);
7740
7742 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7743 int appendFiltered(const std::vector<std::string> &fileNames, T& obj, const void* userData = NULL);
7744
7755 int appendFiltered(const std::vector<const char*> &fileNames, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7756
7758 int appendFiltered(const std::vector<std::string> &fileNames, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7759
7760
7763 int loadAsTextFiltered(const char* fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7764
7766 int loadAsTextFiltered(const std::string& fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7767
7770 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7771 int loadAsTextFiltered(const char* fileName, T& obj, const void* userData = NULL);
7772
7774 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7775 int loadAsTextFiltered(const std::string& fileName, T& obj, const void* userData = NULL);
7776
7779 int appendAsTextFiltered(const char* fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7780
7782 int appendAsTextFiltered(const std::string& fileName, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7783
7786 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7787 int appendAsTextFiltered(const char* fileName, T& obj, const void* userData = NULL);
7788
7790 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7791 int appendAsTextFiltered(const std::string& fileName, T& obj, const void* userData = NULL);
7792
7805 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7806 int appendAsTextFiltered(const std::vector<const char*> &sceneTexts, T& obj, const void* userData = NULL);
7807
7809 template<class T, bool (T::*TMethod)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*)>
7810 int appendAsTextFiltered(const std::vector<std::string> &sceneTexts, T& obj, const void* userData = NULL);
7811
7822 int appendAsTextFiltered(const std::vector<const char*> &sceneTexts, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7823
7825 int appendAsTextFiltered(const std::vector<std::string> &sceneTexts, bool(*callback)(VRayRenderer&, const char* pluginType, std::string& pluginName, void*), const void* userData = NULL);
7826
7829 void start() const;
7830
7833 int startSync() const;
7834
7836 void renderSequence() const;
7837
7841 void renderSequence(SubSequenceDesc descriptions[], size_t count) const;
7842
7844 void continueSequence() const;
7845
7847 void abort() const;
7848
7850 void stop() const;
7851
7857 int exportScene(const char* filePath) const;
7858
7860 int exportScene(const std::string& filePath) const;
7861
7868 int exportScene(const char* filePath, const VRayExportSettings& settings) const;
7869
7871 int exportScene(const std::string& filePath, const VRayExportSettings& settings) const;
7872
7876 std::string exportSceneToBuffer() const;
7877
7882 std::string exportSceneToBuffer(const VRayExportSettings& settings) const;
7883
7889 void bucketRenderNearest(int x, int y) const;
7890
7894 AddHostsResult addHosts(const char* hosts) const;
7895
7897 AddHostsResult addHosts(const std::string& hosts) const;
7898
7902 int removeHosts(const char* hosts) const;
7903
7905 int removeHosts(const std::string& hosts) const;
7906
7910 int resetHosts(const char* hosts = NULL) const;
7911
7913 int resetHosts(const std::string& hosts) const;
7914
7917 std::string getAllHosts() const;
7918
7921 std::string getActiveHosts() const;
7922
7925 std::string getInactiveHosts() const;
7926
7929 unsigned long long commit();
7930
7933 unsigned long long getChangeIndex() const;
7934
7940
7944
7952
7957
7962 VRayImage* getImage(const GetImageOptions &options) const;
7963
7969 size_t getImageIntoBuffer(const GetImageOptions &options, void *buf) const;
7970
7975 RendererState getState() const;
7976
7980 bool isRenderEnded() const;
7981
7984 bool isAborted() const;
7985
7988 bool isFrameSkipped() const;
7989
7992 bool isSequenceEnded() const;
7993
7995 enum class WaitTime : int {
7998 AwaitingOrIdle = -1,
7999
8002 Idle = -2
8003 };
8004
8010 bool waitForRenderEnd(const WaitTime time = WaitTime::AwaitingOrIdle) const;
8011
8016 bool waitForRenderEnd(const int timeout) const;
8017
8021
8025 bool waitForSequenceEnd(const int timeout) const;
8026
8029 bool waitForVFBClosed() const;
8030
8034 bool waitForVFBClosed(const int timeout) const;
8035
8037 std::vector<Plugin> getPlugins() const;
8038
8042 template <class T, class RetT = T> std::vector<RetT> getPlugins() const;
8043
8045 std::vector<Plugin> getPlugins(const char* pluginClassName) const;
8046
8048 std::vector<Plugin> getPlugins(const std::string& pluginClassName) const;
8049
8051 std::vector<Plugin> getPluginsOfCategories(const PluginCategories& categories) const;
8052
8055 std::vector<Plugin> getPluginsOfCategories(const std::vector<PluginCategories>& categories) const;
8056
8058 std::vector<std::string> getAllPluginTypes() const;
8059
8063 std::vector<std::string> getPluginTypesOfCategory(PluginCategory category) const;
8064
8069 Plugin getInstanceOf(const char* pluginType) const;
8070
8075 Plugin getInstanceOf(PluginTypeId pluginTypeId) const;
8076
8078 Plugin getInstanceOf(const std::string& pluginType) const;
8079
8081 template<class T> T getInstanceOf() const;
8082
8089 Plugin getInstanceOrCreate(const char* pluginType);
8090
8097 Plugin getInstanceOrCreate(PluginTypeId pluginTypeId);
8098
8100 Plugin getInstanceOrCreate(const std::string& pluginType);
8101
8103 template<class T> T getInstanceOrCreate();
8104
8112 Plugin getInstanceOrCreate(const char* pluginName, const char* pluginType);
8113
8115 Plugin getInstanceOrCreate(const std::string& pluginName, const char* pluginType);
8116
8118 Plugin getInstanceOrCreate(const char* pluginName, const std::string& pluginType);
8119
8121 Plugin getInstanceOrCreate(const std::string& pluginName, const std::string& pluginType);
8122
8124 Plugin getInstanceOrCreate(const char* pluginName, PluginTypeId pluginTypeId);
8125
8127 Plugin getInstanceOrCreate(const std::string& pluginName, PluginTypeId pluginTypeId);
8128
8130 template<class T> T getInstanceOrCreate(const char* pluginName);
8131
8133 template<class T> T getInstanceOrCreate(const std::string& pluginName);
8134
8136 double getCurrentEventTime() const;
8137
8144 void setOnStateChanged(void(*callback)(VRayRenderer&, RendererState oldState, RendererState newState, double instant, void*), const void* userData = NULL);
8146 template<class T, void (T::*TMethod)(VRayRenderer&, RendererState oldState, RendererState newState, double instant, void* userData)>
8147 void setOnStateChanged(T& object, const void* userData = NULL);
8148
8153 void setOnRendererClose(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8155 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8156 void setOnRendererClose(T& object, const void* userData = NULL);
8157
8165 void setOnProgressiveImageUpdated(void(*callback)(VRayRenderer&, VRayImage* img, unsigned long long changeIndex, ImagePassType pass, double instant, void* userData), const void* userData = NULL);
8167 template<class T, void (T::*TMethod)(VRayRenderer&, VRayImage* img, unsigned long long changeIndex, ImagePassType pass, double instant, void* userData)>
8168 void setOnProgressiveImageUpdated(T& object, const void* userData = NULL);
8169
8176 void setOnLogMessage(void(*callback)(VRayRenderer&, const char* msg, MessageLevel level, double instant, void* userData), MessageLevel minLevel=MessageInfo, const void* userData = NULL);
8178 template<class T, void (T::*TMethod)(VRayRenderer& renderer, const char* msg, MessageLevel level, double instant, void* userData)>
8179 void setOnLogMessage(T& object, MessageLevel minLevel = MessageInfo, const void* userData = NULL);
8180
8188 void setOnLicenseError(void(*callback)(VRayRenderer&, const char* msg, int errorCode, LicenseUserStatus userStatus, double instant, void* userData), const void* userData = NULL);
8190 template<class T, void (T::*TMethod)(VRayRenderer& renderer, const char* msg, int errorCode, LicenseUserStatus userStatus, double instant, void* userData)>
8191 void setOnLicenseError(T& object, const void* userData = NULL);
8192
8203 void setOnBucketInit(void(*callback)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData), const void* userData = NULL);
8205 template<class T, void (T::*TMethod)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData)>
8206 void setOnBucketInit(T& object, const void* userData = NULL);
8207
8217 void setOnBucketReady(void(&callback)(VRayRenderer&, int x, int y, const char* host, VRayImage* img, ImagePassType pass, double instant, void* userData), const void* userData = NULL);
8219 template<class T, void (T::*TMethod)(VRayRenderer&, int x, int y, const char* host, VRayImage* img, ImagePassType pass, double instant, void* userData)>
8220 void setOnBucketReady(T& object, const void* userData = NULL);
8221
8232 void setOnBucketReady(void(&callback)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData), const void* userData = NULL);
8234 template<class T, void (T::* TMethod)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData)>
8235 void setOnBucketReady(T& object, const void* userData = NULL);
8237 void setOnBucketReady(std::nullptr_t null);
8238
8249 void setOnBucketFailed(void(*callback)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData), const void* userData = NULL);
8251 template<class T, void (T::*TMethod)(VRayRenderer&, int x, int y, int width, int height, const char* host, ImagePassType pass, double instant, void* userData)>
8252 void setOnBucketFailed(T& object, const void* userData = NULL);
8253
8262 void setOnProgress(void(*callback)(VRayRenderer&, const char* msg, int elementNumber, int elementsCount, double instant, void* userData), const void* userData = NULL);
8264 template<class T, void (T::*TMethod)(VRayRenderer&, const char* msg, int elementNumber, int elementsCount, double instant, void* userData)>
8265 void setOnProgress(T& object, const void* userData = NULL);
8266
8272 void setOnRenderViewChanged(void(*callback)(VRayRenderer&, const char* propName, double instant, void* userData), const void* userData = NULL);
8274 template<class T, void (T::*TMethod)(VRayRenderer&, const char* propName, double instant, void* userData)>
8275 void setOnRenderViewChanged(T& object, const void* userData = NULL);
8276
8282 void setOnVFBRenderLast(void(*callback)(VRayRenderer&, bool isRendering, double instant, void* userData), const void* userData = NULL);
8284 template<class T, void (T::*TMethod)(VRayRenderer&, bool isRendering, double, void* userData)>
8285 void setOnVFBRenderLast(T& object, const void* userData = NULL);
8286
8292 void setOnVFBInteractiveStart(void(*callback)(VRayRenderer&, bool isRendering, double instant, void* userData), const void* userData = NULL);
8294 template<class T, void (T::*TMethod)(VRayRenderer&, bool isRendering, double instant, void* userData)>
8295 void setOnVFBInteractiveStart(T& object, const void* userData = NULL);
8296
8301 void setOnVFBClosed(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8303 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8304 void setOnVFBClosed(T& object, const void* userData = NULL);
8305
8310 void setOnPostEffectsUpdated(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8312 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8313 void setOnPostEffectsUpdated(T& object, const void* userData = NULL);
8314
8320 void setOnVFBLayersChanged(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8322 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8323 void setOnVFBLayersChanged(T& object, const void* userData = NULL);
8324
8329 void setOnVFBShowMessagesWindow(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8331 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8332 void setOnVFBShowMessagesWindow(T& object, const void* userData = NULL);
8333
8339 void setOnHostConnected(void(*callback)(VRayRenderer&, const char* hostName, double instant, void* userData), const void* userData = NULL);
8341 template<class T, void (T::*TMethod)(VRayRenderer&, const char* hostName, double instant, void* userData)>
8342 void setOnHostConnected(T& object, const void* userData = NULL);
8343
8349 void setOnHostDisconnected(void(*callback)(VRayRenderer&, const char* hostName, double instant, void* userData), const void* userData = NULL);
8351 template<class T, void (T::*TMethod)(VRayRenderer&, const char* hostName, double instant, void* userData)>
8352 void setOnHostDisconnected(T& object, const void* userData = NULL);
8353
8358 void setOnVFBOpenUpdateNotify(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8360 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8361 void setOnVFBOpenUpdateNotify(T& object, const void* userData = NULL);
8362
8366 void setOnVFBSaveSettingsNotify(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8368 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8369 void setOnVFBSaveSettingsNotify(T& object, const void* userData = NULL);
8370
8371
8373 enum class DebugShadingMode : int {
8374 isolateSelect,
8375 globalLighting,
8376 globalAO,
8377 globalWireframe,
8378 globalNormal,
8379 globalUV,
8380 globalBarycentric,
8381 };
8382
8389 void setOnVFBDebugShadingNotify(void(*callback)(VRayRenderer&, int enabled, DebugShadingMode mode, int selectionLocked, double instant, void* userData), const void* userData = NULL);
8391 template<class T, void (T::*TMethod)(VRayRenderer&, int enabled, int mode, int selectionLocked, double instant, void* userData)>
8392 void setOnVFBDebugShadingNotify(T& object, const void* userData = NULL);
8393
8400 void setVFBContextMenuSelectedCallback(void(*callback)(VRayRenderer&, int commandId, int x, int y, void* userData), const void* userData = NULL);
8402 template<class T, void(T::*TMethod)(VRayRenderer&, int commandId, int x, int y, void* userData)>
8403 void setVFBContextMenuSelectedCallback(T& object, const void* userData = NULL);
8404
8408 void setOnVFBCopyToHostFrameBufferNotify(void(*callback)(VRayRenderer&, double instant, void* userData), const void* userData = NULL);
8410 template<class T, void (T::*TMethod)(VRayRenderer&, double instant, void* userData)>
8411 void setOnVFBCopyToHostFrameBufferNotify(T& object, const void* userData = NULL);
8412
8419 void setOnLightMixTransferToScene(int(*callback)(VRayRenderer&, const std::vector<LightMixChange>& changes, double instant, void*), const void* userData = NULL);
8421 template<class T, int(T::*TMethod)(VRayRenderer&, const std::vector<LightMixChange>& lightMixChanges, double instant, void* userData)>
8422 void setOnLightMixTransferToScene(T& object, const void* userData = NULL);
8423
8430 void setOnUploadToCollaboration(int(*callback)(VRayRenderer&, const std::vector<std::string>& fileList, double instant, void*), const void* userData = NULL);
8432 template<class T, int(T::*TMethod)(VRayRenderer&, const std::vector<std::string>& fileList, double instant, void* userData)>
8433 void setOnUploadToCollaboration(T& object, const void* userData = NULL);
8434
8441 void setOnVFBPauseIPR(void(*callback)(VRayRenderer&, bool isRendering, double instant, void* userData), const void* userData = NULL);
8443 template<class T, void (T::*TMethod)(VRayRenderer&, bool isRendering, double instant, void* userData)>
8444 void setOnVFBPauseIPR(T& object, const void* userData = NULL);
8445
8452 void setOnVFBUpdateIPR(void(*callback)(VRayRenderer&, bool isRendering, double instant, void* userData), const void* userData = NULL);
8454 template<class T, void (T::*TMethod)(VRayRenderer&, bool isRendering, double instant, void* userData)>
8455 void setOnVFBUpdateIPR(T& object, const void* userData = NULL);
8456
8464 void setOnVFBAddRenderElementToScene(bool(*callback)(VRayRenderer&, VFBRenderElementType type, double instant, void* userData), const void* userData = NULL);
8466 template<class T, bool (T::*TMethod)(VRayRenderer&, VFBRenderElementType type, double instant, void* userData)>
8467 void setOnVFBAddRenderElementToScene(T& object, const void* userData = NULL);
8468
8470 void setVFBContextMenuItems(const std::vector<VFBContextMenuItem> &items);
8471
8476 bool getVFBContextMenuItemValue(int commandId, int& value) const;
8477
8482 bool setVFBContextMenuItemValue(int commandId, int value);
8483
8488
8492 unsigned long setProgressiveImageUpdateTimeout(unsigned long timeout);
8493
8496
8499
8501 void setBucketReadyHasBuffer(bool hasBuffer);
8502
8505
8508
8511
8513 void setVisualDebuggerEnabled(bool enable);
8514
8517
8520 Plugin getPlugin(const char *pluginName) const;
8521
8523 Plugin getPlugin(const std::string &pluginName) const;
8524
8526 template<class T> T getPlugin(const char *pluginName) const;
8527
8529 template<class T> T getPlugin(const std::string &pluginName) const;
8530
8532 PluginMeta getPluginMeta(const char *pluginClassName) const;
8533
8535 PluginMeta getPluginMeta(const std::string& pluginClassName) const;
8536
8538 PluginMeta getPluginMeta(const PluginTypeId pluginTypeId) const;
8539
8544 Plugin newPlugin(const char* pluginName, const char* pluginType);
8545
8547 Plugin newPlugin(const char* pluginName, PluginTypeId pluginTypeId);
8548
8550 Plugin newPlugin(const std::string& pluginName, const std::string& pluginType);
8551
8553 Plugin newPlugin(const char* pluginName, const std::string& pluginType);
8554
8556 Plugin newPlugin(const std::string& pluginName, const char* pluginType);
8557
8559 template<class T> T newPlugin(const char* pluginName);
8560
8562 template<class T> T newPlugin(const std::string& pluginName);
8563
8565 template<class T> T newPlugin();
8566
8570 Plugin newPlugin(const char* pluginType);
8571
8573 Plugin newPlugin(const std::string &pluginType);
8574
8576 Plugin newPlugin(PluginTypeId pluginTypeId);
8577
8587 Plugin getOrCreatePlugin(const char* pluginName, const char* pluginType);
8588
8590 Plugin getOrCreatePlugin(const std::string& pluginName, const char* pluginType);
8591
8593 Plugin getOrCreatePlugin(const char* pluginName, const std::string& pluginType);
8594
8596 Plugin getOrCreatePlugin(const std::string& pluginName, const std::string& pluginType);
8597
8599 Plugin getOrCreatePlugin(const char* pluginName, PluginTypeId pluginTypeId);
8600
8602 Plugin getOrCreatePlugin(const std::string& pluginName, PluginTypeId pluginTypeId);
8603
8605 template<class T> T getOrCreatePlugin(const char* pluginName);
8606
8608 template<class T> T getOrCreatePlugin(const std::string& pluginName);
8609
8613 Plugin pickPlugin(int x, int y) const;
8614
8619 Plugin pickPlugin(int x, int y, int timeout) const;
8620
8626 std::vector<PickedPluginInfo> pickPlugins(double x, double y, int maxcount = 0, int timeout = -1) const;
8627
8630 bool deletePlugin(const Plugin& plugin);
8631
8634 bool deletePlugin(const std::string& pluginName);
8635
8638 bool deletePlugin(const char* pluginName);
8639
8643 bool deletePlugins(const char* names[], size_t namesCount);
8644
8648 bool deletePlugins(const std::vector<std::string> &names);
8649
8653 bool deletePlugins(const std::vector<VRay::Plugin> &plugins);
8654
8663 bool replacePlugin(const Plugin& oldPlugin, const Plugin& newPlugin);
8664
8671 bool optimizeMaterialGraph(const Plugin& topPlugin);
8672
8674 bool getAutoCommit() const;
8675
8678 void setAutoCommit(bool autoCommit);
8679
8682
8684 size_t getIrradianceMapSize() const;
8687 bool saveIrradianceMapFile(const std::string &fileName);
8689 bool saveIrradianceMapFile(const char* fileName);
8690
8692 size_t getLightCacheSize() const;
8695 bool saveLightCacheFile(const std::string &fileName);
8697 bool saveLightCacheFile(const char* fileName);
8698
8700 size_t getPhotonMapSize() const;
8703 bool savePhotonMapFile(const std::string &fileName);
8705 bool savePhotonMapFile(const char* fileName);
8706
8708 size_t getCausticsSize() const;
8711 bool saveCausticsFile(const std::string &fileName);
8713 bool saveCausticsFile(const char* fileName);
8714
8718 std::vector<ComputeDeviceInfo> getComputeDevicesMetal() const;
8719
8723 std::vector<ComputeDeviceInfo> getComputeDevicesOptix() const;
8724
8731 std::vector<ComputeDeviceInfo> getComputeDevicesCUDA() const;
8732
8736 std::vector<ComputeDeviceInfo> getComputeDevicesDenoiser() const;
8737
8741 std::vector<ComputeDeviceInfo> getComputeDevicesCurrentEngine() const;
8742
8746 bool setComputeDevicesMetal(const std::vector<int> &indices);
8747
8751 bool setComputeDevicesOptix(const std::vector<int> &indices);
8752
8756 bool setComputeDevicesCUDA(const std::vector<int> &indices);
8757
8761 bool setComputeDevicesDenoiser(const std::vector<int> &indices);
8762
8767
8771 bool setComputeDevicesCurrentEngine(const std::vector<int> &indices);
8772
8777 bool setResumableRendering(bool enable, const ResumableRenderingOptions* options);
8778
8788 bool denoiseNow(void(*userCb)(VRayRenderer&, VRayImage*, void*) = 0, bool shouldPassImage = true, const void* userData = NULL);
8789
8791 template<class T, void (T::*TMethod)(VRayRenderer&, VRayImage*, void*)>
8792 bool denoiseNow(T& object, bool shouldPassImage = true, const void* userData = NULL);
8793
8802
8806 void setIncludePaths(const char* includePaths, bool overwrite = true);
8807
8809 void setIncludePaths(const std::string &includePaths, bool overwrite = true);
8810
8813
8816 float getIESPrescribedIntensity(const char* iesLightFileName) const;
8817
8819 float getIESPrescribedIntensity(const std::string &iesLightFileName) const;
8820
8826
8828 bool isManual();
8829
8832
8838 void startDurationEvent(const char* name, int threadIndex = 0);
8839
8845 void endDurationEvent(const char* name, int threadIndex = 0);
8846
8847 private:
8848 VRayProfiler(VRayRenderer& renderer) : owner(renderer) {}
8849 VRayRenderer& owner;
8850 friend class VRayRenderer;
8851 } profiler{ *this };
8852
8859
8866 bool addVRayProfilerMetadata(const char* category, const char* key, const char* value);
8867
8869 bool addVRayProfilerMetadata(const std::string& category, const std::string& key, const std::string& value);
8870
8877 void setOnVRayProfilerWrite(void(*callback)(VRayRenderer&, const std::string& outputFile, int fileType, double instant, void*), const void* userData = nullptr);
8879 template<class T, void(T::*TMethod)(VRayRenderer&, const std::string &outputFile, int fileType, double instant, void* userData)>
8880 void setOnVRayProfilerWrite(T& object, const void* userData = nullptr);
8881
8884 void setDebugShadingSelection(const std::vector<Plugin>& selection);
8885
8886 protected:
8887 Internal::VRayRendererNative* getNativeRenderer() const;
8888 static VRayRenderer* getVRayRenderer(void* rendererNative);
8889
8890 InstanceId getPluginId_internal(const char* pluginName, PluginTypeId& outTypeId) const;
8891 PluginTypeId getPluginTypeId_internal(const char* pluginType) const;
8892 PluginTypeId getPluginTypeId_internal(InstanceId pluginID) const;
8893 const char* getPluginTypeString(PluginTypeId pluginTypeId) const;
8894 Plugin getPlugin_internal(InstanceId pluginID) const;
8895 template<class T> T getPlugin_internal(InstanceId pluginID) const;
8896 const char* getPluginName_internal(InstanceId pluginID) const;
8897 bool pluginExists_internal(InstanceId pluginID) const;
8898
8899 int getPropertyIndexFromName(InstanceId pluginID, const char* propertyName) const;
8900 const char* getPropertyNameFromIndex(InstanceId pluginID, int idx) const;
8901 template<class T> static std::vector<T> getPluginsOfType(VRayRenderer& renderer, const char* pluginType);
8902 template<class T> static std::vector<T> getPluginsOfTypeId(VRayRenderer& renderer, PluginTypeId typeId);
8903 static std::vector<std::string> getStringVector(void *pvector);
8904 static std::vector<const char*> getCharPtrVector(const std::vector<std::string> &strVector);
8905 std::vector<std::string> getPluginPropertyNames(const char* pluginClassName) const; // Returns the names of all properties of a plugin.
8906 const char* getPluginType(const char* name) const;
8907 const char* getPluginType(InstanceId pluginID) const;
8908 bool setPluginName(InstanceId pluginID, const char* name) const;
8909 Type getPluginPropertyRuntimeType(const char* pluginName, const char* propertyName) const;
8910 Type getPluginPropertyRuntimeType(InstanceId pluginID, const char* propertyName) const;
8911 int getPluginPropertyElementsCount(InstanceId pluginID, const char* propertyName) const;
8912 const void* getPluginPropertyDefinition(const char* pluginName, const char* propertyName) const;
8913 const void* getPluginPropertyDefinition(InstanceId pluginID, const char* propertyName) const;
8914 const void* getPluginPropertyDefinitionFromClass(const char* pluginClassName, const char* propertyName) const;
8915 std::string getPluginPropertyValueAsString(const char* pluginName, const char* propertyName, double time) const;
8916 std::string getPluginPropertyValueAsString(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8917 bool setPluginPropertyValueAsString(InstanceId pluginID, const char* propertyName, const char* value) const;
8918 bool setPluginPropertyValueAsStringAtTime(InstanceId pluginID, const char* propertyName, const char* value, double time) const;
8919 bool getPluginPropertyBool(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8920 bool getPluginPropertyBool(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8921 int getPluginPropertyInt(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8922 int getPluginPropertyInt(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8923 float getPluginPropertyFloat(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8924 float getPluginPropertyFloat(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8925 double getPluginPropertyDouble(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8926 Color getPluginPropertyColor(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8927 Color getPluginPropertyColor(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8928 AColor getPluginPropertyAColor(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8929 AColor getPluginPropertyAColor(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8930 Vector getPluginPropertyVector(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8931 Vector getPluginPropertyVector(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8932 Matrix getPluginPropertyMatrix(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8933 Matrix getPluginPropertyMatrix(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8934 Transform getPluginPropertyTransform(const char* pluginName, const char* propertyName, bool& ok, double time) const;
8935 Transform getPluginPropertyTransform(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8936 PluginRef getPluginPropertyPluginRef(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8937 Value getPluginPropertyValue(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8938 template<typename T> T getPluginPropertyTyped(InstanceId pluginID, const char* propertyName, bool& ok, double time) const;
8939 bool isPropertyAnimated(InstanceId pluginID, const char* propertyName) const;
8940 int getKeyframeTimes(InstanceId pluginID, const char* propertyName, double* &times) const;
8941 bool setPluginPropertyValueAtTime(InstanceId pluginID, const char* propertyName, const void *pval, double time) const;
8942 bool setPluginPropertyValueRawAtTime(InstanceId pluginID, const char* propertyName, const void *pval, size_t count, double time) const;
8943
8944#ifdef VRAY_SDK_INTEROPERABILITY
8945 bool getPluginPropertyValueSDKInterop(InstanceId pluginID, const char* propertyName, void *pval, int type) const;
8946 bool getPluginPropertyValueAtTimeSDKInterop(InstanceId pluginID, const char* propertyName, void *pval, int type, double time) const;
8947 bool setPluginPropertyValueSDKInterop(InstanceId pluginID, const char* propertyName, const void* pval, int type) const;
8948 bool setPluginPropertyValueAtTimeSDKInterop(InstanceId pluginID, const char* propertyName, const void* pval, int type, double time) const;
8949#endif // VRAY_SDK_INTEROPERABILITY
8950
8951 Plugin newRenderElementPlugin(int type, const char *instanceName, const char *displayName);
8952 Plugin getRenderElementPlugin(int type) const;
8953 std::vector<Plugin> getRenderElementPluginsList(int type) const;
8954 bool getRenderElementInfo(InstanceId pluginID, int type, RenderElement::Info& chInfo) const;
8955 size_t getRenderElementData(InstanceId pluginID, InstanceId alphaPluginID, int type, int layer, RenderElement::PixelFormat format, bool rgbOrder, const ImageRegion* rgn, void** buf) const;
8956 size_t getRenderElementDataIntoBuffer(
8957 InstanceId pluginID,
8958 InstanceId alphaPluginID,
8959 int type,
8960 int layer,
8962 bool rgbOrder,
8963 const ImageRegion* rgn,
8964 bool flipImage,
8965 void *buf
8966 ) const;
8967 VRayImage* getRenderElementAsImage(InstanceId pluginID, int type, int layer, const ImageRegion* rgn, int corrected) const;
8968 std::string getRenderElementMetadata(InstanceId pluginID, int type) const;
8969 };
8970
8974 public:
8975 ProfilerDurationScope(VRayRenderer& renderer, std::string eventName, int threadIndex = 0) :
8976 renderer(renderer),
8977 eventName(eventName),
8978 threadIndex(threadIndex) {
8979 if (renderer.profiler.isManual()) {
8980 renderer.profiler.startDurationEvent(eventName.c_str(), threadIndex);
8981 }
8982 }
8983
8985 if (renderer.profiler.isManual()) {
8986 renderer.profiler.endDurationEvent(eventName.c_str(), threadIndex);
8987 }
8988
8989 }
8990 private:
8991 VRayRenderer& renderer;
8992 std::string eventName;
8993 int threadIndex;
8994 };
8995
8998 std::string fileName;
9002
9004 };
9005
9008 private:
9009 template<class T, Plugin(T::* TMethod)(VRayRenderer&, const char* assetId, Vector importPosition, void* userData)>
9010 static InstanceId importScatterPresetCallbackT(const char* assetId, Vector* importPosition, void* info);
9011 static InstanceId importScatterPresetCallback(const char* assetId, Vector* importPosition, void* info);
9012
9013 public:
9018 static bool readScatterData(const Plugin& scatterPlugin, std::vector<Transform>& transforms, IntList& topo);
9019
9023 static bool readGaussianData(const Plugin& gaussianPlugin, GaussianReadData& readData);
9024
9028 static bool readGaussianData(const std::string& fileName, GaussianReadData& readData);
9029
9038 static bool readScatterPreset(const ScatterReadParams& params, Plugin(*callback)(VRayRenderer&, const char* assetId, Vector importPosition, void* userData) = 0, const void* userData = nullptr);
9040 template<class T, Plugin(T::* TMethod)(VRayRenderer&, const char* assetId, Vector importPosition, void* userData)>
9041 static bool readScatterPreset(const ScatterReadParams& params, T& object, const void* userData = nullptr);
9042
9043 };
9044
9047 public:
9051 static bool readLuminaireFieldPreviewData(const Plugin& luminairePlugin, LuminaireFieldReadPreviewData& readData);
9052
9056 static bool readLuminaireFieldPreviewData(const std::string& fileName, LuminaireFieldReadPreviewData& readData);
9057 };
9058
9061
9063 class Proxy {
9064 public:
9070 static bool readPreviewGeometry(const Plugin &proxyPlugin, VectorList &vertices, IntList &indices, int countHint = 0);
9071
9077 static bool readPreviewHair(const Plugin &proxyPlugin, VectorList &vertices, IntList &lengths, int countHint = 0);
9078
9083 static bool readPreviewParticles(const Plugin &proxyPlugin, VectorList &positions, int countHint = 0);
9084
9088 static bool readPreviewData(const Plugin &proxyPlugin, ProxyReadData &readData);
9089
9093 static bool readFullData(const Plugin &proxyPlugin, ProxyReadData &readData);
9094
9102 static bool createMeshFile(const Plugin &geomMeshPlugin, const Transform *transform, const ProxyCreateParams &params);
9103
9111 static bool createMeshFile(const Plugin &geomMeshPlugin, const AnimatedTransform &animTransform, const ProxyCreateParams &params);
9112
9120 static bool createCombinedMeshFile(const std::vector<Plugin> &geomMeshPlugins, const std::vector<Transform> *transforms, const ProxyCreateParams &params);
9121
9129 static bool createCombinedMeshFile(const std::vector<Plugin> &geomMeshPlugins, const std::vector<AnimatedTransform> &animTransforms, const ProxyCreateParams &params);
9130
9136 static bool readPreviewGeometry(const ProxyReadParams &params, VectorList &vertices, IntList &indices, int countHint = 0);
9137
9143 static bool readPreviewHair(const ProxyReadParams &params, VectorList &vertices, IntList &lengths, int countHint = 0);
9144
9149 static bool readPreviewParticles(const ProxyReadParams &params, VectorList &positions, int countHint = 0);
9150
9154 static bool readPreviewData(const ProxyReadParams &params, ProxyReadData &readData);
9155
9159 static bool readFullData(const ProxyReadParams &params, ProxyReadData &readData);
9160
9165 static bool createMeshFile(const MeshFileData &data, const Transform *transform, const ProxyCreateParams &params);
9166
9171 static bool createMeshFile(const MeshFileData &data, const AnimatedTransform &animTransform, const ProxyCreateParams &params);
9172
9177 static bool createCombinedMeshFile(const std::vector<MeshFileData> &data, const std::vector<Transform> *transforms, const ProxyCreateParams &params);
9178
9183 static bool createCombinedMeshFile(const std::vector<MeshFileData> &data, const std::vector<AnimatedTransform> &animTransforms, const ProxyCreateParams &params);
9184 };
9185
9187 enum GPUParamSupport {
9188 GPUParamSupport_Full,
9189 GPUParamSupport_Partial,
9190 GPUParamSupport_None,
9191 GPUParamSupport_Unknown,
9192 };
9193
9194 inline std::ostream& operator <<(std::ostream& stream, const GPUParamSupport val) {
9195 switch (val) {
9196 case GPUParamSupport_Full:
9197 stream << "Full";
9198 break;
9199 case GPUParamSupport_Partial:
9200 stream << "Partial";
9201 break;
9202 case GPUParamSupport_None:
9203 stream << "None";
9204 break;
9205 default:
9206 stream << "Unknown";
9207 }
9208 return stream;
9209 }
9210
9211 class UIGuides {
9212 friend class PropertyMeta;
9213
9214 private:
9215 const void* pParamDef;
9216
9217 protected:
9218 UIGuides(const void* pParamDef) : pParamDef(pParamDef) {}
9219
9220 const void* getParamDef() const {
9221 return pParamDef;
9222 }
9223
9224 public:
9302 MaxGuides
9304
9307 Unknown,
9321 LocalSubdivs
9323
9327 DefaultUnits,
9328 Radians,
9329 Degrees,
9330 Millimeters,
9331 Centimeters,
9332 Meters
9333 };
9334
9341 Load,
9342 Save,
9343 LoadAndSave
9344 };
9345
9348 None = 0,
9350 ObjectSet = 1,
9354 TextureSlot = 2,
9356 LightSet = 4,
9358 PartOf3dsMaxTriple = 8,
9360 BitSet = 16,
9364 Boolean = 32
9366
9372 Basic = 0,
9373 DefaultTier = 1,
9374 Advanced = 2
9375 };
9376
9377 UIGuides(const UIGuides& uiGuides) : pParamDef(uiGuides.pParamDef) {}
9378
9379 UIGuides& operator=(const UIGuides& uiGuides) {
9380 pParamDef = uiGuides.pParamDef;
9381 return *this;
9382 }
9383
9386 bool isEnum() const;
9387
9391 bool hasType(const GuideType type) const;
9392
9396 float getFloat(const GuideType type) const;
9397
9401 std::vector<float> getFloats(const GuideType type) const;
9402
9405 std::string getDisplayName() const;
9406
9408 struct EnumItem {
9409 int value;
9410 std::string name;
9411 };
9412
9415 std::vector<EnumItem> getEnumStrings() const;
9416
9420
9424
9427 std::vector<std::string> getFileAssetExts() const;
9428
9431 std::vector<std::string> getFileAssetNames() const;
9432
9436
9440 bool hasAttribute(const AttributesType attributeType) const;
9441
9444 std::vector<std::string> getStringEnumStrings() const;
9445
9448 bool isStringEnum() const;
9449
9452 std::string getRolloutName() const;
9453
9456 std::string getTabName() const;
9457
9460 bool hasOverriddenBy() const;
9461
9464 std::string getValueOfOverriddenBy() const;
9465
9469
9472 bool hasOverride() const;
9473
9477
9481 std::string getValueOfOverride(const int index) const;
9482
9486
9489 std::vector<std::string> getEnableDepends() const;
9490
9493 GPUParamSupport getGPUSupportStatus() const;
9494
9498
9501 std::vector<std::string> getHideDepends() const;
9502 };
9503
9504 class RuntimeUIGuides : public UIGuides {
9505 friend class PropertyRuntimeMeta;
9506 private:
9507 const Internal::VRayRendererNative* renderer;
9508 InstanceId id;
9509 protected:
9510 RuntimeUIGuides(const void* pParamDef, const Internal::VRayRendererNative* renderer, InstanceId id) :
9511 UIGuides(pParamDef), renderer(renderer), id(id) {}
9512
9513 public:
9516 bool isEnabled() const;
9517
9520 bool isHidden() const;
9521 };
9522
9525 friend class PluginMeta;
9526
9527 protected:
9528 const void* pParamDef;
9529 GPUParamSupport gpuSupport;
9530
9531 PropertyMeta(const VRayRenderer *pRenderer, const char* pluginClassName, const char* propertyName)
9532 {
9533 pParamDef = pRenderer->getPluginPropertyDefinitionFromClass(pluginClassName, propertyName);
9534 gpuSupport = (GPUParamSupport)Internal::VRay_PluginUtils_getPropertyGpuSupport(pRenderer->getNativeRenderer(), pluginClassName, pParamDef);
9535 }
9536
9537 public:
9538 PropertyMeta(const PropertyMeta &propertyMeta)
9539 : pParamDef(propertyMeta.pParamDef), gpuSupport(propertyMeta.gpuSupport) {}
9540
9541 PropertyMeta& operator=(const PropertyMeta &propertyMeta) {
9542 pParamDef = propertyMeta.pParamDef;
9543 gpuSupport = propertyMeta.gpuSupport;
9544 return *this;
9545 }
9546
9547 void swap(PropertyMeta &propertyMeta) {
9548 std::swap(pParamDef, propertyMeta.pParamDef);
9549 std::swap(gpuSupport, propertyMeta.gpuSupport);
9550 }
9551
9553 operator bool () const {
9554 return !!pParamDef;
9555 }
9556
9558 int getElementsCount() const {
9559 return Internal::VRay_PluginUtils_getPropertyElementsCount(pParamDef);
9560 }
9561
9563 const char* getName() const {
9564 return Internal::VRay_PluginUtils_getPropertyName(pParamDef);
9565 }
9566
9568 StringList getAliases() const;
9569
9572 Type getType() const {
9573 return Internal::VRay_PluginUtils_getPropertyType(pParamDef);
9574 }
9575
9577 Type getElementType() const {
9578 return Internal::VRay_PluginUtils_getPropertyElementType(pParamDef);
9579 }
9580
9585
9587 std::string getDescription() const {
9588 const char* const description = Internal::VRay_PluginUtils_getPropertyDescription(pParamDef);
9589 return description ? description : "";
9590 }
9591
9593 const char* getDeprecation() const {
9594 return Internal::VRay_PluginUtils_getPropertyDeprecation(pParamDef);
9595 }
9596
9599 std::string getUIGuides() const {
9600 const char* const uiGuides = Internal::VRay_PluginUtils_getPropertyUIGuides(pParamDef);
9601 return uiGuides ? uiGuides : "";
9602 }
9603
9606 return UIGuides(pParamDef);
9607 }
9608
9609 static const char* typeToString(const Type type);
9610
9611 const char* getTypeAsString() const {
9612 return typeToString(getType());
9613 }
9614
9616 GPUParamSupport getGPUSupport() const {
9617 return gpuSupport;
9618 }
9619 };
9620
9623 friend class Plugin;
9624
9625 const VRayRenderer* renderer;
9626 InstanceId id;
9627
9628 protected:
9629 PropertyRuntimeMeta(const Plugin& plugin, const char* propertyName)
9630 : PropertyMeta(plugin.pRenderer, plugin.getType(), propertyName), renderer(plugin.pRenderer), id(plugin.id()) {
9631 }
9632
9633 public:
9634 PropertyRuntimeMeta(const PropertyRuntimeMeta& propertyRuntimeMeta)
9635 : PropertyMeta(propertyRuntimeMeta), renderer(propertyRuntimeMeta.renderer), id(propertyRuntimeMeta.id) {
9636 }
9637
9638 PropertyRuntimeMeta& operator=(const PropertyRuntimeMeta &propertyRuntimeMeta) {
9639 PropertyMeta::operator=(propertyRuntimeMeta);
9640 renderer = propertyRuntimeMeta.renderer;
9641 id = propertyRuntimeMeta.id;
9642 return *this;
9643 }
9644
9647 return renderer->getPluginPropertyElementsCount(id, getName());
9648 }
9649
9651 Type getRuntimeType() const {
9652 return renderer->getPluginPropertyRuntimeType(id, getName());
9653 }
9654
9655 const char* getRuntimeTypeAsString() const {
9656 return typeToString(getRuntimeType());
9657 }
9658
9659 void swap(PropertyRuntimeMeta &propertyRuntimeMeta) {
9660 PropertyMeta::swap(propertyRuntimeMeta);
9661 std::swap(renderer, propertyRuntimeMeta.renderer);
9662 std::swap(id, id);
9663 }
9664
9667 return RuntimeUIGuides(pParamDef, renderer->getNativeRenderer(), id);
9668 }
9669 };
9670
9672 enum GPUPluginSupport {
9673 GPUPluginSupport_Full,
9674 GPUPluginSupport_Partial,
9675 GPUPluginSupport_Bake,
9676 GPUPluginSupport_None,
9677 GPUPluginSupport_Unknown,
9678 };
9679
9680 inline std::ostream& operator <<(std::ostream& stream, const GPUPluginSupport val) {
9681 switch (val) {
9682 case GPUPluginSupport_Full:
9683 stream << "Full";
9684 break;
9685 case GPUPluginSupport_Partial:
9686 stream << "Partial";
9687 break;
9688 case GPUPluginSupport_Bake:
9689 stream << "Bake";
9690 break;
9691 case GPUPluginSupport_None:
9692 stream << "None";
9693 break;
9694 default:
9695 stream << "Unknown";
9696 }
9697 return stream;
9698 }
9699
9702 friend class VRayRenderer;
9703 friend class Plugin;
9704
9705 PluginTypeId typeId;
9706 const char* type;
9707 const VRayRenderer* pRenderer;
9708
9709 protected:
9710 PluginMeta(const Plugin& plugin)
9711 : typeId(plugin.getTypeId())
9712 , type(plugin.getType())
9713 , pRenderer(plugin.getRenderer())
9714 { }
9715
9716 PluginMeta(const VRayRenderer* renderer, const char* typeStr) {
9717 typeId = renderer->getPluginTypeId_internal(typeStr);
9718 type = renderer->getPluginTypeString(typeId);
9719 pRenderer = renderer;
9720 }
9721
9722 PluginMeta(const VRayRenderer* renderer, PluginTypeId pluginTypeId) {
9723 typeId = pluginTypeId;
9724 type = renderer->getPluginTypeString(pluginTypeId);
9725 pRenderer = renderer;
9726 }
9727
9728 public:
9729 PluginMeta(const PluginMeta& pluginMeta) = default;
9730 PluginMeta& operator=(const PluginMeta& pluginMeta) = default;
9731
9732 bool operator==(const PluginMeta& pluginMeta) const {
9733 return typeId == pluginMeta.typeId && pRenderer == pluginMeta.pRenderer;
9734 }
9735
9736 void swap(PluginMeta& pluginMeta) {
9737 std::swap(typeId, pluginMeta.typeId);
9738 std::swap(type, pluginMeta.type);
9739 std::swap(pRenderer, pluginMeta.pRenderer);
9740 }
9741
9743 bool isValid() const {
9744 return !!type;
9745 }
9746
9748 const char* getType() const {
9749 return type;
9750 }
9751
9753 PluginTypeId getTypeId() const {
9754 return typeId;
9755 }
9756
9758 std::vector<std::string> getPropertyNames() const {
9759 return pRenderer->getPluginPropertyNames(type);
9760 }
9761
9763 std::string getDescription() const;
9764
9766 const char* getDeprecation() const;
9767
9769 PropertyMeta getPropertyMeta(const char* propertyName) const {
9770 return PropertyMeta(pRenderer, type, propertyName);
9771 }
9772
9774 PropertyMeta getPropertyMeta(const std::string &propertyName) const {
9775 return PropertyMeta(pRenderer, type, propertyName.c_str());
9776 }
9777
9782 bool checkPluginUIGuides(std::string& errMsg) const;
9783
9785 GPUPluginSupport getGPUSupport() const;
9786
9789 };
9790
9791 class CompressImage;
9792
9793 namespace Internal {
9795 friend class VRay::CompressImage;
9796
9797 std::ofstream ofs;
9798
9799 FileSaveWriteHelper(const char* fileName) : ofs(fileName, std::ofstream::binary) {}
9800
9802 ofs.close();
9803 }
9804 };
9805 }
9806
9809 CompressImage(const CompressImage& ci);
9810 CompressImage& operator=(const CompressImage& ci);
9811
9812 protected:
9813 byte* bufAddr;
9814 size_t bufSize;
9815
9816 CompressImage() : bufAddr(), bufSize() {}
9817
9818 public:
9819 void swap(CompressImage& ci);
9820
9821 operator size_t () const {
9822 return bufSize;
9823 }
9824
9826 void* getBuf() const {
9827 return bufAddr;
9828 }
9829
9831 size_t getLen() const {
9832 return bufSize;
9833 }
9834
9836 bool saveToFile(const char* fileName) const;
9837
9839 bool saveToFile(const std::string &fileName) const {
9840 return saveToFile(fileName.c_str());
9841 }
9842
9843 ~CompressImage() {
9844 if (bufSize)
9845 Internal::C_memory_free(bufAddr);
9846 }
9847 };
9848
9850 class LocalJpeg : public CompressImage {
9851
9852 public:
9856 LocalJpeg(const VRayImage* img, int quality = 0) {
9857 bufSize = Internal::VRayImage_compressToJpeg(img, quality, &bufAddr, nullptr);
9858 }
9859
9861 LocalJpeg(const VRayImage* img, const VRayRenderer& renderer, int quality = 0) {
9862 bufSize = Internal::VRayImage_compressToJpeg(img, quality, &bufAddr, renderer.getNativeRenderer());
9863 }
9864 };
9865
9866 class LocalPng : public CompressImage {
9867
9868 public:
9872 LocalPng(const VRayImage* img, bool preserveAlpha = false) {
9873 bufSize = Internal::VRayImage_compressToPng(img, preserveAlpha, &bufAddr, nullptr);
9874 }
9875
9877 LocalPng(const VRayImage* img, const VRayRenderer& renderer, bool preserveAlpha = false) {
9878 bufSize = Internal::VRayImage_compressToPng(img, preserveAlpha, &bufAddr, renderer.getNativeRenderer());
9879 }
9880 };
9881
9882 class LocalBmp : public CompressImage {
9883
9884 public:
9889 LocalBmp(const VRayImage* img, bool preserveAlpha = false, bool swapChannels = false) {
9890 bufSize = Internal::VRayImage_convertToBmp(img, preserveAlpha, &bufAddr, NULL, swapChannels ? 1 : 0);
9891 }
9892
9894 LocalBmp(const VRayImage* img, const VRayRenderer& renderer, bool preserveAlpha = false, bool swapChannels = false) {
9895 bufSize = Internal::VRayImage_convertToBmp(img, preserveAlpha, &bufAddr, renderer.getNativeRenderer(), swapChannels ? 1 : 0);
9896 }
9897 };
9898
9900 template<class T>
9901 T plugin_cast(Plugin plugin) {
9902 return *static_cast<T*>(&plugin);
9903 }
9904
9906 template<class T>
9907 PluginRefT<T> plugin_cast(PluginRef pluginRef) {
9908 // won't compile if T doesn't inherit from Plugin
9909 return *static_cast<PluginRefT<T>*>(static_cast<T*>(static_cast<Plugin*>(&pluginRef)));
9910 }
9911
9914 template<class T>
9915 T plugin_checked_cast(Plugin plugin) {
9916 return plugin_cast<T>(plugin.getTypeId() != T::getTypeId() ? Plugin() : plugin);
9917 }
9918
9921 template<class T>
9922 PluginRefT<T> plugin_checked_cast(PluginRef pluginRef) {
9923 return plugin_cast<T>(pluginRef.getTypeId() != T::getTypeId() ? PluginRef() : pluginRef);
9924 }
9925
9926 namespace Internal {
9927 template<typename PluginType>
9928 inline bool _isPluginOfTypes(PluginTypeId typeId) {
9929 return typeId == PluginType::getTypeId();
9930 }
9931
9932 template<typename PluginType0, typename PluginType1, typename... RemainingTypes>
9933 inline bool _isPluginOfTypes(PluginTypeId typeId) {
9934 return typeId == PluginType0::getTypeId() || _isPluginOfTypes<PluginType1, RemainingTypes...>(typeId);
9935 }
9936 }
9937
9943 template<typename PluginType>
9944 inline bool isPluginOfType(const Plugin& plugin) {
9945 return plugin.getTypeId() == PluginType::getTypeId();
9946 }
9947
9953 template<typename PluginType, typename... Types>
9954 inline bool isPluginOfTypes(const Plugin& plugin) {
9955 return Internal::_isPluginOfTypes<PluginType, Types...>(plugin.getTypeId());
9956 }
9957
9963 inline bool isPluginOfType(const Plugin& plugin, const char* type) {
9964 return plugin.isNotEmpty() && strcmp(plugin.getType(), type) == 0;
9965 }
9966
9974 template <size_t N>
9975 inline bool isPluginOfTypes(const Plugin& plugin, const char* const (&types)[N]) {
9976 if (plugin.isNotEmpty()) {
9977 const char* type = plugin.getType();
9978 for (size_t i = 0; i < N; ++i) {
9979 if (strcmp(type, types[i]) == 0)
9980 return true;
9981 }
9982 }
9983 return false;
9984 }
9985
9993 template <size_t N>
9994 inline bool isPluginOfTypes(const Plugin& plugin, const PluginTypeId (&types)[N]) {
9995 PluginTypeId typeId = plugin.getTypeId();
9996 for (size_t i = 0; i < N; ++i) {
9997 if (typeId == types[i])
9998 return true;
9999 }
10000 return false;
10001 }
10002
10003 namespace OCIO {
10005 enum SourceMode : int {
10007 Automatic = 0,
10009 Environment,
10011 File,
10013 Internal,
10014 };
10015
10019 std::vector<std::string> colorSpaces;
10021 std::vector<std::string> colorSpaceFamilies;
10023 std::vector<std::string> roles;
10025 std::vector<std::string> roleColorSpaces;
10027 std::vector<std::string> looks;
10029 std::vector<std::string> devices;
10031 std::vector<std::string> viewTransforms;
10034
10039 OCIOConfigurationData(const char* fileName = NULL, SourceMode vraySourceType = SourceMode::Automatic)
10040 : errorCode(OCIOResult::Result_OK) {
10041
10042 Internal::OCIOData internalOCIOData;
10043 errorCode = (OCIOResult)Internal::VRay_OCIO_initData(&internalOCIOData, fileName, (int)vraySourceType);
10044 if (errorCode != OCIOResult::Result_OK) {
10045 const char* ending = internalOCIOData.status ? internalOCIOData.status : "<unknown>";
10046 errorString = std::string("Failed initializing OCIO configuration: ") + ending;
10047 Internal::VRay_OCIO_freeData(&internalOCIOData);
10048#ifndef VRAY_NOTHROW
10049 throw VRayException(errorString);
10050#endif
10051 return;
10052 }
10053
10054 familySeparator = char(internalOCIOData.familySeparator);
10055
10056 convertRawData(colorSpaces, internalOCIOData.colorSpaces, internalOCIOData.colorSpacesCount);
10057 if (internalOCIOData.colorSpaceFamilies) {
10058 convertRawData(colorSpaceFamilies, internalOCIOData.colorSpaceFamilies, internalOCIOData.colorSpacesCount);
10059 }
10060 convertRawData(roles, internalOCIOData.roles, internalOCIOData.rolesCount);
10061 convertRawData(roleColorSpaces, internalOCIOData.roleColorSpaces, internalOCIOData.rolesCount);
10062
10063 convertRawData(looks, internalOCIOData.looks, internalOCIOData.looksCount);
10064 convertRawData(devices, internalOCIOData.devices, internalOCIOData.devicesCount);
10065 convertRawData(viewTransforms, internalOCIOData.viewTransforms, internalOCIOData.viewTransformsCount);
10066
10067 Internal::VRay_OCIO_freeData(&internalOCIOData);
10068 }
10069
10071 std::string getErrorString() const {
10072 return errorString;
10073 }
10074
10075 private:
10077 enum OCIOResult : int {
10078 Result_OK = 0,
10079 Result_FileNotFound,
10080 Result_OCIOException,
10081 Result_EmptyConfiguration,
10082 Result_InternalException = -1
10083 } errorCode;
10084
10086 std::string errorString;
10087
10088 void convertRawData(std::vector<std::string>& output, char const* const* input, const int inputCount) {
10089 output.clear();
10090 output.reserve(inputCount);
10091 for (int i = 0; i < inputCount; ++i) {
10092 output.emplace_back(input[i]);
10093 }
10094 }
10095 };
10096 }
10097
10102 bool setEnvVar(const char* name, const char* value);
10103
10107 const char* getEnvVar(const char* name);
10108
10109 enum OSLParameterType {
10110 OSL_TYPE_UNSUPPORTED,
10111 OSL_TYPE_INT,
10112 OSL_TYPE_BOOL,
10113 OSL_TYPE_FLOAT,
10114 OSL_TYPE_STRING,
10115 OSL_TYPE_TEXTURE,
10116 OSL_TYPE_COLOR,
10117 OSL_TYPE_VECTOR,
10118 OSL_TYPE_OUTPUT_CLOSURE,
10119 OSL_TYPE_OUTPUT_COLOR,
10120 OSL_TYPE_OUTPUT_FLOAT,
10121 OSL_TYPE_MENU
10122 };
10123
10125 std::string name;
10126 OSLParameterType type;
10128 };
10129
10131 std::vector<std::string> outputColorParams;
10132 std::vector<std::string> outputFloatParams;
10133 std::vector<std::string> outputClosureParams;
10134 std::vector<OSLInputParameter> inputParams;
10135 };
10136
10140 Error getOSLParameters(const char* fileName, OSLParameters& params);
10141
10143 Error getOSLParameters(const std::string& fileName, OSLParameters& params);
10144
10145 enum OSLSourceType {
10146 OSL_SOURCE_TYPE_OSL = 1,
10147 OSL_SOURCE_TYPE_OSO = 2,
10148 };
10149
10150 enum OSLSourceEncoding {
10151 OSL_SOURCE_ENC_TXT,
10152 OSL_SOURCE_ENC_BASE64,
10153 };
10154
10160 Error getOSLParameters(const char* src, OSLSourceType type, OSLSourceEncoding encoding, OSLParameters& params);
10161
10163 Error getOSLParameters(const std::string& src, OSLSourceType type, OSLSourceEncoding encoding, OSLParameters& params);
10164
10166 void* vrsceneDesc;
10167 void createThis(const char* filename, const void* settings);
10168 ScenePreview(const ScenePreview&);
10169
10170 public:
10171 struct Settings;
10172 class Object;
10173 struct Particle;
10174
10175 enum ObjectType {
10176 ObjectTypeAll = 0,
10177 ObjectTypeNode,
10178 ObjectTypeNodeParticle,
10179 ObjectTypeLight,
10180 ObjectTypeInstancer,
10181 ObjectTypeVolume,
10182 ObjectTypeVRayScene,
10183 ObjectTypeMaterial,
10184 ObjectTypeDecal,
10185 ObjectTypeClipper,
10186 };
10187
10188 enum DataType {
10189 DataTypeAll = -1,
10190 DataTypeNoData = 0,
10191 DataTypeMesh = (1 << 0),
10192 DataTypeHair = (1 << 1),
10193 DataTypeParticles = (1 << 2),
10194 DataTypeVolume = (1 << 3),
10195 DataTypeInfinitePlane = (1 << 4),
10196 DataTypeInstancer2 = (1 << 5),
10197 DataTypeVRayProxy = (1 << 6),
10198 DataTypeRayserverInstancer = (1 << 7),
10199 DataTypeStaticMesh = (1 << 8),
10200 DataTypePerfectSphere = (1 << 9),
10201 DataTypeGeomInstancer = (1 << 10),
10202
10203 DataTypeHasInstances = DataTypeInstancer2 | DataTypeRayserverInstancer | DataTypeGeomInstancer,
10204
10205 ObjectDataTypeAll = DataTypeAll,
10206 ObjectDataTypeNoData = DataTypeNoData,
10207 ObjectDataTypeMesh = DataTypeMesh,
10208 ObjectDataTypeHair = DataTypeHair,
10209 ObjectDataTypeParticles = DataTypeParticles,
10210 ObjectDataTypeVolume = DataTypeVolume,
10211 ObjectDataTypeInfinitePlane = DataTypeInfinitePlane,
10212 ObjectDataTypeInstancer2 = DataTypeInstancer2,
10213 ObjectDataTypeVRayProxy = DataTypeVRayProxy,
10214 ObjectDataTypeRayserverInstancer = DataTypeRayserverInstancer,
10215 ObjectDataTypeStaticMesh = DataTypeStaticMesh,
10216 ObjectDataTypePerfectSphere = DataTypePerfectSphere,
10217 ObjectDataTypeGeomInstancer = DataTypeGeomInstancer,
10218
10219 ObjectDataTypeHasInstances = DataTypeHasInstances,
10220 };
10221
10222 enum LightType {
10223 LightTypeUnsupported = 0,
10224 LightTypeOmni,
10225 LightTypeRectangle,
10226 LightTypeSphere,
10227 LightTypeDirect,
10228 LightTypeSpot,
10229 LightTypeSun,
10230 LightTypeIES,
10231 LightTypeDome,
10232 LightTypeMesh,
10233 };
10234
10235 enum UpAxis {
10236 UpAxisUnknown = -1,
10237 UpAxisZ = 0,
10238 UpAxisY,
10239 };
10240
10241 struct Sizes2D {
10242 float width;
10243 float length;
10244 };
10245
10246 struct Sizes3D {
10247 float width;
10248 float height;
10249 float length;
10250 };
10251
10255 explicit ScenePreview(const char* filename);
10256
10261 ScenePreview(const char* filename, const Settings& settings);
10262
10263 ~ScenePreview();
10264
10271 std::vector<Object> getObjects(ObjectType objectType = ObjectTypeAll, DataType dataType = DataTypeAll) const;
10272
10276 Object getObject(const char* name) const;
10277
10280 operator bool() const {
10281 return !!vrsceneDesc;
10282 }
10283
10286 bool operator!() const {
10287 return !vrsceneDesc;
10288 }
10289
10291 UpAxis getUpAxis() const;
10292
10294 float getMetersScale() const;
10295
10297 float getPhotometricScale() const;
10298
10300 float getSecondsScale() const;
10301
10303 float getFramesScale() const;
10304
10306 int getFrameStart() const;
10307
10309 int getFrameEnd() const;
10310
10312 int getFPS() const;
10313
10315 size_t getTotalFaces() const;
10316 };
10317
10322 CacheTypeSingle=0,
10324 CacheTypeNone=1,
10327 CacheTypeRam=2
10329
10333 CoordinateSystemRightHanded=0,
10335 CoordinateSystemLeftHanded=1
10337
10338 Settings() :
10339 usePreview(true),
10340 previewFacesCount(100000),
10341 minPreviewFaces(64),
10342 maxPreviewFaces(10000),
10343 cacheType(CacheType::CacheTypeSingle),
10344 coordinateSystem(CoordinateSystem::CoordinateSystemRightHanded) {
10345 }
10346
10347 Bool usePreview;
10348 int previewFacesCount;
10349 int minPreviewFaces;
10350 int maxPreviewFaces;
10351 CacheType cacheType;
10352 CoordinateSystem coordinateSystem;
10353 };
10354
10356 friend class ScenePreview;
10357
10358 void* objectBase;
10359
10360 static void addDataTypeStringHelperPrivate(std::string& currentString, DataType types, DataType dataType, const char* typeString);
10361
10362 explicit Object(void* objectBase) : objectBase(objectBase) {}
10363 Object(void* vrsceneDesc, const char* name);
10364
10365 public:
10366 Object() : objectBase() {}
10367
10370 const char* getName() const;
10371
10374 bool isValid() const {
10375 return !!objectBase;
10376 }
10377
10380 ObjectType getType() const;
10381
10384 const char* getTypeAsString() const;
10385
10389 Transform getTransform(double time = 0) const;
10390
10394 bool getVisibility(double time = 0) const;
10395
10398 const char* getNodeDataName() const;
10399
10402 DataType getDataType() const;
10403
10406 std::string getDataTypeAsString() const;
10407
10413
10418
10419#ifndef VRAY_SDK_INTEROPERABILITY
10423 VectorList getMeshVertices(double time = 0);
10424
10428 IntList getMeshFaces(double time = 0);
10429
10434 VectorList getHairVertices(double time = 0);
10435
10440 IntList getHairNumVertices(double time = 0);
10441
10447 int getMeshVerticesFast(const Vector* &vertices, double time = 0);
10448
10454 int getMeshFacesFast(const int* &faces, double time = 0);
10455
10462 int getHairVerticesFast(const Vector* &vertices, double time = 0);
10463
10470 int getHairNumVerticesFast(const int* &lengths, double time = 0);
10471#else
10476
10481
10487
10493#endif
10494
10495 std::vector<Particle> getInstancerParticles(double time = 0);
10496
10497 Sizes3D getDecalSize(double time = 0);
10498 Sizes2D getClipperSize(double time = 0);
10499 };
10500
10502 friend class Object;
10503
10506
10509
10512
10513 int particleId;
10514
10515 bool isValid() const {
10516 return node.isValid();
10517 }
10518
10519 //char* getUserAttributes() const;
10520 //~Particle();
10521 //private:
10522 //void* userAttributes;
10523 };
10524
10529 void *internalTextureSampler;
10530
10531 public:
10533 UVTextureSampler(const UVTextureSampler &r) = delete;
10534 UVTextureSampler& operator=(const UVTextureSampler &rhs) = delete;
10535 UVTextureSampler(UVTextureSampler &&r) noexcept;
10536 UVTextureSampler& operator=(UVTextureSampler &&rhs) noexcept;
10538
10539 public:
10547
10554
10563 bool sample(const PluginRef &pluginRef, float u, float v, AColor &result);
10564
10566 bool sample(const PluginRef &pluginRef, float u, float v, float &result);
10567
10569 bool sample(const PluginRef &pluginRef, float u, float v, int &result);
10570
10581 VRayImage* sampleArea(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height);
10582
10594 FloatList sampleAreaFloat(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height);
10595
10598 IntList sampleAreaInt(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height);
10599
10600 private:
10602 template<typename ListType, typename SampleFunction>
10603 static std::vector<ListType> sampleAreaAsListResult(int width, int height, SampleFunction &&sampleArea);
10604 };
10605
10606 namespace Util {
10607
10609 struct PluginLink {
10611 std::string fromProperty;
10613 };
10614
10620 std::vector<PluginLink> getChildPlugins(Plugin root, bool recursive);
10621
10624 std::vector<PluginLink> getParentPlugins(Plugin child);
10625
10628 float getIESPrescribedIntensity(const char *iesLightFileName);
10629 }
10630
10632 enum Status {
10634 ErrorMemory = -4,
10635
10637 ErrorResolve = -3,
10638
10640 ErrorConnect = -2,
10641
10643 ErrorTimeout = -1,
10644
10646 ServerReady = 0,
10647
10649 ServerUnknown = 1,
10650
10652 ServerError = 2,
10653
10655 ServerBusy = 3
10656 } status;
10657
10660
10663
10665 std::string hostResolved;
10666
10668 std::string hostConnectedTo; // valid only if ServerBusy
10669
10671 std::string revisionTime;
10672 };
10673
10677 CheckDRHostResult checkDRHost(const char* host);
10678
10680 CheckDRHostResult checkDRHost(const std::string& host);
10681
10684
10685 BinUserAttributesWriter() : index() {}
10686
10697 binUserAttributeType_int = 0,
10698 binUserAttributeType_float,
10699 binUserAttributeType_vector,
10700 binUserAttributeType_acolor,
10701 binUserAttributeType_string,
10702 binUserAttributeType_last,
10703 };
10704
10708 binUserAttributeFlag_small = 1 << 3,
10709
10711 binUserAttributeFlag_smallY = 1 << 2,
10712
10714 binUserAttributeFlag_smallZ = 1 << 1,
10715
10717 binUserAttributeFlag_smallA = 1 << 0,
10718 };
10719
10723 template<size_t count>
10724 void add(const char(&name)[count], int value) {
10725 add(name, count - 1, value);
10726 }
10727
10731 template<size_t count>
10732 void add(const char(&name)[count], float value) {
10733 add(name, count - 1, value);
10734 }
10735
10739 template<size_t count>
10740 void add(const char(&name)[count], const Vector& value) {
10741 add(name, count - 1, value);
10742 }
10743
10747 template<size_t count>
10748 void add(const char(&name)[count], const AColor& value) {
10749 add(name, count - 1, value);
10750 }
10751
10756 template<size_t nameLen>
10757 void add(const char(&name)[nameLen], const char* value, size_t valueLen) {
10758 add(name, nameLen - 1, value, valueLen);
10759 }
10760
10764 template<size_t nameLen, size_t valueLen>
10765 void add(const char(&name)[nameLen], const char(&value)[valueLen]) {
10766 add(name, nameLen - 1, value, valueLen - 1);
10767 }
10768
10772 template<size_t nameLen>
10773 void add(const char(&name)[nameLen], const std::string& value) {
10774 add(name, nameLen - 1, value.c_str(), value.length());
10775 }
10776
10780 void add(const std::string& name, int value) {
10781 add(name.c_str(), name.length(), value);
10782 }
10783
10787 void add(const std::string& name, float value) {
10788 add(name.c_str(), name.length(), value);
10789 }
10790
10794 void add(const std::string& name, const Vector& value) {
10795 add(name.c_str(), name.length(), value);
10796 }
10797
10801 void add(const std::string& name, const AColor& value) {
10802 add(name.c_str(), name.length(), value);
10803 }
10804
10809 void add(const std::string& name, const char* value, size_t valueLen) {
10810 add(name.c_str(), name.length(), value, valueLen);
10811 }
10812
10816 template<size_t valueLen>
10817 void add(const std::string& name, const char(&value)[valueLen]) {
10818 add(name.c_str(), name.length(), value, valueLen - 1);
10819 }
10820
10824 void add(const std::string& name, const std::string& value) {
10825 add(name.c_str(), name.length(), value.c_str(), value.length());
10826 }
10827
10832 void add(const char* name, size_t nameLen, int value) {
10833 appendString(name, nameLen);
10834
10835 if (value >= -128 && value <= 127) {
10836 const byte attrType = binUserAttributeType_int | (binUserAttributeFlag_small << 4);
10837 resize(2);
10838 write(attrType);
10839 write(sbyte(value));
10840 } else {
10841 resize(1 + sizeof(int));
10842 write(binUserAttributeType_int);
10843 write(value);
10844 }
10845 }
10846
10851 void add(const char* name, size_t nameLen, float value) {
10852 appendString(name, nameLen);
10853
10854 byte attrType = binUserAttributeType_float;
10855 byte writeSize = 1;
10856
10857 const SmallFloat smallValue(value, attrType, binUserAttributeFlag_small, writeSize);
10858 resize(writeSize);
10859 write(attrType);
10860 smallValue.write(*this);
10861 }
10862
10867 void add(const char* name, size_t nameLen, const Vector& value) {
10868 appendString(name, nameLen);
10869
10870 byte attrType = binUserAttributeType_vector;
10871 byte writeSize = sizeof(byte);
10872
10873 const SmallFloat smallX(value.x, attrType, binUserAttributeFlag_small, writeSize);
10874 const SmallFloat smallY(value.y, attrType, binUserAttributeFlag_smallY, writeSize);
10875 const SmallFloat smallZ(value.z, attrType, binUserAttributeFlag_smallZ, writeSize);
10876
10877 resize(writeSize);
10878 write(attrType);
10879
10880 smallX.write(*this);
10881 smallY.write(*this);
10882 smallZ.write(*this);
10883 }
10884
10889 void add(const char* name, size_t nameLen, const AColor& value) {
10890 appendString(name, nameLen);
10891
10892 byte attrType = binUserAttributeType_acolor;
10893 byte writeSize = sizeof(byte);
10894
10895 const SmallFloat smallR(value.color.r, attrType, binUserAttributeFlag_small, writeSize);
10896 const SmallFloat smallG(value.color.g, attrType, binUserAttributeFlag_smallY, writeSize);
10897 const SmallFloat smallB(value.color.b, attrType, binUserAttributeFlag_smallZ, writeSize);
10898 const SmallFloat smallA(value.alpha, attrType, binUserAttributeFlag_smallA, writeSize);
10899
10900 resize(writeSize);
10901
10902 write(attrType);
10903
10904 smallR.write(*this);
10905 smallG.write(*this);
10906 smallB.write(*this);
10907 smallA.write(*this);
10908 }
10909
10915 void add(const char* name, size_t nameLen, const char* value, size_t valueLen) {
10916 appendString(name, nameLen);
10917
10918 resize(1);
10919 write(binUserAttributeType_string);
10920
10921 appendString(value, valueLen);
10922 }
10923
10926 void close() {
10927 resize(1);
10928 write('\0');
10929 }
10930
10932 size_t getNumBytes() const {
10933 return index;
10934 }
10935
10937 bool hasData() const {
10938 // Close will write one termination char '\0'.
10939 // Having only name also doesn't make sense.
10940 return index > 2;
10941 }
10942
10945 IntList toIntList() {
10946 resize(1);
10947 write('\0'); // finalize attributes
10948
10949 index = 0;
10950 IntList temp;
10951 temp.swap(data);
10952 return temp;
10953 }
10954
10957 std::string toString() const {
10958 const byte* bytes = reinterpret_cast<const byte*>(data.data());
10959 size_t count = getNumBytes();
10960 std::string chars(count * 3 + 2, '\0');
10961
10962 for (size_t i = 0; i < count; ++i) {
10963 byte b = bytes[i];
10964 chars[3 * i + 0] = getHexChar(b >> 4);
10965 chars[3 * i + 1] = getHexChar(b & 0xf);
10966 chars[3 * i + 2] = ' ';
10967 };
10968 chars[3 * count + 0] = '0';
10969 chars[3 * count + 1] = '0';
10970
10971 return chars;
10972 }
10973
10974 private:
10975 // If float value could be represented as an int (values like 0.0, 1.0, 42.0)
10976 // and fits in int8 [SCHAR_MIN, SCHAR_MAX] it'll be written as a single byte
10977 // setting one of BinUserAttributeTypeFlags "small" flags.
10978 struct SmallFloat {
10979 SmallFloat(float value, byte& attrType, byte smallFlag, byte& writeSize)
10980 : value(value)
10981 , smallFloat(0)
10982 , isSmall(false)
10983 {
10984 const float roundValue = round(value);
10985 const bool almostInt = std::abs(value - roundValue) < 1e-6f;
10986 isSmall = almostInt && roundValue >= -128 && roundValue <= 127;
10987 if (!isSmall) {
10988 writeSize += sizeof(float);
10989 }
10990 else {
10991 smallFloat = sbyte(roundValue);
10992 attrType |= (smallFlag << 4);
10993 writeSize += sizeof(sbyte);
10994 }
10995 }
10996
10997 // Get original float value.
10998 float getFloat() const { return value; }
10999
11000 // Get value that fits in int8.
11001 sbyte getSmallFloat() const { return smallFloat; }
11002
11003 // Check if value could be stored as int8.
11004 bool getIsSmall() const { return isSmall; }
11005
11006 // Write value to buffer.
11007 void write(BinUserAttributesWriter& buf) const {
11008 if (isSmall)
11009 buf.write(smallFloat);
11010 else
11011 buf.write(value);
11012 }
11013
11014 private:
11015 const float value;
11016 sbyte smallFloat;
11017 bool isSmall;
11018 };
11019
11020 inline static char getHexChar(byte b) {
11021 return b < 10 ? b + '0' : b - 10 + 'A';
11022 }
11023
11024 // Append string bytes along with null-terminator.
11025 // @param name String value.
11026 // @param nameLen String value length (without null-terminator).
11027 void appendString(const char* name, size_t nameLen) {
11028 // We'll write name along with '\0' terminator.
11029 resize(nameLen + 1);
11030 memcpy(ptr(), name, nameLen);
11031 index += nameLen;
11032 *(ptr()) = 0;
11033 ++index;
11034 }
11035
11036 // Resize container, write bytes_count bytes, increment index.
11037 void append(const void* bytes, size_t bytes_count) {
11038 resize(bytes_count);
11039 memcpy(ptr(), bytes, bytes_count);
11040 index += bytes_count;
11041 }
11042
11043 // Resize container, write data, increment index.
11044 template<typename T>
11045 void append(const T& value) {
11046 resize(sizeof(T));
11047 write(value);
11048 }
11049
11050 // Write data, increment index. Container must have been resized beforehand.
11051 template<typename T>
11052 void write(const T& value) {
11053 *reinterpret_cast<T*>(ptr()) = value;
11054 index += sizeof(T);
11055 }
11056
11057 // Resize serialization buffer to fit extra bytes.
11058 // @param bytesToAdd Bytes count to accomodate.
11059 void resize(size_t bytesToAdd) {
11060 size_t newSize = index + bytesToAdd;
11061 if (newSize > data.size() * sizeof(int)) {
11062 data.resize((newSize + sizeof(int) - 1) / sizeof(int));
11063 }
11064 }
11065
11066 // Return the current data byte pointer.
11067 byte* ptr() {
11068 return reinterpret_cast<byte*>(data.data()) + index;
11069 }
11070
11071 // Serialization storage.
11072 std::vector<int> data;
11073
11074 // Byte index inside data, size in bytes.
11075 size_t index;
11076 };
11077
11078 inline std::ostream& operator <<(std::ostream& stream, const BinUserAttributesWriter& writer) {
11079 stream << writer.toString();
11080 return stream;
11081 }
11082} // namespace VRay
11083
11084#ifdef VRAY_SDK_INTEROPERABILITY
11085#include "vrayinterop.hpp"
11086#endif
11087
11088#include "_vraysdk_implementation.hpp"
11089
11090#ifdef _MSC_VER
11091# pragma warning(pop) // 4201
11092#endif // _MSC_VER
11093
11094#endif // _VRAY_SDK_HPP_
The raw memory contents of a BMP image.
Definition: vraysdk.hpp:542
Base class for LocalJpeg, LocalPng, LocalBmp. Can't be instantiated.
Definition: vraysdk.hpp:9808
bool saveToFile(const char *fileName) const
Write the data to disk.
size_t getLen() const
Returns size of image data in bytes.
Definition: vraysdk.hpp:9831
bool saveToFile(const std::string &fileName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: vraysdk.hpp:9839
void * getBuf() const
Returns a pointer to the image data.
Definition: vraysdk.hpp:9826
Definition: vraysdk.hpp:3910
Definition: vraysdk.hpp:2851
unsigned getGaussianPrimitivesCount() const
Get the number of Gaussian primitives - this is the unit Gaussian (mean [0,0,0], sd [1,...
Color getAverageColor(unsigned index) const
Get the average Color of the Gaussian primitive with the given index.
Vector getPosition(unsigned index) const
Get the position of the Gaussian primitive with the given index.
const Box & getPreviewBoundingBox() const
Get the preview bounding box of the model, calculated using the Gaussian primitive positions only.
Definition: vraysdk.hpp:2869
A group of utility methods related to variuos geometry source plugins.
Definition: vraysdk.hpp:9007
static bool readGaussianData(const Plugin &gaussianPlugin, GaussianReadData &readData)
static bool readScatterPreset(const ScatterReadParams &params, T &object, const void *userData=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static bool readScatterData(const Plugin &scatterPlugin, std::vector< Transform > &transforms, IntList &topo)
static bool readGaussianData(const std::string &fileName, GaussianReadData &readData)
static bool readScatterPreset(const ScatterReadParams &params, Plugin(*callback)(VRayRenderer &, const char *assetId, Vector importPosition, void *userData)=0, const void *userData=nullptr)
Definition: vraysdk.hpp:9794
The raw memory contents of a JPEG image.
Definition: vraysdk.hpp:489
A group of utility methods related to variuos light source plugins.
Definition: vraysdk.hpp:9046
static bool readLuminaireFieldPreviewData(const Plugin &luminairePlugin, LuminaireFieldReadPreviewData &readData)
static bool readLuminaireFieldPreviewData(const std::string &fileName, LuminaireFieldReadPreviewData &readData)
Definition: vraysdk.hpp:9882
LocalBmp(const VRayImage *img, bool preserveAlpha=false, bool swapChannels=false)
Definition: vraysdk.hpp:9889
LocalBmp(const VRayImage *img, const VRayRenderer &renderer, bool preserveAlpha=false, bool swapChannels=false)
Same as the other constructor. The renderer is used to log error messages.
Definition: vraysdk.hpp:9894
A wrapper around JPEG data in memory. It's meant to be stack allocated to free the data when done.
Definition: vraysdk.hpp:9850
LocalJpeg(const VRayImage *img, const VRayRenderer &renderer, int quality=0)
Same as the other constructor. The renderer is used to log error messages.
Definition: vraysdk.hpp:9861
LocalJpeg(const VRayImage *img, int quality=0)
Definition: vraysdk.hpp:9856
Definition: vraysdk.hpp:9866
LocalPng(const VRayImage *img, bool preserveAlpha=false)
Definition: vraysdk.hpp:9872
LocalPng(const VRayImage *img, const VRayRenderer &renderer, bool preserveAlpha=false)
Same as the other constructor. The renderer is used to log error messages.
Definition: vraysdk.hpp:9877
A variation of VRayImage to be created on the stack so that the image gets auto-deleted.
Definition: vraysdk.hpp:759
Definition: vraysdk.hpp:3503
std::vector< int > getConvexHullTriangles() const
Get the full array of the vertex indices of the convex hull in consecutive triplets.
std::vector< Vector > getConvexHullVertices() const
Get the full array of the vertices of light's convex hull.
Box getBoundingBox() const
Get the bounding box of the luminaire.
bool isValid() const
Checks if the object is valid.
Wrapper around a piece of heap memory. Takes care of calling the proper deallocating function.
Definition: vraysdk.hpp:470
Definition: vraysdk.hpp:4369
bool setArray(const char *propertyName, const int data[], size_t count, double time=TiMe::Default())
void swap(Plugin &plugin) noexcept
Swaps the underlying scene object instance reference and associated renderer reference.
Transform getTransform(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as Transform.
AColor getAColor(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as AColor.
double getDouble(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as double.
const char * getName() const
VectorList getVectorList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as VectorList.
bool isEmpty() const noexcept
Color getColor(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as Color.
Matrix getMatrix(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as Matrix.
Value getValue(const char *propertyName, double time=TiMe::Default()) const
PluginRefT< Plugin > getPlugin(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as a Plugin reference.
std::string getValueAsString(const char *propertyName, double time=TiMe::Default()) const
PluginMeta getMeta() const
unsigned long long getIntegerID() const noexcept
Returns the ID of the plugin instance. The ID is unique per scene contained in a VRayRenderer instanc...
std::string toString() const
Returns a string representation of the plugin which currently is the name of the plugin.
PluginCategories getCategories() const
TransformList getTransformList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as TransformList.
bool setValue(const char *propertyName, const bool value, double time=TiMe::Default())
FloatList getFloatList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as FloatList.
bool operator==(const Plugin &plugin) const noexcept
Returns true if both Plugins belong to the same renderer and point to the same scene object instance.
bool isNotEmpty() const noexcept
PluginTypeId getTypeId() const noexcept
Returns the type id of this plugin as long.
const char * getType() const
Returns the type of this plugin as string.
bool getBool(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as bool.
StringList getStringList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as StringList.
bool operator!=(const Plugin &plugin) const noexcept
Returns false if both Plugins belong to the same renderer and point to the same scene object instance...
PropertyRuntimeMeta getPropertyRuntimeMeta(const char *propertyName) const
std::string getString(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as string.
Vector getVector(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as Vector.
ValueList getValueList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as ValueList. Works only if it really is a generic list.
int getInt(const char *propertyName, double time=TiMe::Default()) const
PluginList getPluginList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as PluginList.
bool isPropertyAnimated(const char *propertyName) const
Plugin() noexcept
Default construct an invalid Plugin - not referencing a V-Ray scene object.
Definition: vraysdk.hpp:4401
ColorList getColorList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as ColorList.
std::vector< double > getKeyframeTimes(const char *propertyName) const
IntList getIntList(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as IntList.
bool setName(const char *newName)
Plugin & operator=(const Plugin &plugin) noexcept
Assign from another Plugin. They both point to the same underlying object. This is like having T& a=x...
VRayRenderer * getRenderer() const noexcept
Return the renderer this Plugin is associated with, can be null on empty plugins.
float getFloat(const char *propertyName, double time=TiMe::Default()) const
Returns the value of a property as float.
Plugin(const Plugin &plugin) noexcept
Copy construct from another Plugin. They both point to the same underlying object....
bool setValueAsString(const char *propertyName, const char *value)
bool isValid() const
Provides static meta information about a specific Plugin type.
Definition: vraysdk.hpp:9701
std::string getDescription() const
Returns a description for this render plugin type. May be empty.
PluginCategories getCategories() const
Returns all the plugin categories this plugin type belongs to, such as being a Light or a Material,...
bool isValid() const
Checks if the object is valid.
Definition: vraysdk.hpp:9743
PluginTypeId getTypeId() const
Returns the type id of the plugin.
Definition: vraysdk.hpp:9753
PropertyMeta getPropertyMeta(const char *propertyName) const
Returns an object used to obtain meta information about a plugin property.
Definition: vraysdk.hpp:9769
std::vector< std::string > getPropertyNames() const
Returns the names of all properties.
Definition: vraysdk.hpp:9758
GPUPluginSupport getGPUSupport() const
Returns to what extent the plugin is supported by V-Ray GPU.
const char * getType() const
Returns the type (name of the class) of the plugin or nullptr on ivalid type.
Definition: vraysdk.hpp:9748
bool checkPluginUIGuides(std::string &errMsg) const
PropertyMeta getPropertyMeta(const std::string &propertyName) const
Returns an object used to obtain meta information about a plugin property.
Definition: vraysdk.hpp:9774
const char * getDeprecation() const
Returns a deprecation string for this render plugin type. May be nullptr!
Definition: vraysdk.hpp:5168
bool operator==(const Plugin &plugin) const noexcept
Returns true if both Plugins point to the same scene object instance.
PluginRefT(const PluginRefT< T > &plugin) noexcept
Copy construct from another PluginRef type.
Definition: vraysdk.hpp:5195
PluginRefT(const PluginRefT &plugin) noexcept
Copy construct from another PluginRef.
Definition: vraysdk.hpp:5191
PluginRefT() noexcept
Default construct an invalid PluginRef - not referencing a V-Ray scene object.
Definition: vraysdk.hpp:5185
bool isOutputValid() const noexcept
Returns true if this PluginRef references a valid Plugin output (including the default one).
Definition: vraysdk.hpp:5215
PluginRefT(const Plugin &plugin, const char *outPropertyName)
Construct from Plugin and output property.
PluginRefT(const Plugin &plugin) noexcept
Construct from another Plugin.
Definition: vraysdk.hpp:5188
void swap(PluginRefT &plugin) noexcept
Swaps the underlying scene object instance reference along with its output and associated renderer re...
PluginRefT & operator=(const PluginRefT< T > &plugin) noexcept
Assign from another PluginRef type. They both point to the same underlying object....
const char * getOutputName() const
std::string toString() const
Returns a string representation of the plugin reference of the form "pluginName::outputPropertyName".
bool operator==(const PluginRefT< T > &plugin) const noexcept
Returns true if both PluginRefs point to the same scene object instance and reference the same output...
Definition: vraysdk.hpp:5241
PluginRefT(const T &plugin, const char *outPropertyName)
Construct from Plugin and output property.
bool operator==(const PluginRefT< Plugin > &plugin) const noexcept
Returns true if both PluginRefTs point to the same scene object instance and reference the same outpu...
std::string toString() const
Returns a string representation of the plugin reference of the form "pluginName::outputPropertyName".
bool isOutputValid() const noexcept
Returns true if this PluginRef references a valid Plugin output (including the default one).
Definition: vraysdk.hpp:5284
PluginRefT & operator=(const PluginRefT &plugin) noexcept
Assign from another PluginRefT. They both point to the same underlying object. This is like having T&...
PluginRefT(const T &plugin) noexcept
Construct from another Plugin.
Definition: vraysdk.hpp:5254
bool operator==(const PluginRefT &plugin) const noexcept
Returns true if both PluginRefTs point to the same scene object instance and reference the same outpu...
const char * getOutputName() const
PluginRefT() noexcept
Default construct an invalid PluginRef - not referencing a V-Ray scene object.
Definition: vraysdk.hpp:5251
bool operator==(const Plugin &plugin) const noexcept
Returns true if both Plugins point to the same scene object instance.
PluginRefT(const PluginRefT &plugin) noexcept
Copy construct from another PluginRef.
Definition: vraysdk.hpp:5257
void swap(PluginRefT &plugin) noexcept
Swaps the underlying scene object instance reference along with its output and associated renderer re...
The raw memory contents of a PNG image.
Definition: vraysdk.hpp:487
Definition: vraysdk.hpp:8973
Static meta information about a plugin property.
Definition: vraysdk.hpp:9524
Type getElementType() const
Returns the type of the property by definition or the type of the list elements when it's a typed lis...
Definition: vraysdk.hpp:9577
Type getType() const
Definition: vraysdk.hpp:9572
std::string getDescription() const
Returns a short description of this property. May be empty.
Definition: vraysdk.hpp:9587
GPUParamSupport getGPUSupport() const
Returns to what extent the property is supported by V-Ray GPU.
Definition: vraysdk.hpp:9616
std::string getUIGuides() const
Definition: vraysdk.hpp:9599
const char * getName() const
Returns the primary name of this property.
Definition: vraysdk.hpp:9563
int getElementsCount() const
Returns the number of elements for the property if it is a list and -1 otherwise.
Definition: vraysdk.hpp:9558
StringList getAliases() const
Returns a list of alias names of this property.
const char * getDeprecation() const
Returns a deprecation string for this property. May be nullptr!
Definition: vraysdk.hpp:9593
UIGuides getUIGuidesObject() const
Returns an object used to obtain meta information about a plugin property uiGuides.
Definition: vraysdk.hpp:9605
Value getDefaultValue() const
Extends PropertyMeta with type information only available at runtime for a specific property instance...
Definition: vraysdk.hpp:9622
RuntimeUIGuides getRuntimeUIGuidesObject() const
Returns an object used to obtain meta and dynamic information about a plugin property uiGuides.
Definition: vraysdk.hpp:9666
Type getRuntimeType() const
Get the current type of the property value. This can differ from the result of getType().
Definition: vraysdk.hpp:9651
int getRuntimeElementsCount() const
Return the current number of elements in a list property.
Definition: vraysdk.hpp:9646
A group of methods for reading data and creating V-Ray geometry proxies.
Definition: vraysdk.hpp:9063
static bool createMeshFile(const Plugin &geomMeshPlugin, const AnimatedTransform &animTransform, const ProxyCreateParams &params)
static bool readPreviewGeometry(const Plugin &proxyPlugin, VectorList &vertices, IntList &indices, int countHint=0)
static bool readPreviewHair(const Plugin &proxyPlugin, VectorList &vertices, IntList &lengths, int countHint=0)
static bool createMeshFile(const MeshFileData &data, const AnimatedTransform &animTransform, const ProxyCreateParams &params)
static bool readPreviewParticles(const Plugin &proxyPlugin, VectorList &positions, int countHint=0)
static bool readFullData(const ProxyReadParams &params, ProxyReadData &readData)
static bool createCombinedMeshFile(const std::vector< MeshFileData > &data, const std::vector< Transform > *transforms, const ProxyCreateParams &params)
static bool createCombinedMeshFile(const std::vector< MeshFileData > &data, const std::vector< AnimatedTransform > &animTransforms, const ProxyCreateParams &params)
static bool readPreviewData(const Plugin &proxyPlugin, ProxyReadData &readData)
static bool createMeshFile(const Plugin &geomMeshPlugin, const Transform *transform, const ProxyCreateParams &params)
static bool readPreviewParticles(const ProxyReadParams &params, VectorList &positions, int countHint=0)
static bool readPreviewGeometry(const ProxyReadParams &params, VectorList &vertices, IntList &indices, int countHint=0)
static bool readFullData(const Plugin &proxyPlugin, ProxyReadData &readData)
static bool createCombinedMeshFile(const std::vector< Plugin > &geomMeshPlugins, const std::vector< AnimatedTransform > &animTransforms, const ProxyCreateParams &params)
static bool readPreviewData(const ProxyReadParams &params, ProxyReadData &readData)
static bool createMeshFile(const MeshFileData &data, const Transform *transform, const ProxyCreateParams &params)
static bool createCombinedMeshFile(const std::vector< Plugin > &geomMeshPlugins, const std::vector< Transform > *transforms, const ProxyCreateParams &params)
static bool readPreviewHair(const ProxyReadParams &params, VectorList &vertices, IntList &lengths, int countHint=0)
Definition: vraysdk.hpp:2884
const std::vector< int > & getMaterialIDs() const
Get material IDs for each consecutive triangle in the full mesh.
Definition: vraysdk.hpp:2925
const std::vector< int > & getParticleVerticesStartIndices() const
Get the array of indices, where the particle vertices data starts - the i-th particle voxel starts at...
Definition: vraysdk.hpp:3093
std::vector< Vector > getHairVoxelVelocities(int hairVoxelIndex) const
Get velocities array of the voxel with the given index.
const std::vector< int > & getVoxelUVValueIndicesStartIndices() const
Get the array of indices, where the voxel UV value indices data starts - the j-th set of the i-th vox...
Definition: vraysdk.hpp:3066
ObjectInfo getMeshObjectInfo(int meshIndex) const
Get the object info of the geometry object with the given index.
int getParticleObjectInfosCount() const
Get the number of particle objects with object info. A particle object contains 1 or more particle vo...
const int * getUVValueIndices(int setIndex) const
Get an index array for the coordinates returned by getUVValues(). The data is owned and freed by this...
std::vector< int > getArrayOfLengths(const int *startIndices, int elementsCount, int objectCount, int uvSetsCount) const
const std::vector< Box > & getParticleVoxelsBBoxes() const
Get the array of bounding boxes of all particle voxels.
Definition: vraysdk.hpp:3158
Box getHairVoxelBBox(int hairVoxelIndex) const
Get bounding box of the hair voxel with the given index.
int getShadersCount() const
Get the number of available shader (material) name/ID pairs.
int getHairObjectInfosCount() const
Get the number of hair objects with object info. A hair object contains 1 or more hair voxels.
const std::vector< Box > & getGeometryVoxelsBBoxes() const
Get the array of bounding boxes of all geometry voxels.
Definition: vraysdk.hpp:3152
const std::vector< int > & getVoxelVerticesStartIndices() const
Get the array of indices, where the voxel vertices data starts - the i-th voxel starts at vertices[vo...
Definition: vraysdk.hpp:3024
const std::vector< Vector > & getUVValues() const
Get the full array of UVW 3-tuples.
Definition: vraysdk.hpp:3069
const std::vector< float > & getHairWidths() const
Get the full array of the hair geometry widths.
Definition: vraysdk.hpp:2997
std::vector< int > getVoxelMaterialIDs(int voxelIndex) const
Get materialIDs array of the voxel with the given index.
int getVoxelInfoObjectsCount() const
Get the number of geometry + hair + particle objects, which have voxel info.
const std::vector< Bool > & getVoxelInfoFlipNormals() const
Get an array of flipNormals flags (1 flag per mesh object - true if the geometric normals should be f...
Definition: vraysdk.hpp:3176
VoxelInfo getParticleVoxelInfo(int meshIndex) const
Get the voxel info of the particle object with the given index.
const std::vector< Box > & getHairVoxelsBBoxes() const
Get the array of bounding boxes of all hair voxels.
Definition: vraysdk.hpp:3155
std::vector< Vector > getVoxelVelocities(int voxelIndex) const
Get velocities array of the voxel with the given index.
VoxelInfo getMeshVoxelInfo(int meshIndex) const
Get the voxel info of the geometry object with the given index.
int getGeometryVoxelsCount() const
Get the number of all geometry voxels. A geometry object contains 1 or more geometry voxels.
const std::vector< int > & getHairVerticesPerStrand() const
Get the full array of the hair strands length data (The i-th strand has hairVerticesPerStrand[i] cons...
Definition: vraysdk.hpp:2994
const std::vector< Vector > & getNormals() const
Get full mesh normal vectors array.
Definition: vraysdk.hpp:2919
const std::vector< Color > & getVoxelInfoWireColor() const
Get an array of diffuse (wire) colors - 1 Color per mesh object.
Definition: vraysdk.hpp:3170
const std::vector< int > & getHairVelocitiesStartIndices() const
Get the array of indices, where the hair velocities data starts - the i-th hair voxel starts at hairV...
Definition: vraysdk.hpp:3090
const std::vector< Vector > & getVelocities() const
Get velocity vectors for each vertex in the vertex array.
Definition: vraysdk.hpp:2931
const std::vector< int > & getVoxelUVValuesStartIndices() const
Get the array of indices, where the voxel UV values data starts - the j-th set of the i-th voxel star...
Definition: vraysdk.hpp:3063
int getLengthFromStartIndex(int objectIndex, int setIndex, const int *startIndices, int elementsCount, int objectCount, int uvSetsCount) const
const std::vector< int > & getParticleWidthsStartIndices() const
Get the array of indices, where the particle widths data starts - the i-th particle voxel starts at p...
Definition: vraysdk.hpp:3096
std::vector< float > getParticleVoxelWidths(int particleVoxelIndex) const
Get widths array of the particle voxel with the given index.
std::string getUVSetName(int setIndex) const
Get the name of the UV set with the given index.
std::vector< int > getVoxelUVValueIndices(int voxelIndex, int setIndex) const
Get UV value indices in the UV values array of the voxel with the given index and of the set with the...
const std::vector< int > & getHairVerticesStartIndices() const
Get the array of indices, where the hair vertices data starts - the i-th hair voxel starts at hairVer...
Definition: vraysdk.hpp:3081
VoxelInfo getHairVoxelInfo(int meshIndex) const
Get the voxel info of the hair object with the given index.
size_t getUVValuesCount(int setIndex) const
Get the length of the array returned by getUVValues().
int getHairVoxelsCount() const
Get the number of all hair voxels. A hair object contains 1 or more hair voxels.
const std::vector< int > & getVoxelVertexIndicesStartIndices() const
Get the array of indices, where the voxel vertex indices data starts - the i-th voxel starts at indic...
Definition: vraysdk.hpp:3027
std::vector< int > getUVOriginalIndices() const
Get an array with the original proxy file indices of the UV sets. They may not equal their index in t...
std::vector< int > getVoxelNormalIndices(int voxelIndex) const
Get normal indices array of the voxel with the given index.
const std::vector< int > & getNormalIndices() const
Get indices in the normal for each triangle (every 3 consecutive ints are one triangle).
Definition: vraysdk.hpp:2922
size_t getUVValueIndicesCount(int setIndex) const
Get the length of the array returned by getUVValueIndices().
std::vector< int > getVoxelEdgeVisibility(int voxelIndex) const
Get an array of edge visibility flags of the voxel with the given index. Each integer in the array ha...
int getMeshObjectInfosCount() const
Get the number of geometry objects with object info. A geometry object contains 1 or more geometry vo...
ObjectInfo getHairObjectInfo(int meshIndex) const
Get the object info of the hair object with the given index.
std::string getShaderName(int shaderIndex) const
Get the name of the shader (material) with the given index.
int getShaderID(int shaderIndex) const
Get the ID of the shader (material) with the given index. Returns -1 if unavailable.
std::vector< Vector > getVoxelUVValues(int voxelIndex, int setIndex) const
Get UV values array of the voxel with the given index and of the set with the given index.
const std::vector< int > & getHairVerticesPerStrandStartIndices() const
Get the array of indices, where the hair strands data starts - the strands data of the i-th hair voxe...
Definition: vraysdk.hpp:3084
ObjectInfo getParticleObjectInfo(int meshIndex) const
Get the object info of the particle object with the given index.
Box getGeometryVoxelBBox(int voxelIndex) const
Get bounding box of the geometry voxel with the given index.
int getParticleVoxelsCount() const
Get the number of all particle voxels. A particle object contains 1 or more particle voxels.
const std::vector< int > & getVoxelNormalsStartIndices() const
Get the array of indices, where the voxel normals data starts - the i-th voxel starts at normals[voxe...
Definition: vraysdk.hpp:3036
std::vector< Vector > getVoxelNormals(int voxelIndex) const
Get normals array of the voxel with the given index.
const std::vector< int > & getUVValueIndices() const
Get the full array of UVW per-vertex indices.
Definition: vraysdk.hpp:3072
std::vector< Vector > getHairVoxelVertices(int hairVoxelIndex) const
Get vertex array of the hair voxel with the given index.
int getLengthFromStartIndex(int objectIndex, const int *startIndices, int elementsCount, int objectCount) const
const std::vector< float > & getParticleWidths() const
Get the full array of the particle geometry widths.
Definition: vraysdk.hpp:3003
const std::vector< Bool > & getVoxelInfoSmoothed() const
Get an array of smoothed flags (1 flag per mesh object - true if the voxel should be rendered with sm...
Definition: vraysdk.hpp:3173
int getAllVoxelsCount() const
Get the number of all voxels (geometry + hair + particle). Useful when the proxy file contains voxels...
const std::vector< int > & getParticleVelocitiesStartIndices() const
Get the array of indices, where the particle velocities data starts - the i-th particle voxel starts ...
Definition: vraysdk.hpp:3099
std::vector< Vector > getVoxelVertices(int voxelIndex) const
Get the vertex array of the voxel with the given index.
const std::vector< int > & getVoxelNormalIndicesStartIndices() const
Get the array of indices, where the voxel normalIndices data starts - the i-th voxel starts at normal...
Definition: vraysdk.hpp:3039
const std::vector< int > & getHairWidthsStartIndices() const
Get the array of indices, where the hair widths data starts - the i-th hair voxel starts at hairWidth...
Definition: vraysdk.hpp:3087
std::vector< int > getVoxelVertexIndices(int voxelIndex) const
Get the vertex indices array of the voxel with the given index.
const std::vector< Vector > & getParticleVertices() const
Get the full array of the particle geometry vertices.
Definition: vraysdk.hpp:3000
const std::vector< int > & getVoxelVelocitiesStartIndices() const
Get the array of indices, where the voxel velocities data starts - the i-th voxel starts at velocitie...
Definition: vraysdk.hpp:3054
std::vector< Vector > getParticleVoxelVertices(int particleVoxelIndex) const
Get vertex array of the particle voxel with the given index.
std::vector< Vector > getParticleVoxelVelocities(int particleVoxelIndex) const
Get velocities array of the particle voxel with the given index.
const std::vector< int > & getVertexIndices() const
Get indices in the vertex array for each triangle (every 3 consecutive ints are one triangle).
Definition: vraysdk.hpp:2916
Box getParticleVoxelBBox(int particleVoxelIndex) const
Get bounding box of the particle voxel with the given index.
ProxyReadData(int flags=MESH_ALL)
Pass different flags (or call setFlags later) if you want to limit the read data.
void setFlags(int flags)
Pass a combination of ReadFlags for the parts of the proxy data you need to read.
Definition: vraysdk.hpp:2910
const std::vector< Vector > & getVertices() const
Get full mesh vertex positions array.
Definition: vraysdk.hpp:2913
const std::vector< int > & getVoxelMaterialIDsStartIndices() const
Get the array of indices, where the voxel materialIDs data starts - the i-th voxel starts at material...
Definition: vraysdk.hpp:3045
std::vector< int > getHairVoxelVerticesPerStrand(int hairVoxelIndex) const
Get the hair strands length data of the hair voxel with the given index.
const Vector * getUVValues(int setIndex) const
Get an array of UVW mapping coordinates for the given mapping channel index. The data is owned and fr...
std::vector< int > getArrayOfLengths(const int *startIndices, int elementsCount, int objectCount) const
const std::vector< int > & getEdgeVisibility() const
Get an array of edge visibility flags, each integer in the array has edge visibility information for ...
Definition: vraysdk.hpp:2928
const std::vector< Vector > & getHairVertices() const
Get the full array of the hair geometry vertices.
Definition: vraysdk.hpp:2991
int getUVSetsCount() const
Get the number of available UV data sets (mapping channels).
int getNumFrames() const
Get the number of all frames in the proxy file. Useful when checking whether the proxy file contains ...
Bool hasVelocityChannel() const
True, in case the currently read frame contains at least one of geometry/hair/particle velocity data....
std::vector< float > getHairVoxelWidths(int hairVoxelIndex) const
Get widths array of the hair voxel with the given index.
Helper class that wraps a plugin instance enabling a certain render element.
Definition: vraysdk.hpp:2376
PixelFormat
This describes the desired data format for getData().
Definition: vraysdk.hpp:2496
@ PF_RGBA_BIT16
4x2 bytes RGBA.
Definition: vraysdk.hpp:2510
@ PF_BW_BIT8
1-byte greyscale/integer.
Definition: vraysdk.hpp:2498
@ PF_RGBA_FLOAT
4x4 bytes float RGBA.
Definition: vraysdk.hpp:2512
@ PF_RGB_FLOAT
3x4 bytes float RGB.
Definition: vraysdk.hpp:2507
@ PF_BW_BIT16
2-byte greyscale/integer.
Definition: vraysdk.hpp:2499
@ PF_RGBA_HALF
4x2 bytes half-float RGBA (currently not supported).
Definition: vraysdk.hpp:2511
@ PF_RGB_BIT16
3x2 bytes RGB.
Definition: vraysdk.hpp:2505
@ PF_BW_BIT32
4-byte greyscale/integer.
Definition: vraysdk.hpp:2500
@ PF_BW_FLOAT
4-byte float greyscale.
Definition: vraysdk.hpp:2502
@ PF_RGB_BIT8
3x1 bytes RGB.
Definition: vraysdk.hpp:2504
@ PF_RGBA_BIT8
4x1 bytes RGBA.
Definition: vraysdk.hpp:2509
@ PF_RGB_HALF
3x2 bytes half-float RGB (currently not supported).
Definition: vraysdk.hpp:2506
@ PF_BW_HALF
2-byte half-float greyscale (currently not supported).
Definition: vraysdk.hpp:2501
Plugin getPlugin() const
Get the plugin instance in the scene that enables this render element. Might be invalid for special c...
VRayImage * getImage(const ImageRegion *rgn=NULL, int layerIndex=0) const
RenderElement()
Default construct an invalid object.
Definition: vraysdk.hpp:2537
size_t getDataIntoBuffer(const GetDataOptions &options, void *data) const
static void releaseData(void *data)
Call this to release data allocated by the getData method.
BinaryFormat
Render channel binary format / storage data type.
Definition: vraysdk.hpp:2486
@ BF_FLOAT
A single float number (e.g. z-depth).
Definition: vraysdk.hpp:2487
@ BF_3FLOAT_SIGNED
3 signed float numbers (e.g. surface normals).
Definition: vraysdk.hpp:2491
@ BF_4FLOAT
4 float numbers (e.g. RGBA color).
Definition: vraysdk.hpp:2492
@ BF_3FLOAT
3 float numbers (e.g. RGB color).
Definition: vraysdk.hpp:2488
@ BF_2FLOAT
2 signed float numbers (e.g. uv coordinates or pixel screen velocity).
Definition: vraysdk.hpp:2489
@ BF_INT
A single integer number (e.g. render ID, material ID etc).
Definition: vraysdk.hpp:2490
PixelFormat getDefaultPixelFormat() const
Get the default format used by the getData method for this render element.
Definition: vraysdk.hpp:2558
size_t getData(void **data, const GetDataOptions &options) const
std::string getMetadata() const
Get render element metadata. Currently works only for Cryptomatte render element and returns manifest...
VRayImage * getImage(const GetImageOptions &options, int layerIndex=0) const
std::string getName() const
Get the display name of this render element.
Definition: vraysdk.hpp:2543
BinaryFormat getBinaryFormat() const
Get the binary format of pixels in this render element.
Definition: vraysdk.hpp:2553
Type
The render channal types/aliases are used to identify some common channels.
Definition: vraysdk.hpp:2381
@ REFLECT_ALPHA
Used by matte materials to store the alpha of the reflections.
Definition: vraysdk.hpp:2436
@ VRMTL_SHEEN_GLOSSINESS
VRayMtl sheen glossiness parameter.
Definition: vraysdk.hpp:2463
@ REALCOLOR
Real color VFB channel.
Definition: vraysdk.hpp:2410
@ COLOR
RGB VFB channel. This is always created by V-Ray and there can't be multiple instances....
Definition: vraysdk.hpp:2415
@ CRYPTOMATTE
Used for Cryptomatte render channel output.
Definition: vraysdk.hpp:2451
@ NODEID
Node ID VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2401
@ RAW_COAT_REFLECTION
Raw coat indirect reflection VFB channel.
Definition: vraysdk.hpp:2467
@ REFLECT
Reflection VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2386
@ VRMTL_COAT_COLOR
VRayMtl coat highlight color (coat filter uninfluenced by Fresnel weight, reflection and refraction c...
Definition: vraysdk.hpp:2466
@ EXTRA_TEX_FLOAT
A single texture override is applied to the whole scene (e.g. Dirt)
Definition: vraysdk.hpp:2482
@ LAST
not a type, just a delimiter
Definition: vraysdk.hpp:2471
@ RENDERTIME
Per-pixel render time.
Definition: vraysdk.hpp:2450
@ DRBUCKET
A channel that keeps track of which DR server rendered a particular bucket (it is a Color buffer that...
Definition: vraysdk.hpp:2429
@ NOISE_LEVEL
The noise level as estimated by the Adaptive and Progressive image samplers. Used for denoising purpo...
Definition: vraysdk.hpp:2441
@ RAW_REFLECTION
Raw reflection VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2405
@ BACKGROUND
Background VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2412
@ VRMTL_REFRACTGLOSS
A VRayMtl reflection glossiness VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2433
@ ZDEPTH
Z-Depth VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2402
@ SHEEN_FILTER
Sheen filter VFB channel.
Definition: vraysdk.hpp:2462
@ COAT_FILTER
Coat filter VFB channel.
Definition: vraysdk.hpp:2468
@ TOON
Toon effect channel.
Definition: vraysdk.hpp:2448
@ MTLRENDERID
Mtl render ID VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2439
@ DENOISED
A denoised version of the image. Adding this render element enables denoising.
Definition: vraysdk.hpp:2443
@ MATERIAL_SELECT
Material select.
Definition: vraysdk.hpp:2476
@ REFRACTION_FILTER
Refraction filter VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2407
@ COAT_REFL_ALPHA
Used by matte materials to store the alpha of the coat reflections.
Definition: vraysdk.hpp:2465
@ NONE
Unspecified channel.
Definition: vraysdk.hpp:2382
@ NORMALS
Normals VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2411
@ LIGHT_SELECT
Link this in the channels parameters of your lights.
Definition: vraysdk.hpp:2453
@ SAMPLERATE
The sample rate for the image samplers.
Definition: vraysdk.hpp:2425
@ RAWGI
Raw GI VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2394
@ COVERAGE
Pixel coverage.
Definition: vraysdk.hpp:2475
@ RAW_REFRACTION
Raw refraction VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2408
@ OBJECT_SELECT
Selects by object/material ID.
Definition: vraysdk.hpp:2479
@ LIGHTING_ANALYSIS
The lighting analysis overlay.
Definition: vraysdk.hpp:2452
@ BUMPNORMALS
The normals modified with bump map. This channel must be generated by shaders.
Definition: vraysdk.hpp:2423
@ MULTIMATTE_ID
RGB matte using material IDs.
Definition: vraysdk.hpp:2478
@ SHADEMAP_EXPORT
A channel that keeps the fragment coordinates in camera space.
Definition: vraysdk.hpp:2435
@ VRMTL_METALNESS
VRayMtl metalness parameter.
Definition: vraysdk.hpp:2455
@ SHADOW
Shadow VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2389
@ REFLECTION_FILTER
Reflection filter VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2404
@ SPECULAR
Specular VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2390
@ MATTESHADOW
Matte shadow channel where full shadows are white and areas not in shadow are black; essentially this...
Definition: vraysdk.hpp:2418
@ ALPHA
Alpha VFB channel. This is always created by V-Ray and there can't be multiple instances....
Definition: vraysdk.hpp:2414
@ EXTRA_TEX_INT
A single texture override is applied to the whole scene (e.g. Dirt)
Definition: vraysdk.hpp:2481
@ CAUSTICS
Caustics VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2393
@ SHEEN_REFL_ALPHA
Used by matte materials to store the alpha of the sheen reflections.
Definition: vraysdk.hpp:2464
@ VRMTL_REFLECTHIGLOSS
A VRayMtl reflection hilight glossiness VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2432
@ GI
GI VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2392
@ RAWTOTALLIGHT
The raw total diffuse lighting (direct+indirect) falling on a surface. This channel is generated by V...
Definition: vraysdk.hpp:2421
@ VRMTL_REFLECTGLOSS
A VRayMtl reflection glossiness VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2431
@ VELOCITY
Velocity VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2398
@ WORLD_POSITION
The position in world space. Used for denoising purposes.
Definition: vraysdk.hpp:2442
@ RENDERID
Render ID VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2399
@ TOON_LIGHTING
Direct toon diffuse lighting.
Definition: vraysdk.hpp:2457
@ EXTRA_TEX
A single texture override is applied to the whole scene (e.g. Dirt)
Definition: vraysdk.hpp:2480
@ USER
User defined channel indices start from here.
Definition: vraysdk.hpp:2473
@ TOTALLIGHT
The total diffuse lighting (direct+indirect) falling on a surface. This channel is generated by V-Ray...
Definition: vraysdk.hpp:2420
@ MTLID
Mtl ID VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2400
@ TOON_SPECULAR
Direct toon specular lighting.
Definition: vraysdk.hpp:2458
@ DIFFUSE
Diffuse filter VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2385
@ WIRECOLOR
Wire color channel where each object appears with a solid color. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2417
@ VRMTL_COAT_GLOSSINESS
VRayMtl coat glossiness parameter.
Definition: vraysdk.hpp:2469
@ RAW_SHEEN_REFLECTION
Raw sheen indirect reflection VFB channel.
Definition: vraysdk.hpp:2461
@ SELFILLUM
Self-illumination VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2388
@ DEFOCUS_AMOUNT
Pixel blur, combination of DOF and moblur. Used for denoising purposes.
Definition: vraysdk.hpp:2445
@ MULTIMATTE
RGB matte for up to 3 objects.
Definition: vraysdk.hpp:2477
@ VRMTL_SHEEN_COLOR
VRayMtl sheen color parameter (sheen filter uninfluenced by Fresnel weight, reflection and refraction...
Definition: vraysdk.hpp:2460
@ LIGHTING
Lighting VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2391
@ RAWLIGHT
Raw light VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2395
@ EFFECTS_RESULT
Channel for all post effects.
Definition: vraysdk.hpp:2447
@ REFRACT
Refraction VFB channel. This channel must be generated by shaders.
Definition: vraysdk.hpp:2387
@ RAWSHADOW
Raw shadow VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2396
@ ATMOSPHERE
Atmospheric effects channel.
Definition: vraysdk.hpp:2384
@ VRMTL_REFLECTIOR
A VRayMtl reflection IOR VFB channel. This channel is generated by V-Ray.
Definition: vraysdk.hpp:2438
@ SSS
A channel used for VRayFastSSS2 material sub-surface portion.
Definition: vraysdk.hpp:2427
@ WORLD_BUMPNORMAL
Normal with bump mapping in world space.
Definition: vraysdk.hpp:2444
Type getType() const
Get the type of the render element.
Definition: vraysdk.hpp:2548
This class groups methods related to management of render elements in the scene.
Definition: vraysdk.hpp:2626
RenderElement add(RenderElement::Type type, const char *displayName, const char *instanceName)
RenderElement get(RenderElement::Type type) const
std::vector< RenderElement > getAll(RenderElement::Type type) const
Definition: vraysdk.hpp:9504
bool isEnabled() const
bool isHidden() const
Definition: vraysdk.hpp:4141
bool getPreset(const char *filename, ScannedMaterialPreset &result) const
bool getInfo(const std::string &filename, std::string &info) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getPreset(const std::string &filename, ScannedMaterialPreset &result) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getInfo(const char *filename, std::string &info) const
Definition: vraysdk.hpp:10355
VUtils::VectorRefList getMeshVertices(double time=0)
DataType getDataType() const
bool isValid() const
Definition: vraysdk.hpp:10374
VRay::Box getMeshBoundingBox(double time=0)
VUtils::IntRefList getHairNumVertices(double time=0)
Transform getTransform(double time=0) const
bool getVisibility(double time=0) const
VUtils::VectorRefList getHairVertices(double time=0)
std::string getDataTypeAsString() const
VRay::Box getWorldBoundingBox(double time=0)
const char * getTypeAsString() const
const char * getName() const
ObjectType getType() const
const char * getNodeDataName() const
VUtils::IntRefList getMeshFaces(double time=0)
Definition: vraysdk.hpp:10165
float getMetersScale() const
Returns scene meters scale.
ScenePreview(const char *filename)
int getFrameEnd() const
Returns animation end frame.
UpAxis getUpAxis() const
Returns scene up axis.
bool operator!() const
Definition: vraysdk.hpp:10286
int getFrameStart() const
Returns animation start frame.
size_t getTotalFaces() const
Returns the total number of faces.
float getFramesScale() const
Returns scene frames scale.
int getFPS() const
Returns FPS.
float getPhotometricScale() const
Returns scene photometric scale.
float getSecondsScale() const
Returns scene seconds scale.
Object getObject(const char *name) const
ScenePreview(const char *filename, const Settings &settings)
std::vector< Object > getObjects(ObjectType objectType=ObjectTypeAll, DataType dataType=DataTypeAll) const
Definition: vraysdk.hpp:9211
bool hasOverriddenBy() const
bool hasOverride() const
bool hasAttribute(const AttributesType attributeType) const
UnitsType
Definition: vraysdk.hpp:9326
QuantityTypeEnum
Defines the quantity type that the parameter represents.
Definition: vraysdk.hpp:9306
@ Angle
Definition: vraysdk.hpp:9318
@ Distance
Definition: vraysdk.hpp:9313
std::string getValueOfOverriddenBy() const
bool isStringEnum() const
std::vector< std::string > getFileAssetNames() const
std::string getValueOfOverride(const int index) const
std::vector< std::string > getEnableDepends() const
std::vector< std::string > getStringEnumStrings() const
bool hasEnabledCondition() const
std::vector< EnumItem > getEnumStrings() const
std::string getRolloutName() const
GuideType
UIGuides supported property types.
Definition: vraysdk.hpp:9226
@ StartRollout
Definition: vraysdk.hpp:9262
@ Tier
Definition: vraysdk.hpp:9291
@ Hide
Indicates when the control should be hidden (not shown at all), depending on other plugin parameter v...
Definition: vraysdk.hpp:9293
@ GPUSupport
To what extent the property is supported by V-Ray GPU.
Definition: vraysdk.hpp:9288
@ QuantityType
Definition: vraysdk.hpp:9272
@ Enum
Definition: vraysdk.hpp:9229
@ Overrides
Definition: vraysdk.hpp:9286
@ MinValue
Limits the min value of the control.
Definition: vraysdk.hpp:9236
@ StringEnum
Definition: vraysdk.hpp:9252
@ SoftMinValue
Limits the max value of the control initially (the user can override it).
Definition: vraysdk.hpp:9267
@ StartTab
Definition: vraysdk.hpp:9265
@ Enable
Indicates when the control should be active (not grayed out), depending on other plugin parameter val...
Definition: vraysdk.hpp:9231
@ FileAssetNames
Definition: vraysdk.hpp:9255
@ SoftMaxValue
Limits the min value of the control initially (the user can override it).
Definition: vraysdk.hpp:9269
@ FileAssetOp
It is used to specify whether the file asset is going to be loaded or saved (or both) by V-Ray.
Definition: vraysdk.hpp:9257
@ Attributes
Definition: vraysdk.hpp:9249
@ Units
Definition: vraysdk.hpp:9243
@ FileAsset
Definition: vraysdk.hpp:9246
@ OverridenBy
Definition: vraysdk.hpp:9279
@ DisplayName
Definition: vraysdk.hpp:9234
@ SpinStep
Add a step hint to a slider.
Definition: vraysdk.hpp:9240
@ MaxValue
Limits the max value of the control.
Definition: vraysdk.hpp:9238
@ DefaultValue
Definition: vraysdk.hpp:9300
FileAssetOpType
Definition: vraysdk.hpp:9340
std::string getDisplayName() const
FileAssetOpType getFileAssetOp() const
bool hasHiddenCondition() const
std::vector< std::string > getHideDepends() const
TierType getTier() const
std::vector< float > getFloats(const GuideType type) const
int getCountOfOverrides() const
std::string getTabName() const
QuantityTypeEnum getQuantityType() const
float getFloat(const GuideType type) const
bool hasType(const GuideType type) const
UnitsType getUnits() const
std::vector< std::string > getFileAssetExts() const
GPUParamSupport getGPUSupportStatus() const
AttributesType
Used to specify some additional attributes for the parameter.
Definition: vraysdk.hpp:9347
TierType
Definition: vraysdk.hpp:9371
bool isEnum() const
Definition: vraysdk.hpp:10528
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 poi...
bool setupRenderer(VRayRenderer &renderer)
IntList sampleAreaInt(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
bool releaseRenderer(VRayRenderer &renderer)
bool sample(const PluginRef &pluginRef, float u, float v, AColor &result)
FloatList sampleAreaFloat(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
VRayImage * sampleArea(const PluginRef &pluginRef, float u_start, float u_end, float v_start, float v_end, int width, int height)
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...
The raw memory contents of a serialized VFB state.
Definition: vraysdk.hpp:491
Definition: vraythrow.hpp:9
Definition: vraysdk.hpp:3725
void setGUIMessageProcessing(bool enableMessageProcessing)
Definition: vraysdk.hpp:3750
VRayInit(bool enableFrameBuffer)
Definition: vraysdk.hpp:3734
This class encapsulates all VFB per-layer related methods.
Definition: vraysdk.hpp:6413
int setUserName(const std::string &layerName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyNames(std::vector< std::string > &propNames) const
int canDelete(bool &isDeletable) const
int setLayerPropertyBoolValue(const char *propName, const bool value)
int getUserName(std::string &layerName) const
int setLayerPropertyIntValue(const char *propName, const int value)
int setBlendMode(const VFBLayerProperty::BlendMode blendMode) const
LayerManager & getLayerManager() const
Return the layer manager this layer is associated with.
int setLayerPropertyColorValue(const char *propName, const Color &value)
int resetLayerPropertyToDefault(const char *propName)
int getLayerPropertyDisplayName(const char *propName, std::string &displayName) const
int getLayerPropertyDisplayName(const std::string &propName, std::string &displayName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyIntByEnumLabel(const char *propName, const char *label)
int getLayerPropertyStampRawStringValue(const std::string &propName, std::string &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyFloatValue(const std::string &propName, const float value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyStampRawStringValue(const char *propName, const char *value)
int isLayerPropertyReadOnly(const std::string &propName, bool &isReadOnly) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyFloatValue(const char *propName, float &value) const
Other type properties ------------------------------------—.
int getLayerPropertyStampFontDescValue(const char *propName, VFBLayerProperty::StampFontDesc &value) const
int setLayerPropertyIntByEnumLabel(const std::string &propName, const std::string &label)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyIntByEnumIndex(const std::string &propName, const int enumIndex)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyStringValue(const std::string &propName, const char *value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyFlags(const std::string &propName, int &flags) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getEnabled(bool &isEnabled) const
int setLayerPropertyStampRawStringValue(const std::string &propName, const char *value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setOpacity(const float opacity) const
int setLayerPropertyIntByEnumLabel(const std::string &propName, const char *label)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyColorValue(const std::string &propName, Color &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyBoolValue(const std::string &propName, const bool value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyStringValue(const std::string &propName, std::string &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyFloatValue(const std::string &propName, float &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyStringValue(const char *propName, const char *value)
int getLayerPropertyType(const std::string &propName, VFBLayerProperty::Type &type) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setUserName(const char *layerName)
int getLayerPropertyBoolValue(const std::string &propName, bool &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyFloatValue(const char *propName, const float value)
int getLayerPropertiesOfType(const VFBLayerProperty::Type type, std::vector< std::string > &values) const
int getLayerPropertyIntValue(const char *propName, int &value) const
int getLayerPropertyIntValue(const std::string &propName, int &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyColorValue(const char *propName, Color &value) const
int getLayerPropertyFlags(const char *propName, int &flags) const
Methods for manipulating the flags of a property ------------------------------------—.
int getClass(std::string &layerClass) const
int getLayerPropertyStampFontDescValue(const std::string &propName, VFBLayerProperty::StampFontDesc &value) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyIntEnumValues(const std::string &propName, std::vector< std::string > &values) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getChildrenCount(int &childrenCount) const
int getLayerPropertyBoolValue(const char *propName, bool &value) const
Integer properties ------------------------------------—.
int resetLayerPropertyToDefault(const std::string &propName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getBlendMode(VFBLayerProperty::BlendMode &blendMode) const
int getLayerPropertiesCount(int &propsCount) const
int isLayerPropertyReadOnly(const char *propName, bool &isReadOnly) const
int setLayerPropertyIntByEnumLabel(const char *propName, const std::string &label)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyStringValue(const char *propName, std::string &value) const
int getLayerPropertiesReadOnly(std::vector< std::string > &values) const
int getLayerPropertyIntEnumLabel(const std::string &propName, std::string &valueLabel) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyStampFontDescValue(const std::string &propName, const VFBLayerProperty::StampFontDesc &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setLayerPropertyStampRawStringValue(const std::string &propName, const std::string &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyIntEnumIndex(const std::string &propName, int &enumIndex) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyStampRawStringValue(const char *propName, std::string &value) const
int setLayerPropertyStampRawStringValue(const char *propName, const std::string &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Layer getChild(const int childIndex) const
int setEnabled(const bool enabled)
int getLayerEnumProperties(std::vector< std::string > &values) const
Some methods for Enum integer properties ------------------------------------—.
int setLayerPropertyColorValue(const std::string &propName, const Color &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getLayerPropertyIntEnumValues(const char *propName, std::vector< std::string > &values) const
int getLayerPropertyIntEnumIndex(const char *propName, int &enumIndex) const
int setLayerPropertyIntValue(const std::string &propName, const int value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int getOpacity(float &opacity) const
int setLayerPropertyIntByEnumIndex(const char *propName, const int enumIndex)
int canBlend(bool &isBlendable) const
int getUniqueTreePathID(std::string &treePathUID) const
int getLayerPropertyIntEnumLabel(const char *propName, std::string &valueLabel) const
std::vector< Layer > getChildren() const
int setLayerPropertyStampFontDescValue(const char *propName, const VFBLayerProperty::StampFontDesc &value)
int getLayerPropertyType(const char *propName, VFBLayerProperty::Type &type) const
Definition: vraysdk.hpp:6777
void lockLayers()
Synchronized batch manipulations on layers ------------------------------------—.
int setAllLayers(const char *json)
int loadAllLayers(const char *filename)
std::vector< Layer > findAllLayersWithUserName(const std::string &userName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Layer createLayer(const std::string &layerClass, const Layer &parent)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< Layer > findAllLayersWithUserName(const char *userName) const
std::vector< Layer > findAllLayersWithLayerClass(const std::string &layerClass) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Layer getRootLayer() const
Common layers access ------------------------------------—.
int bakeLayersToLUT(const std::string &filename) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< Layer > findAllLayersWithLayerClass(const char *layerClass) const
Accumulation of layers ----------------------------------—.
int saveAllLayers(const std::string &filename) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int bakeLayersToLUT(const char *filename) const
int setAllLayers(const std::string &json)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< Layer > getAllLayersAsLayerObjects() const
void unlockLayers()
Unlock the layers critical section.
VFB & getVFB() const
Tree management -----------------------------—.
int loadAllLayers(const std::string &filename)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< std::string > getCreatableLayerClasses() const
std::vector< Layer > getAllBlendableLayers() const
int saveAllLayers(const char *filename) const
std::vector< Layer > getAllEnabledLayers() const
std::string getLastError() const
Returns the last error that occurred when a method of layerManager or Layer was called....
Definition: vraysdk.hpp:6953
Layer createLayer(const char *layerClass, const Layer &parent)
This class groups all VFB related methods.
Definition: vraysdk.hpp:6330
void setState(const void *vfbStateData, size_t dataSize, bool setMain=true, bool setHistory=true)
void setAlwaysOnTop(bool set)
Toggles the always-on-top behavior of the VFB window (disabled by default)
bool isInteractivityEnabled() const
Check if camera control from the VFB is enabled.
void setPosition(int x, int y)
Set the top-left coordinate of the VFB window in screen coordinates.
bool isShown() const
Check if the VFB window is currently shown.
std::string getLayers() const
void setPersistentState(const void *vfbPersistentStateData, size_t dataSize)
void show(bool show, bool setFocus=true)
VFBState * getState(size_t &dataSize, bool includeMain=true, bool includeHistory=true) const
void enableConfirmation(bool enable=true)
Enables the confirmation dialog when the VFB "Clear image" button is pressed.
VFBState * getPersistentState(size_t &dataSize) const
int setLayers(const char *json)
void setPositionAndSize(int x, int y, int w, int h)
Set the top-left coordinate and size of the VFB window in screen coordinates.
int setSettings(const char *json)
bool getPositionAndSize(int &x, int &y, int &w, int &h) const
Get the top-left coordinate of the VFB window in screen coordinates.
bool isConfirmationEnabled() const
Check if the confirmation dialog when clearing an image is enabled.
void enableInteractivity(bool enable=true)
Enables camera control using mouse and keyboard from the VFB image area.
std::string getSettings() const
Definition: vraysdk.hpp:6035
static bool isActiveState(RendererState value)
Convenience function for checking if a state value is in the rendering subset (including preparing).
Definition: vraysdk.hpp:7211
bool isRenderEnded() const
void start() const
Box getBoundingBox(bool &ok) const
Returns the current bounding box of the scene.
void setOnVFBSaveSettingsNotify(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
InstanceHandleType getInstanceHandle() const
void setOnBucketFailed(void(*callback)(VRayRenderer &, int x, int y, int width, int height, const char *host, ImagePassType pass, double instant, void *userData), const void *userData=NULL)
int loadAsTextFiltered(const char *fileName, T &obj, const void *userData=NULL)
void setOnVFBShowMessagesWindow(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T getOrCreatePlugin(const std::string &pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOf(const std::string &pluginType) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setCameraName(const char *name)
Camera name override. Current camera is selected internally using the scene_name property of the came...
int resetHosts(const std::string &hosts) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnRenderViewChanged(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnHostConnected(void(*callback)(VRayRenderer &, const char *hostName, double instant, void *userData), const void *userData=NULL)
void setOnVRayProfilerWrite(T &object, const void *userData=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setRenderMode(RenderMode mode)
void setOnUploadToCollaboration(int(*callback)(VRayRenderer &, const std::vector< std::string > &fileList, double instant, void *), const void *userData=NULL)
void setBucketReadyHasBuffer(bool hasBuffer)
Sets if an image passed in the BucketReady event parameters is needed. If not, no unnecessary copies ...
bool setInteractiveNoiseThreshold(float threshold)
void setOnHostDisconnected(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T getOrCreatePlugin(const char *pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getUseAnimatedValuesState() const
Returns true if setting parameter values adds keyframes and false if it overwrites.
void setOnVFBInteractiveStart(void(*callback)(VRayRenderer &, bool isRendering, double instant, void *userData), const void *userData=NULL)
int getNumThreads() const
Return the number of threads that will be used for rendering. 0 means all CPU logical threads.
void setOnVFBShowMessagesWindow(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
bool setCurrentTime(double time)
void setOnVFBOpenUpdateNotify(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T getInstanceOrCreate(const std::string &pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool savePhotonMapFile(const char *fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int appendAsTextFiltered(const std::string &fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::string getAllHosts() const
void setOnVFBClosed(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setInProcess(bool inProcess)
std::string exportSceneToBuffer() const
void setOnProgressiveImageUpdated(void(*callback)(VRayRenderer &, VRayImage *img, unsigned long long changeIndex, ImagePassType pass, double instant, void *userData), const void *userData=NULL)
int loadAsTextFiltered(const char *fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
bool getDREnabled() const
void setOnVFBCopyToHostFrameBufferNotify(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::string getActiveHosts() const
Plugin getInstanceOrCreate(const char *pluginName, const char *pluginType)
bool setComputeDevicesMetal(const std::vector< int > &indices)
std::vector< PickedPluginInfo > pickPlugins(double x, double y, int maxcount=0, int timeout=-1) const
void setOnRendererClose(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOf(const char *pluginType) const
int appendFiltered(const char *fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
bool clearAllPropertyValuesUpToTime(double time)
Removes all keyframe values at times less than 'time'.
void setOnVFBInteractiveStart(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool deletePlugin(const Plugin &plugin)
bool resume() const
RenderElements getRenderElements()
Returns an object that groups render element management methods.
bool deletePlugin(const char *pluginName)
void setOnVFBPauseIPR(void(*callback)(VRayRenderer &, bool isRendering, double instant, void *userData), const void *userData=NULL)
bool getInProcess() const
Plugin pickPlugin(int x, int y, int timeout) const
int appendFiltered(const std::vector< std::string > &fileNames, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T getInstanceOf() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
WaitTime
Used with waitForRenderEnd()
Definition: vraysdk.hpp:7995
bool enableDRClient(const EnableDRClientParams &enableParams)
int appendAsTextFiltered(const char *fileName, T &obj, const void *userData=NULL)
AddHostsResult addHosts(const char *hosts) const
Plugin newPlugin(const char *pluginType)
bool setRenderSizes(const RenderSizeParams &sizes, bool regionButtonState)
bool waitForSequenceEnd() const
std::vector< Plugin > getPlugins() const
Returns all plugin instances in the current scene.
void setOnStateChanged(void(*callback)(VRayRenderer &, RendererState oldState, RendererState newState, double instant, void *), const void *userData=NULL)
void setOnVFBDebugShadingNotify(void(*callback)(VRayRenderer &, int enabled, DebugShadingMode mode, int selectionLocked, double instant, void *userData), const void *userData=NULL)
Plugin newPlugin(const char *pluginName, const char *pluginType)
bool saveCausticsFile(const char *fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int load(const std::string &fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool waitForVFBClosed(const int timeout) const
unsigned long long commit()
T getInstanceOrCreate(const char *pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int loadAsTextFiltered(const std::string &fileName, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int setBitmapCache(bool onOff)
float getIESPrescribedIntensity(const std::string &iesLightFileName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
ParserError getLastParserError() const
Returns the parser error that occurred when a scene was last loaded or appended.
bool addVRayProfilerMetadata(const std::string &category, const std::string &key, const std::string &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getOrCreatePlugin(const char *pluginName, const char *pluginType)
AutoExposureResult getAutoExposureResult() const
Returns the auto-exposure and auto-white balance values computed during the last light cache calculat...
void setUserCameraChangedCB(void(*cb)(const UserCameraChanged *info, void *userData), void *userData)
void setKeepInteractiveRunning(bool keepRunning)
bool isFrameSkipped() const
bool clearPropertyValuesUpToTime(double time, PluginCategories categories)
Removes all keyframe values at times less than 'time' only from plugins of given categories.
int appendAsText(std::string &&text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setComputeDevicesDenoiser(const std::vector< int > &indices)
const RendererOptions getOptions() const
Return the options used to construct this renderer.
void setOnVFBUpdateIPR(void(*callback)(VRayRenderer &, bool isRendering, double instant, void *userData), const void *userData=NULL)
int append(const std::vector< std::string > &fileNames)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool saveCausticsFile(const std::string &fileName)
int appendAsText(const std::string &text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnBucketFailed(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnLogMessage(void(*callback)(VRayRenderer &, const char *msg, MessageLevel level, double instant, void *userData), MessageLevel minLevel=MessageInfo, const void *userData=NULL)
int loadAsTextFiltered(const std::string &fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
size_t getIrradianceMapSize() const
VRayRenderer(InstanceHandleType handle)
int appendAsTextFiltered(const std::vector< const char * > &sceneTexts, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
bool getImageSize(int &width, int &height) const
Returns the frame buffer width and height.
bool updateLightingAnalysis()
void setOnProgressiveImageUpdated(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setProgresiveImageUpdatedHasBuffer(bool hasBuffer)
Sets if an image passed in the ProgressiveImageUpdated event parameters is needed....
bool saveLightCacheFile(const std::string &fileName)
static bool isInactiveState(RendererState value)
Convenience function for checking if a state value is in the idle subset (including IDLE_FRAME_DONE a...
Definition: vraysdk.hpp:7208
int append(const std::string &fileName, bool drSendNameOnly=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int resetHosts(const char *hosts=NULL) const
void setDebugShadingSelection(const std::vector< Plugin > &selection)
void setOnBucketInit(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnProgress(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
~VRayRenderer()
Destructor.
Plugin getPlugin(const char *pluginName) const
void setOnBucketReady(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T newPlugin(const char *pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
AddHostsResult addHosts(const std::string &hosts) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
T getPlugin(const char *pluginName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getCropRegion(int &srcWidth, int &srcHeight, float &rgnLeft, float &rgnTop, float &rgnWidth, float &rgnHeight) const
Gets the virtual crop region (RgnLeft, RgnTop, RgnWidth, RgnHeigt) within a virtual source image spac...
bool denoiseNow(T &object, bool shouldPassImage=true, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnVFBPauseIPR(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isRenderingInHalfResolution() const
Definition: vraysdk.hpp:7215
void renderSequence() const
Begins rendering an animation sequence in a separate thread. A non-blocking call.
int appendFiltered(const std::vector< std::string > &fileNames, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int loadAsText(const char *text)
std::vector< Plugin > getPluginsOfCategories(const std::vector< PluginCategories > &categories) const
Plugin getCamera() const
Gets the current camera plugin. Don't use this unless you need to use setCamera() - see the comments ...
int loadAsText(const char *text, size_t length, void(*freeFn)(char *text, size_t size, T *holderObject)=NULL, T *holderObject=NULL)
Plugin getInstanceOrCreate(const char *pluginType)
Plugin getInstanceOrCreate(const char *pluginName, PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Box getBoundingBox() const
Returns the current bounding box of the scene.
int appendAsText(const char *text, size_t length, void(*freeFn)(char *text, size_t size, T *holderObject)=NULL, T *holderObject=NULL)
void setVFBContextMenuItems(const std::vector< VFBContextMenuItem > &items)
Set menu items for the VFB's context menu.
void setOnHostConnected(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnLogMessage(T &object, MessageLevel minLevel=MessageInfo, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool waitForSequenceEnd(const int timeout) const
void setIncludePaths(const char *includePaths, bool overwrite=true)
Plugin newPlugin(const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
double getCurrentTime() const
VRayImage * getImage(const GetImageOptions &options) const
int load(const char *fileName)
std::vector< std::string > getAllPluginTypes() const
Returns the class names of all available V-Ray plugin classes loaded from dynamic libraries.
bool setInteractiveSampleLevel(int samplesPerPixel)
int appendFiltered(const std::string &fileName, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getOrCreatePlugin(const std::string &pluginName, PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getVisualDebuggerEnabled() const
Returns whether the Visual Debugger is enabled.
Plugin getInstanceOrCreate(const std::string &pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int appendFiltered(const std::vector< const char * > &fileNames, T &obj, const void *userData=NULL)
std::vector< ComputeDeviceInfo > getComputeDevicesCurrentEngine() const
void setOnPostEffectsUpdated(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnLightMixTransferToScene(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void bucketRenderNearest(int x, int y) const
void setOnVFBLayersChanged(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
void setOnLicenseError(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void clearLastError()
Clears the last error code.
size_t getLightCacheSize() const
void setOnVFBRenderLast(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOrCreate(const char *pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getAutoCommit() const
Get the current state of the autoCommit flag.
Plugin newPlugin(PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool clearScene()
Wipes the scene contents (all plugin instances). This implicitly calls stop() if necessary.
bool enableLiveLinkClient(const LiveLinkClientParameters &params)
void setVFBContextMenuSelectedCallback(void(*callback)(VRayRenderer &, int commandId, int x, int y, void *userData), const void *userData=NULL)
size_t getCausticsSize() const
std::vector< RetT > getPlugins() const
bool setImageSize(int width, int height, bool resetCropRegion=true, bool resetRenderRegion=true)
int loadAsText(const std::string &text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool deletePlugins(const char *names[], size_t namesCount)
void setUserLightChangedCB(void(*cb)(const UserLightChanged *info, void *userData), void *userData)
bool getKeepInteractiveRunning() const
Get the current state of the keepInteractiveRunning flag.
PluginMeta getPluginMeta(const char *pluginClassName) const
Return static meta information about a given plugin type.
RenderMode getRenderMode() const
Get the current render mode.
int appendAsTextFiltered(const std::vector< std::string > &sceneTexts, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
InteractiveStatistics getInteractiveStatistics() const
Returns some performance statistics from the Interactive (RT) engine.
bool denoiseNow(void(*userCb)(VRayRenderer &, VRayImage *, void *)=0, bool shouldPassImage=true, const void *userData=NULL)
bool setInteractiveTimeout(int timeoutMsec)
void setOnVFBLayersChanged(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool addVRayProfilerMetadata(const char *category, const char *key, const char *value)
bool waitForRenderEnd(const int timeout) const
VRayImage * getImage() const
unsigned long setProgressiveImageUpdateTimeout(unsigned long timeout)
std::vector< std::string > getPluginTypesOfCategory(PluginCategory category) const
Plugin getInstanceOrCreate(const std::string &pluginName, const char *pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setDREnabled(bool drEnabled, bool enableBroadcastListener=true)
std::vector< ComputeDeviceInfo > getComputeDevicesOptix() const
float getIESPrescribedIntensity(const char *iesLightFileName) const
void setUserNodeChangedCB(void(*cb)(const UserNodeChanged *info, void *userData), void *userData)
void setIncludePaths(const std::string &includePaths, bool overwrite=true)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int loadFiltered(const char *fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
int append(const std::vector< const char * > &fileNames)
void setOnVFBOpenUpdateNotify(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
bool setCropRegion(int srcWidth, int srcHeight, float rgnLeft, float rgnTop, float rgnWidth, float rgnHeight)
void setVRayProfiler(const VRayProfilerSettings &settings)
bool savePhotonMapFile(const std::string &fileName)
bool setNumThreads(int numThreads)
void setOnBucketReady(void(&callback)(VRayRenderer &, int x, int y, const char *host, VRayImage *img, ImagePassType pass, double instant, void *userData), const void *userData=NULL)
std::vector< Plugin > getPlugins(const std::string &pluginClassName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnLicenseError(void(*callback)(VRayRenderer &, const char *msg, int errorCode, LicenseUserStatus userStatus, double instant, void *userData), const void *userData=NULL)
void setOnStateChanged(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnBucketReady(std::nullptr_t null)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool replacePlugin(const Plugin &oldPlugin, const Plugin &newPlugin)
int appendAsTextFiltered(const char *fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
std::vector< ComputeDeviceInfo > getComputeDevicesMetal() const
T getPlugin(const std::string &pluginName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool saveLightCacheFile(const char *fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnVFBCopyToHostFrameBufferNotify(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
Plugin getOrCreatePlugin(const std::string &pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int loadAsText(std::string &&text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
VRayRenderer(const RendererOptions &rendererOptions)
int appendAsTextFiltered(const std::vector< std::string > &sceneTexts, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setComputeDevicesCurrentEngine(const std::vector< int > &indices)
void abort() const
Flags the image rendering thread to abort and returns immediately (without waiting for it to join)
int appendFiltered(const std::string &fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin newPlugin(const std::string &pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin newPlugin(const std::string &pluginName, const char *pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool waitForRenderEnd(const WaitTime time=WaitTime::AwaitingOrIdle) const
int loadFiltered(const std::string &fileName, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int appendAsTextFiltered(const std::vector< const char * > &sceneTexts, T &obj, const void *userData=NULL)
int appendFiltered(const std::vector< const char * > &fileNames, bool(*callback)(VRayRenderer &, const char *pluginType, std::string &pluginName, void *), const void *userData=NULL)
int exportScene(const char *filePath, const VRayExportSettings &settings) const
void continueSequence() const
When rendering a sequence this starts the next frame after the previous one has completed....
void setOnUploadToCollaboration(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int exportScene(const std::string &filePath, const VRayExportSettings &settings) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOrCreate(PluginTypeId pluginTypeId)
bool setCurrentFrame(int frame)
bool deletePlugins(const std::vector< std::string > &names)
bool getRenderSizes(RenderSizeParams &sizes, bool &regionButtonState) const
int appendAsTextFiltered(const std::string &fileName, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
UserPropertyType
Property types for UserPropertyChanged.
Definition: vraysdk.hpp:7366
bool saveIrradianceMapFile(const std::string &fileName)
int exportScene(const char *filePath) const
void setOnVFBClosed(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
T getInstanceOrCreate()
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< ComputeDeviceInfo > getComputeDevicesCUDA() const
void setOnVFBAddRenderElementToScene(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator!() const
void setOnVFBAddRenderElementToScene(bool(*callback)(VRayRenderer &, VFBRenderElementType type, double instant, void *userData), const void *userData=NULL)
void setAutoCommit(bool autoCommit)
Plugin newPlugin(const char *pluginName, PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
PluginMeta getPluginMeta(const std::string &pluginClassName) const
Return static meta information about a given plugin type.
bool isSequenceEnded() const
Error getLastError() const
Returns the last error that occurred when a method was called. Use this to understand why a method re...
std::string getInactiveHosts() const
float setProgressiveImageUpdateDifference(float difference)
int removeHosts(const std::string &hosts) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOf(PluginTypeId pluginTypeId) const
void setOnRendererClose(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
void setOnLightMixTransferToScene(int(*callback)(VRayRenderer &, const std::vector< LightMixChange > &changes, double instant, void *), const void *userData=NULL)
bool pause() const
Plugin getOrCreatePlugin(const char *pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int loadFiltered(const char *fileName, T &obj, const void *userData=NULL)
T newPlugin()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnProgress(void(*callback)(VRayRenderer &, const char *msg, int elementNumber, int elementsCount, double instant, void *userData), const void *userData=NULL)
bool deletePlugin(const std::string &pluginName)
bool deletePlugins(const std::vector< VRay::Plugin > &plugins)
void setKeepBucketsInCallback(bool keep)
This method allows you to change the default behavior of keeping an image copy in a BucketReady callb...
std::string exportSceneToBuffer(const VRayExportSettings &settings) const
void stop() const
Flags the image rendering thread to stop and waits for it to join.
std::vector< Plugin > getPluginsOfCategories(const PluginCategories &categories) const
Returns all plugin instances that belong to all passed categories.
double getCurrentEventTime() const
Get the current value (in seconds) of the relative time used in event callbacks.
bool saveIrradianceMapFile(const char *fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOrCreate(const std::string &pluginName, PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnVFBUpdateIPR(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setImprovedDefaultSettings(DefaultsPreset preset=quality_medium)
bool setRenderRegion(int rgnLeft, int rgnTop, int rgnWidth, int rgnHeight)
bool waitForVFBClosed() const
int append(const char *fileName, bool drSendNameOnly=false)
const char * getCameraName() const
Gets the camera name override previously set by setCameraName().
bool getVFBContextMenuItemValue(int commandId, int &value) const
bool setVFBContextMenuItemValue(int commandId, int value)
Plugin newPlugin(const char *pluginName, const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool getProgresiveImageUpdatedHasBuffer() const
Gets if an image will be passed in the ProgressiveImageUpdated callback parameters.
bool isAborted() const
int appendAsText(const std::vector< std::string > &sceneTexts)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setComputeDevicesEnvironmentVariable()
void setOnHostDisconnected(void(*callback)(VRayRenderer &, const char *hostName, double instant, void *userData), const void *userData=NULL)
void setVFBContextMenuSelectedCallback(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getInstanceOrCreate(const std::string &pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int appendFiltered(const char *fileName, T &obj, const void *userData=NULL)
void setOnBucketReady(void(&callback)(VRayRenderer &, int x, int y, int width, int height, const char *host, ImagePassType pass, double instant, void *userData), const void *userData=NULL)
void setOnPostEffectsUpdated(void(*callback)(VRayRenderer &, double instant, void *userData), const void *userData=NULL)
Plugin getOrCreatePlugin(const std::string &pluginName, const char *pluginType)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool optimizeMaterialGraph(const Plugin &topPlugin)
LicenseError getLicenseError() const
Returns the license error (if any) that occurred when the renderer was constructed or when rendering ...
void setVisualDebuggerEnabled(bool enable)
Enables/Disables the Visual Debugger functionality.
T newPlugin(const std::string &pluginName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Plugin getPlugin(const std::string &pluginName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnVFBDebugShadingNotify(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setOnBucketInit(void(*callback)(VRayRenderer &, int x, int y, int width, int height, const char *host, ImagePassType pass, double instant, void *userData), const void *userData=NULL)
Plugin pickPlugin(int x, int y) const
std::vector< ComputeDeviceInfo > getComputeDevicesDenoiser() const
bool getRenderRegion(int &rgnLeft, int &rgnTop, int &rgnWidth, int &rgnHeight) const
int exportScene(const std::string &filePath) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setComputeDevicesCUDA(const std::vector< int > &indices)
int removeHosts(const char *hosts) const
bool setCamera(const Plugin &plugin)
void setOnVFBSaveSettingsNotify(T &object, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setKeepProgressiveFramesInCallback(bool keep)
This method allows you to change the default behavior of keeping an image copy in a progressiveImageU...
size_t getImageIntoBuffer(const GetImageOptions &options, void *buf) const
void setOnRenderViewChanged(void(*callback)(VRayRenderer &, const char *propName, double instant, void *userData), const void *userData=NULL)
bool setComputeDevicesOptix(const std::vector< int > &indices)
bool isDRClientEnabled() const
void setOnVRayProfilerWrite(void(*callback)(VRayRenderer &, const std::string &outputFile, int fileType, double instant, void *), const void *userData=nullptr)
unsigned long long getChangeIndex() const
int getCurrentFrame() const
int loadFiltered(const std::string &fileName, T &obj, const void *userData=NULL)
This is an overloaded member function, provided for convenience. It differs from the above function o...
RendererState getState() const
void setOnVFBRenderLast(void(*callback)(VRayRenderer &, bool isRendering, double instant, void *userData), const void *userData=NULL)
int appendAsText(const char *text)
bool setCropRegion(int srcWidth, int srcHeight, float rgnLeft, float rgnTop)
void renderSequence(SubSequenceDesc descriptions[], size_t count) const
void useAnimatedValues(bool on)
bool setResumableRendering(bool enable, const ResumableRenderingOptions *options)
int appendAsText(const std::vector< const char * > &sceneTexts)
bool getBucketReadyHasBuffer() const
Gets if an image will be passed in the BucketReady callback parameters.
Plugin getOrCreatePlugin(const char *pluginName, PluginTypeId pluginTypeId)
This is an overloaded member function, provided for convenience. It differs from the above function o...
DebugShadingMode
Enum with the different debug shading modes.
Definition: vraysdk.hpp:8373
std::vector< Plugin > getPlugins(const char *pluginClassName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int startSync() const
PluginMeta getPluginMeta(const PluginTypeId pluginTypeId) const
Return static meta information about a given plugin type.
size_t getPhotonMapSize() const
A generic value holder used by Plugin parameters.
Definition: vraysdk.hpp:5300
PluginRef getPluginRef() const
Returns invalid PluginRef if the value is not Plugin. Keep in mind the value can be a Plugin and stil...
PluginList getPluginList() const
std::string toString() const
Returns the value as string.
Matrix getMatrix() const
Returns default constructed (uninitialized) Matrix if the value is not Matrix.
ValueList getValueList() const
int getInt() const
Works if the value is int, float, double or boolean. Otherwise returns 0.
bool isOK() const
True if the value can be used. Checks against TYPE_ERROR and TYPE_UNSPECIFIED.
void set(int value)
Stores the passed value and sets the appropriate type.
T get() const
bool getBool() const
Works if the value is int, float, double or boolean. Otherwise returns false.
VectorList getVectorList() const
size_t getCount() const
Returns number of list elements if the value is a list type.
Transform getTransform() const
Returns default constructed (uninitialized) Transform if the value is not Transform.
bool isBad() const
True if there was an error and the value can't be used. Checks against TYPE_ERROR.
std::string getString() const
Returns empty string if the value is not string. Keep in mind the value can be a string and still be ...
AColor getAColor() const
Returns zero AColor if the value is not AColor. Keep in mind the value can be an AColor and still be ...
IntList getIntList() const
bool isList() const
False if this holds a single value.
float getFloat() const
Works if the value is int, float, double or boolean. Otherwise returns 0.0f.
Value() noexcept
Default constructor initializes Value to TYPE_ERROR.
FloatList getFloatList() const
TransformList getTransformList() const
Color getColor() const
Works if the value is Color or AColor. Otherwise returns zero color.
Type getType() const noexcept
Get the actual type of the stored value.
double getDouble() const
Works if the value is int, float, double or boolean. Otherwise returns 0.0.
Vector getVector() const
Returns zero Vector if the value is not Vector. Keep in mind the value can be a Vector and still be z...
const char * getStringType() const
Returns a string representation of the type.
Plugin getPlugin() const
Returns invalid Plugin if the value is not Plugin. Keep in mind the value can be a Plugin and still b...
StringList getStringList() const
ColorList getColorList() const
static Value Unspecified() noexcept
Static constructor initializes Value to TYPE_UNSPECIFIED.
StampFontWeight
Describes the weight of a UI font.
Definition: vraysdk.hpp:389
@ stampFontWeight_light
Light font.
Definition: vraysdk.hpp:391
@ stampFontWeight_bold
Bold font.
Definition: vraysdk.hpp:392
@ stampFontWeight_normal
Normal weight.
Definition: vraysdk.hpp:390
StampFontStyle
Describes the style of a UI font.
Definition: vraysdk.hpp:383
@ stampFontStyle_italic
Italic style.
Definition: vraysdk.hpp:385
@ stampFontStyle_normal
Normal style.
Definition: vraysdk.hpp:384
BlendMode
Definition: vraysdk.hpp:408
@ BlendMode_Saturation
Uses the saturation from the FG, while the value and hue are taken from the BG.
Definition: vraysdk.hpp:431
@ BlendMode_LinearBurn
Same as Color Burn but with less contrast.
Definition: vraysdk.hpp:416
@ BlendMode_Last
Last element.
Definition: vraysdk.hpp:443
@ BlendMode_SplotlightBlend
Also known as 'Spotlight Blend (8bit)'. Same as Spotlight, but additionally brightens the BG.
Definition: vraysdk.hpp:422
@ BlendMode_FgWhiteMask
Definition: vraysdk.hpp:441
@ BlendMode_Add
Adds the FG to the BG.
Definition: vraysdk.hpp:411
@ BlendMode_Subtract
Subtracts the FG from the BG. Does not affect completely black areas.
Definition: vraysdk.hpp:412
@ BlendMode_Hardlight
Also known as 'Hard Light (8bit)'. Spotlight is applied to pixels where the FG is dark and Screen is ...
Definition: vraysdk.hpp:425
@ BlendMode_Hardmix
Also known as 'Hard Mix (8bit)'. Adds the FG to the BG and for each color component returns a value o...
Definition: vraysdk.hpp:427
@ BlendMode_Exclusion
Same as Difference but with less contrast.
Definition: vraysdk.hpp:429
@ BlendMode_ColorDodge
Also known as 'Color Dodge (8bit)'. The color of the FG is applied to lighter pixels in the BG.
Definition: vraysdk.hpp:419
@ BlendMode_Background
Use as background.
Definition: vraysdk.hpp:436
@ BlendMode_Lighten
Compares the FG to the BG and takes the lighter of the two.
Definition: vraysdk.hpp:417
@ BlendMode_Overlay
Also known as 'Overlay (8bit)'. Darker pixels become darker where the BG is dark and brighter pixels ...
Definition: vraysdk.hpp:423
@ BlendMode_Multiply
Multiplies the FG by the BG.
Definition: vraysdk.hpp:414
@ BlendMode_Spotlight
Also known as 'Spotlight (8bit)'. Same as Multiply, but with twice the brightness.
Definition: vraysdk.hpp:421
@ BlendMode_Hue
Uses the hue from the FG , while the value and saturation are taken from the BG.
Definition: vraysdk.hpp:430
@ BlendMode_ColorBurn
The color of the FG is applied to darker pixels in the BG.
Definition: vraysdk.hpp:415
@ BlendMode_Average
The average of the current layer (FG) and the result from the layers below it (BG).
Definition: vraysdk.hpp:410
@ BlendMode_Darken
Compares the FG to the BG and takes the darker pixel values of the two.
Definition: vraysdk.hpp:413
@ BlendMode_Difference
Compares the pixels in the BG and FG and subtracts the darker pixels from the brighter ones.
Definition: vraysdk.hpp:428
@ BlendMode_Value
Uses the value from the FG, while the hue and saturation are taken from the BG.
Definition: vraysdk.hpp:433
@ BlendMode_Softlight
Also known as 'Soft Light (8bit)'. Darker pixels become darker where the FG is dark and brighter pixe...
Definition: vraysdk.hpp:424
@ BlendMode_LinearDodge
Also known as 'Linear Dodge (8bit)'. Same as Color Dodge but with less contrast.
Definition: vraysdk.hpp:420
@ BlendMode_Pinlight
Replaces the BG colors depending on the brightness of the FG color. If the FG color is lighter than m...
Definition: vraysdk.hpp:426
@ BlendMode_Screen
Makes both light and dark areas lighter.
Definition: vraysdk.hpp:418
@ BlendMode_Color
Uses the hue and saturation from the FG, while the value is taken from the BG.
Definition: vraysdk.hpp:432
@ BlendMode_Foreground
Use as foreground.
Definition: vraysdk.hpp:437
@ BlendMode_Divide
Subtracts the BG from the FG. Dark areas of the render are brightened, while bright areas of the rend...
Definition: vraysdk.hpp:434
@ BlendMode_Overwrite
Displays the current layer (FG) on top of all layers (BG) without blending. This is the default.
Definition: vraysdk.hpp:409
@ BlendMode_Normal
Blends the alpha of the VRayMtlSelect render element's material and other layers.
Definition: vraysdk.hpp:435
Flags
Definition: vraysdk.hpp:334
@ EnumRadioButtons
Specific to Int properties, the UI should use radio buttons.
Definition: vraysdk.hpp:338
@ Stretched
Specifies that when a widget is added it has to be stretched.
Definition: vraysdk.hpp:368
@ NonResettable
Properties with this flag won't be reset by calls to resetPropsToDefaults (e.g. Layer name).
Definition: vraysdk.hpp:354
@ WithoutLineEdit
Definition: vraysdk.hpp:365
@ HorizontalRolloutControls
Definition: vraysdk.hpp:347
@ Hidden
If this flag is raised the property should be temporarily hidden from its "Properties" UI.
Definition: vraysdk.hpp:337
@ Advanced
Indicate a property only visible when toggling advanced properties visibility/export mode or whatever...
Definition: vraysdk.hpp:356
@ ReadOnly
Properties with this flag should be shown with a read only UI.
Definition: vraysdk.hpp:350
@ EnumComboBox
Specific to Int properties, the UI should use a combo box.
Definition: vraysdk.hpp:339
@ Command
Definition: vraysdk.hpp:343
@ ScrollableVerticalRollout
Scrollable rollouts will have their contents in a scroll area.
Definition: vraysdk.hpp:352
@ CollapsibleVerticalRollout
Collapsible rollouts have buttons to collapse/expand them.
Definition: vraysdk.hpp:351
@ NoCustomStyleTag
Properties with this flag will not have Q_PROPERTY for custom styling (e.g. horizontal_rollout_groupb...
Definition: vraysdk.hpp:353
@ HasPipetteTool
Specific to Color property, add an additional pipette tool next to the color swatch button.
Definition: vraysdk.hpp:358
@ Transient
Parameter that is not stored in files.
Definition: vraysdk.hpp:349
@ Internal
No UI should be created in its "Properties" UI.
Definition: vraysdk.hpp:336
@ NoUndo
Properties with this flag don't need undo on changes. Example calculated images, curves for now.
Definition: vraysdk.hpp:355
@ Const
Properties marked as "Const" cannot have their internal value modified (i.e. const).
Definition: vraysdk.hpp:361
StampFontFamily
Describes the family of a UI font.
Definition: vraysdk.hpp:372
@ stampFontFamily_monospaced
Monospaced font.
Definition: vraysdk.hpp:379
@ stampFontFamily_sansSerif
A sans serif font.
Definition: vraysdk.hpp:377
@ stampFontFamily_default
Default family.
Definition: vraysdk.hpp:373
@ stampFontFamily_script
Script font (handwriting).
Definition: vraysdk.hpp:376
@ stampFontFamily_modern
Modern font.
Definition: vraysdk.hpp:378
@ stampFontFamily_roman
Roman (serif) font.
Definition: vraysdk.hpp:375
@ stampFontFamily_decorated
Decorated font.
Definition: vraysdk.hpp:374
Type
Definition: vraysdk.hpp:312
@ Rollout
Not in use!
Definition: vraysdk.hpp:322
@ Double
Not in use!
Definition: vraysdk.hpp:323
@ StampString
Holds two strings - raw string with user entered text and one string with fields replaced.
Definition: vraysdk.hpp:330
@ Image
Not in use!
Definition: vraysdk.hpp:326
@ Stream
Not in use! Binary stream holder.
Definition: vraysdk.hpp:331
@ IntEnum
It is an Int with a fixed number of values.
Definition: vraysdk.hpp:313
@ Curve
Not in use!
Definition: vraysdk.hpp:325
@ CustomPopup
Not in use! Holds a pointer to a CustomPopupMenuCallback, can be nullptr.
Definition: vraysdk.hpp:327
@ UInt32
Not in use!
Definition: vraysdk.hpp:324
@ MaskItemList
Not in use! Holds a list of items used for masking - each item is represented with some id,...
Definition: vraysdk.hpp:328
@ StampFont
Holds a StampFontDesc structure describing a font.
Definition: vraysdk.hpp:329
RGBA color, float32.
Definition: vraysdk.hpp:1460
AColor toSRGB() const noexcept
Creates the copy of this AColor with the values converted from linear to sRGB.
Definition: vraysdk.hpp:1593
void operator-=(const AColor &c) noexcept
Definition: vraysdk.hpp:1494
void operator*=(const AColor &c) noexcept
Definition: vraysdk.hpp:1501
void operator/=(const AColor &c) noexcept
Definition: vraysdk.hpp:1529
void makeWhiteComplement() noexcept
Definition: vraysdk.hpp:1572
void operator+=(const AColor &c) noexcept
Definition: vraysdk.hpp:1487
AColor getWhiteComplement() const noexcept
Returns the white complement of the AColor.
Definition: vraysdk.hpp:1566
float getLength() const noexcept
Returns the length of the RGBA components.
Definition: vraysdk.hpp:1556
float getLengthSquared() const noexcept
Returns the squared sum of the RGBA components.
Definition: vraysdk.hpp:1561
float maxComponentValue() const noexcept
Calculates the magnitude of the greatest color component (the alpha is not taken into account)
Definition: vraysdk.hpp:1578
AColor fromSRGB() const noexcept
Creates the copy of this AColor with the values converted from sRGB to linear.
Definition: vraysdk.hpp:1583
Used in Proxy::createMeshFile() and Proxy::createCombinedMeshFile()
Definition: vraysdk.hpp:2319
std::vector< Transform > transforms
List of transformations contained in the animation. The size must be equal to the size of the keyFram...
Definition: vraysdk.hpp:2320
std::vector< int > keyFrames
List of keyFrames contained in the animation. The size must be equal to the size of the transformatio...
Definition: vraysdk.hpp:2321
Contains the auto-exposure and auto-white balance values computed during the last light cache calcula...
Definition: vraysdk.hpp:3575
float autoWhiteBalance
The auto-white balance (in Kelvin). 0 means that autoWhiteBalance calculations are not enabled.
Definition: vraysdk.hpp:3577
float ISO
Definition: vraysdk.hpp:3578
float autoExposure
The auto-exposure multiplier. 0 means that autoExposure calculations are not enabled.
Definition: vraysdk.hpp:3576
Attributes storage format: [attrName\0|type{uint8}|value{some_bytes}][...][...]\0.
Definition: vraysdk.hpp:10683
void add(const char(&name)[nameLen], const std::string &value)
Definition: vraysdk.hpp:10773
void add(const std::string &name, const AColor &value)
Definition: vraysdk.hpp:10801
void add(const char *name, size_t nameLen, float value)
Definition: vraysdk.hpp:10851
void add(const std::string &name, const char(&value)[valueLen])
Definition: vraysdk.hpp:10817
void add(const std::string &name, const std::string &value)
Definition: vraysdk.hpp:10824
void add(const char(&name)[count], const AColor &value)
Definition: vraysdk.hpp:10748
BinUserAttributeTypeFlags
Definition: vraysdk.hpp:10705
bool hasData() const
Checks if we've written any attributes.
Definition: vraysdk.hpp:10937
void close()
Definition: vraysdk.hpp:10926
void add(const std::string &name, const Vector &value)
Definition: vraysdk.hpp:10794
IntList toIntList()
Definition: vraysdk.hpp:10945
void add(const char *name, size_t nameLen, const AColor &value)
Definition: vraysdk.hpp:10889
void add(const char *name, size_t nameLen, const char *value, size_t valueLen)
Definition: vraysdk.hpp:10915
void add(const std::string &name, float value)
Definition: vraysdk.hpp:10787
void add(const std::string &name, const char *value, size_t valueLen)
Definition: vraysdk.hpp:10809
std::string toString() const
Definition: vraysdk.hpp:10957
BinUserAttributeType
Definition: vraysdk.hpp:10696
void add(const char *name, size_t nameLen, int value)
Definition: vraysdk.hpp:10832
void add(const char(&name)[nameLen], const char *value, size_t valueLen)
Definition: vraysdk.hpp:10757
void add(const char(&name)[count], float value)
Definition: vraysdk.hpp:10732
void add(const char *name, size_t nameLen, const Vector &value)
Definition: vraysdk.hpp:10867
void add(const char(&name)[nameLen], const char(&value)[valueLen])
Definition: vraysdk.hpp:10765
void add(const char(&name)[count], const Vector &value)
Definition: vraysdk.hpp:10740
void add(const std::string &name, int value)
Definition: vraysdk.hpp:10780
size_t getNumBytes() const
Get number of written bytes.
Definition: vraysdk.hpp:10932
void add(const char(&name)[count], int value)
Definition: vraysdk.hpp:10724
Equivalent to the Windows API BITMAPFILEHEADER struct.
Definition: vraysdk.hpp:496
unsigned bfOffBits
Offset of raw pixel data in bytes relative to the start of this header.
Definition: vraysdk.hpp:500
Equivalent to the Windows API BITMAPINFOHEADER struct.
Definition: vraysdk.hpp:504
Wrapper around BMP metainfo with pixel accessor method.
Definition: vraysdk.hpp:519
Axis-aligned bounding box.
Definition: vraysdk.hpp:2800
Vector pmax
The upper bounds for the box along the three axes.
Definition: vraysdk.hpp:2802
void expand(const Box &box)
Definition: vraysdk.hpp:2821
void expand(const Vector &point)
Definition: vraysdk.hpp:2806
Vector pmin
The lower bounds for the box along the three axes.
Definition: vraysdk.hpp:2801
Definition: vraysdk.hpp:10631
int cpuCount
Only ServerReady means no error.
Definition: vraysdk.hpp:10659
int vrayVersion
Server V-Ray version number.
Definition: vraysdk.hpp:10662
Status
Definition: vraysdk.hpp:10632
std::string hostConnectedTo
Server is busy connected to ip. Valid only when status is ServerReady.
Definition: vraysdk.hpp:10668
std::string hostResolved
hostName:port translated to ip:port.
Definition: vraysdk.hpp:10665
std::string revisionTime
The time the server revision is built.
Definition: vraysdk.hpp:10671
RGB color, float32.
Definition: vraysdk.hpp:1132
Color getWhiteComplement() const noexcept
Returns the white complement of the Color.
Definition: vraysdk.hpp:1221
float getIntensity() const noexcept
Returns the intensity of the color (also called chroma or saturation) which is the brightness or dull...
Definition: vraysdk.hpp:1173
void makeWhiteComplement() noexcept
Definition: vraysdk.hpp:1227
float getClosestTemperatureAndColor(Color &closestColor, RGBColorSpace colorSpace=sRGB) const
Find the black body color that is closest to the given color and returns it and its temperature in Ke...
float maxComponentValue() const noexcept
Calculates the magnitude of the greatest component.
Definition: vraysdk.hpp:1320
static Color fromTemperature(float temperature, RGBColorSpace colorSpace=sRGB)
Return the normalized RGB color of a black body with the given temperature in Kelvin.
float getLength() const noexcept
Returns the length of the color.
Definition: vraysdk.hpp:1191
static Matrix getRGBtoRGBmatrix(RGBColorSpace srcColorSpace, RGBColorSpace dstColorSpace)
void operator*=(const Color &c) noexcept
Definition: vraysdk.hpp:1253
Color fromSRGB()
Creates the copy of this Color with the values converted from sRGB to linear.
Definition: vraysdk.hpp:1326
float getLuminance() const noexcept
Returns the luminance of the color which is a measure of the intensity of light that reaches the eye.
Definition: vraysdk.hpp:1178
RGBColorSpace
These color space do not include their corresponding gamma corrections!
Definition: vraysdk.hpp:1152
float getLengthSquared() const noexcept
Returns the squared length of the color.
Definition: vraysdk.hpp:1186
void operator/=(const Color &c) noexcept
Definition: vraysdk.hpp:1287
Color toSRGB()
Creates the copy of this Color with the values converted from linear to sRGB.
Definition: vraysdk.hpp:1335
void operator-=(const Color &c) noexcept
Definition: vraysdk.hpp:1245
void operator+=(const Color &c) noexcept
Definition: vraysdk.hpp:1237
void setContrast(float k, float middle=0.5f) noexcept
Definition: vraysdk.hpp:1213
void setSaturation(float k) noexcept
Definition: vraysdk.hpp:1202
float getPower() const
Returns the sum of all color components.
Definition: vraysdk.hpp:1196
float getClosestTemperature(RGBColorSpace colorSpace=sRGB) const
Find the black body color that is closest to the given color and returns its temperature in Kelvin.
Used for GPU device selection by VRayRenderer::getComputeDevicesCurrentEngine() & co.
Definition: vraysdk.hpp:2664
long long deviceHandle
Device handle.
Definition: vraysdk.hpp:2665
int ccMajor
CUDA Compute Capability Major version number.
Definition: vraysdk.hpp:2690
int rtCoreVersion
The version of the raytracing cores (if supported). 0 if the GPU does not support RT Cores.
Definition: vraysdk.hpp:2692
int numConnectedDisplays
Number of displays (monitors) attached to this device. -1 if this information is unavailable.
Definition: vraysdk.hpp:2687
Type
Definition: vraysdk.hpp:2678
@ deviceType_CPU
CPU device.
Definition: vraysdk.hpp:2680
@ deviceType_GPU
GPU device.
Definition: vraysdk.hpp:2681
@ deviceType_default
Default.
Definition: vraysdk.hpp:2679
@ deviceType_ACCEL
Accelerated device.
Definition: vraysdk.hpp:2682
int isCpuEmulation
Is device CPU emulated.
Definition: vraysdk.hpp:2700
std::string name
Non-unique displayable name. Device index is its unique identifier.
Definition: vraysdk.hpp:2668
int cudaOrdinalIndex
Cuda ordinal index.
Definition: vraysdk.hpp:2697
int useForRendering
Device is used for rendering.
Definition: vraysdk.hpp:2672
int tccMode
TCC mode.
Definition: vraysdk.hpp:2698
Type deviceType
Device type.
Definition: vraysdk.hpp:2685
int busId
Bus ID.
Definition: vraysdk.hpp:2695
int totalMemoryMB
MegaBytes.
Definition: vraysdk.hpp:2686
int localIndex
Local index.
Definition: vraysdk.hpp:2696
long long platform
Platform.
Definition: vraysdk.hpp:2666
int ccMinor
CUDA Compute Capability Minor version number.
Definition: vraysdk.hpp:2691
int shaderProcessorsCount
Shader processors count.
Definition: vraysdk.hpp:2694
int useForDenoising
Device is used for denoising.
Definition: vraysdk.hpp:2673
int frequencyMHz
Base clock frequency or -1 if not available.
Definition: vraysdk.hpp:2688
int isSupported
Is device supported.
Definition: vraysdk.hpp:2674
int gFlops
Theoretical GFLOPS. 0 or -1 if not available.
Definition: vraysdk.hpp:2689
The necessary parameters passed to the VRayRenderer::enableDRClient interface.
Definition: vraysdk.hpp:3659
bool withBroadcastListener
True if a broadcast listener socket was created.
Definition: vraysdk.hpp:3666
std::string httpProxy
server:port connection parameter for http connections via proxy
Definition: vraysdk.hpp:3661
int connectTimeout
Initial connection timeout in seconds.
Definition: vraysdk.hpp:3672
std::string dispatcher
can either be an empty string or host[:port]
Definition: vraysdk.hpp:3660
int verboseLevel
Numeric progress verbosity level from 0 (none) to 4 (all, incl. debug)
Definition: vraysdk.hpp:3674
bool enableAssigningWUsAsBackups
TransferrableDrOptions.
Definition: vraysdk.hpp:3668
bool localRendering
True if, when local dispatcher selected, it's configured to spawn a local render server.
Definition: vraysdk.hpp:3665
int upstreamChannels
Number of upstream connections, which the client side will use, when pipelining is not enabled.
Definition: vraysdk.hpp:3673
bool pipelinedUpstream
Whether to use pipelining. Note pipelining will be disabled internally (even if requested),...
Definition: vraysdk.hpp:3667
Used by VRayRenderer::getImage() and RenderElement::getImage()
Definition: vraysdk.hpp:2362
ImageRegion region
Optional crop rectangle.
Definition: vraysdk.hpp:2363
bool flipImage
Flip image top-bottom.
Definition: vraysdk.hpp:2366
bool doColorCorrect
Whether to apply VFB color corrections.
Definition: vraysdk.hpp:2364
bool stripAlpha
Set alpha to 1.
Definition: vraysdk.hpp:2365
A rectangle defined by top-left and bottom-right frame coordinates.
Definition: vraysdk.hpp:240
Options passed to VRayRenderer::saveImage.
Definition: vraysdk.hpp:791
enum VRay::ImageWriterOptions::CompressionType compressionType
for EXR format only
int bitsPerChannel
for EXR format only - either 16 or 32
Definition: vraysdk.hpp:825
Additional parameter flags for Instancer and Instancer2 plugins.
Definition: vraysdk.hpp:3555
static const int useUserAttributesBin
Use binary user attributes.
Definition: vraysdk.hpp:3567
static const int useObjectProperties
Use object properties.
Definition: vraysdk.hpp:3568
static const int useParentTimesAtleastForGeometry
Definition: vraysdk.hpp:3560
static const int useSkipCryptomatte
Skip registering Node for the Cryptomatte.
Definition: vraysdk.hpp:3565
static const int useMaterial
Use material override.
Definition: vraysdk.hpp:3562
static const int useGeometry
Use geometry override.
Definition: vraysdk.hpp:3563
static const int useMapChannels
Use additional map channels.
Definition: vraysdk.hpp:3564
static const int useRenderIDOverride
Use renderIDOverride.
Definition: vraysdk.hpp:3566
unsigned long long usage
The name of the memory type category.
Definition: vraysdk.hpp:2771
Current rendering progress.
Definition: vraysdk.hpp:2760
std::string name
name of the device
Definition: vraysdk.hpp:2761
float totalMem
total mem in mega bytes
Definition: vraysdk.hpp:2764
float utilization
usage (from 0.0f to 100.0f)
Definition: vraysdk.hpp:2762
float freeMem
free mem in mega bytes
Definition: vraysdk.hpp:2763
Returned by VRayRenderer::getInteractiveStatistics when rendering in interactive mode.
Definition: vraysdk.hpp:2752
float currentNoiseThreshold
Current noise threshold. Useful when dynamic noise threshold is enabled.
Definition: vraysdk.hpp:2757
unsigned elapsedTicks
Time since start.
Definition: vraysdk.hpp:2754
std::vector< ComputeDeviceStatistics > computeDevices
array of statistics for each device with valid data
Definition: vraysdk.hpp:2767
std::vector< ComputeDeviceMemoryType > computeDevicesMemUsage
Memory usage by memory type.
Definition: vraysdk.hpp:2774
double pathsPerSecond
Number of camera rays traced per second.
Definition: vraysdk.hpp:2753
int sampleLevel
Number of samples per pixel accumulated.
Definition: vraysdk.hpp:2755
int numPasses
Number of sampling passes done.
Definition: vraysdk.hpp:2756
Parameters for setLicenseServer(). Only serverName is obligatory.
Definition: vraysdk.hpp:3873
std::string proxyUserName
Optional http proxy server.
Definition: vraysdk.hpp:3887
std::string serverName1
Optional alternative server if the primary doesn't work.
Definition: vraysdk.hpp:3881
std::string serverName2
Optional second alternative server.
Definition: vraysdk.hpp:3884
int serverPort
default port is 30304
Definition: vraysdk.hpp:3875
std::string proxyName
Optional http proxy server.
Definition: vraysdk.hpp:3876
std::string username
Optional login.
Definition: vraysdk.hpp:3878
std::string serverName
Primary license server - hostname or IP address.
Definition: vraysdk.hpp:3874
std::string proxyPassword
Login for the optional proxy server.
Definition: vraysdk.hpp:3888
std::string password
For the optional login.
Definition: vraysdk.hpp:3879
Definition: vraysdk.hpp:5762
bool isApplied
[In] Is the channel enabled.
Definition: vraysdk.hpp:5767
Color colorMult
[In] Can be empty for the rest channel.
Definition: vraysdk.hpp:5764
float intensityMult
[In] Color multiplier.
Definition: vraysdk.hpp:5765
bool enabled
[In] Intensity multiplier.
Definition: vraysdk.hpp:5766
3x3 column-major matrix, float32
Definition: vraysdk.hpp:1742
void setRow(const int i, const Vector &a) noexcept
Definition: vraysdk.hpp:1814
void makeTranspose(void) noexcept
Make the matrix to be the transpose of its currrent value.
Definition: vraysdk.hpp:1847
Vector & operator[](const int index) noexcept
Return the i-th column of the matrix (i=0,1,2).
Definition: vraysdk.hpp:1748
void operator+=(const Matrix &m) noexcept
Definition: vraysdk.hpp:1905
Matrix inverse(const Matrix &m) noexcept
Definition: vraysdk.hpp:1945
Matrix makeRotationMatrixX(float xrot) noexcept
Definition: vraysdk.hpp:2119
Matrix makeRotationMatrixY(float yrot) noexcept
Definition: vraysdk.hpp:2128
Matrix noScale(const Matrix &m) noexcept
Definition: vraysdk.hpp:2081
void makeIdentity(void) noexcept
Make the matrix the identity matrix.
Definition: vraysdk.hpp:1826
bool makeInverse(void) noexcept
Definition: vraysdk.hpp:1857
void makeDiagonal(const Vector &a) noexcept
Definition: vraysdk.hpp:1834
Matrix() noexcept=default
Constructor - initializes all components to zero.
void setCol(const int i, const Vector &a) noexcept
Definition: vraysdk.hpp:1807
Matrix makeRotationMatrixZ(float zrot) noexcept
Definition: vraysdk.hpp:2137
void rotate(const Vector &axis) noexcept
Applies a rotation along the given axis. The length of the axis is the tangent of the angle of rotati...
Definition: vraysdk.hpp:1920
void operator/=(float x) noexcept
Divide all elements in the matrix by the given number. Does not perform a check for divide by zero.
Definition: vraysdk.hpp:1899
Matrix(Vector diagonal) noexcept
Constructor to diagonal matrix.
Definition: vraysdk.hpp:1769
void makeZero(void) noexcept
Make the matrix the zero matrix (all elements are zeroes).
Definition: vraysdk.hpp:1819
void set(float value) noexcept
Make diagonal matrix.
Definition: vraysdk.hpp:1790
Matrix normalize(const Matrix &m) noexcept
Definition: vraysdk.hpp:2073
void operator-=(const Matrix &m) noexcept
Definition: vraysdk.hpp:1913
Vector rotationAngles(const Matrix &m) noexcept
Definition: vraysdk.hpp:2093
void set(const Matrix &other) noexcept
Definition: vraysdk.hpp:1798
Vector scale(const Matrix &m) noexcept
Definition: vraysdk.hpp:2087
Matrix(const Vector &a, const Vector &b, const Vector &c) noexcept
Definition: vraysdk.hpp:1775
void operator*=(float x) noexcept
Multiply all elements in the matrix by the given number.
Definition: vraysdk.hpp:1894
Matrix rotate(const Matrix &m, const Vector &axis) noexcept
Definition: vraysdk.hpp:2067
void set(const Vector &a, const Vector &b, const Vector &c) noexcept
Definition: vraysdk.hpp:1785
A container for the data necessary to a export vrmesh with geometry, hair or particles....
Definition: vraysdk.hpp:5695
ValueList hairVertices
ValueList( VectorList ) (single frame) OR ValueList( ValueList(int, VectorList) ) (multiple frames - ...
Definition: vraysdk.hpp:5706
ValueList vertices
ValueList( VectorList ) (single frame) OR ValueList( ValueList(int, VectorList) ) (multiple frames - ...
Definition: vraysdk.hpp:5696
ValueList mapChannels
ValueList( ValueList(int, VectorList, IntList) )
Definition: vraysdk.hpp:5702
ValueList hairWidths
ValueList( FloatList ) (single frame) OR ValueList( ValueList(int, FloatList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5708
ValueList hairVerticesPerStrand
ValueList( IntList ) (single frame) OR ValueList( ValueList(int, IntList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5707
ValueList particleWidths
ValueList( FloatList ) (single frame) OR ValueList( ValueList(int, FloatList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5710
ValueList faces
ValueList( IntList ) (single frame) OR ValueList( ValueList(int, IntList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5697
ValueList mapChNames
ValueList( StringList )
Definition: vraysdk.hpp:5703
ValueList shaderNames
ValueList( ValueList(int, string) )
Definition: vraysdk.hpp:5704
ValueList faceNormals
ValueList( IntList ) (single frame) OR ValueList( ValueList(int, IntList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5699
ValueList normals
ValueList( VectorList ) (single frame) OR ValueList( ValueList(int, VectorList) ) (multiple frames - ...
Definition: vraysdk.hpp:5698
ValueList velocities
ValueList( VectorList ) (single frame) OR ValueList( ValueList(int, VectorList) ) (multiple frames - ...
Definition: vraysdk.hpp:5700
ValueList faceMtlIDs
ValueList( IntList ) (single frame) OR ValueList( ValueList(int, IntList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5701
ValueList edgeVisibility
ValueList( IntList ) (single frame) OR ValueList( ValueList(int, IntList ) ) (multiple frames - ...
Definition: vraysdk.hpp:5705
ValueList particleVertices
ValueList( VectorList ) (single frame) OR ValueList( ValueList(int, VectorList) ) (multiple frames - ...
Definition: vraysdk.hpp:5709
Helper structure storing the relevant configuration entries as they were read from the configuration ...
Definition: vraysdk.hpp:10017
char familySeparator
The separator that is used to distinguish different families for UI separation.
Definition: vraysdk.hpp:10033
std::string getErrorString() const
Get whether there was any error with the loading of the OCIO configuration.
Definition: vraysdk.hpp:10071
std::vector< std::string > roles
List of the stored roles in the configuration.
Definition: vraysdk.hpp:10023
std::vector< std::string > looks
List of the looks in the configuration.
Definition: vraysdk.hpp:10027
std::vector< std::string > viewTransforms
List of unique view transformations from the configuration.
Definition: vraysdk.hpp:10031
std::vector< std::string > colorSpaces
List of the stored color spaces in the configuration.
Definition: vraysdk.hpp:10019
OCIOConfigurationData(const char *fileName=NULL, SourceMode vraySourceType=SourceMode::Automatic)
Definition: vraysdk.hpp:10039
std::vector< std::string > devices
List of devices as read from the configuration.
Definition: vraysdk.hpp:10029
std::vector< std::string > roleColorSpaces
List of corresponding color spaces for each role. Size will match the roles size.
Definition: vraysdk.hpp:10025
std::vector< std::string > colorSpaceFamilies
List of stored color space families for the configuration. May be empty.
Definition: vraysdk.hpp:10021
Definition: vraysdk.hpp:10124
std::string name
Name of the parameter.
Definition: vraysdk.hpp:10125
OSLParameterType type
Type of the parameter.
Definition: vraysdk.hpp:10126
Value defaultValue
Default value defined in the shader file.
Definition: vraysdk.hpp:10127
Definition: vraysdk.hpp:10130
std::vector< OSLInputParameter > inputParams
Input parameters defined in the shader file.
Definition: vraysdk.hpp:10134
std::vector< std::string > outputColorParams
Output color parameters defined in the shader file.
Definition: vraysdk.hpp:10131
std::vector< std::string > outputFloatParams
Output float parameters defined in the shader file.
Definition: vraysdk.hpp:10132
std::vector< std::string > outputClosureParams
Output closure parameters defined in the shader file.
Definition: vraysdk.hpp:10133
The info contained in geometry, hair or particle objects.
Definition: vraysdk.hpp:2785
std::string name
the name of the object
Definition: vraysdk.hpp:2786
int id
the id of the object
Definition: vraysdk.hpp:2787
int vEnd
the end of the voxel range of the object (vEnd is excluded from the range)
Definition: vraysdk.hpp:2789
int vBegin
the begin of the voxel range of the object (vBegin is included in the range)
Definition: vraysdk.hpp:2788
Returned by VRayRenderer::getLastParserError. Use to diagnose problems when loading vrscene files.
Definition: vraysdk.hpp:3966
See VRayRenderer::pickPlugins.
Definition: vraysdk.hpp:5714
This struct is used to determine if a plugin type is of certain category.
Definition: vraysdk.hpp:4225
bool hasTextureIntCategory() const
Is the plugin of category_texture_int.
Definition: vraysdk.hpp:4316
unsigned long long pluginCategoryField
bitfield of the plugin categories
Definition: vraysdk.hpp:4249
bool hasBsdfCategory() const
Is the plugin of category_bsdf.
Definition: vraysdk.hpp:4266
bool hasMaterialCategory() const
Is the plugin of category_material.
Definition: vraysdk.hpp:4286
bool hasLightCategory() const
Is the plugin of category_light.
Definition: vraysdk.hpp:4281
bool hasGeometricObjectCategory() const
Is the plugin of category_geometric_object.
Definition: vraysdk.hpp:4271
bool hasTextureMatrixCategory() const
Is the plugin of category_texture_matrix.
Definition: vraysdk.hpp:4321
bool hasRenderChannelCategory() const
Is the plugin of category_render_channel.
Definition: vraysdk.hpp:4291
bool hasTextureFloatCategory() const
Is the plugin of category_texture_float.
Definition: vraysdk.hpp:4311
bool hasTextureCategory() const
Is the plugin of category_texture.
Definition: vraysdk.hpp:4306
bool hasGeometrySourceCategory() const
Is the plugin of category_geometry_source.
Definition: vraysdk.hpp:4276
bool hasUvwgenCategory() const
Is the plugin of category_uvwgen.
Definition: vraysdk.hpp:4336
bool hasBitmapCategory() const
Is the plugin of category_bitmap.
Definition: vraysdk.hpp:4261
std::vector< PluginCategory > getAll() const
Returns the bitfield as vector of enum values.
bool hasRenderViewCategory() const
Is the plugin of category_render_view.
Definition: vraysdk.hpp:4296
bool hasTextureTransformCategory() const
Is the plugin of category_texture_transform.
Definition: vraysdk.hpp:4326
bool hasSettingsCategory() const
Is the plugin of category_settings.
Definition: vraysdk.hpp:4301
bool hasTextureVectorCategory() const
Is the plugin of category_texture_vector.
Definition: vraysdk.hpp:4331
bool hasVolumetricCategory() const
Is the plugin of category_volumetric.
Definition: vraysdk.hpp:4341
Used by VRay::Proxy::createMeshFile()
Definition: vraysdk.hpp:3401
std::string customPreviewFile
file name to read and use its vertices and faces for the preview voxel
Definition: vraysdk.hpp:3437
int previewType
Definition: vraysdk.hpp:3429
std::string destination
destination file name
Definition: vraysdk.hpp:3426
int startFrame
used if animOn is true
Definition: vraysdk.hpp:3431
std::vector< std::string > objectNames
array of names to associate with respective meshes. This can be used to identify the pieces when read...
Definition: vraysdk.hpp:3435
PreviewTypes
Definition: vraysdk.hpp:3402
@ SIMPLIFY_FACE_SAMPLING
Definition: vraysdk.hpp:3406
@ SIMPLIFY_COMBINED
Definition: vraysdk.hpp:3421
@ SIMPLIFY_CLUSTERING
Definition: vraysdk.hpp:3410
@ SIMPLIFY_EDGE_COLLAPSE
Definition: vraysdk.hpp:3414
int endFrame
used if animOn is true
Definition: vraysdk.hpp:3432
Bool exportPointCloud
when enabled, adds a point cloud representation of the mesh separated into different levels of detail...
Definition: vraysdk.hpp:3442
float pointSize
determines the size of point cloud disks at the most detailed level. If this value is small,...
Definition: vraysdk.hpp:3443
int previewParticles
number of preview particles (default 20000)
Definition: vraysdk.hpp:3445
std::vector< Color > voxelInfoWireColor
array of diffuse (wire) colors - 1 Color per mesh object
Definition: vraysdk.hpp:3438
std::vector< int > objectIDs
array of unique IDs for the respective meshes. This should usually match Node.objectID values.
Definition: vraysdk.hpp:3436
int previewFaces
approximate number of preview triangles (default 10000; set to 0 to disable preview)
Definition: vraysdk.hpp:3428
int mergeVoxels
merge all voxels of the same type, before subdivision
Definition: vraysdk.hpp:3433
std::vector< Bool > voxelInfoFlipNormals
array of flipNormals flags (1 flag per mesh object - true if the geometric normals should be flipped)
Definition: vraysdk.hpp:3440
int previewHairs
number of preview hairs (default 1000)
Definition: vraysdk.hpp:3444
std::vector< Bool > voxelInfoSmoothed
array of smoothed flags (1 flag per mesh object - true if the voxel should be rendered with smoothed ...
Definition: vraysdk.hpp:3439
Bool bakeTransforms
when enabled (default), applies the input Transform(s) to the geometry data, otherwise writes the Tra...
Definition: vraysdk.hpp:3446
int elementsPerVoxel
number of triangles in each voxel
Definition: vraysdk.hpp:3427
int animOn
enables saving multiple animated frames in the proxy
Definition: vraysdk.hpp:3430
The necessary parameters for reading data in a proxy file.
Definition: vraysdk.hpp:3450
int flip_axis
0 do not rotate; 1 transform from Maya to 3dsMax coordinate system (90 deg. rotation around x axis); ...
Definition: vraysdk.hpp:3454
float particle_width_multiplier
a multiplier to the particle width data
Definition: vraysdk.hpp:3471
float smooth_angle
smooth angle in degrees
Definition: vraysdk.hpp:3459
int compute_normals
true to calculate smooth normals
Definition: vraysdk.hpp:3453
int num_preview_faces
number of faces in preview
Definition: vraysdk.hpp:3458
bool use_full_names
read the full path instead of only the name
Definition: vraysdk.hpp:3463
float hair_width_multiplier
a multiplier to the hair width data
Definition: vraysdk.hpp:3470
bool compute_bbox
true to compute the bounding box, false to read it from the file
Definition: vraysdk.hpp:3464
std::string file
file name to read
Definition: vraysdk.hpp:3451
bool subdiv_uvs
subdivide or skip mapping channels
Definition: vraysdk.hpp:3466
int subdiv_level
the subdivision level
Definition: vraysdk.hpp:3455
std::string object_path
starting object path in Alembic hierarchy
Definition: vraysdk.hpp:3452
bool use_alembic_offset
true to use Alembic animation frame offset
Definition: vraysdk.hpp:3469
float fps
frames per second for calculation of current time and frame
Definition: vraysdk.hpp:3462
bool instancing
turns on/off the instancing of Alembic duplicated objects
Definition: vraysdk.hpp:3468
bool subdiv_preserve_geom_borders
if true, the borders won't be subdivided
Definition: vraysdk.hpp:3467
int anim_type
animated proxy playback type(0 - loop; 1 - once; 2 - ping - pong; 3 - still)
Definition: vraysdk.hpp:3457
float anim_speed
animated proxy playback speed
Definition: vraysdk.hpp:3460
int subdiv_preserve_map_borders
determines the smoothing mode of the mapping channels' borders. 0-None, 1-Internal and 2-All
Definition: vraysdk.hpp:3456
bool subdiv_all_meshes
true to subdivide Alembic PolyMesh and SubD objects; false to subdivide only SubD objects
Definition: vraysdk.hpp:3465
float anim_offset
animated proxy initial frame offset
Definition: vraysdk.hpp:3461
Controls what the buffer returned by getData() contains.
Definition: vraysdk.hpp:2563
Plugin * alphaChannelPlugin
The plugin describing the alpha channel render element. Can be NULL.
Definition: vraysdk.hpp:2573
bool rgbOrder
true - RGB order, false - BGR order
Definition: vraysdk.hpp:2576
bool useDefaultAlpha
Use any existing alpha render channel.
Definition: vraysdk.hpp:2574
PixelFormat format
The desired pixel format.
Definition: vraysdk.hpp:2575
int layerIndex
For multi-layer elements only. The Cryptomatte layer index (between 0 and num_level/2)....
Definition: vraysdk.hpp:2578
ImageRegion * region
An optional image region rectange; NULL means the whole image.
Definition: vraysdk.hpp:2577
This structure is used to return information about a particular channel in the VFB.
Definition: vraysdk.hpp:2516
BinaryFormat binaryFormat
The channel binary format.
Definition: vraysdk.hpp:2518
Type type
The channel type/alias.
Definition: vraysdk.hpp:2519
const char * name
The name of the channel as it appears in the VFB.
Definition: vraysdk.hpp:2517
Definition: vraysdk.hpp:5734
int rgnLeft
Render region left.
Definition: vraysdk.hpp:5748
int rgnTop
Render region top.
Definition: vraysdk.hpp:5749
float cropRgnHeight
Crop region height.
Definition: vraysdk.hpp:5741
int bmpHeight
Output bitmap height. This is the sampling resolution, not the file resolution.
Definition: vraysdk.hpp:5737
int imgHeight
Output image height.
Definition: vraysdk.hpp:5745
float cropRgnLeft
Crop region left.
Definition: vraysdk.hpp:5738
int rgnHeight
Render region height.
Definition: vraysdk.hpp:5751
float cropRgnTop
Crop region top.
Definition: vraysdk.hpp:5739
int bmpWidth
Output bitmap width. This is the sampling resolution, not the file resolution.
Definition: vraysdk.hpp:5736
int imgWidth
Output image width.
Definition: vraysdk.hpp:5744
int rgnWidth
Render region width.
Definition: vraysdk.hpp:5750
int bitmask
Bitmask which indicates which part to be set or has been set.
Definition: vraysdk.hpp:5759
float cropRgnWidth
Crop region width.
Definition: vraysdk.hpp:5740
Combines various options required for the rendering process.
Definition: vraysdk.hpp:3593
bool showVfbButtonCopyToHostFrameBuffer
show "Duplicate to host frame buffer" button
Definition: vraysdk.hpp:3624
bool showVfbButtonIPRUpdate
show "Update IPR" button
Definition: vraysdk.hpp:3623
bool showVfbAddDenoiserREToSceneButton
show "Add Denoiser to the scene" button
Definition: vraysdk.hpp:3626
std::string vfbLanguage
[OPTIONAL] A language code string telling the VFB which builtin language to load (from VRay::Language...
Definition: vraysdk.hpp:3636
bool showVfbAddLightMixREToSceneButton
show "Add LightMix to the scene" button
Definition: vraysdk.hpp:3625
ThemeStyle vfbDrawStyle
specifies VFB drawing style
Definition: vraysdk.hpp:3604
bool useVfbLog
use built-in VFB log
Definition: vraysdk.hpp:3618
bool noRenderLicensePreCheck
if set appsdk will not check for render node license before rendering is started
Definition: vraysdk.hpp:3611
bool showVfbButtonTestResolution
show "Test Resolution" button
Definition: vraysdk.hpp:3621
bool enableVfbPlugins
Allow the VFB to load plugins.
Definition: vraysdk.hpp:3619
bool showVfbButtonIPRPause
show "Pause IPR" button
Definition: vraysdk.hpp:3622
ThemeStyle
Specifies the drawing style of the VFB widgets.
Definition: vraysdk.hpp:3596
bool hideToSceneButton
hide Light Mix To Scene button
Definition: vraysdk.hpp:3617
bool useDefaultVfbTheme
enabled by default. If set to false the parent application theme is inherited
Definition: vraysdk.hpp:3612
bool enableFrameBuffer
true to enable the frame buffer
Definition: vraysdk.hpp:3609
bool showVfbButtonDebugShading
show "IPR Debug Shading" button
Definition: vraysdk.hpp:3620
bool dockFrameBuffer
dock V-Ray Frame Buffer window
Definition: vraysdk.hpp:3616
bool allowInvalidCharactersInPluginNames
allow invalid characters in plugin names
Definition: vraysdk.hpp:3615
std::string pluginLibraryPath
[OPTIONAL] specifies additional, non-default plugin library paths to load vray_*.dll (libvray_*....
Definition: vraysdk.hpp:3634
bool showFrameBuffer
true to initially show the frame buffer
Definition: vraysdk.hpp:3610
bool previewRenderer
optimize the renderer for small preview purposes
Definition: vraysdk.hpp:3614
bool showVfbButtonInteractiveStart
show "Start IPR" button
Definition: vraysdk.hpp:3613
Definition: vraysdk.hpp:3476
std::string outputFileName
Definition: vraysdk.hpp:3479
bool compressProgressiveFiles
Set to false to disable compression. (These files can get quite large)
Definition: vraysdk.hpp:3482
int progressiveAutoSaveSeconds
Definition: vraysdk.hpp:3492
bool deleteResumableFileOnSuccess
Definition: vraysdk.hpp:3487
See encodeScannedMaterialParams() and getScannedMaterialUILicense()
Definition: vraysdk.hpp:3973
This structure contains the parameters used in the rendering of the scanned materials.
Definition: vraysdk.hpp:3988
int dome
the mapping channel
Definition: vraysdk.hpp:4034
int triplanar
Clear coat multiplier.
Definition: vraysdk.hpp:4056
float ccmul
This parameter modifies the clear coat reflection to metalic behavior, i.e., it modulates the reflect...
Definition: vraysdk.hpp:4055
float cutoff
the reflection rays count, the UI contains subdivision parameter, this must be seto to the square val...
Definition: vraysdk.hpp:4032
int noTransp
the minimal path length of a reflected ray that allows to use GI, if the path is shorter "fear" ray t...
Definition: vraysdk.hpp:4047
float sceneScale
used when the plain option is set to PL_SCRAMBLE, determines the size of the pieces that are continuo...
Definition: vraysdk.hpp:4038
Bool noCachedGI
the output color space (Not used anymore, replaced by the vray color space)
Definition: vraysdk.hpp:4053
ColorSpace
Definition: vraysdk.hpp:4009
@ CS_PP
adobe rgb
Definition: vraysdk.hpp:4012
@ CS_ADOBE
sRGB - linear
Definition: vraysdk.hpp:4011
float saturation
inverse gamma
Definition: vraysdk.hpp:4023
Transform uvtrans
general result multiplier (tint)
Definition: vraysdk.hpp:4027
int noPrimGI
edge displacement, used to prevent the flat appearance of the edges
Definition: vraysdk.hpp:4045
MapChannelsMask mapChBitmask
multiplies the transparency (only the transparency, the translucency remains!) (Not used anymore)
Definition: vraysdk.hpp:4049
float fltStrength
strength of the replace paint effect
Definition: vraysdk.hpp:4051
int disablewmap
displacement/paralax multiplier
Definition: vraysdk.hpp:4025
float sssmul
Clear coat glossiness variation, the measured value is kept in presets.scratchdens.
Definition: vraysdk.hpp:4061
Triplanar
Definition: vraysdk.hpp:4015
@ TP_RNDOFFS
Enable triplanar.
Definition: vraysdk.hpp:4017
@ TP_RNDROT
Enable random offset.
Definition: vraysdk.hpp:4018
float retrace
the primary rays are rendered without using the GI engine (better acuracity, lower speed) (Not used a...
Definition: vraysdk.hpp:4046
ColorSpace clrSpace
strength of the filter
Definition: vraysdk.hpp:4052
int twoside
uniform reflections distribution, when nonzero the importance sampling is not used
Definition: vraysdk.hpp:4043
int displace
same as two side in the standard material
Definition: vraysdk.hpp:4044
int fasttrans
Controls the triplanar mapping, combination of enum Triplanar flags.
Definition: vraysdk.hpp:4057
int nsamples
the z value of the view vector below which bump is gradualy applied
Definition: vraysdk.hpp:4031
MapChannels
Definition: vraysdk.hpp:3996
@ VRSM_FILTER
the color of the material
Definition: vraysdk.hpp:3998
@ VRSM_CCMULT
general color multiplier
Definition: vraysdk.hpp:3999
float paintStrength
bitmask for the maps used in the rendering
Definition: vraysdk.hpp:4050
MapChannelsMask
These values can be combined. Each bit enables the corresponding feature.
Definition: vraysdk.hpp:4003
float transpMul
force opaque rendering even if backside lighting is present.
Definition: vraysdk.hpp:4048
Plain
Definition: vraysdk.hpp:3989
@ PL_HMGSYM
the material is homogenous and potentially anisotropic, an averaged brdf is used instead texture,...
Definition: vraysdk.hpp:3992
@ PL_TRIPLANAR
the material is homogenous and isotropic , no uv mapping is needed
Definition: vraysdk.hpp:3993
@ PL_HMG
no plain strategy
Definition: vraysdk.hpp:3991
int mapChannel
stop of the indirect ray if the total weight is below this value
Definition: vraysdk.hpp:4033
float multdirect
prevent double lighting by direct and reflection rays (not used anymore)
Definition: vraysdk.hpp:4035
float bumpstart
bump multiplier for the inclined views
Definition: vraysdk.hpp:4030
float scrambleSize
limit for the tracing recursion
Definition: vraysdk.hpp:4037
float ccglossyvar
Clear coat glossiness, the measured value is kept in presets.specbell.
Definition: vraysdk.hpp:4060
int usemap
uv mapping transformation matrix
Definition: vraysdk.hpp:4028
float ccbump
clear coat highlights
Definition: vraysdk.hpp:4041
float bumpmul
not used
Definition: vraysdk.hpp:4029
int traceDepth
multipliers for different parts of the light (not used anymore)
Definition: vraysdk.hpp:4036
ScannedMaterialParams()
sss thickness multiplier
int cchlight
the clear coat ior, used for carpaints and other materials with thin refractive layer
Definition: vraysdk.hpp:4040
Color filter
disable use of the enlargement, directly the original small sample is used for rendering (Not used an...
Definition: vraysdk.hpp:4026
float ccmetalrefl
rendering without using the GI engine at all (but most scenes have low scanned materials in count)
Definition: vraysdk.hpp:4054
int BWforGI
Used in volumetric translucency calculation, switches between two models of calculation,...
Definition: vraysdk.hpp:4058
float ccior
the size of one scene unit in cm
Definition: vraysdk.hpp:4039
int unfRefl
used to make the clear coat not perfect
Definition: vraysdk.hpp:4042
float invgamma
this option modifies the rendering in order to improve the result for materials without large details
Definition: vraysdk.hpp:4022
float ccglossy
The material is represented as non colored for the GI rays, used to prevent the color bleeding when t...
Definition: vraysdk.hpp:4059
Definition: vraysdk.hpp:4102
float specbell
Controls how to use the smooth brdf model.
Definition: vraysdk.hpp:4123
int plain
ClearCoat index of reflection.
Definition: vraysdk.hpp:4109
float shdmul
Height multiplier for self shadowing.
Definition: vraysdk.hpp:4120
float fuzzy
Controls the pure reflective behavior for inclined angles, a feature typical for brushed metal.
Definition: vraysdk.hpp:4127
float bumpstart
Bump multiplier for the inclined views.
Definition: vraysdk.hpp:4111
float topvLs_A
Used mostly with top view fabrics, modifies the rendering of the inclined views making them blurred a...
Definition: vraysdk.hpp:4128
float bumpmul
Plain materials strategy.
Definition: vraysdk.hpp:4110
float lfsizecm
value used to control the function converting translucency to transparency
Definition: vraysdk.hpp:4136
float free7
CC specular multiplier (Not used anymore)
Definition: vraysdk.hpp:4125
float orgglvar
the clear coat glossiness the inverse angle deviation width (60 is one degree), since 20....
Definition: vraysdk.hpp:4115
float specmul
CC specular highlights, inverse bell width (60 is one degree)
Definition: vraysdk.hpp:4124
float ccmetalrefl
Multiplier of the indirect light, used to handle the fluorescent materials by putting value below 1 i...
Definition: vraysdk.hpp:4132
ScannedMaterialPreset()
The large feature map physical size.
float orggls
Clear coat noise-like bump amount (there is separate hmap bump)
Definition: vraysdk.hpp:4114
int forcebrdf
Used to render materials with sharp sparks, a procedural map with relative size this param is used to...
Definition: vraysdk.hpp:4122
float indmul
When flakes is nonzero (spark mode) this parameter specifies to not scramble the uv coordinates.
Definition: vraysdk.hpp:4131
int triplanar
The sample thickness in mm, used to introduce alpha/translucency correction of thick materials.
Definition: vraysdk.hpp:4134
int keepflakesuv
Not used anymore (set to 1)
Definition: vraysdk.hpp:4130
float topvLs_B
Used in top view materials to control the light direction correction.
Definition: vraysdk.hpp:4129
int flakes
Brightness multiplier for self shadowing.
Definition: vraysdk.hpp:4121
float depthmul
The z-value of the view vector below which bump is gradualy applied.
Definition: vraysdk.hpp:4112
float transpf
used to force triplanar mapping when certain customer has old vray (luxottica)
Definition: vraysdk.hpp:4135
SmoothModelFlags
Definition: vraysdk.hpp:4103
@ SMF_PS
when set, the BRDF is "forced"
Definition: vraysdk.hpp:4105
@ SMF_FORCE
used in forcebrdf
Definition: vraysdk.hpp:4104
float shdhmul
Clear coat effect multiplier.
Definition: vraysdk.hpp:4119
float ccbump
Displacement multiplier.
Definition: vraysdk.hpp:4113
float free4
the material thumnail relative offset - this is kind of a hack, using the place of an old obsolete pa...
Definition: vraysdk.hpp:4117
int thumbpos
the clearcoat glossiness variation (0-none 1-the shallow anglesare glossy), since 20....
Definition: vraysdk.hpp:4116
The necessary parameters for reading the data in the preset config file (.mbc)
Definition: vraysdk.hpp:8997
std::string fileName
Scatter preset config file (.mbc)
Definition: vraysdk.hpp:8998
float unitRescale
Rescale to specific callers units setup, e.g. the default Cosmos asset units are centimeters,...
Definition: vraysdk.hpp:9000
Plugin scatterPlugin
A GeomScatter plugin instance to be filled by the Scatter preset config.
Definition: vraysdk.hpp:8999
bool isYAxisUp
If true - process as if Y is up axis and otherwise default to Z.
Definition: vraysdk.hpp:9001
Definition: vraysdk.hpp:10501
Object material
Material used for the particle, can be empty/invalid if no material override present.
Definition: vraysdk.hpp:10511
Transform transform
Particle transform.
Definition: vraysdk.hpp:10508
Object node
Particle object, always valid (unless the Particle is invalid).
Definition: vraysdk.hpp:10505
Definition: vraysdk.hpp:10318
CoordinateSystem
The coordinate system in which the preview will be loaded.
Definition: vraysdk.hpp:10331
CacheType
Definition: vraysdk.hpp:10319
Definition: vraysdk.hpp:10241
Definition: vraysdk.hpp:10246
A helper struct with info regarding file exports for plugins of a specified type.
Definition: vraysdk.hpp:2651
std::string fileNameSuffix
Substring to append at the end of the common part of the filename passed to the export function.
Definition: vraysdk.hpp:2655
std::string pluginType
Allowed types: "view", "lights", "geometry", "nodes", "materials", "textures", "bitmaps",...
Definition: vraysdk.hpp:2653
Describes a sub-sequence of an animation range at regular steps (usually step=1)
Definition: vraysdk.hpp:2659
A math object used to define object position, rotation and scale in 3D space.
Definition: vraysdk.hpp:2170
void operator-=(const Transform &tm) noexcept
Subtract another tranformation from this one.
Definition: vraysdk.hpp:2220
Transform() noexcept=default
Default constructor - zero initializes all components.
Vector transformVec(const Vector &a) const noexcept
Definition: vraysdk.hpp:2227
Transform(int i) noexcept
Definition: vraysdk.hpp:2190
Vector inverseTransform(const Vector &a, const Transform &tm) noexcept
Definition: vraysdk.hpp:2303
void makeInverse(void) noexcept
Make the transformation the inverse of its current value.
Definition: vraysdk.hpp:2232
void operator*=(float x) noexcept
Multiply the transformation by a number.
Definition: vraysdk.hpp:2208
void operator+=(const Transform &tm) noexcept
Add another transformation to this one.
Definition: vraysdk.hpp:2214
void makeIdentity(void) noexcept
Make the transformation the identity transformation.
Definition: vraysdk.hpp:2202
void makeZero(void) noexcept
Make the transformation the zero transformation.
Definition: vraysdk.hpp:2196
Structure representing an enumerated item with a value and a name.
Definition: vraysdk.hpp:9408
int value
The integer value of the enum item.
Definition: vraysdk.hpp:9409
std::string name
The string name of the enum item.
Definition: vraysdk.hpp:9410
Definition: vraysdk.hpp:5785
bool skipAllSuccessorsOfCurrentPlugin
Definition: vraysdk.hpp:5798
bool overwriteExistingPlugin
Definition: vraysdk.hpp:5805
bool skipOnlyCurrentPlugin
Definition: vraysdk.hpp:5794
std::string name
Definition: vraysdk.hpp:5789
This stuct is used to describe a menu item in the VFB's custom context menu.
Definition: vraysdk.hpp:5726
int id
ID of the menu item. Should be greater than or equal to 0.
Definition: vraysdk.hpp:5727
bool enabled
False if the menu should be disabled.
Definition: vraysdk.hpp:5730
std::string text
Display text of the menu item.
Definition: vraysdk.hpp:5731
VFBMenuItemType type
Type of the menu item.
Definition: vraysdk.hpp:5728
int defaultValue
Initial value of the item. Used only when the type is "checkbox". 0 means cleared and 1 means checked...
Definition: vraysdk.hpp:5729
Describes a UI font.
Definition: vraysdk.hpp:396
StampFontFamily fontFamily
Font family.
Definition: vraysdk.hpp:398
char fontFace[100]
Name of the font face ("Arial" etc).
Definition: vraysdk.hpp:401
StampFontWeight fontWeight
Font weight.
Definition: vraysdk.hpp:400
int pointSize
Size of text, in points.
Definition: vraysdk.hpp:397
StampFontStyle fontStyle
Font style.
Definition: vraysdk.hpp:399
A struct that encapsulates the export scene options.
Definition: vraysdk.hpp:5628
bool appendFrameSuffix
valid only when currentFrameOnly=true - appends a %04d frame number to the file name
Definition: vraysdk.hpp:5636
std::string sceneBasePath
Optional absolute scene base path that can be used for resolving relative paths for the ....
Definition: vraysdk.hpp:5670
bool renderElementsSeparateFolders
controls the default value of SettingsOutput.relements_separateFolders
Definition: vraysdk.hpp:5632
bool compressed
enables zlib compression of large data arrays; requires hexArrays==true
Definition: vraysdk.hpp:5629
bool stripPaths
If enabled, the paths for bitmap textures and other external files are stripped from the file so that...
Definition: vraysdk.hpp:5637
bool printHeader
whether to write the comment section with version and time info
Definition: vraysdk.hpp:5633
std::vector< std::string > additionalIncludeFiles
Optional list of files to #include at the end of the main vrscene.
Definition: vraysdk.hpp:5655
bool hexTransforms
transforms will be encoded in hex (mainly useful with large instancers)
Definition: vraysdk.hpp:5631
std::vector< Plugin > pluginExportList
If this is not empty, only these plugins will be exported instead of all plugins in the scene.
Definition: vraysdk.hpp:5652
double rightInterval
Definition: vraysdk.hpp:5646
bool incremental
valid only when currentFrameOnly=true && appendFrameSuffix=false - set to true to incrementally appen...
Definition: vraysdk.hpp:5635
double leftInterval
Definition: vraysdk.hpp:5642
std::vector< SubFileInfo > subFileInfos
A list of files to split the scene into, based on plugin type. See SubFileInfo struct comments.
Definition: vraysdk.hpp:5649
bool hexArrays
data arrays will be encoded in hex
Definition: vraysdk.hpp:5630
int vrfilesComputeHashes
True if MD5 and SHA256 hashes should be computed and written in the .vrfiles file for each resolved a...
Definition: vraysdk.hpp:5672
int vrfilesExport
Enable or disable vrfiles file writing.
Definition: vraysdk.hpp:5668
std::string hostAppString
An optional string identifying the host application, version, etc.
Definition: vraysdk.hpp:5658
int vrdataSmallBufferSizeLimit
Set a limit for the min size of the buffer. If the buffer is smaller it is not written to the vrdata ...
Definition: vraysdk.hpp:5663
bool currentFrameOnly
if true only the current keyframe is exported, otherwise the whole timeline
Definition: vraysdk.hpp:5634
bool vrdataExport
Enable or disable vrdata file writing.
Definition: vraysdk.hpp:5661
int vrdataFileSizeLimitMiB
Limit the size of the vrdata file. If this limit is reached another file is started.
Definition: vraysdk.hpp:5665
Definition: vraysdk.hpp:548
static VRayImage * createFromPng(const void *buffer, size_t size)
Takes raw PNG contents including header to create a copy of the data in a new VRayImage.
VRayImage * getFitOut(int width, int height) const
static VRayImage * createFromBmp(const VRayRenderer &renderer, const void *buffer, size_t size=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Png * compressToPng(size_t &size, bool preserveAlpha=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
AColor * getPixelData()
Returns a direct pointer to the image contents for in-place modification.
Jpeg * compressToJpeg(size_t &size, int quality=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Bmp * compressToBmp(bool preserveAlpha=false, bool swapChannels=false) const
Returns a new BMP object with a copy of this image's contents. Caller has to delete it.
VRayImage * getResizedCropped(int srcX, int srcY, int srcWidth, int srcHeight, int dstWidth, int dstHeight) const
Returns a new cropped and then resized/rescaled image. Caller has to delete it.
float getGamma() const
Bmp * compressToBmp(size_t &size, bool preserveAlpha=false, bool swapChannels=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static VRayImage * createFromJpeg(const VRayRenderer &renderer, const void *buffer, size_t size)
This is an overloaded member function, provided for convenience. It differs from the above function o...
VRayImage * getCropped(int x, int y, int width, int height) const
Returns a new cropped image. Caller has to delete it.
VRayImage * getResized(int width, int height) const
Returns a new resized/rescaled image. Caller has to delete it.
VRayImage * getDownscaled(int width, int height) const
AColor calculateWhiteBalanceMultiplier(WhiteBalanceMode mode) const
Returns a color multiplier to pass to mulColor function.
static void loadSize(const char *fileName, int &width, int &height)
VRayImage * getDownscaledCropped(int srcX, int srcY, int srcWidth, int srcHeight, int dstWidth, int dstHeight) const
IntList_DataType
These correspond to (some of) the values of RawBitmapBuffer::pixels_type.
Definition: vraysdk.hpp:602
@ rgba_float
8-bit int BGRA
Definition: vraysdk.hpp:604
@ bgr_byte
16-bit unsigned int RGBA
Definition: vraysdk.hpp:606
@ rgba_16bit
32-bit float RGBA (sRGB or gamma won't be applied automatically)
Definition: vraysdk.hpp:605
bool setGamma(float gamma)
DrawMode
Definition: vraysdk.hpp:658
@ DRAW_MODE_BLEND_FAST
Alpha-blend using only the source image alpha but keep the original destination image alpha unchanged...
Definition: vraysdk.hpp:660
@ DRAW_MODE_COPY
Overwrite destination image pixels with the source image pixels.
Definition: vraysdk.hpp:659
VRayImage * getFitIn(int width, int height) const
const AColor * getPixelData(size_t &count) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static VRayImage * load(const std::string &fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static VRayImage * createFromBmp(const void *buffer, size_t size=0)
Takes raw BMP contents including header to create a copy of the data in a new VRayImage.
Bmp * compressToBmp(size_t &size, const VRayRenderer &renderer, bool preserveAlpha=false, bool swapChannels=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Jpeg * compressToJpeg(size_t &size, const VRayRenderer &renderer, int quality=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool changeGamma(float gamma)
static VRayImage * createFromJpeg(const void *buffer, size_t size)
Takes raw JPEG contents including header to create a copy of the data in a new VRayImage.
static void loadSize(const std::string &fileName, int &width, int &height)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Png * compressToPng(size_t &size, const VRayRenderer &renderer, bool preserveAlpha=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Png * compressToPng(bool preserveAlpha=false) const
Returns a new PNG object with a compressed copy of this image's contents. Caller has to delete it.
AColor * getPixelData(size_t &count)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Png * compressToPng(const VRayRenderer &renderer, bool preserveAlpha=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Bmp * compressToBmp(const VRayRenderer &renderer, bool preserveAlpha=false, bool swapChannels=false) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Jpeg * compressToJpeg(const VRayRenderer &renderer, int quality=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool draw(const VRayImage *image, int x, int y, DrawMode mode=DRAW_MODE_COPY)
VRayImage * getCutIn(int width, int height) const
const AColor * getPixelData() const
Returns a direct pointer to the image contents for reading.
static VRayImage * load(const char *fileName)
bool changeSRGB(bool apply=true)
static VRayImage * createFromPng(const VRayRenderer &renderer, const void *buffer, size_t size)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Jpeg * compressToJpeg(int quality=0) const
Returns a new JPEG object with a compressed copy of this image's contents. Caller has to delete it.
static VRayImage * createFromRawData(const void *buffer, size_t size, IntList_DataType dataType, int width, int height)
Takes raw pixel contents to create a copy of the data in a new VRayImage.
MemoryBuffer * toBitmapData(size_t &size, bool preserveAlpha=false, bool swapChannels=false, bool reverseY=false, int stride=0, int alphaValue=-1) const
The settings passed to the VRayRenderer::setVRayProfiler() interface.
Definition: vraysdk.hpp:3692
std::string outputDirectory
The directory where the profiler reports will be created. If nullptr is passed, temp directory is use...
Definition: vraysdk.hpp:3709
std::string productName
Name of the host product.
Definition: vraysdk.hpp:3711
FileType
Definition: vraysdk.hpp:3702
@ FileType_JSON
This is the raw profiler output, which is passed when an HTML file could not be generated.
Definition: vraysdk.hpp:3704
@ FileType_HTML
An html output file. Needs a valid htmlTemplatePath or valid installation of the default path.
Definition: vraysdk.hpp:3703
int maxDepth
The maximum ray bounces that will be profiled. Range [1, 8].
Definition: vraysdk.hpp:3708
Mode
Definition: vraysdk.hpp:3693
@ Simple
Do not use, this mode will be mapped to Full mode.
@ Process
Only profile the PREPARING state (e.g., plugin initialization, geometry compilation,...
@ Full
Profile the whole rendering process.
std::string htmlTemplatePath
The full path to the profiler html template. If this is left empty, the default location will be sear...
Definition: vraysdk.hpp:3710
Mode mode
Specifies the operational mode of the Profiler.
Definition: vraysdk.hpp:3707
std::string productVersion
Version of the host product.
Definition: vraysdk.hpp:3712
std::string sceneName
Name of the scene that will be profiled. Used as a suffix to the generated filename.
Definition: vraysdk.hpp:3713
Definition: vraysdk.hpp:7391
Definition: vraysdk.hpp:7401
Definition: vraysdk.hpp:7415
Definition of one changed property for LiveLink scene updates.
Definition: vraysdk.hpp:7377
Definition: vraysdk.hpp:8821
void endDurationEvent(const char *name, int threadIndex=0)
void startDurationEvent(const char *name, int threadIndex=0)
void writeAndFreeData()
Explicitly writes the profiler data, if not already written and deinitializes the profiler.
bool isManual()
Returns true if the profiler was initialized manually (through profiler.initializeManually,...
void initializeManually(const VRayProfilerSettings &settings)
Definition: vraysdk.hpp:107
General purpose vector in 3D space using float32.
Definition: vraysdk.hpp:831
float lengthSqr(const Vector &a) noexcept
Definition: vraysdk.hpp:1094
Vector & makeZero(void) noexcept
Sets the components of the vector.
Definition: vraysdk.hpp:860
float length(const Vector &a) noexcept
Definition: vraysdk.hpp:1088
Vector & set(T1 x_, T2 y_, T3 z_) noexcept
Sets the components of the vector.
Definition: vraysdk.hpp:854
Vector rotate(const Vector &v, const Vector &axis) noexcept
Definition: vraysdk.hpp:1113
float length(void) const noexcept
Returns the length of the vector.
Definition: vraysdk.hpp:929
float & operator[](const int index) noexcept
Returns the i-th component (0 for x, 1 for y, 2 for z)
Definition: vraysdk.hpp:919
Vector & operator-=(const Vector &other) noexcept
Subtracts the components of the given vector.
Definition: vraysdk.hpp:872
double mixed(const Vector &a, const Vector &b, const Vector &c) noexcept
Definition: vraysdk.hpp:1073
Vector mul(const Vector &a, const Vector &b) noexcept
Definition: vraysdk.hpp:1044
Vector & operator*=(int factor) noexcept
Multiplies all components by the given number.
Definition: vraysdk.hpp:878
Vector normalize(const Vector &a) noexcept
Definition: vraysdk.hpp:1082
Vector & operator/=(int divisor) noexcept
Divides all components by the given number.
Definition: vraysdk.hpp:896
void rotate(const Vector &axis) noexcept
Rotates the vector along the given axis. The length of the axis is the tangent of the angle of rotati...
Vector operator-(void) const noexcept
Reverses the sign of all components.
Definition: vraysdk.hpp:914
float lengthSqr(void) const noexcept
Returns the squared length of the vector.
Definition: vraysdk.hpp:934
Vector & operator+=(const Vector &other) noexcept
Adds the components of the given vector.
Definition: vraysdk.hpp:866
The information about a voxel.
Definition: vraysdk.hpp:2793
Color wireColor
the diffuse (wire) color of the voxel
Definition: vraysdk.hpp:2794
Bool smoothed
true, if the voxel should be rendered with smoothed normals
Definition: vraysdk.hpp:2795
Bool flipNormals
true, if the geometric normals should be flipped
Definition: vraysdk.hpp:2796
bool multipleFiles
unused
Definition: vraysdk.hpp:796
bool multiChannel
create a single multi-channel file if the file format supports it
Definition: vraysdk.hpp:804
bool velocityZeroBased
unused
Definition: vraysdk.hpp:803
bool skipRGB
do not write the RGB channel into a separate file
Definition: vraysdk.hpp:801
bool frameNumber
the current frame number will be appended to the file name(s)
Definition: vraysdk.hpp:798
bool applyColorCorrections
bake the VFB corrections to the output file
Definition: vraysdk.hpp:805
bool noAlpha
do not write the alpha channel together with the color data
Definition: vraysdk.hpp:799
bool singleChannel
only a single channel is written to the file (the current one in vfb)
Definition: vraysdk.hpp:800
bool skipAlpha
do not write the alpha channel into a separate file
Definition: vraysdk.hpp:797
bool writeIntegerIDs
write to EXR as integer data
Definition: vraysdk.hpp:802
Definition: vraysdk.hpp:3378
static double None()
The None value (double) of the TiMe union In case used in Plugin::setValue(), the given plugin proper...
Definition: vraysdk.hpp:3397
TiMe(double time)
Constructs a TiMe object from a given time (double)
Definition: vraysdk.hpp:3387
static double Default()
Definition: vraysdk.hpp:3393
TiMe()
Default constructor.
Definition: vraysdk.hpp:3385
Definition: vraysdk.hpp:3524