project-navigation
Personal tools

Author Topic: glowmaplink partially fixed !?  (Read 2231 times)

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
glowmaplink partially fixed !?
« on: December 08, 2010, 01:22:00 pm »
I was able to fix some of the troubles I had with 'glowmaplink', @ least it is usable now if there is only one glowmaplink animation per texture...

Take a look  :o

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Re: glowmaplink partially fixed !?
« Reply #1 on: December 08, 2010, 01:34:50 pm »
I had to change line 526 in r_material.c to start with frame 0 instead of starting the for-loop with frame 1 [for (i = 0; i < s->anim.num_frames; i++) {] otherwise the orginal texture would blink each time the loop repeats.
Code: [Select]
static int R_LoadAnimImages (materialStage_t *s)
{
char name[MAX_QPATH];
int i, j;

if (!s->image) {
Com_Printf("R_LoadAnimImages: Texture not defined in anim stage.\n");
return -1;
}

Q_strncpyz(name, s->image->name, sizeof(name));
j = strlen(name);

if (name[j - 1] != '0') {
Com_Printf("R_LoadAnimImages: Texture name does not end in 0: %s\n", name);
return -1;
}

/* the first image was already loaded by the stage parse, so just copy
* the pointer into the images array */

s->anim.images[0] = s->image;
name[j - 1] = 0;

/* now load the rest - HERE THE CHANGE HAPPENED: */
for (i = 0; i < s->anim.num_frames; i++) {
const char *c = va("%s%d", name, i);
image_t *image = R_FindImage(c, it_material);
s->anim.images[i] = image;
if (image == r_noTexture) {
Com_Printf("R_LoadAnimImages: Failed to resolve texture: %s\n", c);
return -1;
}
if (s->flags & STAGE_GLOWMAPLINK) {
if (image->glowmap)
Com_Printf("R_LoadAnimImages: overriding already existing glowmap for %s\n", image->name);
image->glowmap = image;
}
}

return 0;
}


In the material file the glowmaplink has to be first, then the original texture has to be blended over once again:

Code: [Select]
/* ufo2_10: K.I.T.T. (Best to be synchronized with ufo2_09) */
{
material tex_ufo/ufo2_10
bump 1.5
hardness 0.2
parallax 1.0
specular 1.5
/* fx Animation (green/yellow) */
{
glowmaplink
texture pt/fx/fx2_10_1a0
anim 14 19.0
blend GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
texture tex_ufo/ufo2_10
blend GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
lightmap
}
}

Unfortunately I still have problems to get more than one glowmaplink animation per texture to work...

Offline MCR

  • PHALANX veteran
  • ******
  • Posts: 1244
    • View Profile
Re: glowmaplink partially fixed !?
« Reply #2 on: December 09, 2010, 09:38:50 am »
As requested - here is the .diff