LightWrap++
AC++wrapperfortheLightWave3DSDK
sceneinfo.h
Go to the documentation of this file.
1 #ifndef LWPP_SCENEINFO_H
2 #define LWPP_SCENEINFO_H
3 
4 #include <lwpp/item.h>
5 #include <lwpp/matrix4x4.h>
6 #include <lwpp/camerainfo.h>
7 //#include <lwrender.h>
8 
9 namespace lwpp
10 {
12  class TimeInfo : public GlobalBase<LWTimeInfo>
13  {
14  public:
15  TimeInfo() { ; }
16  LWTime Time() const
17  {
18  if (globPtr) return globPtr->time;
19  else return 0;
20  }
21  LWFrame Frame() const
22  {
23  if (globPtr) return globPtr->frame;
24  else return 0;
25  }
26  };
27 
28  inline LWFrame GetFrame()
29  {
30  TimeInfo ti;
31  return ti.Frame();
32  }
33 
34  inline LWTime GetTime()
35  {
36  TimeInfo ti;
37  return ti.Time();
38  }
39 
41 
44  class SceneInfo : protected GlobalBase<LWSceneInfo>
45  {
46  static const char *filterNames[];
47  public:
49  SceneInfo() { ; }
50 
52  bool isValid() const {return globPtr != 0;}
54  const char *name() const {return globPtr->name;}
55 
57  const char *filename() const {return globPtr->filename;}
58 
60  int numPoints() const {return globPtr->numPoints;}
61 
63  int numPolygons() const {return globPtr->numPolygons;}
64 
66  int renderType() const {return globPtr->renderType;}
67 
86  int renderOpts() const {return globPtr->renderOpts;}
87 
89  LWFrame frameStart() const {return globPtr->frameStart;}
90 
92  LWFrame frameEnd() const {return globPtr->frameEnd;}
93 
95  LWFrame frameStep() const {return globPtr->frameStep;}
96 
98  double framesPerSecond() const {return globPtr->framesPerSecond;}
99 
101  int frameWidth() const {return globPtr->frameWidth;}
102 
104  int frameHeight() const {return globPtr->frameHeight;}
109  double pixelAspect() const {return globPtr->pixelAspect;}
114  int minSamplesPerPixel() const {return globPtr->minSamplesPerPixel;}
119  int maxSamplesPerPixel() const {return globPtr->maxSamplesPerPixel;}
123  int *limitedRegion() const {return globPtr->limitedRegion;}
125  int recursionDepth() const {return globPtr->recursionDepth;}
129  LWItemID renderCamera(LWTime time) const {return globPtr->renderCamera(time);}
133  LWItemID renderCamera ()
134  {
135  return renderCamera(GetTime());
136  }
138  int numThreads() const {return globPtr->numThreads;}
140  const char *animFilename() const {return globPtr->animFilename;}
142  const char *RGBPrefix() const {return globPtr->RGBPrefix;}
144  const char *alphaPrefix() const {return globPtr->alphaPrefix;}
151  int antialiasing() const {return globPtr->antialiasing;}
153  bool enhancedAA() const {return globPtr->enhancedAA ? true : false;}
155  const char *getAAName() const
156  {
157  static std::string ret;
158  ret.clear();
159  int aa = antialiasing();
160 
161  if (aa >= 100)
162  {
163  char buffer[256];
164  sprintf(buffer,"PLD %i",aa - 99);
165  ret = buffer;
166  }
167  else
168  {
169  if ((aa >= 0) && (aa < 5) && enhancedAA()) ret = "Enhanced ";
170  switch (aa)
171  {
172  case 0: ret = "none"; break;
173  case 1: ret += "Low"; break;
174  case 2: ret += "Medium"; break;
175  case 3: ret += "High"; break;
176  case 4: ret += "Extreme"; break;
177  default: ret += "unknown"; break;
178  }
179  }
180  if (adaptiveSampling())
181  {
182  char buffer[256];
183  sprintf(buffer," - AS (%f)", adaptiveThreshold());
184  ret += buffer;
185  }
186  return ret.c_str();
187  }
188  bool adaptiveSampling (void) const {return globPtr->adaptiveSampling ? true : false;}
190  float adaptiveThreshold(void) const {return globPtr->adaptiveThreshold;}
192  bool softfilter (void) const {
193  // we check the FIRST bit
194  return (globPtr->filter | 0x0001) ? true : false;
195  }
196 
197  // Enumeration for the filter names
198  enum FilterTypes {
204  };
205 
207 
213  {
214  return static_cast<FilterTypes>((globPtr->filter >> 1) & 0x001F); // remove soft filter bit and mask out lower 5 bits
215  }
216 
218  const char *reconstructionFilterName () const
219  {
221  if ((filter >= 0) && (filter < UNKNOWN))
222  {
223  return filterNames[filter];
224  }
225  else
226  {
227  return "unknown";
228  }
229  }
230 
231  // Returns a boolean value indicating if the area lights are double sided or not
232  //bool dblSidedAreaLights(void) const {return globPtr->dblSidedAreaLights ? true : false;}
233 
234 #if (LW_SDK >= 96)
235  double getCausticsIntensity() const { return globPtr->causticsIntensity; }
236  int getCausticsAccuracy() const { return globPtr->causticsAccuracy; }
237  int getCausticsSoftness() const { return globPtr->causticsSoftness; }
238  int getRadiosityFlags() const { return globPtr->radiosityFlags; }
239  double getDynamicsRangeMin() const { return globPtr->dynamicsRangeMin; }
240  double getDynamicsRangeMax() const { return globPtr->dynamicsRangeMax; }
241  double getSaturation() const { return globPtr->saturation; }
242 
243  LWRENDERINGMODE GetRenderMode() const { return (LWRENDERINGMODE) globPtr->rendermode; }
244  /*
245  int pixelFilterForceMT;
246  int has_multithreaded_filters;
247  int useZminmax;
248  double zmin;
249  double zmax;
250  int calculateallnormals;
251  */
252 #endif
253  };
254 
255  // Supporting functions
257 
262  Matrix4x4d getWorld2Screen(LWItemID id, LWTime time);
263 
265  Matrix4x4d getWorld2Screen(LWTime time);
266 
267  Matrix4x4d getWorld2Screen(LWItem cid, LWTime time);
268 
270  bool World2Screen(lwpp::Point3d pt, double scoord[2], lwpp::Matrix4x4d &CameraTransform, double frameAspect);
271 
273  bool World2Screen(lwpp::Vector3d dir, double scoord[2], lwpp::Matrix4x4d &CameraTransform, double frameAspect);
274 
276 
285  bool World2Screen(lwpp::Point3d pt, double scoord[2], LWItemID camID, LWTime time, double pixelAspect);
286 
288 
295  bool World2Screen(lwpp::Point3d pt, double scoord[2], LWTime time);
296 }
297 
298 #endif // LWPP_SCENEINFO_H