PDA

View Full Version : Saber trail...


ALIEN_JL
06-26-2002, 03:38 AM
http://alienjl.homestead.com/files/sabertrail.jpg

Do you know why in JK2 saber trail is usually that
type 1 ??

And if you do then do you know how to change
it to that type 2 ??

Tchouky
06-26-2002, 05:15 PM
here is the trail code .
I didn't really understand how it did work.
It's in the cg_addsaber function in the cgame .
Good luck !

{
float oldAlpha = 1.0f - ( diff / SABER_TRAIL_TIME );

// New muzzle
VectorCopy( rgb1, fx.mVerts[0].rgb );
fx.mVerts[0].alpha = 255.0f;

fx.mVerts[0].ST[0] = 0.0f;
fx.mVerts[0].ST[1] = 1.0f;
fx.mVerts[0].destST[0] = 1.0f;
fx.mVerts[0].destST[1] = 1.0f;

// new tip
VectorCopy( rgb1, fx.mVerts[1].rgb );
fx.mVerts[1].alpha = 255.0f;

fx.mVerts[1].ST[0] = 0.0f;
fx.mVerts[1].ST[1] = 0.0f;
fx.mVerts[1].destST[0] = 1.0f;
fx.mVerts[1].destST[1] = 0.0f;

// old tip
VectorCopy( rgb1, fx.mVerts[2].rgb );
fx.mVerts[2].alpha = 255.0f;

fx.mVerts[2].ST[0] = 1.0f - oldAlpha; // NOTE: this just happens to contain the value I want
fx.mVerts[2].ST[1] = 0.0f;
fx.mVerts[2].destST[0] = 1.0f + fx.mVerts[2].ST[0];
fx.mVerts[2].destST[1] = 0.0f;

// old muzzle
VectorCopy( rgb1, fx.mVerts[3].rgb );
fx.mVerts[3].alpha = 255.0f;

fx.mVerts[3].ST[0] = 1.0f - oldAlpha; // NOTE: this just happens to contain the value I want
fx.mVerts[3].ST[1] = 1.0f;
fx.mVerts[3].destST[0] = 1.0f + fx.mVerts[2].ST[0];
fx.mVerts[3].destST[1] = 1.0f;

fx.mShader = cgs.media.saberBlurShader;
fx.mSetFlags = FX_USE_ALPHA;
fx.mKillTime = SABER_TRAIL_TIME;


trap_FX_AddPrimitive(&fx);
}

ALIEN_JL
06-28-2002, 06:40 PM
It starts with this:

Go from new muzzle to new end...then to old end...back
down to old muzzle...finally connect back to the new
muzzle...this is our trail quad

And if i understand right that means that saber trail is
always quadrangle...

But that screenshot of mine prove otherwise:mad:

Does anyone have any idea how this works...