HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_Ambient.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OBJ library (C++)
7  *
8  * COMMENTS: Ambient Light object definition (base class for lights too)
9  *
10  */
11 
12 #ifndef __OBJ_Ambient_h__
13 #define __OBJ_Ambient_h__
14 
15 #include "OBJ_API.h"
16 #include "OBJ_Camera.h"
17 
18 class obj_Scene;
19 class IFD_LightParms;
20 class OBJ_ReLightProxy;
21 class RE_Light;
22 
23 #define LIGHTBANK_PREFIX "lb:"
24 
26 {
28 
29  I_N_AMB_INDICES // should always be last in the list
30 };
31 
32 // Yes, this is gross, however, because we assume that you can render
33 // from any light source, we have to sub-class from OBJ_Camera.
35 {
36 public:
37  OBJ_Ambient(OP_Network *, const char *, OP_Operator *);
38  ~OBJ_Ambient() override;
39 
40  static PRM_Template *getObsolete();
41 
42  virtual RE_Light *getLightValue();
43  virtual void updateLightValue(fpreal t,
44  bool for_viewport = true);
45  virtual int isAmbient();
46  const UT_Options & getLightParms() const;
47 
49  {
50  fpreal dim = DIMMER(t);
51  r = CR(t)*dim;
52  g = CG(t)*dim;
53  b = CB(t)*dim;
54  }
55  OBJ_OBJECT_TYPE getObjectType() const override;
56 
57  virtual void rmanBestShader(UT_String &str, fpreal t) = 0;
58  virtual void vexBestShader(UT_String &str, fpreal t) = 0;
59  virtual void vexBestShadow(UT_String &str, fpreal t) = 0;
60 
61  static PRM_Template *getTemplateList();
62 
63  OBJ_Ambient *castToOBJAmbient() override { return this; }
64 
65  /// Get the tag used for light linking
66  bool getLightLinkTag(UT_String &tag, bool create=true);
67 
68  // Remove an existing light linking tag. Returns false if the tag doesn't
69  // exist.
70  bool removeLightLinkTag(const char *tag);
71 
72  // Create a new light linking tag for a given suffix.
73  // and the new tag checked for uniqueness. The new tag name is returned.
74  bool createLightLinkTag(const char *tag_suffix, UT_String &tag);
75 
76  fpreal DIMMER(fpreal t);
77  void SHADER(UT_String &str, fpreal t);
78  void RISHADER(UT_String &str, fpreal t);
79  fpreal CR(fpreal t);
80  fpreal CG(fpreal t);
81  fpreal CB(fpreal t);
82  int BIND_OGL_LIGHT(fpreal t);
83  int BIND_LIGHT(fpreal t);
84 
86  PI_EditScriptedParms &editparms,
88  const CH_ChannelList &channels) override;
90  PI_EditScriptedParms &editparms,
91  UT_StringArray &names,
92  PRM_ParmNameMap &nmap) override;
93 
94 protected:
95 
96  // Used to get pointer to indirection indices for each object type
97  int *getIndirect() const override
98  { return ambientIndirect; }
99 
100  // The camera does not use all of its parameters during a cook. Therefore
101  // in order to get the time dependencies right, we must override this.
102  bool cookedDataUsesAllParameters() const override
103  { return true; }
104 
106 private:
107 
108  static int *ambientIndirect;
109 };
110 
111 #endif
OBJ_AmbIndex
Definition: OBJ_Ambient.h:25
GT_API const UT_StringHolder selection
bool cookedDataUsesAllParameters() const override
Definition: OBJ_Ambient.h:102
void getLightColor(fpreal &r, fpreal &g, fpreal &b, fpreal t)
Definition: OBJ_Ambient.h:48
GLboolean GLboolean g
Definition: glcorearb.h:1222
int * getIndirect() const override
Definition: OBJ_Ambient.h:97
int collectPropertiesFromChannels(PI_EditScriptedParms &, UT_BitArray &selection, const CH_ChannelList &channels) override
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLdouble t
Definition: glad.h:2397
OBJ_Ambient * castToOBJAmbient() override
Definition: OBJ_Ambient.h:63
A map of string to various well defined value types.
Definition: UT_Options.h:84
OBJ_ReLightProxy * myRELightProxy
Definition: OBJ_Ambient.h:105
static PRM_Template * getTemplateList(OBJ_ParmsStyle style)
fpreal64 fpreal
Definition: SYS_Types.h:277
int collectPropertiesFromParms(PI_EditScriptedParms &, UT_StringArray &names, PRM_ParmNameMap &nmap) override
GLboolean r
Definition: glcorearb.h:1222
static PRM_Template * getObsolete()
#define OBJ_API
Definition: OBJ_API.h:10
OBJ_OBJECT_TYPE getObjectType() const override
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:73
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)