r4172 - in trunk/data: particles qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Aug 24 11:30:57 EDT 2008


Author: div0
Date: 2008-08-24 11:30:57 -0400 (Sun, 24 Aug 2008)
New Revision: 4172

Added:
   trunk/data/particles/hookbeam.tga
Modified:
   trunk/data/qcsrc/client/hook.qc
Log:
new hook graphics


Added: trunk/data/particles/hookbeam.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/particles/hookbeam.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/qcsrc/client/hook.qc
===================================================================
--- trunk/data/qcsrc/client/hook.qc	2008-08-24 15:11:32 UTC (rev 4171)
+++ trunk/data/qcsrc/client/hook.qc	2008-08-24 15:30:57 UTC (rev 4172)
@@ -28,7 +28,7 @@
 	p.HookEnd = end;
 }
 
-void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, vector view_forward)
+void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, vector view_forward, string texture, float aspect, vector rgb)
 {
 	// I want to draw a quad...
 	// from and to are MIDPOINTS.
@@ -37,7 +37,7 @@
 	float length_tex;
 
 	axis = normalize(to - from);
-	length_tex = vlen(to - from) / thickness;
+	length_tex = aspect * vlen(to - from) / thickness;
 
 	// direction is perpendicular to the view normal, and perpendicular to the axis
 	thickdir = normalize(cross(axis, org - from));
@@ -48,13 +48,13 @@
 	D = to - thickdir * (thickness / 2);
 
 	if(checkextension("DP_SV_WRITEPICTURE"))
-		R_BeginPolygon("particles/hookbeam", 0);
+		R_BeginPolygon(texture, 0);
 	else
 		R_BeginPolygon("", 0);
-	R_PolygonVertex(A, '0 0 0', '.5 1 0', 1);
-	R_PolygonVertex(B, '1 0 0', '.5 1 0', 1);
-	R_PolygonVertex(C, '1 0 0' + length_tex * '0 1 0', '.5 1 0', 1);
-	R_PolygonVertex(D, '0 0 0' + length_tex * '0 1 0', '.5 1 0', 1);
+	R_PolygonVertex(A, '0 0 0', rgb, 1);
+	R_PolygonVertex(B, '0 1 0', rgb, 1);
+	R_PolygonVertex(C, '0 1 0' + length_tex * '1 0 0', rgb, 1);
+	R_PolygonVertex(D, '0 0 0' + length_tex * '1 0 0', rgb, 1);
 	R_EndPolygon();
 }
 
@@ -79,6 +79,6 @@
 		else
 			a = e.HookStart;
 		b = e.HookEnd;
-		Draw_GrapplingHookLine(a, b, 8, o, v_forward);
+		Draw_GrapplingHookLine(b, a, 8, o, v_forward, "particles/hookbeam", 0.5, '1 1 1');
 	}
 }




More information about the nexuiz-commits mailing list