Posted: 18th Dec 2003 14:52
Deck the halls with bells and holly
Tis the season to be jolly

etc. etc.

Well as its festive season I thought I would put together a snippet. I'm attaching a lens flare routine for DB Pro. For the newcomers and beginning coders I have also included extensive commentary on how it works and how you can modify the product. I'll also post it into the codebase.

I'd like to volunteer this as perhaps being the first ever snippet exclusively written and developed in RobK's wonderful Blue IDE.

Just two quibbles on it. First, you'll see that it doesn't use DB Pro's 3d maths commands. I'll post an updated version in the next few days that does. Secondly, it doesn't turn off if the Sun objkect is occluded. I'll post an update for this in a few days as well.

Merry Christmas to you all ... and I expect to see a lot more lens flares in your games!!

Philip

**EDIT: Please note that before you use the code attached in the source box you need to replace some functions in it with the replacement functions contained in my subsequent post below. Thank you**
Posted: 18th Dec 2003 15:50
Thats great mate....I'll test it when I get home. Always wanted some detailed help on how this worked and I've just got to the point in my first DBPro project where I wanted to do one of these.

Thanks
Posted: 18th Dec 2003 16:05
I've just spotted that the original DB Pro editor complains about my next free object number function. If anyone gets that problem use the attached instead. The attached replacement functions are not as efficient but they do work in the original editor.

Theres always something, isn't there?

Philip
Posted: 8th Jan 2004 1:05
Couldn't get it to work..."Unable to close nest at line 85" This is somewhere near

DIM lens(9) AS lensflare
Posted: 8th Jan 2004 6:37
That error is actually generated by the function call in the line reading:

lens(i).obj_number = get_free_object_number()

and is the problem which I posted replacement functions for above. What you haven't done and do need to do is copy the replacement get_free_object_number() etc. functions over the original functions as I said in my post above. If you do that, it'll work a-ok.

Incidentally I have now updated the codebase entry for this snippet with the correct functions. Therefore, its only this thread which still contains the bad functions.

Cheers

Philip
Posted: 8th Jan 2004 11:07
Thanks, I'll try it later...looking forward to it!