🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

int-float with arrays

Started by
2 comments, last by lxnyce 19 years, 7 months ago
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;
	}
}


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.
Advertisement
you cant do "RGBA = (float)i;" ?
...isn't it

float(i)


in AS?
Dan Royer, OwnerMarginally Clever Games
Ahhh, that explains it. I usually cast as (float)i, but doing it as float(i) worked. Thanks alot.

This topic is closed to new replies.

Advertisement