Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Lens flare

Author
Message
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 18th Dec 2003 14:52 Edited at: 8th Jan 2004 06:38
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**

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
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

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
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

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Jan 2004 01:05
Couldn't get it to work..."Unable to close nest at line 85" This is somewhere near

DIM lens(9) AS lensflare

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 8th Jan 2004 06: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

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Jan 2004 11:07
Thanks, I'll try it later...looking forward to it!

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php

Login to post a reply

Server time is: 2024-11-24 00:03:40
Your offset time is: 2024-11-24 00:03:40