@@ -33,40 +33,47 @@ void CPortal::OnRender()
3333 {
3434 VERIFY (poly.size ());
3535 // draw rect
36- static xr_vector<FVF::L> V;
37- V.resize (poly.size () + 2 );
38- Fvector C = {0 , 0 , 0 };
39- for (u32 k = 0 ; k < poly.size (); k++)
40- {
41- C.add (poly[k]);
42- V[k + 1 ].set (poly[k], 0x800000FF );
43- }
44- V.back ().set (poly[0 ], 0x800000FF );
45- C.div ((float )poly.size ());
46- V[0 ].set (C, 0x800000FF );
36+ xr_vector<FVF::L> V; V.resize (poly.size ()*3 );
37+ Fvector vCenter = { 0 .0f , 0 .0f , 0 .0f };
38+ const u32 uPortalColor = 0x800000FF ;
39+ for (u32 k = 0 ; k < poly.size (); k++)
40+ {
41+ vCenter.add (poly[k]);
42+
43+ V[k*3 +1 ].set (poly[k], uPortalColor);
44+ if (k+1 == poly.size ())
45+ V[k*3 +2 ].set (poly[0 ], uPortalColor);
46+ else
47+ V[k*3 +2 ].set (poly[k+1 ], uPortalColor);
48+ }
49+ vCenter.div ((float )poly.size ());
50+
51+ for (u32 k = 0 ; k < poly.size (); k++)
52+ V[k*3 ].set (vCenter, uPortalColor);
4753
4854 RCache.set_xform_world (Fidentity);
4955 // draw solid
50- RCache.set_Shader (RImplementation.m_SelectionShader );
51- RCache.dbg_Draw (D3DPT_TRIANGLEFAN, &*V.begin (), V.size () - 2 );
56+ RCache.set_Shader (RImplementation.m_SelectionShader );
57+ RCache.dbg_Draw (D3DPT_TRIANGLELIST, &*V.begin (),V.size ()/ 3 );
5258
5359 // draw wire
60+ V.resize (poly.size ()+1 ); // skyloader: change vertex array for wire
61+ for (u32 k = 0 ; k < poly.size (); k++)
62+ V[k].set (poly[k], uPortalColor);
63+ V.back ().set (poly[0 ], uPortalColor);
64+
5465 if (bDebug)
5566 {
5667 RImplementation.rmNear ();
57- }
58- else
59- {
68+ } else {
6069 Device.SetNearer (TRUE );
6170 }
62- RCache.set_Shader (RImplementation.m_WireShader );
63- RCache.dbg_Draw (D3DPT_LINESTRIP, &*( V.begin () + 1 ), V.size () - 2 );
71+ RCache.set_Shader (RImplementation.m_WireShader );
72+ RCache.dbg_Draw (D3DPT_LINESTRIP,&* V.begin (), V.size ()- 1 );
6473 if (bDebug)
6574 {
6675 RImplementation.rmNormal ();
67- }
68- else
69- {
76+ } else {
7077 Device.SetNearer (FALSE );
7178 }
7279 }
0 commit comments