HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~OBJ_Ambient();
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 
48  {
49  fpreal dim = DIMMER(t);
50  r = CR(t)*dim;
51  g = CG(t)*dim;
52  b = CB(t)*dim;
53  }
54  virtual OBJ_OBJECT_TYPE getObjectType() const;
55 
56  virtual void rmanBestShader(UT_String &str, fpreal t) = 0;
57  virtual void vexBestShader(UT_String &str, fpreal t) = 0;
58  virtual void vexBestShadow(UT_String &str, fpreal t) = 0;
59 
60  static PRM_Template *getTemplateList();
61 
62  virtual OBJ_Ambient *castToOBJAmbient() { return this; }
63 
64  /// Get the tag used for light linking
65  bool getLightLinkTag(UT_String &tag, bool create=true);
66 
67  // Remove an existing light linking tag. Returns false if the tag doesn't
68  // exist.
69  bool removeLightLinkTag(const char *tag);
70 
71  // Create a new light linking tag for a given suffix.
72  // and the new tag checked for uniqueness. The new tag name is returned.
73  bool createLightLinkTag(const char *tag_suffix, UT_String &tag);
74 
75  fpreal DIMMER(fpreal t);
76  void SHADER(UT_String &str, fpreal t);
77  void RISHADER(UT_String &str, fpreal t);
78  fpreal CR(fpreal t);
79  fpreal CG(fpreal t);
80  fpreal CB(fpreal t);
81  int BIND_OGL_LIGHT(fpreal t);
82  int BIND_LIGHT(fpreal t);
83 
85  PI_EditScriptedParms &editparms,
86  UT_BitArray &selection,
87  const CH_ChannelList &channels);
88  virtual int collectPropertiesFromParms(
89  PI_EditScriptedParms &editparms,
90  UT_StringArray &names,
91  PRM_ParmNameMap &nmap);
92 
93 protected:
94 
95  // Used to get pointer to indirection indices for each object type
96  virtual int *getIndirect() const
97  { return ambientIndirect; }
98 
99  // The camera does not use all of its parameters during a cook. Therefore
100  // in order to get the time dependencies right, we must override this.
101  virtual bool cookedDataUsesAllParameters() const
102  { return true; }
103 
105 private:
106 
107  static int *ambientIndirect;
108 };
109 
110 #endif
OBJ_AmbIndex
Definition: OBJ_Ambient.h:25
virtual int * getIndirect() const
Definition: OBJ_Ambient.h:96
void getLightColor(fpreal &r, fpreal &g, fpreal &b, fpreal t)
Definition: OBJ_Ambient.h:47
GLboolean GLboolean g
Definition: glcorearb.h:1221
virtual int collectPropertiesFromChannels(PI_EditScriptedParms &, UT_BitArray &selection, const CH_ChannelList &channels)
virtual bool cookedDataUsesAllParameters() const
Definition: OBJ_Ambient.h:101
virtual int collectPropertiesFromParms(PI_EditScriptedParms &, UT_StringArray &names, PRM_ParmNameMap &nmap)
virtual OBJ_OBJECT_TYPE getObjectType() const
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
double fpreal
Definition: SYS_Types.h:269
OBJ_ReLightProxy * myRELightProxy
Definition: OBJ_Ambient.h:104
static PRM_Template * getTemplateList(OBJ_ParmsStyle style)
virtual OBJ_Ambient * castToOBJAmbient()
Definition: OBJ_Ambient.h:62
GLboolean r
Definition: glcorearb.h:1221
static PRM_Template * getObsolete()
#define OBJ_API
Definition: OBJ_API.h:10
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:70