aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVrayPlugin.h
diff options
context:
space:
mode:
authorBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
committerBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
commitbd0027e737c6512397f841c22786274ed74b927f (patch)
treef7ffbdb8f3741bb7f24635616cc189cba5cb865c /vrayPlug/plugin/shaveVrayPlugin.h
downloadshave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz
shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'vrayPlug/plugin/shaveVrayPlugin.h')
-rw-r--r--vrayPlug/plugin/shaveVrayPlugin.h233
1 files changed, 233 insertions, 0 deletions
diff --git a/vrayPlug/plugin/shaveVrayPlugin.h b/vrayPlug/plugin/shaveVrayPlugin.h
new file mode 100644
index 0000000..e0f47e2
--- /dev/null
+++ b/vrayPlug/plugin/shaveVrayPlugin.h
@@ -0,0 +1,233 @@
+#ifndef _HAIR_VRAY_PLUGIN_H_
+#define _HAIR_VRAY_PLUGIN_H_
+
+// Shave and a Haircut
+// (c) 2019 Epic Games
+// US Patent 6720962
+
+/**********************************************************************
+ *<
+ FILE: shaveVrayPlugin.h
+
+ DESCRIPTION: VRay plugin
+
+ CREATED BY: Vladimir Dubovoy <[email protected]>
+
+ HISTORY: created 30-03-2010
+
+ *>
+ **********************************************************************/
+
+// V-Ray headers
+#include "vraybase.h"
+#include "vraymayageom.h"
+#include "vrayplugins.h"
+#include "meshinfointerface.h"
+#include "defparams.h"
+#include "charstring.h"
+
+#ifdef VRAY30
+ #define VR30_CONST_STR_HACK(x) const_cast<char*>(x)
+#else
+ #define VR30_CONST_STR_HACK(x) x
+#endif
+
+#include <stdio.h>
+
+class shaveVrayPlugin : public VR::VRayStaticGeomSource{
+public:
+ static const char* version;
+ VR::VRayRenderer *vray;
+
+#if defined(VRAY30) || defined(VRAY40)
+ int useGlobalHairTree;
+ int dynHairTessel;
+ float edgeLen;
+#endif
+
+ // Cache for the parameters
+ //not sure what for these are used
+ //PluginBase *meshPlugin;
+ //MeshInfoInterface *meshInfoInterface;
+
+
+ shaveVrayPlugin(VR::VRayPluginDesc *desc);
+ ~shaveVrayPlugin();
+
+ void freeMem();
+
+ // From VRayPlugin
+ void renderBegin(VR::VRayRenderer *vray);
+ void renderEnd(VR::VRayRenderer *vray);
+ void frameBegin(VR::VRayRenderer *vray);
+ void frameEnd(VR::VRayRenderer *vray);
+
+ // From VRayStaticGeomSource
+ VR::VRayStaticGeometry* newInstance(
+ VR::MaterialInterface *mtl,
+ VR::BSDFInterface *bsdf, int renderID,
+ VR::VolumetricInterface *volume, VR::LightList *lightList,
+#ifdef VRAY40
+ const VR::Transform &baseTM,
+#else
+ const VR::TraceTransform &baseTM,
+#endif
+ int objectID, const tchar *userAttributes, int primaryVisibility);
+
+ void deleteInstance(VR::VRayStaticGeometry *instance);
+
+ VR::VRayContext* getVRayContext();
+
+ void SetStackIndex(int idx) {_stackIndex() = idx;}
+ int GetStackIndex() const {return stackIndex();}
+
+ void SetUseOwnBSDF(bool use) {_ownshader() = use ? 1 : 0;}
+ bool GetUseOwnBSDF() const {return ownshader() != 0;}
+
+ bool GetSquirrel() const {return squirrel() != 0;}
+ bool GetTipFade() const {return tipfade() != 0;}
+
+ const VR::Color& GetSpecTint() const {return spectint();}
+ const VR::Color& GetSpecTint2() const {return spectint2();}
+
+ inline bool GetCameraVisibility() const {return cameraVisibility() != 0;}
+ inline bool GetReflVisibility() const {return reflVisibility() != 0;}
+ inline bool GetRefrVisibility() const {return refrVisibility() != 0;}
+ inline bool GetLightVisibility() const {return lightVisibility() != 0;}
+ inline bool GetGiVisibility() const {return GiVisibility() != 0;}
+
+ inline float GetSelfShadow() const {return selfShadow();}
+ inline bool GetRecvShadow() const {return recvShadow();}
+
+ //const VR::Vector& GetUVs() const {return uvs();}
+ int GetNumFacesPerInst() const {return numFacesPerInst();}
+ int GetNumUVSets() const {return numUVSets();}
+
+ //does not work for standalone
+ //shaveVrayVectorListParam* GetUVparam() const
+ //{
+ // return m_uvsParam;
+ //}
+ //shaveVrayIntListParam* GetDataParam() const
+ //{
+ // return m_dataParam;
+ //}
+ //shaveVrayIntParam* GetDataSizeParam() const
+ //{
+ // return m_dataSizeParam;
+ //}
+
+protected:
+
+ int numThreads;
+ VR::VRayContext **ctxs; // used for sampling the textures
+
+ void createRayContextes(VR::VRayRenderer *vray);
+
+ //const member access
+ inline int stackIndex() const {return m_stackIndex;}
+ inline int instanced() const {return m_instanced;}
+ inline int ownshader() const {return m_ownshader;}
+ inline int numFacesPerInst()const {return m_numFacesPerInst;}
+ inline int numUVSets() const {return m_numUVSets;}
+ //inline const VR::Vector& uvs() const {return m_uvs;}
+ inline int squirrel() const {return m_squirrel;}
+ inline int tipfade() const {return m_tipfade;}
+ inline const VR::Color& spectint() const {return m_spectint;}
+ inline const VR::Color& spectint2()const {return m_spectint2;}
+ inline int cameraVisibility() const {return m_cameraVisibility;}
+ inline int reflVisibility() const {return m_reflVisibility;}
+ inline int refrVisibility() const {return m_refrVisibility;}
+ inline int lightVisibility() const {return m_lightVisibility;}
+ inline int GiVisibility() const {return m_GiVisibility;}
+ inline float selfShadow() const {return m_selfShadow;}
+ inline int recvShadow() const {return m_recvShadow;}
+
+ //member access
+ inline int& _stackIndex() {return m_stackIndex;}
+ inline int& _instanced() {return m_instanced;}
+ inline int& _ownshader() {return m_ownshader;}
+ inline int& _numFacesPerInst() {return m_numFacesPerInst;}
+ inline int& _numUVSets() {return m_numUVSets;}
+ //inline VR::Vector& _uvs() {return m_uvs;}
+ inline int& _squirrel() {return m_squirrel;}
+ inline int& _tipfade() {return m_tipfade;}
+ inline VR::Color& _spectint() {return m_spectint;}
+ inline VR::Color& _spectint2() {return m_spectint2;}
+ inline int& _cameraVisibility(){return m_cameraVisibility;}
+ inline int& _reflVisibility() {return m_reflVisibility;}
+ inline int& _refrVisibility() {return m_refrVisibility;}
+ inline int& _lightVisibility() {return m_lightVisibility;}
+ inline int& _GiVisibility() {return m_GiVisibility;}
+ inline float& _selfShadow() {return m_selfShadow;}
+ inline int& _recvShadow() {return m_recvShadow;}
+
+ static void pause(int minSeconds, int maxSeconds);
+
+private:
+
+ int m_instanced;
+ int m_stackIndex;
+ int m_ownshader;
+ int m_numFacesPerInst;
+ int m_numUVSets;
+ int m_squirrel;
+ int m_tipfade;
+ VR::Color m_spectint;
+ VR::Color m_spectint2;
+ VR::CharString m_libPath;
+ //VR::Vector m_uvs;
+ int m_cameraVisibility;
+ int m_reflVisibility;
+ int m_refrVisibility;
+ int m_lightVisibility;
+ int m_GiVisibility;
+ float m_selfShadow;
+ int m_recvShadow;
+
+public:
+ static VR::CharString draFile;
+};
+
+#define DO_LOGS
+#ifdef DO_LOGS
+
+#ifdef WIN32
+ extern FILE* alog;
+#define LOGMSG(prefix, msg) {if(alog){ fprintf(alog,"%s> %s\n",prefix,msg);fflush(alog);}}
+#else
+#define LOGMSG(prefix, msg) {fprintf(stdout,"%s> %s\n",prefix,msg);fflush(stdout);}
+#endif
+
+#ifdef WIN32
+ extern FILE* alog;
+#define LOGMSGS(prefix, msg1, msg2) {if(alog){ fprintf(alog,"%s> %s %s\n",prefix,msg1,msg2);;fflush(alog);}}
+#else
+#define LOGMSGS(prefix, msg1, msg2) {fprintf(stdout,"%s> %s %s\n",prefix,msg1,msg2);fflush(stdout);}
+#endif
+
+#ifdef WIN32
+ extern FILE* alog;
+#define LOGMSGI(prefix, msg1, i) {if(alog){ fprintf(alog,"%s> %s %i\n",prefix,msg1,i);;fflush(alog);}}
+#else
+#define LOGMSGI(prefix, msg1, i) {fprintf(stdout,"%s> %s %i\n",prefix,msg1,i);fflush(stdout);}
+#endif
+
+#ifdef WIN32
+ extern FILE* alog;
+#define LOGMSGI3(prefix, msg1, i1, i2, i3){if(alog) {fprintf(alog,"%s> %s %i %i %i\n",prefix,msg1,i1,i2,i3);fflush(alog);}}
+#else
+#define LOGMSGI3(prefix, msg1, i1, i2, i3) {fprintf(stdout,"%s> %s %i %i %i\n",prefix,msg1,i1,i2,i3);fflush(stdout);}
+#endif
+
+#else //DO_LOGS
+
+#define LOGMSG(prefix, msg) {;}
+#define LOGMSGS(prefix, msg1, msg2) {;}
+#define LOGMSGI(prefix, msg1, i) {;}
+#define LOGMSGI3(prefix, msg1, i1, i2, i3){;}
+
+#endif //DO_LOGS
+
+#endif //end of_HAIR_VRAY_PLUGIN_H_
+