Ooops
October 19, 2021, 01:07:27

Author Topic: Is this allowed? For Next Loop  (Read 492 times)

Offline JBR

  • Full Member
  • ***
  • Posts: 143
Is this allowed? For Next Loop
« on: July 21, 2021, 00:45:57 »
Code: [Select]
For part% = 0 To Part_Max-1

        Local word% = Part_Alive%( part/32 )

        If word = 0 Then part = part + 32 : Goto nnext_particle

                .nnext_particle
                Next


Basically a bit for each particle. If the 32 bits (integer) are all 0 then can I add 32 to the loop counter and jump to Next? It seems to work but not sure if 'legal'?

Saves me checking 32 bits individually when the whole 32 bits are zero.

Thanks, Jim.



Offline STEVIE G

  • Hero Member
  • *****
  • Posts: 621
Re: Is this allowed? For Next Loop
« Reply #1 on: July 21, 2021, 07:35:35 »
It'll work but its a bit of a hack. Always avoid goto myself. 

Can you explain  more about how this particle system works as I'm sure there will be better alternatives?

Offline Pakz

  • Full Member
  • ***
  • Posts: 220
    • My homepage
Re: Is this allowed? For Next Loop
« Reply #2 on: July 21, 2021, 08:34:31 »
If you wish to jump to the next cycle in a loop you can use the Continue command.

edit: I checked. It seems blitz3d does not have this Continue command. So the goto is the thing to use :)

What I also did was to create a If check and a variable set to true or false on the code below if that needs or does not need to be exectuted. But I think goto's are faster anyway.
« Last Edit: July 21, 2021, 09:07:38 by Pakz »

Offline JBR

  • Full Member
  • ***
  • Posts: 143
Re: Is this allowed? For Next Loop
« Reply #3 on: July 21, 2021, 23:32:07 »
It'll work but its a bit of a hack. Always avoid goto myself. 

Can you explain  more about how this particle system works as I'm sure there will be better alternatives?

Hi Stevie I have space for 64K particles and 8 surfaces of 8192 quads.

I think I was over stressing the Graphics Card or communication to Graphics Card.

I've changes to 64K particles and 2 surfaces of 8192. i.e. most drawn is 16K.

I've done a dot product check and find I can get a good reduction (a third) by checking for >= 0.6 rather than >0.0

>=0.6 is good enough to get visible particles visible!

I'm using Krischans code to make the particle quad facing forwards always. I don't fully understand it but it works.

I feel I've got a good system atm. But any advice is appreciated.

Jim



 

SimplePortal 2.3.6 © 2008-2014, SimplePortal