AcGiLightTraits.h 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // acgiLightTraits.h
  13. //
  14. // AcRxObject
  15. // AcGiSubEntityTraits
  16. // AcGiDrawableTraits
  17. // AcGiNonEntityTraits
  18. //
  19. // AcGiLightTraits
  20. // AcGiStandardLightTraits
  21. // AcGiPointLightTraits
  22. // AcGiSpotLightTraits
  23. // AcGiDistantLightTraits
  24. // AcGiPhotometricLightTraits
  25. // AcGiShadowParameters
  26. // AcGiLightAttenuation
  27. // AcGiSkyParameters
  28. //
  29. //
  30. // DESCRIPTION:
  31. //
  32. // This API extends AcGi to support light and illumination definition.
  33. // Light entities pass their illumination information along to the graphics
  34. // system and renderer through the AcGiLightTraits interfaces.
  35. //
  36. #pragma once
  37. #include "acgi.h"
  38. #pragma pack (push, 8)
  39. ////////////////////////////////////////////////////////////////////////
  40. // class AcGiLightTraits
  41. ////////////////////////////////////////////////////////////////////////
  42. /// <summary>
  43. /// Parent class for interfaces passed to AcDbLight objects in the
  44. /// implementation of setAttributes(). The light first down-casts the
  45. /// traits class to the specific type, specified earlier in the addLight()
  46. /// call. It then sets specific light properties.
  47. ///
  48. /// This class derives (indirectly) from AcGiDrawableTraits, as that is what
  49. /// is passed into AcGiDrawable::setAttributes().
  50. ///
  51. /// Lights on frozen layers will not be processed; their light will not
  52. /// illuminate the model.
  53. /// </summary>
  54. ///
  55. /// <remarks>
  56. /// A light passing it's properties to this class should not rely on any
  57. /// default values.
  58. /// </remarks>
  59. ///
  60. class AcGiLightTraits : public AcGiNonEntityTraits
  61. {
  62. public:
  63. ACRX_DECLARE_MEMBERS(AcGiLightTraits);
  64. /// <summary>
  65. /// Turns the light on or off in the viewport or render. If the light
  66. /// is off, the other properties here may simply be ignored. However,
  67. /// lights that are turned off may still "draw" graphics for display
  68. /// in the viewport.
  69. ///
  70. /// Lights on frozen layers are not processed at all, so your light
  71. /// object does not have to check that condition.
  72. /// </summary>
  73. ///
  74. /// <param name="on">
  75. /// If true, the light is "turned on".
  76. /// </param>
  77. virtual void setOn(bool on) = 0;
  78. /// <summary>
  79. /// Light on/off state.
  80. /// </summary>
  81. ///
  82. /// <returns>
  83. /// True if the light is on.
  84. /// </returns>
  85. virtual bool isOn() const = 0;
  86. };
  87. ////////////////////////////////////////////////////////////////////////
  88. // class AcGiShadowParameters
  89. ////////////////////////////////////////////////////////////////////////
  90. /// <summary>
  91. /// Container class for all shadow-related light properties.
  92. /// </summary>
  93. ///
  94. class AcGiShadowParameters : public AcRxObject
  95. {
  96. public:
  97. ACRX_DECLARE_MEMBERS(AcGiShadowParameters);
  98. AcGiShadowParameters();
  99. virtual ~AcGiShadowParameters();
  100. bool operator==(const AcGiShadowParameters& params) const;
  101. /// <summary>
  102. /// Turns shadow casting from this light on and off.
  103. /// </summary>
  104. ///
  105. /// <param name="on">
  106. /// If true, this light casts shadows.
  107. /// </param>
  108. virtual void setShadowsOn(bool on);
  109. /// <summary>
  110. /// Does the light cast shadows?
  111. /// </summary>
  112. ///
  113. /// <returns>
  114. /// True if the light casts shadows.
  115. /// </returns>
  116. virtual bool shadowsOn() const;
  117. /// <summary>
  118. /// The method used to calculate shadows.
  119. /// </summary>
  120. enum ShadowType {
  121. /// <summary>
  122. /// Shadows are calculated using a ray-trace algorithm.
  123. /// </summary>
  124. kShadowsRayTraced = 0,
  125. /// <summary>
  126. /// Shadow maps are created for each light.
  127. /// </summary>
  128. kShadowMaps,
  129. /// <summary>
  130. /// The area-sampled shadow algorithm models the effect of
  131. /// extended light sources which typically exhibit penumbra.
  132. /// </summary>
  133. kAreaSampled
  134. };
  135. /// <summary>
  136. /// Sets the method used to calculate shadows cast by this light.
  137. /// </summary>
  138. ///
  139. /// <param name="typ">
  140. /// One of: kShadowsRayTraced, kShadowMaps
  141. /// </param>
  142. ///
  143. /// <remarks>
  144. /// When shadows are ray-traced, shadow map size and softness parameters
  145. /// are ignored.
  146. /// </remarks>
  147. virtual void setShadowType(ShadowType typ);
  148. /// <summary>
  149. /// The method used to calculate shadows cast by this light.
  150. /// </summary>
  151. ///
  152. /// <returns>
  153. /// One of: kShadowsRayTraced, kShadowMaps
  154. /// </returns>
  155. virtual ShadowType shadowType() const;
  156. /// <summary>
  157. /// Sets the shadow map size, in pixels. Larger numbers produce more
  158. /// accurate shadows, but require more memory and take longer to render.
  159. /// </summary>
  160. ///
  161. /// <param name="sz">
  162. /// Valid values are 64, 128, 256, 512, 1024, 2048, and 4096.
  163. /// </param>
  164. ///
  165. /// <returns>
  166. /// Returns true if a valid size is passed in.
  167. /// </returns>
  168. ///
  169. /// <remarks>
  170. /// This value only applies if shadow type is kShadowMaps.
  171. /// </remarks>
  172. virtual bool setShadowMapSize(Adesk::UInt16 sz);
  173. /// <summary>
  174. /// The size of the shadow map, in pixels.
  175. /// </summary>
  176. ///
  177. /// <returns>
  178. /// The size of the shadow map, in pixels.
  179. /// Should be one of: 64, 128, 256, 512, 1024, 2048, or 4096.
  180. /// </returns>
  181. ///
  182. /// <remarks>
  183. /// Only applies if shadow type is kShadowMaps.
  184. /// </remarks>
  185. virtual Adesk::UInt16 shadowMapSize() const;
  186. /// <summary>
  187. /// Sets the softness (or fuzziness) of shadow-mapped shadows. The value
  188. /// represents the number of pixels at the edge of the shadow that are
  189. /// blended into the underlying image.
  190. /// </summary>
  191. ///
  192. /// <param name="soft">
  193. /// The value can range from 1 to 10.
  194. /// </param>
  195. ///
  196. /// <returns>
  197. /// Returns true if a valid softness value is passed in.
  198. /// </returns>
  199. ///
  200. /// <remarks>
  201. /// This value only applies if shadow type is kShadowMaps.
  202. /// </remarks>
  203. virtual bool setShadowMapSoftness(Adesk::UInt8 soft);
  204. /// <summary>
  205. /// The softness (or fuzziness) of the edge of the shadow. The value
  206. /// represents the number of pixels at the edge of the shadow that are
  207. /// blended into the underlying image.
  208. /// </summary>
  209. ///
  210. /// <returns>
  211. /// The number of pixels at the edge of the shadow to blend.
  212. /// </returns>
  213. ///
  214. /// <remarks>
  215. /// This value only applies if shadow type is kShadowMaps.
  216. /// </remarks>
  217. virtual Adesk::UInt8 shadowMapSoftness() const;
  218. /// <summary>
  219. /// Sets the number of shadow rays to shoot for the light. This
  220. /// controls the softness of sampled shadows.
  221. /// </summary>
  222. ///
  223. /// <param name="samples">
  224. /// The number of shadow rays to shoot for the light.
  225. /// </param>
  226. ///
  227. /// <returns>
  228. /// Returns true if a valid sample size is passed in.
  229. /// </returns>
  230. ///
  231. /// <remarks>
  232. /// This value only applies if shadow type is kAreaSampled.
  233. /// </remarks>
  234. virtual bool setShadowSamples(Adesk::UInt16 samples);
  235. /// <summary>
  236. /// The number of shadow rays to shoot for the light.
  237. /// </summary>
  238. ///
  239. /// <returns>
  240. /// The number of shadow rays to shoot for the light.
  241. /// </returns>
  242. ///
  243. /// <remarks>
  244. /// Only applies if shadow type is kAreaSampled.
  245. /// </remarks>
  246. virtual Adesk::UInt16 shadowSamples() const;
  247. /// <summary>
  248. /// Determines if the light shape is visible in the rendering.
  249. /// </summary>
  250. ///
  251. /// <param name="on">
  252. /// If true, the light shape will be visible in the rendering.
  253. /// </param>
  254. virtual void setShapeVisibility(bool visible);
  255. /// <summary>
  256. /// Is the light visible in the rendering?
  257. /// </summary>
  258. ///
  259. /// <returns>
  260. /// True if the light shape is visible in the rendering.
  261. /// </returns>
  262. virtual bool shapeVisibility() const;
  263. /// <summary>
  264. /// The shape of the extended light source.
  265. /// </summary>
  266. enum ExtendedLightShape {
  267. /// <summary>
  268. /// Linear lamps (communicated to mental ray as degenerate rectangles).
  269. /// </summary>
  270. kLinear = 0,
  271. /// <summary>
  272. /// Rectangular extended light source.
  273. /// </summary>
  274. kRectangle,
  275. /// <summary>
  276. /// Disk-shaped extended light source.
  277. /// </summary>
  278. kDisk,
  279. /// <summary>
  280. /// Cylindrical extended light source.
  281. /// </summary>
  282. kCylinder,
  283. /// <summary>
  284. /// Spherical extended light source.
  285. /// </summary>
  286. kSphere
  287. };
  288. /// <summary>
  289. /// Sets the shape of the extended light source.
  290. /// </summary>
  291. ///
  292. /// <param name="shape">
  293. /// One of: kRectangle, kDisk, kCylinder, kSphere, kLinear, kWeb
  294. /// </param>
  295. ///
  296. /// <returns>
  297. /// Returns true if a valid shape is passed in.
  298. /// </returns>
  299. ///
  300. /// <remarks>
  301. /// This value only applies if shadow type is kAreaSampled.
  302. /// </remarks>
  303. virtual bool setExtendedLightShape(ExtendedLightShape shape);
  304. /// <summary>
  305. /// The shape of the extended light source.
  306. /// </summary>
  307. ///
  308. /// <returns>
  309. /// One of: kRectangle, kDisk, kCylinder, kSphere, kLinear, kWeb
  310. /// </returns>
  311. ///
  312. /// <remarks>
  313. /// Only applies if shadow type is kAreaSampled.
  314. /// </remarks>
  315. virtual ExtendedLightShape extendedLightShape() const;
  316. /// <summary>
  317. /// Sets the length of the extended light source.
  318. /// </summary>
  319. ///
  320. /// <param name="length">
  321. /// The length of the extended light source.
  322. /// </param>
  323. ///
  324. /// <returns>
  325. /// Returns true if a valid length is passed in.
  326. /// </returns>
  327. ///
  328. /// <remarks>
  329. /// This value only applies if shadow type is kAreaSampled and
  330. /// extended light source shape is kLinear, kRectangle or kCylinder.
  331. /// </remarks>
  332. virtual bool setExtendedLightLength(double length);
  333. /// <summary>
  334. /// The length of the extended light source.
  335. /// </summary>
  336. ///
  337. /// <returns>
  338. /// The length of the extended light source.
  339. /// </returns>
  340. ///
  341. /// <remarks>
  342. /// Only applies if shadow type is kAreaSampled and extended
  343. /// light source shape is kLinear, kRectangle or kCylinder.
  344. /// </remarks>
  345. virtual double extendedLightLength() const;
  346. /// <summary>
  347. /// Sets the width of the extended light source.
  348. /// </summary>
  349. ///
  350. /// <param name="width">
  351. /// The width of the extended light source.
  352. /// </param>
  353. ///
  354. /// <returns>
  355. /// Returns true if a valid width is passed in.
  356. /// </returns>
  357. ///
  358. /// <remarks>
  359. /// This value only applies if shadow type is kAreaSampled and
  360. /// extended light source shape is kRectangle.
  361. /// </remarks>
  362. virtual bool setExtendedLightWidth(double width);
  363. /// <summary>
  364. /// The width of the extended light source.
  365. /// </summary>
  366. ///
  367. /// <returns>
  368. /// The width of the extended light source.
  369. /// </returns>
  370. ///
  371. /// <remarks>
  372. /// Only applies if shadow type is kAreaSampled and
  373. /// extended light source shape is kRectangle.
  374. /// </remarks>
  375. virtual double extendedLightWidth() const;
  376. /// <summary>
  377. /// Sets the radius of the extended light source.
  378. /// </summary>
  379. ///
  380. /// <param name="radius">
  381. /// The radius of the extended light source.
  382. /// </param>
  383. ///
  384. /// <returns>
  385. /// Returns true if a valid radius is passed in.
  386. /// </returns>
  387. ///
  388. /// <remarks>
  389. /// This value only applies if shadow type is kAreaSampled and
  390. /// extended light source shape is kDisk, kCylinder or kSphere.
  391. /// </remarks>
  392. virtual bool setExtendedLightRadius(double radius);
  393. /// <summary>
  394. /// The radius of the extended light source.
  395. /// </summary>
  396. ///
  397. /// <returns>
  398. /// The radius of the extended light source.
  399. /// </returns>
  400. ///
  401. /// <remarks>
  402. /// Only applies if shadow type is kAreaSampled and
  403. /// extended light source shape is kDisk, kCylinder or kSphere.
  404. /// </remarks>
  405. virtual double extendedLightRadius() const;
  406. protected:
  407. bool mShadowsOn;
  408. ShadowType mShadowType;
  409. Adesk::UInt16 mShadowMapSize;
  410. Adesk::UInt8 mShadowMapSoftness;
  411. Adesk::UInt16 mShadowSamples;
  412. bool mbShapeVisibility;
  413. ExtendedLightShape mExtLightShape;
  414. double mExtLightLength;
  415. double mExtLightWidth;
  416. double mExtLightRadius;
  417. };
  418. ////////////////////////////////////////////////////////////////////////
  419. // class AcGiLightAttenuation
  420. ////////////////////////////////////////////////////////////////////////
  421. /// <summary>
  422. /// Container class for light attenuation parameters.
  423. /// </summary>
  424. ///
  425. class AcGiLightAttenuation : public AcRxObject
  426. {
  427. public:
  428. ACRX_DECLARE_MEMBERS(AcGiLightAttenuation);
  429. AcGiLightAttenuation();
  430. virtual ~AcGiLightAttenuation();
  431. bool operator==(const AcGiLightAttenuation& atten) const;
  432. /// <summary>
  433. /// The type of attenuation, or decay, for this light. This only applies
  434. /// to point and spot lights. Distant lights always have no attenuation.
  435. /// </summary>
  436. enum AttenuationType {
  437. /// <summary>
  438. /// No attenuation; emitted light has the same brightness (intensity)
  439. /// regardless of the distance to the source.
  440. /// </summary>
  441. kNone = 0,
  442. /// <summary>
  443. /// Sets attenuation to be the inverse of the linear distance from the
  444. /// light.
  445. /// </summary>
  446. kInverseLinear,
  447. /// <summary>
  448. /// Sets attenuation to be the inverse of the square of the distance
  449. /// from the light.
  450. /// </summary>
  451. kInverseSquare
  452. };
  453. /// <summary>
  454. /// Sets the attenuation type for the light.
  455. /// </summary>
  456. ///
  457. /// <param name="typ">
  458. /// One of: kNone, kInverseLinear, kInverseSquare
  459. /// </param>
  460. virtual void setAttenuationType(AttenuationType typ);
  461. /// <summary>
  462. /// The attenuation type for the light.
  463. /// </summary>
  464. ///
  465. /// <returns>
  466. /// One of: kNone, kInverseLinear, kInverseSquare
  467. /// </returns>
  468. virtual AttenuationType attenuationType() const;
  469. /// <summary>
  470. /// Turns on and off application of any attenuation limits.
  471. /// </summary>
  472. ///
  473. /// <param name="on">
  474. /// If true, both start and end limits will be used.
  475. /// </param>
  476. virtual void setUseLimits(bool on);
  477. /// <summary>
  478. /// Are the start and end limits used by this light?
  479. /// </summary>
  480. ///
  481. /// <returns>
  482. /// True if start and end attenuation limits are used.
  483. /// </returns>
  484. virtual bool useLimits() const;
  485. /// <summary>
  486. /// Sets the distances (a range) from the light source where emitted light
  487. /// affects the model.
  488. /// </summary>
  489. ///
  490. /// <param name="startlim">
  491. /// The distance from the light source where light begins to affect the
  492. /// model; objects closer than this are not affected by the light.
  493. /// </param>
  494. /// <param name="endlim">
  495. /// The distance from the light source beyond which the light has no affect.
  496. /// </param>
  497. ///
  498. /// <remarks>
  499. /// Start limit must be less than end limit, and both numbers must
  500. /// greater than or equal to zero.
  501. /// </remarks>
  502. virtual void setLimits(double startlim, double endlim);
  503. /// <summary>
  504. /// The distance from the light source where light begins to affect the
  505. /// model; objects closer than this are not affected by the light.
  506. /// </summary>
  507. ///
  508. /// <returns>
  509. /// A distance.
  510. /// </returns>
  511. virtual double startLimit() const;
  512. /// <summary>
  513. /// The distance from the light source beyond which the light has no affect.
  514. /// </summary>
  515. ///
  516. /// <returns>
  517. /// A distance.
  518. /// </returns>
  519. virtual double endLimit() const;
  520. private:
  521. AttenuationType mAttenType;
  522. bool mUseAttenLimits;
  523. double mAttenStartLimit;
  524. double mAttenEndLimit;
  525. };
  526. ////////////////////////////////////////////////////////////////////////
  527. // class AcGiSkyParameters
  528. ////////////////////////////////////////////////////////////////////////
  529. /// <summary>
  530. /// Container class for all sky-related sun properties.
  531. /// </summary>
  532. ///
  533. class AcGiSkyParameters : public AcRxObject
  534. {
  535. public:
  536. ACRX_DECLARE_MEMBERS(AcGiSkyParameters);
  537. AcGiSkyParameters();
  538. virtual ~AcGiSkyParameters();
  539. bool operator==(const AcGiSkyParameters& params) const;
  540. /// <summary>
  541. /// Enables computation of skylight illumination.
  542. /// </summary>
  543. ///
  544. /// <param name="enable">
  545. /// If true, skylight illumination will be computed.
  546. /// </param>
  547. void setIllumination(bool enable) { return setIlluminationImp(enable); }
  548. /// <summary>
  549. /// Should skylight illumination be calculated?
  550. /// </summary>
  551. ///
  552. /// <returns>
  553. /// True if skylight illumination will be computed.
  554. /// </returns>
  555. bool illumination() const { return illuminationImp(); }
  556. /// <summary>
  557. /// Sets the intensity factor which determines the level of
  558. /// non-physical modulation of skylight.
  559. /// </summary>
  560. ///
  561. /// <param name="intensity">
  562. /// The intensity factor for skylight.
  563. /// </param>
  564. ///
  565. /// <returns>
  566. /// Returns true if a valid intensity factor is passed in.
  567. /// </returns>
  568. bool setIntensityFactor(double intensity) { return setIntensityFactorImp(intensity); }
  569. /// <summary>
  570. /// The intensity factor which determines the level of
  571. /// non-physical modulation of skylight.
  572. /// </summary>
  573. ///
  574. /// <returns>
  575. /// The instensity factor for skylight.
  576. /// </returns>
  577. double intensityFactor() const { return intensityFactorImp(); }
  578. /// <summary>
  579. /// Specifies turbidity or atmosphere.
  580. /// </summary>
  581. ///
  582. /// <param name="haze">
  583. /// The turbidity or atmosphere value.
  584. /// </param>
  585. ///
  586. /// <returns>
  587. /// Returns true if a valid atmosphere value is passed in.
  588. /// </returns>
  589. bool setHaze(double haze) { return setHazeImp(haze); }
  590. /// <summary>
  591. /// The turbidity or atmosphere value.
  592. /// </summary>
  593. ///
  594. /// <returns>
  595. /// The turbidity or atmosphere value.
  596. /// </returns>
  597. double haze() const { return hazeImp(); }
  598. /// <summary>
  599. /// Sets the world-space height of the horizon plane.
  600. /// </summary>
  601. ///
  602. /// <param name="height">
  603. /// The world-space height of the horizon plane.
  604. /// </param>
  605. ///
  606. /// <returns>
  607. /// Returns true if a valid height is passed in.
  608. /// </returns>
  609. bool setHorizonHeight(double height) { return setHorizonHeightImp(height); }
  610. /// <summary>
  611. /// The world-space height of the horizon plane.
  612. /// </summary>
  613. ///
  614. /// <returns>
  615. /// The world-space height of the horizon plane.
  616. /// </returns>
  617. double horizonHeight() const { return horizonHeightImp(); }
  618. /// <summary>
  619. /// Sets the amount of blurring between ground plane and sky.
  620. /// </summary>
  621. ///
  622. /// <param name="blur">
  623. /// The amount of blurring between ground plane and sky.
  624. /// </param>
  625. ///
  626. /// <returns>
  627. /// Returns true if a valid blur amount is passed in.
  628. /// </returns>
  629. bool setHorizonBlur(double blur) { return setHorizonBlurImp(blur); }
  630. /// <summary>
  631. /// The amount of blurring between ground plane and sky.
  632. /// </summary>
  633. ///
  634. /// <returns>
  635. /// The amount of blurring between ground plane and sky.
  636. /// </returns>
  637. double horizonBlur() const { return horizonBlurImp(); }
  638. /// <summary>
  639. /// Sets the color of the ground plane.
  640. /// </summary>
  641. ///
  642. /// <param name="color">
  643. /// The color of the ground plane. AcCmColor supports all color models
  644. /// within AutoCAD, including color book colors.
  645. /// </param>
  646. void setGroundColor(const AcCmColor& color) { return setGroundColorImp(color); }
  647. /// <summary>
  648. /// The color of the ground plane.
  649. /// </summary>
  650. ///
  651. /// <returns>
  652. /// The color of the ground plane.
  653. /// </returns>
  654. AcCmColor groundColor() const { return groundColorImp(); }
  655. /// <summary>
  656. /// Sets the color of the night sky.
  657. /// </summary>
  658. ///
  659. /// <param name="color">
  660. /// The color of the night sky. AcCmColor supports all color models
  661. /// within AutoCAD, including color book colors.
  662. /// </param>
  663. void setNightColor(const AcCmColor& color) { setNightColorImp(color); }
  664. /// <summary>
  665. /// The color of the night sky.
  666. /// </summary>
  667. ///
  668. /// <returns>
  669. /// The color of the night sky.
  670. /// </returns>
  671. AcCmColor nightColor() const { return nightColorImp(); }
  672. /// <summary>
  673. /// Specifies whether aerial perspective is applied.
  674. /// </summary>
  675. ///
  676. /// <param name="apply">
  677. /// If true, aerial perspective is applied.
  678. /// </param>
  679. void setAerialPerspective(bool apply) { setAerialPerspectiveImp(apply); }
  680. /// <summary>
  681. /// Should aerial perspective be applied?
  682. /// </summary>
  683. ///
  684. /// <returns>
  685. /// True if aerial perspective is applied.
  686. /// </returns>
  687. bool aerialPerspective() const { return aerialPerspectiveImp(); }
  688. /// <summary>
  689. /// Sets the distance at which 10% haze occlusion results.
  690. /// </summary>
  691. ///
  692. /// <param name="distance">
  693. /// The distance at which 10% haze occlusion results.
  694. /// </param>
  695. ///
  696. /// <returns>
  697. /// Returns true if a valid distance is passed in.
  698. /// </returns>
  699. bool setVisibilityDistance(double distance) { return setVisibilityDistanceImp(distance); }
  700. /// <summary>
  701. /// The distance at which 10% haze occlusion results.
  702. /// </summary>
  703. ///
  704. /// <returns>
  705. /// The distance at which 10% haze occlusion results.
  706. /// </returns>
  707. double visibilityDistance() const { return visibilityDistanceImp(); }
  708. /// <summary>
  709. /// Sets the scale of the sun disk (1.0 = correct size).
  710. /// </summary>
  711. ///
  712. /// <param name="scale">
  713. /// The scale of the sun disk (1.0 = correct size).
  714. /// </param>
  715. ///
  716. /// <returns>
  717. /// Returns true if a valid scale is passed in.
  718. /// </returns>
  719. bool setDiskScale(double scale) { return setDiskScaleImp(scale); }
  720. /// <summary>
  721. /// The scale of the sun disk (1.0 = correct size).
  722. /// </summary>
  723. ///
  724. /// <returns>
  725. /// The scale of the sun disk (1.0 = correct size).
  726. /// </returns>
  727. double diskScale() const { return diskScaleImp(); }
  728. /// <summary>
  729. /// Sets the intensity of the sun glow.
  730. /// </summary>
  731. ///
  732. /// <param name="intensity">
  733. /// The intensity of the sun glow.
  734. /// </param>
  735. ///
  736. /// <returns>
  737. /// Returns true if a valid intensity value is passed in.
  738. /// </returns>
  739. bool setGlowIntensity (double intensity) { return setGlowIntensityImp(intensity); }
  740. /// <summary>
  741. /// The intensity of the sun glow.
  742. /// </summary>
  743. ///
  744. /// <returns>
  745. /// The intensity of the sun glow.
  746. /// </returns>
  747. double glowIntensity() const { return glowIntensityImp(); }
  748. /// <summary>
  749. /// Sets the intensity of the sun disk.
  750. /// </summary>
  751. ///
  752. /// <param name="intensity">
  753. /// The intensity of the sun disk.
  754. /// </param>
  755. ///
  756. /// <returns>
  757. /// Returns true if a valid intensity value is passed in.
  758. /// </returns>
  759. bool setDiskIntensity(double intensity) { return setDiskIntensityImp(intensity); }
  760. /// <summary>
  761. /// The intensity of the sun disk.
  762. /// </summary>
  763. ///
  764. /// <returns>
  765. /// The intensity of the sun disk.
  766. /// </returns>
  767. double diskIntensity() const { return diskIntensityImp(); }
  768. /// <summary>
  769. /// Sets the number of samples to take on the solar disk.
  770. /// </summary>
  771. ///
  772. /// <param name="samples">
  773. /// The number of samples to take on the solar disk.
  774. /// </param>
  775. ///
  776. /// <returns>
  777. /// Returns true if a valid sample size is passed in.
  778. /// </returns>
  779. ///
  780. /// <remarks>
  781. /// This value only applies if shadow type is kAreaSampled.
  782. /// </remarks>
  783. bool setSolarDiskSamples(Adesk::UInt16 samples) { return setSolarDiskSamplesImp(samples); }
  784. /// <summary>
  785. /// The number of samples to take on the solar disk.
  786. /// </summary>
  787. ///
  788. /// <returns>
  789. /// The number of samples to take on the solar disk.
  790. /// </returns>
  791. ///
  792. /// <remarks>
  793. /// Only applies if shadow type is kAreaSampled.
  794. /// </remarks>
  795. Adesk::UInt16 solarDiskSamples() const { return solarDiskSamplesImp(); }
  796. /// <summary>
  797. /// For internal use only.
  798. /// </summary>
  799. bool setSunDirection(const AcGeVector3d& sundir) { return setSunDirectionImp(sundir); }
  800. /// <summary>
  801. /// Gets the direction (vector) of the sun's light rays.
  802. /// </summary>
  803. ///
  804. /// <returns>
  805. /// The direction vector of sunlight, from the Sun to the model.
  806. /// </returns>
  807. const AcGeVector3d& sunDirection() const { return sunDirectionImp(); }
  808. /// <summary>
  809. /// Sets the red-blue shift on the sky. This provides control on the "redness" of the
  810. /// sky. The default of 0.0 is physically accurate. A minimum value of -1.0 will produce
  811. /// a extremely blue sky, whereas the maximum value of 1.0 will produce an extremely
  812. /// red sky.
  813. /// </summary>
  814. /// <returns>
  815. /// Returns true if the input value is in the valid range of -1.0 to 1.0. Returns
  816. /// false otherwise.
  817. /// </returns>
  818. bool setRedBlueShift (double redBlueShift) { return setRedBlueShiftImp(redBlueShift); }
  819. /// <summary>
  820. /// Returns the red-blue shift on the sky. This provides control on the "redness" of the
  821. /// sky. The default of 0.0 is physically accurate. A minimum value of -1.0 will produce
  822. /// a extremely blue sky, whereas the maximum value of 1.0 will produce an extremely
  823. /// red sky.
  824. /// </summary>
  825. /// <returns>
  826. /// Returns the currently set value.
  827. /// </returns>
  828. double redBlueShift (void) const { return redBlueShiftImp(); }
  829. /// <summary>
  830. /// Artificially modifies the sky's saturation level. The minimum value of 0.0 will produce
  831. /// a extreme of black and white whereas the maximum value of 2.0 will produce highly boosted
  832. /// saturation.
  833. /// </summary>
  834. /// <returns>
  835. /// Returns true if the input value is in the valid range of 0.0 to 2.0. Returns
  836. /// false otherwise.
  837. /// </returns>
  838. bool setSaturation (double saturation) { return setSaturationImp(saturation); }
  839. /// <summary>
  840. /// Returns the the sky's saturation level. The minimum value of 0.0 will produce
  841. /// a extreme of black and white whereas the maximum value of 2.0 will produce highly boosted
  842. /// saturation.
  843. /// </summary>
  844. /// <returns>
  845. /// Returns the currently set value.
  846. /// </returns>
  847. double saturation (void) const { return saturationImp(); }
  848. protected:
  849. virtual void setIlluminationImp (bool enable);
  850. virtual bool illuminationImp (void) const;
  851. virtual bool setIntensityFactorImp (double intensity);
  852. virtual double intensityFactorImp () const;
  853. virtual bool setHazeImp (double haze);
  854. virtual double hazeImp (void) const;
  855. virtual bool setHorizonHeightImp (double height);
  856. virtual double horizonHeightImp (void) const;
  857. virtual bool setHorizonBlurImp (double blur);
  858. virtual double horizonBlurImp () const;
  859. virtual void setGroundColorImp (const AcCmColor& color);
  860. virtual AcCmColor groundColorImp () const;
  861. virtual void setNightColorImp (const AcCmColor& color);
  862. virtual AcCmColor nightColorImp () const;
  863. virtual void setAerialPerspectiveImp (bool apply);
  864. virtual bool aerialPerspectiveImp () const;
  865. virtual bool setVisibilityDistanceImp (double distance);
  866. virtual double visibilityDistanceImp () const;
  867. virtual bool setDiskScaleImp (double scale);
  868. virtual double diskScaleImp () const;
  869. virtual bool setGlowIntensityImp (double intensity);
  870. virtual double glowIntensityImp () const;
  871. virtual bool setDiskIntensityImp (double intensity);
  872. virtual double diskIntensityImp () const;
  873. virtual bool setSolarDiskSamplesImp (Adesk::UInt16 samples);
  874. virtual Adesk::UInt16 solarDiskSamplesImp (void) const;
  875. virtual bool setSunDirectionImp (const AcGeVector3d& sundir);
  876. virtual const AcGeVector3d& sunDirectionImp (void) const;
  877. virtual bool setRedBlueShiftImp (double redBlueShift);
  878. virtual double redBlueShiftImp (void) const;
  879. virtual bool setSaturationImp (double saturation);
  880. virtual double saturationImp (void) const;
  881. private:
  882. bool mStatus;
  883. double mIntensityFactor;
  884. double mHaze;
  885. double mHorizonHeight;
  886. double mHorizonBlur;
  887. AcCmColor mGroundColor;
  888. AcCmColor mNightColor;
  889. bool mAerialPerspective;
  890. double mVisibilityDistance;
  891. double mDiskScale;
  892. double mGlowIntensity;
  893. double mDiskIntensity;
  894. Adesk::UInt16 mSolarDiskSamples;
  895. AcGeVector3d mSunDirection;
  896. double mRedBlueShift;
  897. double mSaturation;
  898. };
  899. ////////////////////////////////////////////////////////////////////////
  900. // class AcGiStandardLightTraits
  901. ////////////////////////////////////////////////////////////////////////
  902. /// <summary>
  903. /// This intermediate class represents a standard, or non-photometric light.
  904. /// It defines properties common to all non-photometric lights.
  905. /// </summary>
  906. ///
  907. /// <remarks>
  908. /// A light passing it's properties to this class shouldn't rely on any
  909. /// default values.
  910. /// </remarks>
  911. ///
  912. class AcGiStandardLightTraits : public AcGiLightTraits
  913. {
  914. public:
  915. ACRX_DECLARE_MEMBERS(AcGiStandardLightTraits);
  916. /// <summary>
  917. /// Sets the intensity of the light. Intensity must be greater than or equal
  918. /// to zero. A value of 0.0 turns the light off.
  919. /// </summary>
  920. ///
  921. /// <param name="inten">
  922. /// The intensity, or brightness, of the light. A value of 0.0 effectively
  923. /// turns the light off.
  924. /// </param>
  925. virtual void setIntensity(double inten) = 0;
  926. /// <summary>
  927. /// The intensity of the light.
  928. /// </summary>
  929. ///
  930. /// <returns>
  931. /// Light intensity. The value will always be greater than or equal to zero.
  932. /// </returns>
  933. virtual double intensity() const = 0;
  934. /// <summary>
  935. /// Sets the color of the light.
  936. /// </summary>
  937. ///
  938. /// <param name="color">
  939. /// The color of the emitted light. AcCmColor supports all color models
  940. /// within AutoCAD, including color book colors.
  941. /// </param>
  942. virtual void setLightColor(const AcCmColor& color) = 0;
  943. /// <summary>
  944. /// The color of the light.
  945. /// </summary>
  946. ///
  947. /// <returns>
  948. /// Returns the color of emitted light.
  949. /// </returns>
  950. virtual AcCmColor lightColor() const = 0;
  951. /// <summary>
  952. /// Sets the shadow parameters for this light.
  953. /// </summary>
  954. ///
  955. /// <param name="params">
  956. /// The AcGiShadowParameters object that defines the way shadows are cast from this light.
  957. /// </param>
  958. virtual void setShadowParameters(const AcGiShadowParameters& params) = 0;
  959. /// <summary>
  960. /// Provides access to shadow parameters for this light.
  961. /// </summary>
  962. ///
  963. /// <param name="params">
  964. /// An AcGiShadowParameters object that will contain the current shadow
  965. /// properties of this light.
  966. /// </param>
  967. virtual void shadowParameters(AcGiShadowParameters& params) const = 0;
  968. };
  969. ////////////////////////////////////////////////////////////////////////
  970. // class AcGiPointLightTraits
  971. ////////////////////////////////////////////////////////////////////////
  972. /// <summary>
  973. /// This class represents a point light source, whose light is emitted in all
  974. /// directions.
  975. /// </summary>
  976. ///
  977. /// <remarks>
  978. /// A light passing it's properties to this class shouldn't rely on any
  979. /// default values.
  980. /// </remarks>
  981. class AcGiPointLightTraits : public AcGiStandardLightTraits
  982. {
  983. public:
  984. ACRX_DECLARE_MEMBERS(AcGiPointLightTraits);
  985. /// <summary>
  986. /// Sets the position of the light source. The coordinate space is defined
  987. /// by the current context.
  988. /// </summary>
  989. ///
  990. /// <param name="pos">
  991. /// The position of the light source.
  992. /// </param>
  993. virtual void setPosition(const AcGePoint3d& pos) = 0;
  994. /// <summary>
  995. /// The position of the light source, in the coordinate space of the
  996. /// current context.
  997. /// </summary>
  998. ///
  999. /// <returns>
  1000. /// The position as an AcGePoint3d.
  1001. /// </returns>
  1002. virtual AcGePoint3d position() const = 0;
  1003. /// <summary>
  1004. /// Provides access to attenuation parameters for this light.
  1005. /// </summary>
  1006. ///
  1007. /// <param name="atten">
  1008. /// An AcGiLightAttenuation object that will contain the current attenuation
  1009. /// parameters of this light.
  1010. /// </param>
  1011. virtual void lightAttenuation(AcGiLightAttenuation& atten) const = 0;
  1012. /// <summary>
  1013. /// Sets the attenuation parameters of this point light.
  1014. /// </summary>
  1015. ///
  1016. /// <param name="atten">
  1017. /// The AcGiLightAttenuation object that defines the way light attenuates from this light.
  1018. /// </param>
  1019. virtual void setAttenuation(const AcGiLightAttenuation& atten) = 0;
  1020. /// <summary>
  1021. /// Sets the physical intensity of the light in candela.
  1022. /// </summary>
  1023. ///
  1024. /// <param name="physicalIntensity">
  1025. /// The physical intensity of the light in candela.
  1026. /// </param>
  1027. virtual void setPhysicalIntensity(double physicalIntensity) = 0;
  1028. /// <summary>
  1029. /// The physical intensity of the light in candela.
  1030. /// </summary>
  1031. ///
  1032. /// <returns>
  1033. /// The physical intensity of the light in candela.
  1034. /// </returns>
  1035. virtual double physicalIntensity() const = 0;
  1036. /// <summary>
  1037. /// Sets the corresponding RGB color for the light's lamp color.
  1038. /// </summary>
  1039. ///
  1040. /// <param name="rgbColor">
  1041. /// Input RGB value for the light's lamp color.
  1042. /// </param>
  1043. ///
  1044. /// <remarks>
  1045. /// This value can only be modified if lamp color type is kCustom. If
  1046. /// lamp color type is set to kKelvin or kPreset, the RGB color is
  1047. /// predetermined; therefore, the RGB color cannot be modifed in
  1048. /// either case.
  1049. /// </remarks>
  1050. virtual void setLampColor (const AcGiColorRGB& rgbColor) = 0;
  1051. /// <summary>
  1052. /// The RGB value for the light's lamp color.
  1053. /// </summary>
  1054. ///
  1055. /// <param name="rgbColor">
  1056. /// Output RGB value for the light's lamp color.
  1057. /// </param>
  1058. virtual void lampColor (AcGiColorRGB& rgbColor) const = 0;
  1059. /// <summary>
  1060. /// Indicates whether or not the light has a target. If this is set to
  1061. /// false, the targetLocation() is effectively ignored.
  1062. /// </summary>
  1063. ///
  1064. /// <param name="bHasTarget">
  1065. /// Indicates whether or not the light has a target.
  1066. /// </param>
  1067. virtual void setHasTarget (bool bHasTarget) = 0;
  1068. /// <summary>
  1069. /// Indicates whether or not the light has a target. If this is set to
  1070. /// false, the targetLocation() is effectively ignored.
  1071. /// </summary>
  1072. ///
  1073. /// <returns>
  1074. /// Whether or not the light has a target.
  1075. /// </returns>
  1076. virtual bool hasTarget (void) const = 0;
  1077. /// <summary>
  1078. /// Sets the location of the target point for the light. This, in
  1079. /// combination with the position, determine the direction that the
  1080. /// light is "pointing". The coordinate space for this point is defined by
  1081. /// the current context.
  1082. /// </summary>
  1083. ///
  1084. /// <param name="loc">
  1085. /// Location (point) of the light's target. It should not be exactly
  1086. /// the same as the position.
  1087. /// </param>
  1088. virtual void setTargetLocation(const AcGePoint3d& loc) = 0;
  1089. /// <summary>
  1090. /// The location (position) towards which the light is pointing, in
  1091. /// the coordinate space of the current context.
  1092. /// </summary>
  1093. ///
  1094. /// <returns>
  1095. /// The location as an AcGePoint3d.
  1096. /// </returns>
  1097. virtual AcGePoint3d targetLocation() const = 0;
  1098. };
  1099. ////////////////////////////////////////////////////////////////////////
  1100. // class AcGiSpotLightTraits
  1101. ////////////////////////////////////////////////////////////////////////
  1102. /// <summary>
  1103. /// This class represents a spot light source, whose light is emitted in a
  1104. /// specific direction, and has an associated "light cone".
  1105. /// </summary>
  1106. ///
  1107. /// <remarks>
  1108. /// A light passing it's properties to this class shouldn't rely on any
  1109. /// default values.
  1110. /// </remarks>
  1111. class AcGiSpotLightTraits : public AcGiStandardLightTraits
  1112. {
  1113. public:
  1114. ACRX_DECLARE_MEMBERS(AcGiSpotLightTraits);
  1115. /// <summary>
  1116. /// Sets the position of the light source. The coordinate space is defined
  1117. /// by the current context.
  1118. /// </summary>
  1119. ///
  1120. /// <param name="pos">
  1121. /// The position of the light source.
  1122. /// </param>
  1123. virtual void setPosition(const AcGePoint3d& pos) = 0;
  1124. /// <summary>
  1125. /// The position of the light source, in the coordinate space of the
  1126. /// current context.
  1127. /// </summary>
  1128. ///
  1129. /// <returns>
  1130. /// The position as an AcGePoint3d.
  1131. /// </returns>
  1132. virtual AcGePoint3d position() const = 0;
  1133. /// <summary>
  1134. /// Sets the location of the target point for a spot light. This, in
  1135. /// combination with the position, determine the direction that the spot
  1136. /// light is "pointing". The coordinate space for this point is defined by
  1137. /// the current context.
  1138. /// </summary>
  1139. ///
  1140. /// <param name="loc">
  1141. /// Location (point) of the spot light's target. It should not be exactly
  1142. /// the same as the position.
  1143. /// </param>
  1144. virtual void setTargetLocation(const AcGePoint3d& loc) = 0;
  1145. /// <summary>
  1146. /// The location (position) towards which the spot light is pointing, in
  1147. /// the coordinate space of the current context.
  1148. /// </summary>
  1149. ///
  1150. /// <returns>
  1151. /// The location as an AcGePoint3d.
  1152. /// </returns>
  1153. virtual AcGePoint3d targetLocation() const = 0;
  1154. /// <summary>
  1155. /// Sets the hotspot and falloff angles.
  1156. ///
  1157. /// The region between the hotspot and falloff angles is sometimes
  1158. /// referred to as the rapid decay area.
  1159. ///
  1160. /// The greater the difference between the hotspot and falloff angles,
  1161. /// the softer the edge of the light beam. If the hotspot and falloff
  1162. /// angles are equal, the edge of the light beam is sharp. Both values
  1163. /// can range from 0 to 160 degrees. You cannot set the hotspot angle
  1164. /// to be greater than the falloff angle.
  1165. /// </summary>
  1166. ///
  1167. /// <param name="hotspot">
  1168. /// The hotspot cone angle, in radians. Defines the brightest part of the
  1169. /// spot light beam. Must be smaller than or equal to the falloff.
  1170. /// </param>
  1171. /// <param name="falloff">
  1172. /// The falloff cone angle, in radians. Defines the full cone of light. This
  1173. /// is also known as the field angle. Must be larger than or equal to the
  1174. /// hotspot.
  1175. /// </param>
  1176. ///
  1177. /// <returns>
  1178. /// Returns true if valid angles are passed in.
  1179. /// </returns>
  1180. virtual bool setHotspotAndFalloff(double hotspot, double falloff) = 0;
  1181. /// <summary>
  1182. /// The hotspot angle of this spot light.
  1183. /// </summary>
  1184. ///
  1185. /// <returns>
  1186. /// The hotspot angle, in radians.
  1187. /// </returns>
  1188. virtual double hotspot() const = 0;
  1189. /// <summary>
  1190. /// The falloff angle of this spot light.
  1191. /// </summary>
  1192. ///
  1193. /// <returns>
  1194. /// The falloff angle, in radians.
  1195. /// </returns>
  1196. virtual double falloff() const = 0;
  1197. /// <summary>
  1198. /// Provides access to attenuation parameters for this light.
  1199. /// </summary>
  1200. ///
  1201. /// <param name="atten">
  1202. /// An AcGiLightAttenuation object that will contain the current attenuation
  1203. /// parameters of this light.
  1204. /// </param>
  1205. virtual void lightAttenuation(AcGiLightAttenuation& atten) const = 0;
  1206. /// <summary>
  1207. /// Sets the attenuation parameters of this spot light.
  1208. /// </summary>
  1209. ///
  1210. /// <param name="atten">
  1211. /// The AcGiLightAttenuation object that defines the way light attenuates from this light.
  1212. /// </param>
  1213. virtual void setAttenuation(const AcGiLightAttenuation& atten) = 0;
  1214. /// <summary>
  1215. /// Sets the physical intensity of the light in candela.
  1216. /// </summary>
  1217. ///
  1218. /// <param name="physicalIntensity">
  1219. /// The physical intensity of the light in candela.
  1220. /// </param>
  1221. virtual void setPhysicalIntensity(double physicalIntensity) = 0;
  1222. /// <summary>
  1223. /// The physical intensity of the light in candela.
  1224. /// </summary>
  1225. ///
  1226. /// <returns>
  1227. /// The physical intensity of the light in candela.
  1228. /// </returns>
  1229. virtual double physicalIntensity() const = 0;
  1230. /// <summary>
  1231. /// Sets the corresponding RGB color for the light's lamp color.
  1232. /// </summary>
  1233. ///
  1234. /// <param name="rgbColor">
  1235. /// Input RGB value for the light's lamp color.
  1236. /// </param>
  1237. ///
  1238. /// <remarks>
  1239. /// This value can only be modified if lamp color type is kCustom. If
  1240. /// lamp color type is set to kKelvin or kPreset, the RGB color is
  1241. /// predetermined; therefore, the RGB color cannot be modifed in
  1242. /// either case.
  1243. /// </remarks>
  1244. virtual void setLampColor (const AcGiColorRGB& rgbColor) = 0;
  1245. /// <summary>
  1246. /// The RGB value for the light's lamp color.
  1247. /// </summary>
  1248. ///
  1249. /// <param name="rgbColor">
  1250. /// Output RGB value for the light's lamp color.
  1251. /// </param>
  1252. virtual void lampColor (AcGiColorRGB& rgbColor) const = 0;
  1253. };
  1254. ////////////////////////////////////////////////////////////////////////
  1255. // class AcGiDistantLightTraits
  1256. ////////////////////////////////////////////////////////////////////////
  1257. /// <summary>
  1258. /// This class represents a distant light source, whose light is emitted in
  1259. /// parallel rays, with an infinite distance between the light source and
  1260. /// the model.
  1261. /// </summary>
  1262. ///
  1263. /// <remarks>
  1264. /// A light passing it's properties to this class shouldn't rely on any
  1265. /// default values.
  1266. /// </remarks>
  1267. class AcGiDistantLightTraits : public AcGiStandardLightTraits
  1268. {
  1269. public:
  1270. ACRX_DECLARE_MEMBERS(AcGiDistantLightTraits);
  1271. /// <summary>
  1272. /// Sets the direction the light rays travel in. This vector is in the
  1273. /// direction of the light rays (from light to model).
  1274. /// </summary>
  1275. ///
  1276. /// <param name="vec">
  1277. /// The vector for the light rays.
  1278. /// </param>
  1279. ///
  1280. /// <remarks>
  1281. /// This same interface is used for the sun; all of the other parameters
  1282. /// used to set the location of the sun, such as latitude, longitude, date,
  1283. /// and time, boil down to a vector, which is sent to the graphics system
  1284. /// through this method.
  1285. /// </remarks>
  1286. virtual void setLightDirection(const AcGeVector3d& vec) = 0;
  1287. /// <summary>
  1288. /// The direction (vector) that the light rays travel in.
  1289. /// </summary>
  1290. ///
  1291. /// <returns>
  1292. /// The direction, as a vector; the positive direction of this vector is
  1293. /// from light to model.
  1294. /// </returns>
  1295. virtual AcGeVector3d lightDirection() const = 0;
  1296. /// <summary>
  1297. /// Tells the system to render this distant light as sunlight. Some
  1298. /// rendering systems use special algorithms to render sunlight, as its
  1299. /// intensity is so high.
  1300. /// </summary>
  1301. ///
  1302. /// <param name="isSunlight">
  1303. /// If true, this distant light may be rendered as sunlight.
  1304. /// </param>
  1305. virtual void setIsSunlight(bool isSunlight) = 0;
  1306. /// <summary>
  1307. /// Does this distant light represent sunlight?
  1308. /// </summary>
  1309. ///
  1310. /// <returns>
  1311. /// True if the light will be rendered as sunlight.
  1312. /// </returns>
  1313. virtual bool isSunlight() const = 0;
  1314. /// <summary>
  1315. /// Sets the physical intensity of the light in candela.
  1316. /// </summary>
  1317. ///
  1318. /// <param name="physicalIntensity">
  1319. /// The physical intensity of the light in candela.
  1320. /// </param>
  1321. virtual void setPhysicalIntensity(double physicalIntensity) = 0;
  1322. /// <summary>
  1323. /// The physical intensity of the light in candela.
  1324. /// </summary>
  1325. ///
  1326. /// <returns>
  1327. /// The physical intensity of the light in candela.
  1328. /// </returns>
  1329. virtual double physicalIntensity() const = 0;
  1330. /// <summary>
  1331. /// Sets the corresponding RGB color for the light's lamp color.
  1332. /// </summary>
  1333. ///
  1334. /// <param name="rgbColor">
  1335. /// Input RGB value for the light's lamp color.
  1336. /// </param>
  1337. ///
  1338. /// <remarks>
  1339. /// This value can only be modified if lamp color type is kCustom. If
  1340. /// lamp color type is set to kKelvin or kPreset, the RGB color is
  1341. /// predetermined; therefore, the RGB color cannot be modifed in
  1342. /// either case.
  1343. /// </remarks>
  1344. virtual void setLampColor (const AcGiColorRGB& rgbColor) = 0;
  1345. /// <summary>
  1346. /// The RGB value for the light's lamp color.
  1347. /// </summary>
  1348. ///
  1349. /// <param name="rgbColor">
  1350. /// Output RGB value for the light's lamp color.
  1351. /// </param>
  1352. virtual void lampColor (AcGiColorRGB& rgbColor) const = 0;
  1353. /// <summary>
  1354. /// Sets the sky parameters for this light.
  1355. /// </summary>
  1356. ///
  1357. /// <param name="params">
  1358. /// An AcGiSkyParameters object that contains the sky properties of this light.
  1359. /// </param>
  1360. virtual void setSkyParameters(const AcGiSkyParameters& params) = 0;
  1361. /// <summary>
  1362. /// Provides access to sky parameters for this light.
  1363. /// </summary>
  1364. ///
  1365. /// <param name="params">
  1366. /// An AcGiSkyParameters object that contains the sky properties of this light.
  1367. /// </param>
  1368. virtual void skyParameters(AcGiSkyParameters& params) const = 0;
  1369. };
  1370. ////////////////////////////////////////////////////////////////////////
  1371. // class AcGiWebLightTraits
  1372. ////////////////////////////////////////////////////////////////////////
  1373. /// <summary>
  1374. /// Extended distant light interface allowing for photometric traits.
  1375. /// </summary>
  1376. ///
  1377. class AcGiWebLightTraits : public AcGiPointLightTraits
  1378. {
  1379. public:
  1380. ACRX_DECLARE_MEMBERS(AcGiWebLightTraits);
  1381. /// <summary>
  1382. /// Types of web files
  1383. /// </summary>
  1384. enum WebFileType
  1385. {
  1386. /// <summary>
  1387. /// Type C web file
  1388. /// </summary>
  1389. kTypeC = 1,
  1390. /// <summary>
  1391. /// Type B web file
  1392. /// </summary>
  1393. kTypeB = 2,
  1394. /// <summary>
  1395. /// Type A web file
  1396. /// </summary>
  1397. kTypeA = 3
  1398. };
  1399. /// <summary>
  1400. /// Types of symmetry in the web file
  1401. /// </summary>
  1402. enum WebSymmetry
  1403. {
  1404. /// <summary>
  1405. /// No symmetry
  1406. /// </summary>
  1407. kNoSymmetry = 0,
  1408. /// <summary>
  1409. /// Symmetric about the XZ plane
  1410. /// </summary>
  1411. kSingleSymmetry = 1,
  1412. /// <summary>
  1413. /// Symmetric about the XZ and YZ planes
  1414. /// </summary>
  1415. kDoubleSymmetry = 2,
  1416. /// <summary>
  1417. /// Symmetric about the Z axis
  1418. /// </summary>
  1419. kAxialSymmetry = 3,
  1420. };
  1421. /// <summary>
  1422. /// Sets the path to the file containing the light's goniometric
  1423. /// data (i.e. Illuminating Engineering Society or IES file). Only
  1424. /// applies to photometric lights.
  1425. /// </summary>
  1426. ///
  1427. /// <param name="webFile">
  1428. /// Input ACHAR* const pointer to the light's IES file.
  1429. /// </param>
  1430. virtual void setWebFile(const ACHAR* webFile) = 0;
  1431. /// <summary>
  1432. /// The path to the file containing the light's goniometric
  1433. /// data (i.e. Illuminating Engineering Society or IES file).
  1434. /// </summary>
  1435. ///
  1436. /// <param name="webFile">
  1437. /// Output ACHAR* const pointer to the light's IES file.
  1438. /// </param>
  1439. virtual void webFile(AcString& webFile) const = 0;
  1440. /// <summary>
  1441. /// Sets the rotation offset (specified in XYZ Euler angles) used to
  1442. /// orient the goniometric data relative to the light orientation.
  1443. /// </summary>
  1444. ///
  1445. /// <param name="rotation">
  1446. /// Input rotation offset specified in XYZ Euler angles.
  1447. /// </param>
  1448. virtual void setWebRotation(AcGeVector3d rotation) = 0;
  1449. /// <summary>
  1450. /// The rotation offset (specified in XYZ Euler angles) used to
  1451. /// orient the goniometric data relative to the light orientation.
  1452. /// </summary>
  1453. ///
  1454. /// <param name="rotation">
  1455. /// Output rotation offset specified in XYZ Euler angles.
  1456. /// </param>
  1457. virtual void webRotation(AcGeVector3d& rotation) const = 0;
  1458. /// <summary>
  1459. /// Explicitly set the flux value in lumens for the web light.
  1460. /// </summary>
  1461. ///
  1462. /// <param name="flux">
  1463. /// The explicit flux value in lumens for the web light.
  1464. /// </param>
  1465. virtual void setWebFlux(double flux) const = 0;
  1466. /// <summary>
  1467. /// Returns the flux value in lumens set for the web light.
  1468. /// </summary>
  1469. ///
  1470. /// <returns>
  1471. /// The flux value set for the web light in lumens.
  1472. /// </returns>
  1473. virtual double webFlux() const = 0;
  1474. /// <summary>
  1475. /// Sets the type of web file which was set by setWebFile().
  1476. /// </summary>
  1477. ///
  1478. /// <param name="type">
  1479. /// The type of the web file specified by setWebFile().
  1480. /// </param>
  1481. virtual void setWebFileType (WebFileType type) = 0;
  1482. /// <summary>
  1483. /// Returns the type of web file.
  1484. /// </summary>
  1485. ///
  1486. /// <returns>
  1487. /// The type of web file.
  1488. /// </returns>
  1489. virtual WebFileType webFileType (void) const = 0;
  1490. /// <summary>
  1491. /// Sets the symmetry of web file which was set by setWebFile().
  1492. /// </summary>
  1493. ///
  1494. /// <param name="symmetry">
  1495. /// The symmetry of the web file specified by setWebFile().
  1496. /// </param>
  1497. virtual void setWebSymmetry (WebSymmetry symmetry) = 0;
  1498. /// <summary>
  1499. /// Returns the type of symmetry in the web file.
  1500. /// </summary>
  1501. ///
  1502. /// <returns>
  1503. /// The type of symmetry in the web file.
  1504. /// </returns>
  1505. virtual WebSymmetry webSymmetry (void) const = 0;
  1506. /// <summary>
  1507. /// This method sets a flag to indicate that the IES file based web light is a bilaterally symmetric luminaire
  1508. /// that exhibits symmetry about the 90 to 270 degree plane. In this case, in the corresponding IES file,
  1509. /// the first value for the horizontal angle will be 90 degrees and the last value for the horizontal angle
  1510. /// will be 270 degrees. This method can be used to establish the web light as having this characteristic,
  1511. /// such that any special processing that should apply to this type of web light can be conditioned upon this
  1512. /// flag. For more information, consult the following publication, which describes the IES file format
  1513. /// standard in full:
  1514. ///
  1515. /// IESNA LM-63-95,
  1516. /// IESNA Standard File Format for Electronic Transfer of Photometric Data,
  1517. /// By the IESNA (Illuminating Engineering Socety of North America) Computer Committee.
  1518. /// </summary>
  1519. ///
  1520. /// <param name="symmetry">
  1521. /// The value of the horizontal angle 90 to 270 flag for the web file
  1522. /// specified by setWebFile().
  1523. /// </param>
  1524. virtual void setWebHorzAng90to270 (bool bIs90to270) = 0;
  1525. /// <summary>
  1526. /// Returns whether the horizontal angle 90 to 270 flag is set.
  1527. /// </summary>
  1528. ///
  1529. /// <returns>
  1530. /// The setting of the horizontal angle 90 to 270 flag.
  1531. /// </returns>
  1532. virtual bool webHorzAng90to270 (void) const = 0;
  1533. };
  1534. #pragma pack (pop)