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.

DarkBASIC Discussion / second camera for post-render: set of functions

Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 30th Oct 2012 18:42 Edited at: 30th Oct 2012 18:53

I have made ​​a set of functions to manipulate (fake) cameras, to create post-rendering. You can exclude objects rendering, disable rendering, resize rendering, it is very simple to use, the explanations are in the source code. I took the mirror effect for this demo, with 3 cameras.


DirectX 9.0c (February 2010)/ DBClassic v1.20
Fluffy Rabbit
User Banned
Posted: 31st Oct 2012 14:13

Any work on Latch's texture camera code is progress. I have not had the time to look at your code in detail (it sure is a lot!) but I assume that the potential is there to have a genuine reflective surface. What I mean is to have a plain that is textured to accurately represent a reflection of the camera's current view, so that one could have reflective water and mirrors without flipping the whole level. If you could pull that off, it would be beyond awesome.
Years of Service
User Offline
Joined: 23rd Jul 2006
Posted: 6th Nov 2012 04:25
Good stuff! On the computer I'm testing this on, your example runs at about 470 fps out of the box.

Enjoy your day.
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Feb 2013 19:43 Edited at: 11th Feb 2013 19:50
Yes, this runs really well for me too. Nice work!

I was looking at this code:

I use something similar for toggles too but I think it is a shame that we use such awkward code for such a common task. So I set out to find a compact way to do toggles without any conditions. After many more complex versions I arrived at a very simple equation:

toggle = keystate(x) * (toggle+1)

I have done some rudimentary testing and it performs around 3% slower than the longer method but this seems to improve with greater numbers of cycles (probably because there is only one variable being assigned).

Here is a usage example:

It acts by counting upwards while the key is held then resetting to zero on release, so you could use this for many applications including delayed key presses.

Example: the program will increase total toggles on key press, then if the key is held long enough it will start adding every cycle until release.

^ That's what she said.
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 14th Feb 2013 10:46
Quote: "toggle = keystate(x) * (toggle+1)"

My GOD is that ingenious!

"You're all wrong. You're all idiots." - Fluffy Rabbit
"Bottom line, people are retarded." - Fluffy Rabbit

Login to post a reply

Server time is: 2020-08-05 08:31:55
Your offset time is: 2020-08-05 08:31:55