MCPcopy Create free account
hub / github.com/JACoders/OpenJK / DrawSegment

Method DrawSegment

code/cgame/FxPrimitives.cpp:2105–2180  ·  view source on GitHub ↗

----------------------------

Source from the content-addressed store, hash-verified

2103
2104//----------------------------
2105void CBezier::DrawSegment( vec3_t start, vec3_t end, float texcoord1, float texcoord2 )
2106{
2107 vec3_t lineDir, cross, viewDir;
2108 static vec3_t lastEnd[2];
2109 polyVert_t verts[4];
2110 float scale;
2111
2112 VectorSubtract( end, start, lineDir );
2113 VectorSubtract( end, cg.refdef.vieworg, viewDir );
2114 CrossProduct( lineDir, viewDir, cross );
2115 VectorNormalize( cross );
2116
2117 scale = mRefEnt.radius * 0.5f;
2118
2119 //Construct the oriented quad
2120 if ( mInit )
2121 {
2122 VectorCopy( lastEnd[0], verts[0].xyz );
2123 VectorCopy( lastEnd[1], verts[1].xyz );
2124 }
2125 else
2126 {
2127 VectorMA( start, -scale, cross, verts[0].xyz );
2128 VectorMA( start, scale, cross, verts[1].xyz );
2129 }
2130
2131 verts[0].st[0] = 0.0f;
2132 verts[0].st[1] = texcoord1;
2133
2134 verts[0].modulate[0] = mRefEnt.shaderRGBA[0] * ( 1.0f - texcoord1 );
2135 verts[0].modulate[1] = mRefEnt.shaderRGBA[1] * ( 1.0f - texcoord1 );
2136 verts[0].modulate[2] = mRefEnt.shaderRGBA[2] * ( 1.0f - texcoord1 );
2137 verts[0].modulate[3] = mRefEnt.shaderRGBA[3];
2138
2139 verts[1].st[0] = 1.0f;
2140 verts[1].st[1] = texcoord1;
2141 verts[1].modulate[0] = mRefEnt.shaderRGBA[0] * ( 1.0f - texcoord1 );
2142 verts[1].modulate[1] = mRefEnt.shaderRGBA[1] * ( 1.0f - texcoord1 );
2143 verts[1].modulate[2] = mRefEnt.shaderRGBA[2] * ( 1.0f - texcoord1 );
2144 verts[1].modulate[3] = mRefEnt.shaderRGBA[3];
2145
2146 if ( texcoord1 == 0.0f )
2147 {
2148 verts[0].modulate[0] = 0;
2149 verts[0].modulate[1] = 0;
2150 verts[0].modulate[2] = 0;
2151 verts[0].modulate[3] = 0;
2152 verts[1].modulate[0] = 0;
2153 verts[1].modulate[1] = 0;
2154 verts[1].modulate[2] = 0;
2155 verts[1].modulate[3] = 0;
2156 }
2157
2158 VectorMA( end, scale, cross, verts[2].xyz );
2159 verts[2].st[0] = 1.0f;
2160 verts[2].st[1] = texcoord2;
2161 verts[2].modulate[0] = mRefEnt.shaderRGBA[0] * ( 1.0f - texcoord2 );
2162 verts[2].modulate[1] = mRefEnt.shaderRGBA[1] * ( 1.0f - texcoord2 );

Callers

nothing calls this directly

Calls 6

VectorSubtractFunction · 0.85
CrossProductFunction · 0.85
VectorNormalizeFunction · 0.85
VectorCopyFunction · 0.85
cgi_R_AddPolyToSceneFunction · 0.70
VectorMAFunction · 0.50

Tested by

no test coverage detected