Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

int-float with arrays


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   -  Reputation: 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.

Sponsor:

#2 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 04 November 2004 - 06:05 PM

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

#3 Aggrav8d   Members   -  Reputation: 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   -  Reputation: 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.



PARTNERS