Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

int-float with arrays

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 lxnyce   Members   

122
Like
0Likes
Like

Posted 04 November 2004 - 03:15 PM

I am having trouble converting from int to float using arrays. The following works if I use an array of integers, but when using floats it doesn't work (as shown below). I tried casting it to a float but that didn't work as well? Anybody have an idea of what I am doing wrong? Is there a better way to do this?

float[] RGBA(100);
void RGBShader() {
	for (int i=0; i<100; i++) {
		RGBA[i] = i;
	}
}




The goal here is to pass a block of floating point pixel values and have the script manipulate it. I could use a two dimensional function, but the computation has to be fast. I will probably run some tests comaring the array method, function call method, and a standard C code method to see what the overhead performance is like. Just want to get the array method working. If not possible, no worries, i'll stick with the function calls.

#2 Rain Dog   Members   

136
Like
0Likes
Like

Posted 04 November 2004 - 06:05 PM

you cant do "RGBA[i] = (float)i;" ?

#3 Aggrav8d   Members   

133
Like
0Likes
Like

Posted 04 November 2004 - 06:51 PM

...isn't it

float(i)


in AS?

Dan Royer, OwnerMarginally Clever Games

#4 lxnyce   Members   

122
Like
0Likes
Like

Posted 05 November 2004 - 01:41 AM

Ahhh, that explains it. I usually cast as (float)i, but doing it as float(i) worked. Thanks alot.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.