Problem with List

Monkey Forums/Monkey Programming/Problem with List

Rone(Posted 2012) [#1]
Hallo,

I wonder if there is any common way of iterating through an list and inserting an new node at a specific position...without changing the List class?

First of all its very annoying that there's no way to retrieve the Head node, since HeadNode.GetNode returns null per default...so I changed it for testing, that it returns Self...

Strange thing is, that my code behave different when using List._head or List.FirstNode(). List._head seems to work, but List.FirstNode() chrashes although they returns the same reference..

Here's the sample code..convertion from miniB3D's 'RenderListAdd(mesh:TMesh,List:TList)'




AdamRedwoods(Posted 2012) [#2]
I wrote about Nodes and Node insertion in wikibooks (the quick answer is use the Node constructor):
http://en.wikibooks.org/wiki/Monkey/Language/Lists

As for miniB3D, the route I took is not to worry too much about mesh.order since you can sort the list according to order value when the user decides to order on their own using TEntity EntityOrder().

Plus, that ListEntityAdd() will go through the entire entity list. When you are doing large terrains and particles (2000+), this will start to eat time if you are adding/freeing multiple entities every frame. Better to Sort() a sublist after the camera does its frustum culling.


Side note: I've been working on a version of monkey+miniB3D that I hope to release end of this month. You can track my progress here:
http://monkeycoder.co.nz/Community/posts.php?topic=2212
I encourage others to take a crack at miniB3D as well, it's a great way to learn monkey.


Rone(Posted 2012) [#3]
Thank you very much!

Added a dummy mesh before List.FirstNode() and checked for null...Works now :)

Better to Sort() a sublist after the camera does its frustum culling.
Using it only for testing/ prototyping...didn't meditate on fast scene management on mobile platforms yet...

I encourage others to take a crack at miniB3D as well, it's a great way to learn monkey.
Its definitely a great source for beginners when learning openGl, but its an architectural disaster with chunky issues in its design...[ ..not the brilliant B3D top part ;)] people should better take a crack at Ogre or reading professional blogs for example...

Did you encapsulate the openGL stuff in your miniB3D version, in order to support xna, for example?


AdamRedwoods(Posted 2012) [#4]
Did you encapsulate the openGL stuff in your miniB3D version, in order to support xna, for example?


No, i'm trying not to deviate from minib3d too much to keep the simplicity.
I feel the community can add to it/modify it to their hearts pleasure once it's released, since I feel that's what most minib3d users do.