Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by 7th_zorro. 04/20/24 07:29
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, henrybane, flink, Edgar_Herrera), 758 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SUB]float16 to var #474628
10/26/18 13:54
10/26/18 13:54
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I recently needed to retrieve a pixel from a 16 bits floating point formatted render target.

Code:
var var_from_float16short(short _s) {
	int _sign = _s & 32768;
	int _exp = ((int)(_s & 31744) >> 10) - 15;
	int _frac = _s & 1023;
	var _r;
	memcpy(&_r, &_frac, 4);
	_r += 1;
	if(_exp)
		_r *= pow(2, _exp);
	if (_sign)
		_r = -_r;
	return _r;
}



Salud!

Re: [SUB]float16 to var [Re: txesmi] #475469
12/12/18 12:28
12/12/18 12:28
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Thanks for sharing!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1