Gamestudio Links
Zorro Links
Newest Posts
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/21/19 14:59
Alarm whenever logged out from Broker
by chsmac85. 08/21/19 14:36
What are you working on?
by 3run. 08/21/19 13:28
file_write var array ?
by laz. 08/20/19 17:18
Updating Assets<Brokername
>.csv

by Sabre. 08/20/19 15:40
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
8 registered members (RealSerious3D, 3run, AndrewAMD, Southqvist, kankan, 3 invisible), 640 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
GorgonzolaBYTE, Southqvist, tawin, Raedwulf, Sabre
18270 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,237
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,237
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,844
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,844
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