scene.cpp 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WW3D *
  23. * *
  24. * $Archive:: /VSS_Sync/ww3d2/scene.cpp $*
  25. * *
  26. * Author:: Greg_h *
  27. * *
  28. * $Modtime:: 8/29/01 7:29p $*
  29. * *
  30. * $Revision:: 22 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * SceneClass::SceneClass -- constructor *
  35. * SceneClass::~SceneClass -- destructor *
  36. * SceneClass::Render -- preps the scene for rendering, derived classes should override *
  37. * SceneClass::Add_Render_Object -- base add function *
  38. * SceneClass::Remove_Render_Object -- base remove function *
  39. * SceneClass::Set_Depth_Cue -- set the depth cue values *
  40. * SceneClass::Set_Fog_Range -- set the fog range *
  41. * SceneClass::Get_Fog_Range -- get the fog range *
  42. * SceneClass::Render -- preps the scene for rendering, derived classes should add functional*
  43. * SimpleSceneClass -- Constructor *
  44. * SimpleSceneClass::~SimpleSceneClass -- destructor *
  45. * SimpleSceneClass::Add_Render_Object -- add a render object to the scene *
  46. * SimpleSceneClass::Remove_Render_Object -- remove a render object from this scene *
  47. * SimpleSceneClass::Visiblity_Check -- set the visiblity status of the render objects *
  48. * SimpleSceneClass::Render -- internal scene rendering function *
  49. * SimpleSceneClass::Render -- Render this scene *
  50. * SimpleSceneClass::Create_Iterator -- create an iterator for this scene *
  51. * SimpleSceneClass::Destroy_Iterator -- destroy an iterater of this scene *
  52. * SceneClass::Save -- saves scene settings into a chunk *
  53. * SceneClass::Load -- loads scene settings from a chunk *
  54. * SimpleSceneClass::Compute_Point_Visibility -- returns visibility of a point *
  55. * SimpleSceneClass::Remove_All_Render_Objects -- Removes all render objects from the scene *
  56. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  57. #include "scene.h"
  58. #include "plane.h"
  59. #include "camera.h"
  60. #include "ww3d.h"
  61. #include "rinfo.h"
  62. #include "chunkio.h"
  63. #include "dx8renderer.h"
  64. #include "dx8wrapper.h"
  65. #include "sortingrenderer.h"
  66. #include "coltest.h"
  67. /*
  68. ** Chunk ID's used by SceneClass
  69. */
  70. enum
  71. {
  72. SCENECLASS_CHUNK_VARIABLES = 0x00042300,
  73. SCENECLASS_VARIABLE_AMBIENTLIGHT = 0x00,
  74. SCENECLASS_VARIABLE_POLYRENDERMODE,
  75. SCENECLASS_VARIABLE_FOGCOLOR,
  76. SCENECLASS_VARIABLE_FOGENABLED,
  77. SCENECLASS_VARIABLE_FOGSTART,
  78. SCENECLASS_VARIABLE_FOGEND,
  79. };
  80. /*
  81. ** SimpleSceneIterator
  82. ** This iterator is used by the SimpleSceneClass to allow
  83. ** the user to iterate through its render objects.
  84. */
  85. class SimpleSceneIterator : public SceneIterator
  86. {
  87. public:
  88. virtual void First(void);
  89. virtual void Next(void);
  90. virtual bool Is_Done(void);
  91. virtual RenderObjClass * Current_Item(void);
  92. protected:
  93. SimpleSceneIterator(RefRenderObjListClass * renderlist,bool onlyvis);
  94. RefRenderObjListIterator RobjIterator;
  95. SimpleSceneClass * Scene;
  96. bool OnlyVis;
  97. friend class SimpleSceneClass;
  98. };
  99. /***********************************************************************************************
  100. * SceneClass::SceneClass -- constructor *
  101. * *
  102. * INPUT: *
  103. * *
  104. * OUTPUT: *
  105. * *
  106. * WARNINGS: *
  107. * *
  108. * HISTORY: *
  109. * 12/10/98 GTH : Created. *
  110. *=============================================================================================*/
  111. SceneClass::SceneClass(void) :
  112. AmbientLight(0.5f,0.5f,0.5f),
  113. PolyRenderMode(FILL),
  114. ExtraPassPolyRenderMode(EXTRA_PASS_DISABLE),
  115. FogEnabled(false),
  116. FogColor(0,0,0),
  117. FogStart(0.0f),
  118. FogEnd(1000.0f) // Arbitrary default value
  119. {
  120. }
  121. /***********************************************************************************************
  122. * SceneClass::~SceneClass -- destructor *
  123. * *
  124. * INPUT: *
  125. * *
  126. * OUTPUT: *
  127. * *
  128. * WARNINGS: *
  129. * *
  130. * HISTORY: *
  131. * 12/10/98 GTH : Created. *
  132. *=============================================================================================*/
  133. SceneClass::~SceneClass(void)
  134. {
  135. }
  136. /***********************************************************************************************
  137. * SceneClass::Add_Render_Object -- base add function *
  138. * *
  139. * This function only sets the render object's scene pointer and calls the notify method. *
  140. * Derived classes must add the functionality of actually storing a pointer to the object *
  141. * and doing something with it :) *
  142. * *
  143. * INPUT: *
  144. * obj - pointer to the object to add *
  145. * *
  146. * OUTPUT: *
  147. * *
  148. * WARNINGS: *
  149. * *
  150. * HISTORY: *
  151. * 2/25/99 GTH : Created. *
  152. *=============================================================================================*/
  153. void SceneClass::Add_Render_Object(RenderObjClass * obj)
  154. {
  155. obj->Notify_Added(this);
  156. }
  157. /***********************************************************************************************
  158. * SceneClass::Remove_Render_Object -- base remove function *
  159. * *
  160. * Similar to the add function; concrete derived classes must override and actually remove *
  161. * the object... *
  162. * *
  163. * INPUT: *
  164. * obj - pointer to the object to remove *
  165. * *
  166. * OUTPUT: *
  167. * *
  168. * WARNINGS: *
  169. * *
  170. * HISTORY: *
  171. * 2/25/99 GTH : Created. *
  172. *=============================================================================================*/
  173. void SceneClass::Remove_Render_Object(RenderObjClass * obj)
  174. {
  175. obj->Notify_Removed(this);
  176. }
  177. /***********************************************************************************************
  178. * SceneClass::Render -- preps the scene for rendering, derived classes should add functionalit*
  179. * *
  180. * INPUT: *
  181. * *
  182. * OUTPUT: *
  183. * *
  184. * WARNINGS: *
  185. * *
  186. * HISTORY: *
  187. * 12/10/98 GTH : Created. *
  188. *=============================================================================================*/
  189. void SceneClass::Render(RenderInfoClass & rinfo)
  190. {
  191. DX8Wrapper::Set_Fog(FogEnabled, FogColor, FogStart, FogEnd);
  192. if (Get_Extra_Pass_Polygon_Mode()==EXTRA_PASS_DISABLE) {
  193. Customized_Render(rinfo);
  194. }
  195. else {
  196. bool old_enable=WW3D::Is_Texturing_Enabled();
  197. DX8Wrapper::Set_DX8_Render_State (D3DRS_ZBIAS, 0);
  198. Customized_Render(rinfo);
  199. switch (Get_Extra_Pass_Polygon_Mode()) {
  200. case EXTRA_PASS_LINE:
  201. WW3D::Enable_Texturing(false);
  202. DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
  203. DX8Wrapper::Set_DX8_Render_State (D3DRS_ZBIAS, 7);
  204. Customized_Render(rinfo);
  205. break;
  206. case EXTRA_PASS_CLEAR_LINE:
  207. DX8Wrapper::Clear(true, false, Vector3(0.0f,0.0f,0.0f)); // Clear color but not z
  208. WW3D::Enable_Texturing(false);
  209. DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
  210. DX8Wrapper::Set_DX8_Render_State (D3DRS_ZBIAS, 7);
  211. Customized_Render(rinfo);
  212. break;
  213. }
  214. WW3D::Enable_Texturing(old_enable);
  215. }
  216. }
  217. /***********************************************************************************************
  218. * SceneClass::Save -- saves scene settings into a chunk *
  219. * *
  220. * INPUT: *
  221. * *
  222. * OUTPUT: *
  223. * *
  224. * WARNINGS: *
  225. * *
  226. * HISTORY: *
  227. *=============================================================================================*/
  228. void SceneClass::Save(ChunkSaveClass & csave)
  229. {
  230. csave.Begin_Chunk(SCENECLASS_CHUNK_VARIABLES);
  231. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_AMBIENTLIGHT,AmbientLight);
  232. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_POLYRENDERMODE,PolyRenderMode);
  233. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_FOGCOLOR,FogColor);
  234. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_FOGENABLED,FogEnabled);
  235. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_FOGSTART,FogStart);
  236. WRITE_MICRO_CHUNK(csave,SCENECLASS_VARIABLE_FOGEND,FogEnd);
  237. csave.End_Chunk();
  238. }
  239. /***********************************************************************************************
  240. * SceneClass::Load -- loads scene settings from a chunk *
  241. * *
  242. * INPUT: *
  243. * *
  244. * OUTPUT: *
  245. * *
  246. * WARNINGS: *
  247. * *
  248. * HISTORY: *
  249. *=============================================================================================*/
  250. void SceneClass::Load(ChunkLoadClass & cload)
  251. {
  252. cload.Open_Chunk();
  253. if (cload.Cur_Chunk_ID() == SCENECLASS_CHUNK_VARIABLES) {
  254. while (cload.Open_Micro_Chunk()) {
  255. switch(cload.Cur_Micro_Chunk_ID()) {
  256. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_AMBIENTLIGHT,AmbientLight);
  257. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_POLYRENDERMODE,PolyRenderMode);
  258. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_FOGCOLOR,FogColor);
  259. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_FOGENABLED,FogEnabled);
  260. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_FOGSTART,FogStart);
  261. READ_MICRO_CHUNK(cload,SCENECLASS_VARIABLE_FOGEND,FogEnd);
  262. }
  263. cload.Close_Micro_Chunk();
  264. }
  265. } else {
  266. WWDEBUG_SAY(("Unhandled Chunk: 0x%X in file: %s line: %d\r\n",cload.Cur_Chunk_ID(),__FILE__,__LINE__));
  267. }
  268. cload.Close_Chunk();
  269. }
  270. /***********************************************************************************************
  271. * SimpleSceneClass -- Constructor *
  272. * *
  273. * INPUT: *
  274. * *
  275. * OUTPUT: *
  276. * *
  277. * WARNINGS: *
  278. * *
  279. * HISTORY: *
  280. * 3/24/98 GTH : Created. *
  281. * 9/10/99 GTH : Created. *
  282. *=============================================================================================*/
  283. SimpleSceneClass::SimpleSceneClass(void) :
  284. Visibility_Checked(false)
  285. {
  286. }
  287. /***********************************************************************************************
  288. * SimpleSceneClass::~SimpleSceneClass -- destructor *
  289. * *
  290. * INPUT: *
  291. * *
  292. * OUTPUT: *
  293. * *
  294. * WARNINGS: *
  295. * *
  296. * HISTORY: *
  297. * 3/24/98 GTH : Created. *
  298. *=============================================================================================*/
  299. SimpleSceneClass::~SimpleSceneClass(void)
  300. {
  301. Remove_All_Render_Objects();
  302. }
  303. /***********************************************************************************************
  304. * SimpleSceneClass::Remove_All_Render_Objects -- Removes all render objects from the scene *
  305. * *
  306. * *
  307. * *
  308. * *
  309. * INPUT: *
  310. * *
  311. * OUTPUT: *
  312. * *
  313. * WARNINGS: *
  314. * *
  315. * HISTORY: *
  316. * 8/27/2001 hy : Created. *
  317. *=============================================================================================*/
  318. void SimpleSceneClass::Remove_All_Render_Objects(void)
  319. {
  320. RenderObjClass * obj;
  321. while ( ( obj = RenderList.Remove_Head() ) != NULL ) {
  322. SceneClass::Remove_Render_Object(obj);
  323. obj->Release_Ref(); // remove head gets a ref
  324. }
  325. }
  326. /***********************************************************************************************
  327. * SimpleSceneClass::Add_Render_Object -- add a render object to the scene *
  328. * *
  329. * INPUT: *
  330. * *
  331. * OUTPUT: *
  332. * *
  333. * WARNINGS: *
  334. * *
  335. * HISTORY: *
  336. * 3/24/98 GTH : Created. *
  337. *=============================================================================================*/
  338. void SimpleSceneClass::Add_Render_Object(RenderObjClass * obj)
  339. {
  340. SceneClass::Add_Render_Object(obj);
  341. RenderList.Add(obj);
  342. }
  343. /***********************************************************************************************
  344. * SimpleSceneClass::Remove_Render_Object -- remove a render object from this scene *
  345. * *
  346. * INPUT: *
  347. * *
  348. * OUTPUT: *
  349. * *
  350. * WARNINGS: *
  351. * *
  352. * HISTORY: *
  353. * 3/24/98 GTH : Created. *
  354. *=============================================================================================*/
  355. void SimpleSceneClass::Remove_Render_Object(RenderObjClass * obj)
  356. {
  357. SceneClass::Remove_Render_Object(obj);
  358. // HY
  359. // this line must come last because otherwise it might cause
  360. // a premature release ref and cause a crash
  361. RenderList.Remove(obj);
  362. }
  363. void SimpleSceneClass::Register(RenderObjClass * obj,RegType for_what)
  364. {
  365. switch (for_what) {
  366. case ON_FRAME_UPDATE:
  367. UpdateList.Add(obj);
  368. break;
  369. case LIGHT:
  370. LightList.Add(obj);
  371. break;
  372. case RELEASE:
  373. ReleaseList.Add(obj);
  374. break;
  375. };
  376. }
  377. void SimpleSceneClass::Unregister(RenderObjClass * obj,RegType for_what)
  378. {
  379. switch (for_what) {
  380. case ON_FRAME_UPDATE:
  381. UpdateList.Remove(obj);
  382. break;
  383. case LIGHT:
  384. LightList.Remove(obj);
  385. break;
  386. case RELEASE:
  387. ReleaseList.Remove(obj);
  388. break;
  389. }
  390. }
  391. /***********************************************************************************************
  392. * SimpleSceneClass::Visiblity_Check -- set the visiblity status of the render objects *
  393. * *
  394. * INPUT: *
  395. * *
  396. * OUTPUT: *
  397. * *
  398. * WARNINGS: *
  399. * *
  400. * HISTORY: *
  401. * 3/24/98 GTH : Created. *
  402. * 4/13/98 NH : Added non-trivial checking (sphere vs. frustum). *
  403. *=============================================================================================*/
  404. void SimpleSceneClass::Visibility_Check(CameraClass * camera)
  405. {
  406. RefRenderObjListIterator it(&RenderList);
  407. // Loop over all top-level RenderObjects in this scene. If the bounding sphere is not in front
  408. // of all the frustum planes, it is invisible.
  409. for (it.First(); !it.Is_Done(); it.Next()) {
  410. RenderObjClass * robj = it.Peek_Obj();
  411. if (robj->Is_Force_Visible()) {
  412. robj->Set_Visible(true);
  413. } else {
  414. robj->Set_Visible(!camera->Cull_Sphere(robj->Get_Bounding_Sphere()));
  415. }
  416. // Prepare visible objects for LOD:
  417. if (robj->Is_Really_Visible()) {
  418. robj->Prepare_LOD(*camera);
  419. }
  420. }
  421. Visibility_Checked = true;
  422. }
  423. /***********************************************************************************************
  424. * SimpleSceneClass::Compute_Point_Visibility -- returns visibility of a point *
  425. * *
  426. * This function is used by the default dazzle behavior. SimpleSceneClass's implementation *
  427. * casts a ray against every object in the scene to see if the dazzle is occluded. *
  428. * *
  429. * INPUT: *
  430. * *
  431. * OUTPUT: *
  432. * *
  433. * WARNINGS: *
  434. * *
  435. * HISTORY: *
  436. * 6/13/2001 gth : Created. *
  437. *=============================================================================================*/
  438. float SimpleSceneClass::Compute_Point_Visibility
  439. (
  440. RenderInfoClass & rinfo,
  441. const Vector3 & point
  442. )
  443. {
  444. CastResultStruct res;
  445. LineSegClass ray(rinfo.Camera.Get_Position(),point);
  446. RayCollisionTestClass raytest(ray,&res,COLLISION_TYPE_PROJECTILE);
  447. RefRenderObjListIterator it(&RenderList);
  448. for (it.First(); !it.Is_Done(); it.Next()) {
  449. RenderObjClass * robj = it.Peek_Obj();
  450. robj->Cast_Ray(raytest);
  451. }
  452. if (res.Fraction == 1.0f) {
  453. return 1.0f;
  454. } else {
  455. return 0.0f;
  456. }
  457. }
  458. /***********************************************************************************************
  459. * SimpleSceneClass::Render -- Render this scene *
  460. * *
  461. * passes the gerd and camera to all render objects for rendering... *
  462. * *
  463. * INPUT: *
  464. * *
  465. * OUTPUT: *
  466. * *
  467. * WARNINGS: *
  468. * *
  469. * HISTORY: *
  470. * 12/10/98 GTH : Created. *
  471. *=============================================================================================*/
  472. void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo)
  473. {
  474. // SceneClass::Render(rinfo);
  475. // If visibility has not been checked for this scene since the last
  476. // Render() call, check it (set/clear the visibility bit in all render
  477. // objects in the scene).
  478. if (!Visibility_Checked) {
  479. // set the visibility bit in all render objects in all layers.
  480. Visibility_Check(&rinfo.Camera);
  481. }
  482. Visibility_Checked = false;
  483. RefRenderObjListIterator it(&UpdateList);
  484. // allow all objects in the update list to do their "every frame" processing
  485. for (it.First(); !it.Is_Done(); it.Next()) {
  486. it.Peek_Obj()->On_Frame_Update();
  487. }
  488. // apply only the first four lights in the scene
  489. // derived classes should use light environment
  490. WWASSERT(rinfo.light_environment==NULL);
  491. int count=0;
  492. // Turn off lights in case we have none
  493. DX8Wrapper::Set_Light(0,NULL);
  494. DX8Wrapper::Set_Light(1,NULL);
  495. DX8Wrapper::Set_Light(2,NULL);
  496. DX8Wrapper::Set_Light(3,NULL);
  497. for (it.First(&LightList); !it.Is_Done(); it.Next())
  498. {
  499. if (count<4)
  500. {
  501. DX8Wrapper::Set_Light(count,*(LightClass*)it.Peek_Obj());
  502. } else
  503. {
  504. // Simple scene only supports 4 global lights
  505. WWDEBUG_SAY(("Light %d ignored\n",count));
  506. }
  507. count++;
  508. }
  509. // loop through all render objects in the list:
  510. for (it.First(&RenderList); !it.Is_Done(); it.Next()) {
  511. // get the render object
  512. RenderObjClass * robj = it.Peek_Obj();
  513. if (robj->Is_Really_Visible()) {
  514. robj->Render(rinfo);
  515. }
  516. }
  517. }
  518. void SimpleSceneClass::Post_Render_Processing(RenderInfoClass& rinfo)
  519. {
  520. // process the 'Release' list. These are objects that have notified us that they
  521. // want to be released. We have to walk this list twice, first un-linking the
  522. // object from the scene or its container. And then removing them all from
  523. // the list. (this last removal will destroy any auto-created objects)
  524. RefRenderObjListIterator it(&ReleaseList);
  525. for (it.First(&ReleaseList); !it.Is_Done(); it.Next()) {
  526. RenderObjClass * robj = it.Peek_Obj();
  527. if (robj->Get_Container()) {
  528. robj->Get_Container()->Remove_Sub_Object(robj);
  529. } else {
  530. robj->Remove();
  531. }
  532. }
  533. while(!ReleaseList.Is_Empty()) {
  534. ReleaseList.Release_Head();
  535. }
  536. }
  537. /***********************************************************************************************
  538. * SimpleSceneClass::Create_Iterator -- create an iterator for this scene *
  539. * *
  540. * INPUT: *
  541. * *
  542. * OUTPUT: *
  543. * *
  544. * WARNINGS: *
  545. * *
  546. * HISTORY: *
  547. * 3/27/98 GTH : Created. *
  548. *=============================================================================================*/
  549. SceneIterator * SimpleSceneClass::Create_Iterator(bool onlyvisible)
  550. {
  551. SimpleSceneIterator * it = W3DNEW SimpleSceneIterator(&RenderList,onlyvisible);
  552. return it;
  553. }
  554. /***********************************************************************************************
  555. * SimpleSceneClass::Destroy_Iterator -- destroy an iterater of this scene *
  556. * *
  557. * INPUT: *
  558. * *
  559. * OUTPUT: *
  560. * *
  561. * WARNINGS: *
  562. * *
  563. * HISTORY: *
  564. * 3/27/98 GTH : Created. *
  565. *=============================================================================================*/
  566. void SimpleSceneClass::Destroy_Iterator(SceneIterator * it)
  567. {
  568. delete it;
  569. }
  570. SimpleSceneIterator::SimpleSceneIterator(RefRenderObjListClass * list,bool onlyvis) :
  571. RobjIterator(list)
  572. {
  573. // TODO: make SimpleSceneIterator able to iterate through only the visible nodes.
  574. OnlyVis = onlyvis;
  575. }
  576. void SimpleSceneIterator::First(void)
  577. {
  578. RobjIterator.First();
  579. }
  580. void SimpleSceneIterator::Next(void)
  581. {
  582. RobjIterator.Next();
  583. }
  584. bool SimpleSceneIterator::Is_Done(void)
  585. {
  586. return RobjIterator.Is_Done();
  587. }
  588. RenderObjClass * SimpleSceneIterator::Current_Item(void)
  589. {
  590. return RobjIterator.Peek_Obj();
  591. }