![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| rawimage * | AllocateImage (char *) |
| void | DeallocateImage (rawimage *) |
| color | ImageMap (rawimage *, flt, flt) |
| void | LoadImage (rawimage *) |
| void | ResetImage (void) |
| void | ResetImages (void) |
| rawimage* AllocateImage | ( | char * | ) |
Definition at line 140 of file imap.cpp.
References rawimage::bpp, rawimage::data, rawimage::loaded, rawimage::name, numimages, rt_getmem(), rtbomb(), rawimage::xres, and rawimage::yres.
Referenced by apitextotex().
{
rawimage * newimage = NULL;
int i, len, intable;
intable=0;
if (numimages!=0) {
for (i=0; i<numimages; i++) {
if (!strcmp(filename, imagelist[i]->name)) {
newimage=imagelist[i];
intable=1;
}
}
}
if (!intable) {
newimage=(rawimage *)rt_getmem(sizeof(rawimage));
newimage->loaded=0;
newimage->xres=0;
newimage->yres=0;
newimage->bpp=0;
newimage->data=NULL;
len=strlen(filename);
if (len > 80) rtbomb("Filename too long in image map!!");
strcpy(newimage->name, filename);
imagelist[numimages]=newimage; /* add new one to the table */
numimages++; /* increment the number of images */
}
return newimage;
}
| void DeallocateImage | ( | rawimage * | ) |
Definition at line 172 of file imap.cpp.
References rawimage::data, rawimage::loaded, and rt_freemem().
{
image->loaded=0;
rt_freemem(image->data);
}
Definition at line 88 of file imap.cpp.
References color::b, rawimage::data, color::g, rawimage::loaded, LoadImage(), color::r, rawimage::xres, and rawimage::yres.
Referenced by image_cyl_texture(), image_plane_texture(), and image_sphere_texture().
{
color col, colx, colx2;
flt x,y, px, py;
int x1, x2, y1, y2;
unsigned char * ptr;
unsigned char * ptr2;
if (!image->loaded) {
LoadImage(image);
image->loaded=1;
}
if ((u <= 1.0) && (u >=0.0) && (v <= 1.0) && (v >= 0.0)) {
x=(image->xres - 1.0) * u; /* floating point X location */
y=(image->yres - 1.0) * v; /* floating point Y location */
px = x - ((int) x);
py = y - ((int) y);
x1 = (int) x;
x2 = x1 + 1;
y1 = (int) y;
y2 = y1 + 1;
ptr = image->data + ((image->xres * y1) + x1) * 3;
ptr2 = image->data + ((image->xres * y1) + x2) * 3;
colx.r = (flt) ((flt)ptr[0] + px*((flt)ptr2[0] - (flt) ptr[0])) / 255.0;
colx.g = (flt) ((flt)ptr[1] + px*((flt)ptr2[1] - (flt) ptr[1])) / 255.0;
colx.b = (flt) ((flt)ptr[2] + px*((flt)ptr2[2] - (flt) ptr[2])) / 255.0;
ptr = image->data + ((image->xres * y2) + x1) * 3;
ptr2 = image->data + ((image->xres * y2) + x2) * 3;
colx2.r = ((flt)ptr[0] + px*((flt)ptr2[0] - (flt)ptr[0])) / 255.0;
colx2.g = ((flt)ptr[1] + px*((flt)ptr2[1] - (flt)ptr[1])) / 255.0;
colx2.b = ((flt)ptr[2] + px*((flt)ptr2[2] - (flt)ptr[2])) / 255.0;
col.r = colx.r + py*(colx2.r - colx.r);
col.g = colx.g + py*(colx2.g - colx.g);
col.b = colx.b + py*(colx2.b - colx.b);
}
else {
col.r=0.0;
col.g=0.0;
col.b=0.0;
}
return col;
}
| void LoadImage | ( | rawimage * | ) |
Definition at line 81 of file imap.cpp.
References rawimage::loaded, and readimage().
Referenced by ImageMap().
{
if (!image->loaded) {
readimage(image);
image->loaded=1;
}
}
| void ResetImage | ( | void | ) |
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.