renderState.I 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. // Filename: renderState.I
  2. // Created by: drose (21Feb02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: RenderState::is_empty
  20. // Access: Published
  21. // Description: Returns true if the state is empty, false otherwise.
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE bool RenderState::
  24. is_empty() const {
  25. return _attributes.empty();
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: RenderState::get_num_attribs
  29. // Access: Published
  30. // Description: Returns the number of separate attributes indicated
  31. // in the state.
  32. ////////////////////////////////////////////////////////////////////
  33. INLINE int RenderState::
  34. get_num_attribs() const {
  35. return _attributes.size();
  36. }
  37. ////////////////////////////////////////////////////////////////////
  38. // Function: RenderState::get_attrib
  39. // Access: Published
  40. // Description: Returns the nth attribute in the state.
  41. ////////////////////////////////////////////////////////////////////
  42. INLINE const RenderAttrib *RenderState::
  43. get_attrib(int n) const {
  44. nassertr(n >= 0 && n < (int)_attributes.size(), NULL);
  45. return _attributes[n]._attrib;
  46. }
  47. ////////////////////////////////////////////////////////////////////
  48. // Function: RenderState::get_override
  49. // Access: Published
  50. // Description: Returns the override associated with the nth
  51. // attribute in the state.
  52. ////////////////////////////////////////////////////////////////////
  53. INLINE int RenderState::
  54. get_override(int n) const {
  55. nassertr(n >= 0 && n < (int)_attributes.size(), 0);
  56. return _attributes[n]._override;
  57. }
  58. ////////////////////////////////////////////////////////////////////
  59. // Function: RenderState::has_cull_callback
  60. // Access: Published
  61. // Description: Returns true if any of the RenderAttribs in this
  62. // state request a cull_callback(), false if none of
  63. // them do.
  64. ////////////////////////////////////////////////////////////////////
  65. INLINE bool RenderState::
  66. has_cull_callback() const {
  67. if ((_flags & F_checked_cull_callback) == 0) {
  68. // We pretend this function is const, even though it transparently
  69. // modifies the internal shader cache.
  70. ((RenderState *)this)->determine_cull_callback();
  71. }
  72. return (_flags & F_has_cull_callback) != 0;
  73. }
  74. ////////////////////////////////////////////////////////////////////
  75. // Function: RenderState::cache_ref
  76. // Access: Published
  77. // Description: Overrides this method to update PStats appropriately.
  78. ////////////////////////////////////////////////////////////////////
  79. INLINE void RenderState::
  80. cache_ref() const {
  81. #ifdef DO_PSTATS
  82. int old_referenced_bits = get_referenced_bits();
  83. NodeCachedReferenceCount::cache_ref();
  84. consider_update_pstats(old_referenced_bits);
  85. #else // DO_PSTATS
  86. NodeCachedReferenceCount::cache_ref();
  87. #endif // DO_PSTATS
  88. }
  89. ////////////////////////////////////////////////////////////////////
  90. // Function: RenderState::cache_unref
  91. // Access: Published
  92. // Description: Overrides this method to update PStats appropriately.
  93. ////////////////////////////////////////////////////////////////////
  94. INLINE bool RenderState::
  95. cache_unref() const {
  96. #ifdef DO_PSTATS
  97. int old_referenced_bits = get_referenced_bits();
  98. bool result = NodeCachedReferenceCount::cache_unref();
  99. consider_update_pstats(old_referenced_bits);
  100. return result;
  101. #else // DO_PSTATS
  102. return NodeCachedReferenceCount::cache_unref();
  103. #endif // DO_PSTATS
  104. }
  105. ////////////////////////////////////////////////////////////////////
  106. // Function: RenderState::node_ref
  107. // Access: Published
  108. // Description: Overrides this method to update PStats appropriately.
  109. ////////////////////////////////////////////////////////////////////
  110. INLINE void RenderState::
  111. node_ref() const {
  112. #ifdef DO_PSTATS
  113. int old_referenced_bits = get_referenced_bits();
  114. NodeCachedReferenceCount::node_ref();
  115. consider_update_pstats(old_referenced_bits);
  116. #else // DO_PSTATS
  117. NodeCachedReferenceCount::node_ref();
  118. #endif // DO_PSTATS
  119. }
  120. ////////////////////////////////////////////////////////////////////
  121. // Function: RenderState::node_unref
  122. // Access: Published
  123. // Description: Overrides this method to update PStats appropriately.
  124. ////////////////////////////////////////////////////////////////////
  125. INLINE bool RenderState::
  126. node_unref() const {
  127. #ifdef DO_PSTATS
  128. int old_referenced_bits = get_referenced_bits();
  129. bool result = NodeCachedReferenceCount::node_unref();
  130. consider_update_pstats(old_referenced_bits);
  131. return result;
  132. #else // DO_PSTATS
  133. return NodeCachedReferenceCount::node_unref();
  134. #endif // DO_PSTATS
  135. }
  136. ////////////////////////////////////////////////////////////////////
  137. // Function: RenderState::get_draw_order
  138. // Access: Published
  139. // Description: Returns the draw order indicated by the
  140. // CullBinAttrib, if any, associated by this state (or 0
  141. // if there is no CullBinAttrib). See get_bin_index().
  142. ////////////////////////////////////////////////////////////////////
  143. INLINE int RenderState::
  144. get_draw_order() const {
  145. if ((_flags & F_checked_bin_index) == 0) {
  146. // We pretend this function is const, even though it transparently
  147. // modifies the internal draw_order cache.
  148. ((RenderState *)this)->determine_bin_index();
  149. }
  150. return _draw_order;
  151. }
  152. ////////////////////////////////////////////////////////////////////
  153. // Function: RenderState::get_fog
  154. // Access: Published
  155. // Description: This function is provided as an optimization, to
  156. // speed up the render-time checking for the existance
  157. // of a FogAttrib on this state. It returns a
  158. // pointer to the FogAttrib, if there is one, or
  159. // NULL if there is not.
  160. ////////////////////////////////////////////////////////////////////
  161. INLINE const FogAttrib *RenderState::
  162. get_fog() const {
  163. if ((_flags & F_checked_fog) == 0) {
  164. // We pretend this function is const, even though it transparently
  165. // modifies the internal fog cache.
  166. ((RenderState *)this)->determine_fog();
  167. }
  168. return _fog;
  169. }
  170. ////////////////////////////////////////////////////////////////////
  171. // Function: RenderState::get_bin
  172. // Access: Published
  173. // Description: This function is provided as an optimization, to
  174. // speed up the render-time checking for the existance
  175. // of a BinAttrib on this state. It returns a
  176. // pointer to the BinAttrib, if there is one, or
  177. // NULL if there is not.
  178. ////////////////////////////////////////////////////////////////////
  179. INLINE const CullBinAttrib *RenderState::
  180. get_bin() const {
  181. if ((_flags & F_checked_bin) == 0) {
  182. // We pretend this function is const, even though it transparently
  183. // modifies the internal bin cache.
  184. ((RenderState *)this)->determine_bin();
  185. }
  186. return _bin;
  187. }
  188. ////////////////////////////////////////////////////////////////////
  189. // Function: RenderState::get_transparency
  190. // Access: Published
  191. // Description: This function is provided as an optimization, to
  192. // speed up the render-time checking for the existance
  193. // of a TransparencyAttrib on this state. It returns a
  194. // pointer to the TransparencyAttrib, if there is one,
  195. // or NULL if there is not.
  196. ////////////////////////////////////////////////////////////////////
  197. INLINE const TransparencyAttrib *RenderState::
  198. get_transparency() const {
  199. if ((_flags & F_checked_transparency) == 0) {
  200. // We pretend this function is const, even though it transparently
  201. // modifies the internal transparency cache.
  202. ((RenderState *)this)->determine_transparency();
  203. }
  204. return _transparency;
  205. }
  206. ////////////////////////////////////////////////////////////////////
  207. // Function: RenderState::get_bin_index
  208. // Access: Published
  209. // Description: Returns the bin index indicated by the CullBinAttrib,
  210. // if any, associated by this state (or the default bin
  211. // index if there is no CullBinAttrib). This function
  212. // is provided as an optimization for determining this
  213. // at render time.
  214. ////////////////////////////////////////////////////////////////////
  215. INLINE int RenderState::
  216. get_bin_index() const {
  217. if ((_flags & F_checked_bin_index) == 0) {
  218. // We pretend this function is const, even though it transparently
  219. // modifies the internal bin_index cache.
  220. ((RenderState *)this)->determine_bin_index();
  221. }
  222. return _bin_index;
  223. }
  224. ////////////////////////////////////////////////////////////////////
  225. // Function: RenderState::get_color
  226. // Access: Published
  227. // Description: This function is provided as an optimization, to
  228. // speed up the render-time checking for the existance
  229. // of a ColorAttrib on this state. It returns a
  230. // pointer to the ColorAttrib, if there is one, or
  231. // NULL if there is not.
  232. ////////////////////////////////////////////////////////////////////
  233. INLINE const ColorAttrib *RenderState::
  234. get_color() const {
  235. if ((_flags & F_checked_color) == 0) {
  236. // We pretend this function is const, even though it transparently
  237. // modifies the internal color cache.
  238. ((RenderState *)this)->determine_color();
  239. }
  240. return _color;
  241. }
  242. ////////////////////////////////////////////////////////////////////
  243. // Function: RenderState::get_color_scale
  244. // Access: Published
  245. // Description: This function is provided as an optimization, to
  246. // speed up the render-time checking for the existance
  247. // of a ColorScaleAttrib on this state. It returns a
  248. // pointer to the ColorScaleAttrib, if there is one, or
  249. // NULL if there is not.
  250. ////////////////////////////////////////////////////////////////////
  251. INLINE const ColorScaleAttrib *RenderState::
  252. get_color_scale() const {
  253. if ((_flags & F_checked_color_scale) == 0) {
  254. // We pretend this function is const, even though it transparently
  255. // modifies the internal color_scale cache.
  256. ((RenderState *)this)->determine_color_scale();
  257. }
  258. return _color_scale;
  259. }
  260. ////////////////////////////////////////////////////////////////////
  261. // Function: RenderState::get_texture
  262. // Access: Published
  263. // Description: This function is provided as an optimization, to
  264. // speed up the render-time checking for the existance
  265. // of a TextureAttrib on this state. It returns a
  266. // pointer to the TextureAttrib, if there is one, or
  267. // NULL if there is not.
  268. ////////////////////////////////////////////////////////////////////
  269. INLINE const TextureAttrib *RenderState::
  270. get_texture() const {
  271. if ((_flags & F_checked_texture) == 0) {
  272. // We pretend this function is const, even though it transparently
  273. // modifies the internal texture cache.
  274. ((RenderState *)this)->determine_texture();
  275. }
  276. return _texture;
  277. }
  278. ////////////////////////////////////////////////////////////////////
  279. // Function: RenderState::get_tex_gen
  280. // Access: Published
  281. // Description: This function is provided as an optimization, to
  282. // speed up the render-time checking for the existance
  283. // of a TexGenAttrib on this state. It returns a
  284. // pointer to the TexGenAttrib, if there is one, or
  285. // NULL if there is not.
  286. ////////////////////////////////////////////////////////////////////
  287. INLINE const TexGenAttrib *RenderState::
  288. get_tex_gen() const {
  289. if ((_flags & F_checked_tex_gen) == 0) {
  290. // We pretend this function is const, even though it transparently
  291. // modifies the internal tex_gen cache.
  292. ((RenderState *)this)->determine_tex_gen();
  293. }
  294. return _tex_gen;
  295. }
  296. ////////////////////////////////////////////////////////////////////
  297. // Function: RenderState::get_tex_matrix
  298. // Access: Published
  299. // Description: This function is provided as an optimization, to
  300. // speed up the render-time checking for the existance
  301. // of a TexMatrixAttrib on this state. It returns a
  302. // pointer to the TexMatrixAttrib, if there is one, or
  303. // NULL if there is not.
  304. ////////////////////////////////////////////////////////////////////
  305. INLINE const TexMatrixAttrib *RenderState::
  306. get_tex_matrix() const {
  307. if ((_flags & F_checked_tex_matrix) == 0) {
  308. // We pretend this function is const, even though it transparently
  309. // modifies the internal tex_matrix cache.
  310. ((RenderState *)this)->determine_tex_matrix();
  311. }
  312. return _tex_matrix;
  313. }
  314. ////////////////////////////////////////////////////////////////////
  315. // Function: RenderState::get_render_mode
  316. // Access: Published
  317. // Description: This function is provided as an optimization, to
  318. // speed up the render-time checking for the existance
  319. // of a RenderModeAttrib on this state. It returns a
  320. // pointer to the RenderModeAttrib, if there is one, or
  321. // NULL if there is not.
  322. ////////////////////////////////////////////////////////////////////
  323. INLINE const RenderModeAttrib *RenderState::
  324. get_render_mode() const {
  325. if ((_flags & F_checked_render_mode) == 0) {
  326. // We pretend this function is const, even though it transparently
  327. // modifies the internal render_mode cache.
  328. ((RenderState *)this)->determine_render_mode();
  329. }
  330. return _render_mode;
  331. }
  332. ////////////////////////////////////////////////////////////////////
  333. // Function: RenderState::get_clip_plane
  334. // Access: Published
  335. // Description: This function is provided as an optimization, to
  336. // speed up the render-time checking for the existance
  337. // of a ClipPlaneAttrib on this state. It returns a
  338. // pointer to the ClipPlaneAttrib, if there is one, or
  339. // NULL if there is not.
  340. ////////////////////////////////////////////////////////////////////
  341. INLINE const ClipPlaneAttrib *RenderState::
  342. get_clip_plane() const {
  343. if ((_flags & F_checked_clip_plane) == 0) {
  344. // We pretend this function is const, even though it transparently
  345. // modifies the internal clip_plane cache.
  346. ((RenderState *)this)->determine_clip_plane();
  347. }
  348. return _clip_plane;
  349. }
  350. ////////////////////////////////////////////////////////////////////
  351. // Function: RenderState::get_shader
  352. // Access: Published
  353. // Description: This function is provided as an optimization, to
  354. // speed up the render-time checking for the existance
  355. // of a ShaderAttrib on this state. It returns a
  356. // pointer to the ShaderAttrib, if there is one, or
  357. // NULL if there is not.
  358. ////////////////////////////////////////////////////////////////////
  359. INLINE const ShaderAttrib *RenderState::
  360. get_shader() const {
  361. if ((_flags & F_checked_shader) == 0) {
  362. // We pretend this function is const, even though it transparently
  363. // modifies the internal shader cache.
  364. ((RenderState *)this)->determine_shader();
  365. }
  366. return _shader;
  367. }
  368. ////////////////////////////////////////////////////////////////////
  369. // Function: RenderState::get_audio_volume
  370. // Access: Published
  371. // Description: This function is provided as an optimization, to
  372. // speed up the render-time checking for the existance
  373. // of an AudioVolumeAttrib on this state. It returns a
  374. // pointer to the AudioVolumeAttrib, if there is one, or
  375. // NULL if there is not.
  376. ////////////////////////////////////////////////////////////////////
  377. INLINE const AudioVolumeAttrib *RenderState::
  378. get_audio_volume() const {
  379. if ((_flags & F_checked_audio_volume) == 0) {
  380. // We pretend this function is const, even though it transparently
  381. // modifies the internal audio_volume cache.
  382. ((RenderState *)this)->determine_audio_volume();
  383. }
  384. return _audio_volume;
  385. }
  386. ////////////////////////////////////////////////////////////////////
  387. // Function: RenderState::determine_bin
  388. // Access: Private
  389. // Description: This is the private implementation of get_bin().
  390. ////////////////////////////////////////////////////////////////////
  391. INLINE void RenderState::
  392. determine_bin() {
  393. MutexHolder holder(_lock);
  394. do_determine_bin();
  395. }
  396. ////////////////////////////////////////////////////////////////////
  397. // Function: RenderState::determine_transparency
  398. // Access: Private
  399. // Description: This is the private implementation of get_transparency().
  400. ////////////////////////////////////////////////////////////////////
  401. INLINE void RenderState::
  402. determine_transparency() {
  403. MutexHolder holder(_lock);
  404. do_determine_transparency();
  405. }
  406. ////////////////////////////////////////////////////////////////////
  407. // Function: RenderState::set_destructing
  408. // Access: Private
  409. // Description: This function should only be called from the
  410. // destructor; it indicates that this RenderState
  411. // object is beginning destruction. It is only used as
  412. // a sanity check, and is only meaningful when NDEBUG is
  413. // not defined.
  414. ////////////////////////////////////////////////////////////////////
  415. INLINE void RenderState::
  416. set_destructing() {
  417. #ifndef NDEBUG
  418. _flags |= F_is_destructing;
  419. #endif
  420. }
  421. ////////////////////////////////////////////////////////////////////
  422. // Function: RenderState::is_destructing
  423. // Access: Private
  424. // Description: Returns true if the RenderState object is
  425. // currently within its destructor
  426. // (i.e. set_destructing() has been called). This is
  427. // only used as a sanity check, and is only meaningful
  428. // when NDEBUG is not defined.
  429. ////////////////////////////////////////////////////////////////////
  430. INLINE bool RenderState::
  431. is_destructing() const {
  432. #ifndef NDEBUG
  433. return (_flags & F_is_destructing) != 0;
  434. #else
  435. return false;
  436. #endif
  437. }
  438. ////////////////////////////////////////////////////////////////////
  439. // Function: RenderState::consider_update_pstats
  440. // Access: Private
  441. // Description: Calls update_pstats() if the state of the referenced
  442. // bits has changed from the indicated value.
  443. ////////////////////////////////////////////////////////////////////
  444. INLINE void RenderState::
  445. consider_update_pstats(int old_referenced_bits) const {
  446. #ifdef DO_PSTATS
  447. int new_referenced_bits = get_referenced_bits();
  448. if (old_referenced_bits != new_referenced_bits) {
  449. update_pstats(old_referenced_bits, new_referenced_bits);
  450. }
  451. #endif // DO_PSTATS
  452. }
  453. ////////////////////////////////////////////////////////////////////
  454. // Function: RenderState::Composition::Constructor
  455. // Access: Public
  456. // Description:
  457. ////////////////////////////////////////////////////////////////////
  458. INLINE RenderState::Composition::
  459. Composition() {
  460. }
  461. ////////////////////////////////////////////////////////////////////
  462. // Function: RenderState::Composition::Copy Constructor
  463. // Access: Public
  464. // Description:
  465. ////////////////////////////////////////////////////////////////////
  466. INLINE RenderState::Composition::
  467. Composition(const RenderState::Composition &copy) :
  468. _result(copy._result)
  469. {
  470. }
  471. ////////////////////////////////////////////////////////////////////
  472. // Function: RenderState::Attribute::Constructor
  473. // Access: Public
  474. // Description:
  475. ////////////////////////////////////////////////////////////////////
  476. INLINE RenderState::Attribute::
  477. Attribute(const RenderAttrib *attrib, int override) :
  478. _type(attrib->get_type()),
  479. _attrib(attrib),
  480. _override(override)
  481. {
  482. }
  483. ////////////////////////////////////////////////////////////////////
  484. // Function: RenderState::Attribute::Constructor
  485. // Access: Public
  486. // Description: This constructor is only used when reading the
  487. // RenderState from a bam file. At this point, the
  488. // attribute pointer is unknown.
  489. ////////////////////////////////////////////////////////////////////
  490. INLINE RenderState::Attribute::
  491. Attribute(int override) :
  492. _override(override)
  493. {
  494. }
  495. ////////////////////////////////////////////////////////////////////
  496. // Function: RenderState::Attribute::Constructor
  497. // Access: Public
  498. // Description: This constructor makes an invalid Attribute with no
  499. // RenderAttrib pointer; its purpose is just to make an
  500. // object we can use to look up a particular type in the
  501. // Attribute set.
  502. ////////////////////////////////////////////////////////////////////
  503. INLINE RenderState::Attribute::
  504. Attribute(TypeHandle type) :
  505. _type(type),
  506. _attrib(NULL),
  507. _override(0)
  508. {
  509. }
  510. ////////////////////////////////////////////////////////////////////
  511. // Function: RenderState::Attribute::Copy Constructor
  512. // Access: Public
  513. // Description:
  514. ////////////////////////////////////////////////////////////////////
  515. INLINE RenderState::Attribute::
  516. Attribute(const Attribute &copy) :
  517. _type(copy._type),
  518. _attrib(copy._attrib),
  519. _override(copy._override)
  520. {
  521. }
  522. ////////////////////////////////////////////////////////////////////
  523. // Function: RenderState::Attribute::Copy Assignment Operator
  524. // Access: Public
  525. // Description:
  526. ////////////////////////////////////////////////////////////////////
  527. INLINE void RenderState::Attribute::
  528. operator = (const Attribute &copy) {
  529. _type = copy._type;
  530. _attrib = copy._attrib;
  531. _override = copy._override;
  532. }
  533. ////////////////////////////////////////////////////////////////////
  534. // Function: RenderState::Attribute::operator <
  535. // Access: Public
  536. // Description: This is used by the Attributes set to uniquify
  537. // RenderAttributes by type. Only one RenderAttrib of a
  538. // given type is allowed in the set. This ordering must
  539. // also match the ordering reported by compare_to().
  540. ////////////////////////////////////////////////////////////////////
  541. INLINE bool RenderState::Attribute::
  542. operator < (const Attribute &other) const {
  543. return _type < other._type;
  544. }
  545. ////////////////////////////////////////////////////////////////////
  546. // Function: RenderState::Attribute::compare_to
  547. // Access: Public
  548. // Description: Provides an indication of whether a particular
  549. // attribute is equivalent to another one, for purposes
  550. // of generating unique RenderStates. This should
  551. // compare all properties of the Attribute, but it is
  552. // important that the type is compared first, to be
  553. // consistent with the ordering defined by operator <.
  554. ////////////////////////////////////////////////////////////////////
  555. INLINE int RenderState::Attribute::
  556. compare_to(const Attribute &other) const {
  557. if (_type != other._type) {
  558. return _type.get_index() - other._type.get_index();
  559. }
  560. if (_attrib != other._attrib) {
  561. return _attrib < other._attrib ? -1 : 1;
  562. }
  563. return _override - other._override;
  564. }
  565. ////////////////////////////////////////////////////////////////////
  566. // Function: RenderState::get_shader_expansion
  567. // Access: Public
  568. // Description:
  569. ////////////////////////////////////////////////////////////////////
  570. INLINE ShaderExpansion *RenderState::
  571. get_shader_expansion() const {
  572. return _shader_expansion;
  573. }
  574. ////////////////////////////////////////////////////////////////////
  575. // Function: RenderState::set_shader_expansion
  576. // Access: Public
  577. // Description:
  578. ////////////////////////////////////////////////////////////////////
  579. INLINE void RenderState::
  580. set_shader_expansion(ShaderExpansion *exp) {
  581. _shader_expansion = exp;
  582. }
  583. ////////////////////////////////////////////////////////////////////
  584. // Function: RenderState::flush_level
  585. // Access: Public, Static
  586. // Description: Flushes the PStatCollectors used during traversal.
  587. ////////////////////////////////////////////////////////////////////
  588. INLINE void RenderState::
  589. flush_level() {
  590. _node_counter.flush_level();
  591. _cache_counter.flush_level();
  592. }
  593. ////////////////////////////////////////////////////////////////////
  594. // Function: RenderState::CompositionCycleDescEntry::Constructor
  595. // Access: Public
  596. // Description:
  597. ////////////////////////////////////////////////////////////////////
  598. INLINE RenderState::CompositionCycleDescEntry::
  599. CompositionCycleDescEntry(const RenderState *obj,
  600. const RenderState *result,
  601. bool inverted) :
  602. _obj(obj),
  603. _result(result),
  604. _inverted(inverted)
  605. {
  606. }