Gamestudio Links
Zorro Links
Newest Posts
No errors in the command line
by jcl. 05/06/26 06:48
Purchase A8 full licence version
by jcl. 05/05/26 11:20
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (Hartmann846, TipmyPip, 2 invisible), 5,361 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hartmann846, dangyc, ukgamer, valino, juergenwue
19212 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 | 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