00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #pragma once
00012
00013
00014
00015
00016 #include "maxtypes.h"
00017 #include "genlight.h"
00018 #include "custattrib.h"
00019
00020
00021
00022 class ToneOperator;
00023 class ShadowType;
00024 class Interval;
00025
00027
00030 #define LIGHTSCAPE_LIGHT_CLASS Class_ID(0x30331006, 0x2454bd3)
00031
00033 #define LS_POINT_LIGHT_ID Class_ID(0x32375fcc, 0xb025cf0)
00034
00035 #define LS_LINEAR_LIGHT_ID Class_ID(0x78207401, 0x357f1d58)
00036
00037 #define LS_AREA_LIGHT_ID Class_ID(0x36507d92, 0x105a1a47)
00038
00039 #define LS_DISC_LIGHT_ID Class_ID(0x5bcc6d42, 0xc4f430e)
00040
00041 #define LS_SPHERE_LIGHT_ID Class_ID(0x7ca93582, 0x1abb6b32)
00042
00043 #define LS_CYLINDER_LIGHT_ID Class_ID(0x46f634e3, 0xa327aaf)
00044
00046 #define LS_POINT_LIGHT_TARGET_ID Class_ID(0x658d4f97, 0x72cd4259)
00047
00048 #define LS_LINEAR_LIGHT_TARGET_ID Class_ID(0x45076885, 0x40791449)
00049
00050 #define LS_AREA_LIGHT_TARGET_ID Class_ID(0x71794f9d, 0x70ae52f2)
00051
00052 #define LS_DISC_LIGHT_TARGET_ID Class_ID(0x38732348, 0x201758b3)
00053
00054 #define LS_SPHERE_LIGHT_TARGET_ID Class_ID(0x33fc7ae9, 0x54433dc5)
00055
00056 #define LS_CYLINDER_LIGHT_TARGET_ID Class_ID(0x7c8b5b10, 0x4bd33e86)
00057
00059 #define LS_AREALIGHTCUSTATTRIB_CLASS_ID Class_ID(0x554c5e06, 0x325037bc)
00060
00061
00062 #define LS_AREALIGHTCUSTATTRIB_INTERFACE_ID Interface_ID(0x46aa0b9f, 0x64866ff3)
00063
00064 #define LIGHTSCAPE_LIGHT_INTENSITY_MIN 0.0f
00065 #define LIGHTSCAPE_LIGHT_INTENSITY_MAX 1.0e7f
00066
00067
00068
00069
00070 #pragma warning(push)
00071 #pragma warning(disable:4239)
00072
00074
00078
00079 class LightscapeLight : public GenLight {
00080
00081 public:
00082
00083
00084
00085
00086
00089 enum LightTypes {
00090 TYPE_BASE = 532,
00091 TARGET_POINT_TYPE = TYPE_BASE + 0,
00092 POINT_TYPE = TYPE_BASE + 1,
00093 TARGET_LINEAR_TYPE = TYPE_BASE + 2,
00094 LINEAR_TYPE = TYPE_BASE + 3,
00095 TARGET_AREA_TYPE = TYPE_BASE + 4,
00096 AREA_TYPE = TYPE_BASE + 5,
00097 TARGET_DISC_TYPE = TYPE_BASE + 6,
00098 DISC_TYPE = TYPE_BASE + 7,
00099 TARGET_SPHERE_TYPE = TYPE_BASE + 8,
00100 SPHERE_TYPE = TYPE_BASE + 9,
00101 TARGET_CYLINDER_TYPE = TYPE_BASE + 10,
00102 CYLINDER_TYPE = TYPE_BASE + 11,
00103 LAST_TYPE = CYLINDER_TYPE
00104 };
00105
00108 enum DistTypes {
00109 ISOTROPIC_DIST = 0,
00110 SPOTLIGHT_DIST = 1,
00111 DIFFUSE_DIST = 2,
00112 WEB_DIST = 3,
00113 LAST_DIST = WEB_DIST
00114 };
00115
00117 enum ReferenceIDs {
00119 REF_PARAMS = 0,
00121 REF_SHADOW_PARAMS = 1,
00123 REF_SPOT_PARAMS = 2,
00125 REF_WEB_PARAMS = 3,
00127 REF_SHADOWGEN = 4,
00129 REF_EXT_PARAMS = 5,
00131 LAST_REF = REF_EXT_PARAMS
00132 };
00133
00135 enum ParameterBlockID {
00137 PB_GENERAL = 0,
00139 PB_SHADOW = 1,
00141 PB_SPOT = 2,
00143 PB_WEB = 3,
00145 PB_EXT = 4,
00147 LAST_PB = PB_EXT
00148 };
00149
00151 enum ParameterIDs {
00153 PB_DIST_TYPE = 1,
00155 PB_USE_LIGHT = 2,
00157 PB_CAST_SHADOWS = 3,
00159 PB_LIGHT_COLOR = 4,
00161 PB_FILTER_COLOR = 5,
00163 PB_INTENSITY = 6,
00165 PB_KELVIN = 8,
00167 PB_USE_KELVIN = 10,
00169 PB_INTENSITY_AT = 13,
00171 PB_INTENSITY_TYPE = 14,
00173 PB_FLUX = 15,
00175 PB_ORIGINAL_INTENSITY = 16,
00177 PB_ORIGINAL_FLUX = 17,
00179 PB_USE_DIMMER = 18,
00181 PB_DIMMER = 19,
00183 PB_COLORSHIFT_DIMMING = 20,
00185 PB_USE_FARATTENUATION = 21,
00187 PB_SHOW_FARATTENUATION_GIZMO = 22,
00189 PB_START_FARATTENUATION = 23,
00191 PB_END_FARATTENUATION = 24,
00193 LAST_GEN_PB = PB_END_FARATTENUATION
00194 };
00195
00197 enum ExtParamIDs {
00199 PB_CONTRAST = 0,
00201 PB_DIFFSOFT = 1,
00203 PB_PROJECTOR = 2,
00205 PB_PROJECTOR_MAP = 3,
00207 PB_AFFECT_DIFFUSE = 4,
00209 PB_AFFECT_SPECULAR = 5,
00211 PB_AMBIENT_ONLY = 6,
00213 PB_TDIST = 7,
00214
00215
00216
00217
00218
00219
00220
00222 PB_LINELIGHT_LENGTH = 11,
00224 PB_AREALIGHT_LENGTH = 11,
00226 PB_AREALIGHT_WIDTH = 12,
00228 PB_DISCLIGHT_RADIUS = 13,
00230 PB_SPHERELIGHT_RADIUS_OLD = 14,
00231 PB_SPHERELIGHT_RADIUS = PB_DISCLIGHT_RADIUS,
00233 PB_CYLINDERLIGHT_RADIUS_OLD = 15,
00234 PB_CYLINDERLIGHT_RADIUS = PB_DISCLIGHT_RADIUS,
00236 PB_CYLINDERLIGHT_LENGTH_OLD = 16,
00237 PB_CYLINDERLIGHT_LENGTH = PB_LINELIGHT_LENGTH,
00239 LAST_EXT_PB = PB_CYLINDERLIGHT_LENGTH_OLD
00240 };
00241
00243 enum ShadowIDs {
00245 PB_ATMOS_SHAD = 0,
00247 PB_ATMOS_OPACITY = 1,
00249 PB_ATMOS_COLAMT = 2,
00251 PB_SHADMULT = 3,
00253 PB_SHAD_COLMAP = 4,
00255 PB_SHADCOLOR = 5,
00257 PB_LIGHT_AFFECTS_SHADOW = 6,
00259 PB_USE_GLOBAL_PARAMS = 7,
00261 PB_SHAD_PROJ_MAP = 8,
00263 LAST_SHAD_PB = PB_SHAD_PROJ_MAP
00264 };
00265
00267 enum SpotlightIDs {
00269 PB_BEAM_ANGLE = 0,
00271 PB_FIELD_ANGLE = 1,
00273 PB_CONE_DISPLAY = 2,
00275 LAST_SPOT_PB = PB_CONE_DISPLAY
00276 };
00277
00279 enum DistributionIDs {
00281 PB_WEB_FILE_NAME = 0,
00283 PB_WEB_ROTATE_X = 1,
00285 PB_WEB_ROTATE_Y = 2,
00287 PB_WEB_ROTATE_Z = 3,
00289 LAST_WEB_PB = PB_WEB_ROTATE_Z
00290 };
00291
00294 enum IntensityType {
00296 LUMENS = 0,
00298 CANDELAS = 1,
00300 LUX_AT =2,
00301 };
00302
00304 enum MaxShadowType {
00306 NO_SHADOW_GENERATOR = -1,
00308 BITMAP_SHADOWS = 0,
00310 RAYTRACE_SHADOWS = 1,
00312 OTHER_SHADOWS = 0xffff
00313 };
00314
00315
00316
00317 class AreaLightCustAttrib;
00318
00319
00320
00322
00326 static AreaLightCustAttrib* GetAreaLightCustAttrib(
00327 CustAttrib* attrib
00328 );
00329
00330
00331
00333
00334
00339 virtual void SetType( int type ) = 0;
00341
00357 virtual void SetType( const MCHAR* name ) = 0;
00359
00361 virtual int Type( ) = 0;
00363
00364 virtual const MCHAR* TypeName( ) = 0;
00366
00368
00369
00372 virtual void SetDistribution( DistTypes dist ) = 0;
00374
00375 virtual DistTypes GetDistribution( ) const = 0;
00377
00379
00380
00384 virtual void SetIntensityAt( float f ) = 0;
00386
00388 virtual float GetIntensityAt( ) = 0;
00390
00392
00393
00396 virtual void SetIntensityType( IntensityType t ) = 0;
00398
00399 virtual IntensityType GetIntensityType( ) = 0;
00401
00403
00404
00411 virtual void SetFlux(
00412 TimeValue t,
00413 float flux
00414 ) = 0;
00416
00420 virtual float GetFlux(
00421 TimeValue t,
00422 Interval &valid = Interval( 0,0 )
00423 ) const = 0;
00425
00427
00428
00436 virtual void SetRGBFilter(
00437 TimeValue t,
00438 Point3& rgb
00439 ) = 0;
00441
00445 virtual Point3 GetRGBFilter(
00446 TimeValue t,
00447 Interval &valid = Interval( 0,0 )
00448 ) = 0;
00450
00454 virtual void SetHSVFilter(
00455 TimeValue t,
00456 Point3& hsv
00457 ) = 0;
00459
00463 virtual Point3 GetHSVFilter(
00464 TimeValue t,
00465 Interval &valid = Interval( 0,0 )
00466 ) = 0;
00468
00469
00471
00472
00479 virtual ShadowType* ActiveShadowType( ) = 0;
00481
00483 virtual ShadowType* GetShadowGenerator( ) = 0;
00485
00487 virtual const MCHAR* GetShadowGeneratorName( ) = 0;
00489
00493 virtual void SetShadowGenerator( ShadowType* s ) = 0;
00495
00498 virtual void SetShadowGenerator( const MCHAR* name ) = 0;
00500
00502
00503
00506 virtual void SetUseShadowColorMap(
00507 TimeValue t,
00508 int onOff
00509 ) = 0;
00511
00513 virtual int GetUseShadowColorMap( TimeValue t ) = 0;
00515
00517
00520 virtual void SetInclude( BOOL onOff ) = 0;
00521
00524
00529 virtual void UpdateTargDistance(
00530 TimeValue t,
00531 INode* inode
00532 ) = 0;
00533
00535
00536
00538 virtual BOOL SetKelvinControl( Control *kelvin ) = 0;
00540
00542 virtual BOOL SetFilterControl( Control *filter ) = 0;
00544
00545 virtual Control* GetKelvinControl( ) = 0;
00547
00548 virtual Control* GetFilterControl( ) = 0;
00550
00552
00553
00558 virtual float GetKelvin(
00559 TimeValue t,
00560 Interval& v = Interval(0,0)
00561 ) = 0;
00563
00568 virtual void SetKelvin(
00569 TimeValue t,
00570 float kelvin
00571 ) = 0;
00573
00575
00576
00578 virtual BOOL GetUseKelvin( ) = 0;
00580
00583 virtual void SetUseKelvin( BOOL useKelvin ) = 0;
00585
00587
00588
00589 virtual MaxSDK::AssetManagement::AssetUser GetWebFile( ) const = 0;
00591
00595 virtual const MCHAR* GetFullWebFileName( ) const = 0;
00597
00599 virtual void SetWebFile( const MaxSDK::AssetManagement::AssetUser& file ) = 0;
00601
00603
00604
00605 virtual float GetWebRotateX( ) const = 0;
00607
00609 virtual void SetWebRotateX( float degrees ) = 0;
00611
00612 virtual float GetWebRotateY( ) const = 0;
00614
00616 virtual void SetWebRotateY( float degrees ) = 0;
00618
00619 virtual float GetWebRotateZ( ) const = 0;
00621
00623 virtual void SetWebRotateZ( float degrees ) = 0;
00625
00627
00628
00632 virtual float GetDimmerValue(TimeValue t, Interval &valid = Interval( 0,0 )) const = 0;
00634
00638 virtual void SetDimmerValue(TimeValue t, float dimmer) = 0;
00640
00642
00643
00644 virtual BOOL GetUseMultiplier() const = 0;
00646
00648 virtual void SetUseMultiplier(BOOL on) = 0;
00650
00652
00653
00655 virtual BOOL IsColorShiftEnabled() const = 0;
00656
00659
00661 virtual void EnableColorShift(BOOL on) = 0;
00663
00665
00666
00671 virtual float GetResultingIntensity(TimeValue t, Interval &valid = Interval( 0,0 )) const = 0;
00673
00678 virtual float GetResultingFlux(TimeValue t, Interval &valid = Interval( 0,0 )) const = 0;
00680
00682
00684 virtual Point3 GetCenter( ) const = 0;
00685
00687
00688
00692 virtual float GetRadius(TimeValue t, Interval &valid = Interval(0,0)) const = 0;
00693
00695
00699 virtual void SetRadius(TimeValue t, float radius) = 0;
00701
00703
00704
00708 virtual float GetLength(TimeValue t, Interval &valid = Interval(0,0)) const = 0;
00709
00711
00715 virtual void SetLength(TimeValue t, float length) = 0;
00717
00719
00720
00724 virtual float GetWidth(TimeValue t, Interval &valid = Interval(0,0)) const = 0;
00725
00727
00731 virtual void SetWidth(TimeValue t, float width) = 0;
00733
00734
00736
00737
00749 virtual void SetShape(
00750 int count,
00751 const Point3* pointsIn
00752 ) = 0;
00754
00762 virtual int GetShape(
00763 Point3* pointsOut,
00764 int bufSize
00765 ) const = 0;
00767
00769
00770
00772 virtual float GetOriginalFlux( ) const = 0;
00774
00780 virtual void SetOriginalFlux( float flux ) = 0;
00782
00784
00785
00787 virtual float GetOriginalIntensity( ) const = 0;
00789
00795 virtual void SetOriginalIntensity( float candelas ) = 0;
00797 };
00798
00799 #pragma warning(pop)
00800
00802
00805 class LightscapeLight::AreaLightCustAttrib : public BaseInterface {
00806
00807 public:
00808
00810 enum {
00811 kDefaultSamples_Area = 32,
00812 kDefaultSamples_Linear = kDefaultSamples_Area,
00813 kDefaultSamples_Cylinder = kDefaultSamples_Area,
00814 kDefaultSamples_Sphere = kDefaultSamples_Area,
00815 kDefaultSamples_Disc = kDefaultSamples_Area,
00816 kDefaultSamples_Point = 0
00817 };
00818
00820 static const BOOL kDefault_EnableAreaLight = TRUE;
00821
00823 static const BOOL kDefault_EnableLightShapeRendering = FALSE;
00824
00826
00830 virtual bool AreaLightComputationEnabled(TimeValue t, Interval* valid = NULL) const = 0;
00831
00833
00837 virtual BOOL IsLightShapeRenderingEnabled(TimeValue t, Interval* valid = NULL) const = 0;
00838
00840
00843 virtual void LightShapeRenderingEnabled(TimeValue t, BOOL on) = 0;
00844
00846
00847
00852 virtual int GetNumSamples(TimeValue t, Interval* valid = NULL) const = 0;
00854
00857 virtual void SetNumSamples(TimeValue t, int numSamples) = 0;
00859
00860
00862 virtual Interface_ID GetID() { return LS_AREALIGHTCUSTATTRIB_INTERFACE_ID; }
00863 };
00864
00866
00867 inline LightscapeLight::AreaLightCustAttrib*
00868 LightscapeLight::GetAreaLightCustAttrib(
00869 CustAttrib* attrib
00870 )
00871 {
00872 return attrib == NULL ? NULL
00873 : static_cast<LightscapeLight::AreaLightCustAttrib*>(
00874 attrib->GetInterface(LS_AREALIGHTCUSTATTRIB_INTERFACE_ID));
00875 }
00876
00877