00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LUX_API_H
00024 #define LUX_API_H 1
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00030 typedef char *LuxToken;
00031 typedef char *LuxPointer;
00032 #define LUX_NULL NULL
00033
00034 void luxInit();
00035 void luxCleanup();
00036
00037
00038 void luxIdentity();
00039 void luxTranslate(float dx, float dy, float dz);
00040 void luxRotate(float angle, float ax, float ay, float az);
00041 void luxScale(float sx, float sy, float sz);
00042 void luxLookAt(float ex, float ey, float ez, float lx, float ly, float lz, float ux, float uy, float uz);
00043 void luxConcatTransform(float transform[16]);
00044 void luxTransform(float transform[16]);
00045 void luxCoordinateSystem(const char *);
00046 void luxCoordSysTransform(const char *);
00047 void luxPixelFilter(const char *name, ...);
00048 void luxPixelFilterV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00049 void luxFilm(const char *name, ...);
00050 void luxFilmV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00051 void luxSampler(const char *name, ...);
00052 void luxSamplerV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00053 void luxAccelerator(const char *name, ...);
00054 void luxAcceleratorV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00055 void luxSurfaceIntegrator(const char *name, ...);
00056 void luxSurfaceIntegratorV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00057 void luxVolumeIntegrator(const char *name, ...);
00058 void luxVolumeIntegratorV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00059 void luxCamera(const char *name, ...);
00060 void luxCameraV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00061 void luxWorldBegin();
00062 void luxAttributeBegin();
00063 void luxAttributeEnd();
00064 void luxTransformBegin();
00065 void luxTransformEnd();
00066 void luxTexture(const char *name, const char *type, const char *texname, ...);
00067 void luxTextureV(const char *name, const char *type, const char *texname, int n, LuxToken tokens[], LuxPointer params[]);
00068 void luxMaterial(const char *name, ...);
00069 void luxMaterialV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00070 void luxMakeNamedMaterial(const char *name, ...);
00071 void luxMakeNamedMaterialV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00072 void luxNamedMaterial(const char *name, ...);
00073 void luxNamedMaterialV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00074 void luxLightSource(const char *name, ...);
00075 void luxLightSourceV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00076 void luxAreaLightSource(const char *name, ...);
00077 void luxAreaLightSourceV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00078 void luxPortalShape(const char *name, ...);
00079 void luxPortalShapeV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00080 void luxShape(const char *name, ...);
00081 void luxShapeV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00082 void luxReverseOrientation();
00083 void luxVolume(const char *name, ...);
00084 void luxVolumeV(const char *name, int n, LuxToken tokens[], LuxPointer params[]);
00085 void luxObjectBegin(const char *name);
00086 void luxObjectEnd();
00087 void luxObjectInstance(const char *name);
00088 void luxMotionInstance(const char *name, float startTime, float endTime, const char *toTransform);
00089 void luxWorldEnd();
00090
00091
00092 void luxLoadFLM(const char* name);
00093 void luxSaveFLM(const char* name);
00094
00095 void luxOverrideResumeFLM(const char *name);
00096
00097
00098 void luxStart();
00099 void luxPause();
00100 void luxExit();
00101 void luxWait();
00102
00103 void luxSetHaltSamplePerPixel(int haltspp, bool haveEnoughSamplePerPixel, bool suspendThreadsWhenDone);
00104
00105
00106 int luxAddThread();
00107 void luxRemoveThread();
00108
00109
00110 void luxSetEpsilon(const float minValue, const float maxValue);
00111
00112 enum ThreadSignals { RUN, PAUSE, EXIT};
00113 struct RenderingThreadInfo {
00114 int threadIndex;
00115 ThreadSignals status;
00116 };
00117
00118
00119 int luxGetRenderingThreadsStatus(RenderingThreadInfo *info, int maxInfoCount);
00120
00121
00122 void luxUpdateFramebuffer();
00123 unsigned char* luxFramebuffer();
00124
00125
00126 void luxGetHistogramImage(unsigned char *outPixels, int width, int height, int options);
00127
00128 #define LUX_HISTOGRAM_RGB 1
00129 #define LUX_HISTOGRAM_RGB_ADD 2
00130 #define LUX_HISTOGRAM_RED 4
00131 #define LUX_HISTOGRAM_GREEN 8
00132 #define LUX_HISTOGRAM_BLUE 16
00133 #define LUX_HISTOGRAM_VALUE 32
00134 #define LUX_HISTOGRAM_LOG 64
00135
00136
00137
00138
00139
00140 enum luxComponent { LUX_FILM
00141 };
00142
00143 enum luxComponentParameters { LUX_FILM_TM_TONEMAPKERNEL,
00144 LUX_FILM_TM_REINHARD_PRESCALE,
00145 LUX_FILM_TM_REINHARD_POSTSCALE,
00146 LUX_FILM_TM_REINHARD_BURN,
00147 LUX_FILM_TM_LINEAR_SENSITIVITY,
00148 LUX_FILM_TM_LINEAR_EXPOSURE,
00149 LUX_FILM_TM_LINEAR_FSTOP,
00150 LUX_FILM_TM_LINEAR_GAMMA,
00151 LUX_FILM_TM_CONTRAST_YWA,
00152 LUX_FILM_TORGB_X_WHITE,
00153 LUX_FILM_TORGB_Y_WHITE,
00154 LUX_FILM_TORGB_X_RED,
00155 LUX_FILM_TORGB_Y_RED,
00156 LUX_FILM_TORGB_X_GREEN,
00157 LUX_FILM_TORGB_Y_GREEN,
00158 LUX_FILM_TORGB_X_BLUE,
00159 LUX_FILM_TORGB_Y_BLUE,
00160 LUX_FILM_TORGB_GAMMA,
00161 LUX_FILM_UPDATEBLOOMLAYER,
00162 LUX_FILM_DELETEBLOOMLAYER,
00163 LUX_FILM_BLOOMRADIUS,
00164 LUX_FILM_BLOOMWEIGHT,
00165 LUX_FILM_VIGNETTING_ENABLED,
00166 LUX_FILM_VIGNETTING_SCALE,
00167 LUX_FILM_ABERRATION_ENABLED,
00168 LUX_FILM_ABERRATION_AMOUNT,
00169 LUX_FILM_UPDATEGLARELAYER,
00170 LUX_FILM_DELETEGLARELAYER,
00171 LUX_FILM_GLARE_AMOUNT,
00172 LUX_FILM_GLARE_RADIUS,
00173 LUX_FILM_GLARE_BLADES,
00174 LUX_FILM_HISTOGRAM_ENABLED,
00175 LUX_FILM_NOISE_CHIU_ENABLED,
00176 LUX_FILM_NOISE_CHIU_RADIUS,
00177 LUX_FILM_NOISE_CHIU_INCLUDECENTER,
00178 LUX_FILM_NOISE_GREYC_ENABLED,
00179 LUX_FILM_NOISE_GREYC_AMPLITUDE,
00180 LUX_FILM_NOISE_GREYC_NBITER,
00181 LUX_FILM_NOISE_GREYC_SHARPNESS,
00182 LUX_FILM_NOISE_GREYC_ANISOTROPY,
00183 LUX_FILM_NOISE_GREYC_ALPHA,
00184 LUX_FILM_NOISE_GREYC_SIGMA,
00185 LUX_FILM_NOISE_GREYC_FASTAPPROX,
00186 LUX_FILM_NOISE_GREYC_GAUSSPREC,
00187 LUX_FILM_NOISE_GREYC_DL,
00188 LUX_FILM_NOISE_GREYC_DA,
00189 LUX_FILM_NOISE_GREYC_INTERP,
00190 LUX_FILM_NOISE_GREYC_TILE,
00191 LUX_FILM_NOISE_GREYC_BTILE,
00192 LUX_FILM_NOISE_GREYC_THREADS,
00193 LUX_FILM_LG_COUNT,
00194 LUX_FILM_LG_ENABLE,
00195 LUX_FILM_LG_NAME,
00196 LUX_FILM_LG_SCALE,
00197 LUX_FILM_LG_SCALE_RED,
00198 LUX_FILM_LG_SCALE_BLUE,
00199 LUX_FILM_LG_SCALE_GREEN,
00200 LUX_FILM_LG_TEMPERATURE,
00201 LUX_FILM_LG_SCALE_X,
00202 LUX_FILM_LG_SCALE_Y,
00203 LUX_FILM_LG_SCALE_Z
00204 };
00205
00206
00207 void luxSetParameterValue(luxComponent comp, luxComponentParameters param, double value, int index = 0);
00208 double luxGetParameterValue(luxComponent comp, luxComponentParameters param, int index = 0);
00209 double luxGetDefaultParameterValue(luxComponent comp, luxComponentParameters param, int index = 0);
00210 void luxSetStringParameterValue(luxComponent comp, luxComponentParameters param, const char* value, int index = 0);
00211
00212 int luxGetStringParameterValue(luxComponent comp, luxComponentParameters param, char* dst, int dstlen, int index = 0);
00213 int luxGetDefaultStringParameterValue(luxComponent comp, luxComponentParameters param, char* dst, int dstlen, int index = 0);
00214
00215
00216
00217 void luxAddServer(const char * name);
00218 void luxRemoveServer(const char * name);
00219 int luxGetServerCount();
00220 void luxUpdateFilmFromNetwork();
00221 void luxSetNetworkServerUpdateInterval(int updateInterval);
00222 int luxGetNetworkServerUpdateInterval();
00223
00224 struct RenderingServerInfo {
00225 int serverIndex;
00226
00227
00228 const char *name;
00229 const char *port;
00230 const char *sid;
00231
00232 unsigned int secsSinceLastContact;
00233 double numberOfSamplesReceived;
00234 };
00235
00236
00237 int luxGetRenderingServersStatus(RenderingServerInfo *info, int maxInfoCount);
00238
00239
00240 double luxStatistics(const char *statName);
00241
00242
00243 void luxEnableDebugMode();
00244 void luxDisableRandomMode();
00245
00246
00247 extern int luxLastError;
00248 extern int luxLogFilter;
00249 typedef void (*LuxErrorHandler)(int code, int severity, const char *msg);
00250 extern void luxErrorHandler(LuxErrorHandler handler);
00251 extern void luxErrorAbort(int code, int severity, const char *message);
00252 extern void luxErrorIgnore(int code, int severity, const char *message);
00253 extern void luxErrorPrint(int code, int severity, const char *message);
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 #define LUX_NOERROR 0
00266
00267 #define LUX_NOMEM 1
00268 #define LUX_SYSTEM 2
00269 #define LUX_NOFILE 3
00270 #define LUX_BADFILE 4
00271 #define LUX_BADVERSION 5
00272 #define LUX_DISKFULL 6
00273
00274 #define LUX_UNIMPLEMENT 12
00275 #define LUX_LIMIT 13
00276 #define LUX_BUG 14
00277
00278 #define LUX_NOTSTARTED 23
00279 #define LUX_NESTING 24
00280 #define LUX_NOTOPTIONS 25
00281 #define LUX_NOTATTRIBS 26
00282 #define LUX_NOTPRIMS 27
00283 #define LUX_ILLSTATE 28
00284 #define LUX_BADMOTION 29
00285 #define LUX_BADSOLID 30
00286
00287 #define LUX_BADTOKEN 41
00288 #define LUX_RANGE 42
00289 #define LUX_CONSISTENCY 43
00290 #define LUX_BADHANDLE 44
00291 #define LUX_NOPLUGIN 45
00292 #define LUX_MISSINGDATA 46
00293 #define LUX_SYNTAX 47
00294
00295 #define LUX_MATH 61
00296
00297
00298
00299 #define LUX_DEBUG -1
00300
00301 #define LUX_INFO 0
00302 #define LUX_WARNING 1
00303 #define LUX_ERROR 2
00304 #define LUX_SEVERE 3
00305
00306 #ifdef __cplusplus
00307 }
00308 #endif
00309
00310 #endif