Jump to content

Home

Saber trail...


ALIEN_JL

Recommended Posts

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);
		}

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...