Results 1 to 8 of 8

Thread: Placing objects in a collection.

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    Netherlands
    Posts
    12

    Question Placing objects in a collection.

    I'm programming a game now. I designed a small engine to make the programming of the game some faster.

    I make a class, if I want to render a bird, I place the mesh into the object of that class. That object goes into a collection.

    Another function renders the collections. But not all the objects have to be rendered all the time, because they are out the sight for example.

    What is faster?

    1. Placing all the objects that have to be rendered in another collection so the renderfunction renders the whole collection. I have to transfer objects from one collection to another often then.


    Code:
    Sub transfer()
    for i = 1 to collection1.count
    if calculatevisible(collection1.item(i)) then collection2.add collection1.item(i)
    next i
    End sub
    
    Sub Render()
    for j = 1 to collection2.count
    collection2.item(j).render
    next j
    End sub
    calculatevisible calculates that the object is in sight or not.


    2. Or just adding a parameter to the objects so the renderer can see when it has to be rendered:
    Code:
    for i = 1 to collection.count
    If collection.item(i).visible then collection.item(i).render
    Next i
    Last edited by Douchekop; Jan 2nd, 2003 at 10:03 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width