View previous topic :: View next topic |
Author |
Message |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
|
Back to top |
|
 |
reckless
Joined: 24 Jan 2008 Posts: 390 Location: inside tha debugger
|
Posted: Mon Feb 16, 2009 3:41 am Post subject: |
|
|
if i remember correctly it could be done by modifying the hardcoded dot sizes
Code: |
//this part ->
byte dottexture[8][8] =
{
{0,1,1,0,0,0,0,0},
{1,1,1,1,0,0,0,0},
{1,1,1,1,0,0,0,0},
{0,1,1,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
};
//end
void R_InitParticleTexture (void)
{
int x,y;
byte data[8][8][4];
//
// particle texture
//
particletexture = texture_extension_number++;
GL_Bind(particletexture);
//and here
for (x=0 ; x<8 ; x++)
{
for (y=0 ; y<8 ; y++)
{
data[y][x][0] = 255;
data[y][x][1] = 255;
data[y][x][2] = 255;
data[y][x][3] = dottexture[x][y]*255;
}
}
//end
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
particletexture_blood = EasyTgaLoad("textures/particles/blood.tga");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
particletexture_dirblood = EasyTgaLoad("textures/particles/blood2.tga");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
} |
|
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Mon Feb 16, 2009 8:33 am Post subject: |
|
|
looks like the particle texture is unchanged in that screenshot -- it's just that they all have like .5 alpha or something.
so just replace the glColor3f (x, y, z) with a glColor4f (x, y, z, 0.5) |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
Posted: Mon Feb 16, 2009 11:14 am Post subject: |
|
|
Those are considered fancy, really?? _________________ Unit reporting!
http://www.bendarling.net/ |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Mon Feb 16, 2009 1:56 pm Post subject: |
|
|
Electro wrote: | Those are considered fancy, really?? |
...eh fancy enough
anyways thanks, ill see what i can break :O _________________ bah |
|
Back to top |
|
 |
MDave

Joined: 17 Dec 2007 Posts: 75
|
Posted: Mon Feb 16, 2009 3:22 pm Post subject: |
|
|
It would be nice to make them fade over the course of its lifetime, like in quake 2.  |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Mon Feb 16, 2009 5:17 pm Post subject: |
|
|
That's straightforward enough, just deduct some multiple of frametime from alpha during each update (each particle should of course have it's own alpha stored in the particle_t struct to enable this). _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Mon Feb 16, 2009 5:45 pm Post subject: |
|
|
metlslime wrote: |
so just replace the glColor3f (x, y, z) with a glColor4f (x, y, z, 0.5) |
i cant find this part  _________________ bah |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Mon Feb 16, 2009 11:15 pm Post subject: |
|
|
oh, i guess the line is actually:
Code: | glColor3ubv ((byte *)&d_8to24table[(int)p->color]); |
It takes a pointer to an array of bytes, so it might be easier to replace it with:
Code: |
glColor4ub((byte *)&d_8to24table[(int)p->color],
(byte *)&d_8to24table[(int)p->color] + 1,
(byte *)&d_8to24table[(int)p->color] + 2,
128);
|
replace the 128 with whatever alpha value you want, from 0-255 |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Mon Feb 16, 2009 11:41 pm Post subject: |
|
|
metlslime wrote: | oh, i guess the line is actually:
Code: | glColor3ubv ((byte *)&d_8to24table[(int)p->color]); |
It takes a pointer to an array of bytes, so it might be easier to replace it with:
Code: |
glColor4ub((byte *)&d_8to24table[(int)p->color],
(byte *)&d_8to24table[(int)p->color] + 1,
(byte *)&d_8to24table[(int)p->color] + 2,
128);
|
replace the 128 with whatever alpha value you want, from 0-255 |
cool it worked
but the particles have lost their colouring, and i got 9 warnings
--------------------Configuration: winquake - Win32 GL Release--------------------
Compiling...
r_part.c
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(676) : warning C4047: 'function' : 'unsigned char ' differs in levels of indirection from 'unsigned char *'
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(676) : warning C4024: 'glColor4ub' : different types for formal and actual parameter 1
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(677) : warning C4047: 'function' : 'unsigned char ' differs in levels of indirection from 'unsigned char *'
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(677) : warning C4024: 'glColor4ub' : different types for formal and actual parameter 2
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(678) : warning C4047: 'function' : 'unsigned char ' differs in levels of indirection from 'unsigned char *'
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(678) : warning C4024: 'glColor4ub' : different types for formal and actual parameter 3
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(679) : warning C4761: integral size mismatch in argument; conversion supplied
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(679) : warning C4761: integral size mismatch in argument; conversion supplied
C:\Users\alex\Desktop\quake\src\proquake\r_part.c(679) : warning C4761: integral size mismatch in argument; conversion supplied
Linking...
glprotest.exe - 0 error(s), 9 warning(s)
im sorry if im being a bother because im still new to this, i mean, i just figured out how to make the particles square in reckless'es matrix he posted
ill still look into what i can atm
edit: ouch, i tried adding a "v" to "glColor4ub" and i crashed the engine _________________ bah |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Feb 17, 2009 1:13 am Post subject: |
|
|
Try this:
Top of R_DrawParticles, declare:
Instead of the glColor3ub, use:
Code: | pcolor = (byte *) &d_8to24table[(int) p->color];
glColor4ub (pcolor[0], pcolor[1], pcolor[2], 128); |
Breaks things up a little, and will be slower (but not that anyone would notice ), but it's easier to read/debug/etc for when you're starting out. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Tue Feb 17, 2009 2:02 am Post subject: |
|
|
oops... i didn't derefence that pointer... should be:
Code: | glColor4ub(*(byte *)&d_8to24table[(int)p->color],
*(byte *)&d_8to24table[(int)p->color] + 1,
*(byte *)&d_8to24table[(int)p->color] + 2,
128); |
but yeah, mh's code is less messy, maybe just use that instead. |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Tue Feb 17, 2009 2:07 am Post subject: |
|
|
thanks, didn't realize there is so many different ways to do different tasks...now i understand why engines take so long to update :O
hmm could i make a cvar for the transparency like :
Code: | pcolor = (byte *) &d_8to24table[(int) p->color];
glColor4ub (pcolor[0], pcolor[1], pcolor[2], parttrans.value); |
and then :
Code: |
cvar_t parttrans = {"parttrans", "150", true}; //partical transparancy value...save to conf. |
does that look right, and would i put it at the top of r_part.c?
should i make it gl_parttrans or r_parttrans...hmm GL or render
eh?
EDIT: Quote: | C:\Users\alex\Desktop\quake\src\proquake\r_part.c(680) : warning C4761: integral size mismatch in argument; conversion supplied |
DAMN YOU WARNING!!!!!!!!!!!!!!!!!!!![aka does not compute]
EDITEDIT: BUT IT WORKS!!!!!!! WAHAHAHAHAHAHAHAHAHAHAHAHAH ...... I DESERVE A SASH http://www.newgrounds.com/portal/viewer.php?id=474371&key=JuIvOhXzFtOzFxbStiMmY2ODYxNmYyQjMwODIrNl9xNWI1NDE7QjkwQlYxOzJWMzJiNDIwZjcrVnFfOTAxbTk5NTcwNzkxNg%3D%3D _________________ bah |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Tue Feb 17, 2009 1:42 pm Post subject: |
|
|
well, i tried that and still got the same warning [??]
perhaps i shouldn't fix something that's not broken [yet,it might break]. my next question would be how to make them effected by the lights in the map but, it sounds like it might be a lot of work for such a little effect.
so anyways, where should i look to make the particles lives longer, so they linger for a few more seconds? im guessing its still in r_part.c
........well i figured out how to make there lives shorter, now to reverse [heh]
.................got it, in r_part.c under R_DrawParticles Code: | frametime = cl.time - cl.oldtime;
time3 = frametime * 10;//15
time2 = frametime * 2.2; // 15//10; //i think i messed up the div. equally
time1 = frametime * 1.1;//5
grav = frametime * sv_gravity.value * 0.005; //ligers where it lives
dvel = 4*frametime; |
_________________ bah |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|