Eclipse SUMO - Simulation of Urban MObility
GUIBaseVehicleHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Functions used in GUIBaseVehicleHelper and GNEVehicle
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 #include <fx.h>
24 
29 #include "GLHelper.h"
30 #include "GUIBaseVehicleHelper.h"
31 
32 
33 // ===========================================================================
34 // data definitions
35 // ===========================================================================
36 /* -------------------------------------------------------------------------
37  * drawed shapes
38  * ----------------------------------------------------------------------- */
39 double vehiclePoly_PassengerCarBody[] = { .5, 0, 0, 0, 0, .3, 0.08, .44, 0.25, .5, 0.95, .5, 1., .4, 1., -.4, 0.95, -.5, 0.25, -.5, 0.08, -.44, 0, -.3, 0, 0, -10000 };
40 double vehiclePoly_PassengerCarBodyFront[] = { 0.1, 0, 0.025, 0, 0.025, 0.25, 0.27, 0.4, 0.27, -.4, 0.025, -0.25, 0.025, 0, -10000 };
41 double vehiclePoly_PassengerFrontGlass[] = { 0.35, 0, 0.3, 0, 0.3, 0.4, 0.43, 0.3, 0.43, -0.3, 0.3, -0.4, 0.3, 0, -10000 };
42 double vehiclePoly_PassengerSedanRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.77, -.47, 0.67, -.37, 0.45, -.37, 0.34, -.47, -10000 };
43 double vehiclePoly_PassengerSedanLeftGlass[] = { 0.36, .43, 0.34, .47, 0.77, .47, 0.67, .37, 0.45, .37, 0.34, .47, -10000 };
44 double vehiclePoly_PassengerSedanBackGlass[] = { 0.80, 0, 0.70, 0, 0.70, 0.3, 0.83, 0.4, 0.83, -.4, 0.70, -.3, 0.70, 0, -10000 };
45 double vehiclePoly_PassengerHatchbackRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.80, -.37, 0.45, -.37, 0.34, -.47, -10000 };
46 double vehiclePoly_PassengerHatchbackLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.80, .37, 0.45, .37, 0.34, .47, -10000 };
47 double vehiclePoly_PassengerHatchbackBackGlass[] = { 0.92, 0, 0.80, 0, 0.80, 0.3, 0.95, 0.4, 0.95, -.4, 0.80, -.3, 0.80, 0, -10000 };
48 double vehiclePoly_PassengerWagonRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.87, -.37, 0.45, -.37, 0.34, -.47, -10000 };
49 double vehiclePoly_PassengerWagonLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.87, .37, 0.45, .37, 0.34, .47, -10000 };
50 double vehiclePoly_PassengerWagonBackGlass[] = { 0.92, 0, 0.90, 0, 0.90, 0.3, 0.95, 0.4, 0.95, -.4, 0.90, -.3, 0.90, 0, -10000 };
51 
52 double vehiclePoly_PassengerVanBody[] = { .5, 0, 0, 0, 0, .4, 0.1, .5, 0.97, .5, 1., .47, 1., -.47, 0.97, -.5, 0.1, -.5, 0, -.4, 0, 0, -10000 };
53 double vehiclePoly_PassengerVanBodyFront[] = { 0.1, 0, 0.025, 0, 0.025, 0.25, 0.13, 0.4, 0.13, -.4, 0.025, -0.25, 0.025, 0, -10000 };
54 double vehiclePoly_PassengerVanFrontGlass[] = { 0.21, 0, 0.16, 0, 0.16, 0.4, 0.29, 0.3, 0.29, -0.3, 0.16, -0.4, 0.16, 0, -10000 };
55 double vehiclePoly_PassengerVanRightGlass[] = { 0.36, -.43, 0.20, -.47, 0.98, -.47, 0.91, -.37, 0.31, -.37, 0.20, -.47, -10000 };
56 double vehiclePoly_PassengerVanLeftGlass[] = { 0.36, .43, 0.20, .47, 0.98, .47, 0.91, .37, 0.31, .37, 0.20, .47, -10000 };
57 double vehiclePoly_PassengerVanBackGlass[] = { 0.95, 0, 0.94, 0, 0.94, 0.3, 0.98, 0.4, 0.98, -.4, 0.94, -.3, 0.94, 0, -10000 };
58 
59 double vehiclePoly_DeliveryMediumRightGlass[] = { 0.21, -.43, 0.20, -.47, 0.38, -.47, 0.38, -.37, 0.31, -.37, 0.20, -.47, -10000 };
60 double vehiclePoly_DeliveryMediumLeftGlass[] = { 0.21, .43, 0.20, .47, 0.38, .47, 0.38, .37, 0.31, .37, 0.20, .47, -10000 };
61 
62 double vehiclePoly_TransportBody[] = { .5, 0, 0, 0, 0, .45, 0.05, .5, 2.25, .5, 2.25, -.5, 0.05, -.5, 0, -.45, 0, 0, -10000 };
63 double vehiclePoly_TransportFrontGlass[] = { 0.1, 0, 0.05, 0, 0.05, 0.45, 0.25, 0.4, 0.25, -.4, 0.05, -0.45, 0.05, 0, -10000 };
64 double vehiclePoly_TransportRightGlass[] = { 0.36, -.47, 0.10, -.48, 1.25, -.48, 1.25, -.4, 0.3, -.4, 0.10, -.48, -10000 };
65 double vehiclePoly_TransportLeftGlass[] = { 0.36, .47, 0.10, .48, 1.25, .48, 1.25, .4, 0.3, .4, 0.10, .48, -10000 };
66 
67 double vehiclePoly_EVehicleBody[] = { .5, 0, 0, 0, 0, .3, 0.08, .44, 0.25, .5, 0.75, .5, .92, .44, 1, .3, 1, -.3, .92, -.44, .75, -.5, .25, -.5, 0.08, -.44, 0, -.3, 0, 0, -1000 };
68 double vehiclePoly_EVehicleFrontGlass[] = { .5, 0, 0.05, .05, 0.05, .25, 0.13, .39, 0.3, .45, 0.70, .45, .87, .39, .95, .25, .95, -.25, .87, -.39, .70, -.45, .3, -.45, 0.13, -.39, 0.05, -.25, 0.05, 0.05, -1000 };
69 //double vehiclePoly_EVehicleFrontGlass[] = { 0.35,0, 0.1,0, 0.1,0.4, 0.43,0.3, 0.43,-0.3, 0.1,-0.4, 0.1,0, -10000 };
70 double vehiclePoly_EVehicleBackGlass[] = { 0.65, 0, 0.9, 0, 0.9, 0.4, 0.57, 0.3, 0.57, -0.3, 0.9, -0.4, 0.9, 0, -10000 };
71 
72 double vehiclePoly_Ship[] = { 0.25, 0, 0, 0, 0.1, 0.25, 0.2, 0.45, 0.25, 0.5, 0.95, 0.5, 1.0, 0.45, 1.0, -0.45, 0.95, -0.5, 0.25, -0.5, 0.2, -0.45, 0.1, -0.25, 0, 0, -10000 };
73 double vehiclePoly_ShipDeck[] = { 0.5, 0, 0.25, 0.4, 0.95, 0.4, 0.95, -0.4, 0.25, -0.4, 0.25, 0.4, -10000 };
74 double vehiclePoly_ShipSuperStructure[] = { 0.8, 0, 0.5, 0.3, 0.85, 0.3, 0.85, -0.3, 0.5, -0.3, 0.5, 0.3, -10000 };
75 
76 double vehiclePoly_Cyclist[] = { 0.5, 0, 0.25, 0.45, 0.25, 0.5, 0.8, 0.15, 0.8, -0.15, 0.25, -0.5, 0.25, -0.45, -10000 };
77 
78 double vehiclePoly_EmergencySign[] = { .2, .5, -.2, .5, -.2, -.5, .2, -.5, -10000 };
79 double vehiclePoly_Emergency[] = { .1, .1, -.1, .1, -.1, -.1, .1, -.1, -10000 };
80 double vehiclePoly_Emergency2[] = { .04, .3, -.04, .3, -.04, -.3, .04, -.3, -10000 };
81 
82 double vehiclePoly_EmergencyLadder[] = { -.5, .3, .5, .3, .5, .2, -.5, .2, -10000 };
83 double vehiclePoly_EmergencyLadder2[] = { -.5, -.3, .5, -.3, .5, -.2, -.5, -.2, -10000 };
84 double vehiclePoly_EmergencyLadder3[] = { -.45, .3, -.4, .3, -.4, -.3, -.45, -.3, -10000 };
85 double vehiclePoly_EmergencyLadder4[] = { .45, .3, .4, .3, .4, -.3, .45, -.3, -10000 };
86 double vehiclePoly_EmergencyLadder5[] = { .05, .3, .0, .3, .0, -.3, .05, -.3, -10000 };
87 double vehiclePoly_EmergencyLadder6[] = { -.25, .3, -.2, .3, -.2, -.3, -.25, -.3, -10000 };
88 double vehiclePoly_EmergencyLadder7[] = { .25, .3, .2, .3, .2, -.3, .25, -.3, -10000 };
89 
90 double vehiclePoly_Rickshaw[] = { 0.5, 0, 0.25, 0.45, 0.25, 0.5, 0.8, 0.15, 0.8, -0.15, 0.25, -0.5, 0.25, -0.45, -10000 };
91 
92 // ===========================================================================
93 // method definitions
94 // ===========================================================================
95 
96 void
97 GUIBaseVehicleHelper::drawPoly(const double* poses, const double offset) {
98  glPushMatrix();
99  glTranslated(0, 0, offset * .1);
100  glPolygonOffset(0, (GLfloat) - offset);
101  glBegin(GL_TRIANGLE_FAN);
102  int i = 0;
103  while (poses[i] > -999) {
104  glVertex2d(poses[i], poses[i + 1]);
105  i = i + 2;
106  }
107  glEnd();
108  glPopMatrix();
109 }
110 
111 void
112 GUIBaseVehicleHelper::drawAction_drawVehicleAsBoxPlus(const double width, const double length) {
113  glPushMatrix();
114  glScaled(width, length, 1.);
115  glBegin(GL_TRIANGLE_STRIP);
116  glVertex2d(0., 0.);
117  glVertex2d(-.5, .15);
118  glVertex2d(.5, .15);
119  glVertex2d(-.5, 1.);
120  glVertex2d(.5, 1.);
121  glEnd();
122  glPopMatrix();
123 }
124 
125 
126 void
127 GUIBaseVehicleHelper::drawAction_drawVehicleAsTrianglePlus(const double width, const double length) {
128  if (length >= 8.) {
129  drawAction_drawVehicleAsBoxPlus(width, length);
130  return;
131  }
132  glPushMatrix();
133  glScaled(width, length, 1.);
134  glBegin(GL_TRIANGLES);
135  glVertex2d(0., 0.);
136  glVertex2d(-.5, 1.);
137  glVertex2d(.5, 1.);
138  glEnd();
139  glPopMatrix();
140 }
141 
142 
143 void
144 GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(const GUIVisualizationSettings& s, const SUMOVehicleShape shape, const double width, const double length,
145  int carriageIndex) {
146  UNUSED_PARAMETER(s);
147  RGBColor current = GLHelper::getColor();
148  RGBColor lighter = current.changedBrightness(51);
149  RGBColor darker = current.changedBrightness(-51);
150  glPushMatrix();
151  glRotated(90, 0, 0, 1);
152  glScaled(length, width, 1.);
153 
154  // draw main body
155  switch (shape) {
156  case SVS_UNKNOWN:
158  GLHelper::setColor(lighter);
160  glColor3d(0, 0, 0);
162  break;
163  case SVS_PEDESTRIAN:
164  glTranslated(0, 0, .045);
166  glTranslated(0, 0, -.045);
167  glScaled(.7, 2, 1);
168  glTranslated(0, 0, .04);
169  GLHelper::setColor(lighter);
171  glTranslated(0, 0, -.04);
172  break;
173  case SVS_BICYCLE:
174  case SVS_MOPED:
175  case SVS_MOTORCYCLE: {
176  RGBColor darker = current.changedBrightness(-50);
177  // body
179  // head
180  glPushMatrix();
181  glTranslated(0.4, 0, .5);
182  glScaled(0.1, 0.2, 1);
183  GLHelper::setColor(darker);
185  glPopMatrix();
186  // bike frame
188  glPushMatrix();
189  glTranslated(0.5, 0, .3);
190  glScaled(0.5, 0.05, 1);
192  glPopMatrix();
193  // handle bar
194  glPushMatrix();
195  glTranslated(0.25, 0, .3);
196  glScaled(0.02, 0.5, 1);
198  glPopMatrix();
199  }
200  break;
201  case SVS_PASSENGER:
202  case SVS_PASSENGER_SEDAN:
204  case SVS_PASSENGER_WAGON:
206  GLHelper::setColor(lighter);
208  glColor3d(0, 0, 0);
210  break;
211  case SVS_PASSENGER_VAN:
213  GLHelper::setColor(lighter);
215  glColor3d(0, 0, 0);
220  break;
221  case SVS_DELIVERY:
223  GLHelper::setColor(lighter);
225  glColor3d(0, 0, 0);
229  break;
230  case SVS_TRUCK:
232  case SVS_TRUCK_1TRAILER:
233  if (carriageIndex < 1) {
234  glScaled(1. / (length), 1, 1.);
236  glColor3d(0, 0, 0);
240  }
241  break;
242  case SVS_BUS:
243  case SVS_BUS_COACH:
244  case SVS_BUS_TROLLEY: {
245  double ml = length;
246  glScaled(1. / (length), 1, 1.);
247  glTranslated(0, 0, .04);
248  glBegin(GL_TRIANGLE_FAN);
249  glVertex2d(ml / 2., 0);
250  glVertex2d(0, 0);
251  glVertex2d(0, -.45);
252  glVertex2d(0 + .05, -.5);
253  glVertex2d(ml - .05, -.5);
254  glVertex2d(ml, -.45);
255  glVertex2d(ml, .45);
256  glVertex2d(ml - .05, .5);
257  glVertex2d(0 + .05, .5);
258  glVertex2d(0, .45);
259  glVertex2d(0, 0);
260  glEnd();
261  glTranslated(0, 0, -.04);
262 
263  glTranslated(0, 0, .045);
264  glColor3d(0, 0, 0);
265  glBegin(GL_QUADS);
266  glVertex2d(0 + .05, .48);
267  glVertex2d(0 + .05, -.48);
268  glVertex2d(0 + .15, -.48);
269  glVertex2d(0 + .15, .48);
270 
271  glVertex2d(ml - .1, .45);
272  glVertex2d(ml - .1, -.45);
273  glVertex2d(ml - .05, -.45);
274  glVertex2d(ml - .05, .45);
275 
276  glVertex2d(0 + .20, .49);
277  glVertex2d(0 + .20, .45);
278  glVertex2d(ml - .20, .45);
279  glVertex2d(ml - .20, .49);
280 
281  glVertex2d(0 + .20, -.49);
282  glVertex2d(0 + .20, -.45);
283  glVertex2d(ml - .20, -.45);
284  glVertex2d(ml - .20, -.49);
285 
286  glEnd();
287  glTranslated(0, 0, -.045);
288  }
289  break;
290  case SVS_BUS_FLEXIBLE:
291  case SVS_RAIL:
292  case SVS_RAIL_CAR:
293  case SVS_RAIL_CARGO:
294  case SVS_E_VEHICLE:
296  glColor3d(0, 0, 0);
298  glTranslated(0, 0, .048);
299  GLHelper::setColor(current);
300  glBegin(GL_QUADS);
301  glVertex2d(.3, .5);
302  glVertex2d(.35, .5);
303  glVertex2d(.35, -.5);
304  glVertex2d(.3, -.5);
305 
306  glVertex2d(.3, -.05);
307  glVertex2d(.7, -.05);
308  glVertex2d(.7, .05);
309  glVertex2d(.3, .05);
310 
311  glVertex2d(.7, .5);
312  glVertex2d(.65, .5);
313  glVertex2d(.65, -.5);
314  glVertex2d(.7, -.5);
315  glEnd();
316  glTranslated(0, 0, -.048);
317  //drawPoly(vehiclePoly_EVehicleBackGlass, 4.5);
318  break;
319  case SVS_ANT:
320  glPushMatrix();
321  // ant is stretched via vehicle length
322  GLHelper::setColor(darker);
323  // draw left side
324  GLHelper::drawBoxLine(Position(-0.2, -.10), 350, 0.5, .02);
325  GLHelper::drawBoxLine(Position(-0.3, -.50), 240, 0.4, .03);
326  GLHelper::drawBoxLine(Position(0.3, -.10), 340, 0.8, .03);
327  GLHelper::drawBoxLine(Position(0.05, -.80), 290, 0.6, .04);
328  GLHelper::drawBoxLine(Position(0.4, -.10), 20, 0.8, .03);
329  GLHelper::drawBoxLine(Position(0.65, -.80), 75, 0.6, .04);
330  GLHelper::drawBoxLine(Position(0.5, -.10), 55, 0.8, .04);
331  GLHelper::drawBoxLine(Position(1.1, -.55), 90, 0.6, .04);
332  // draw right side
333  GLHelper::drawBoxLine(Position(-0.2, .10), 190, 0.5, .02);
334  GLHelper::drawBoxLine(Position(-0.3, .50), 300, 0.4, .03);
335  GLHelper::drawBoxLine(Position(0.3, .10), 200, 0.8, .03);
336  GLHelper::drawBoxLine(Position(0.05, .80), 250, 0.6, .04);
337  GLHelper::drawBoxLine(Position(0.4, .10), 160, 0.8, .03);
338  GLHelper::drawBoxLine(Position(0.65, .80), 105, 0.6, .04);
339  GLHelper::drawBoxLine(Position(0.5, .10), 125, 0.8, .04);
340  GLHelper::drawBoxLine(Position(1.1, .55), 90, 0.6, .04);
341  // draw body
342  GLHelper::setColor(current);
343  glTranslated(0, 0, 0.1);
345  glTranslated(.4, 0, 0);
347  glTranslated(.4, 0, 0);
349  glPopMatrix();
350  break;
351  case SVS_SHIP: {
352  RGBColor darker = current.changedBrightness(-30);
353  RGBColor darker2 = current.changedBrightness(-70);
355  GLHelper::setColor(darker);
357  GLHelper::setColor(darker2);
359  break;
360  }
361  case SVS_EMERGENCY: // similar to delivery
363  GLHelper::setColor(darker);
365  glColor3d(0, 0, 0);
369  // first aid sign
370  glTranslated(0.7, 0, 0);
371  glColor3d(.18, .55, .34);
373  glColor3d(1, 1, 1);
376  break;
377  case SVS_FIREBRIGADE: // similar to delivery in red orange
379  GLHelper::setColor(lighter);
381  glColor3d(0, 0, 0);
385  // draw ladder
386  glTranslated(0.7, 0, 0);
387  glColor3d(1, .5, 0);
389  glColor3d(.5, .5, .5);
397  break;
398  case SVS_POLICE: // similar to passenger grey with blue
400  GLHelper::setColor(lighter);
402  glColor3d(0, 0, 0);
404  // first aid sign
405  glTranslated(0.7, 0, 0);
406  glColor3d(.5, .5, .5);
408  glColor3d(0, 0, 1);
411  break;
412  case SVS_RICKSHAW: // Rickshaw
414  // wheels
415  GLHelper::setColor(darker);
416  glPushMatrix();
417  glTranslated(.5, .5, -0.1);
419  glPopMatrix();
420  //other wheel
421  glPushMatrix();
422  glTranslated(.5, -.5, -0.1);
424  glPopMatrix();
425  break;
426  default: // same as passenger
428  glColor3d(1, 1, 1);
430  glColor3d(0, 0, 0);
432  break;
433  }
434 
435  // draw decorations
436  switch (shape) {
437  case SVS_PEDESTRIAN:
438  break;
439  case SVS_BICYCLE:
440  //glScaled(length, 1, 1.);
441  glBegin(GL_TRIANGLE_FAN);
442  glVertex2d(1 / 2., 0);
443  glVertex2d(0, 0);
444  glVertex2d(0, -.03);
445  glVertex2d(0 + .05, -.05);
446  glVertex2d(1 - .05, -.05);
447  glVertex2d(1, -.03);
448  glVertex2d(1, .03);
449  glVertex2d(1 - .05, .05);
450  glVertex2d(0 + .05, .05);
451  glVertex2d(0, .03);
452  glVertex2d(0, 0);
453  glEnd();
454  break;
455  case SVS_MOPED:
456  case SVS_MOTORCYCLE:
457  //glScaled(length, 1, 1.);
458  glBegin(GL_TRIANGLE_FAN);
459  glVertex2d(1 / 2., 0);
460  glVertex2d(0, 0);
461  glVertex2d(0, -.03);
462  glVertex2d(0 + .05, -.2);
463  glVertex2d(1 - .05, -.2);
464  glVertex2d(1, -.03);
465  glVertex2d(1, .03);
466  glVertex2d(1 - .05, .2);
467  glVertex2d(0 + .05, .2);
468  glVertex2d(0, .03);
469  glVertex2d(0, 0);
470  glEnd();
471  break;
472  case SVS_PASSENGER:
473  case SVS_PASSENGER_SEDAN:
477  break;
482  break;
483  case SVS_PASSENGER_WAGON:
487  break;
488  case SVS_PASSENGER_VAN:
489  case SVS_DELIVERY:
490  break;
491  case SVS_TRUCK:
492  GLHelper::setColor(current);
493  GLHelper::drawBoxLine(Position(2.3, 0), 90., length - 2.3, .5);
494  break;
496  if (carriageIndex < 0) {
497  GLHelper::setColor(current);
498  GLHelper::drawBoxLine(Position(2.8, 0), 90., length - 2.8, .5);
499  }
500  break;
501  case SVS_TRUCK_1TRAILER: {
502  GLHelper::setColor(current);
503  double l = length - 2.3;
504  if (carriageIndex != 0) {
505  l = l / 2.;
506  GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
507  GLHelper::drawBoxLine(Position(2.3 + l + .5, 0), 90., l - .5, .5);
508  } else {
509  GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
510  }
511  break;
512  }
513  case SVS_BUS_TROLLEY:
514  glPushMatrix();
515  glTranslated(0, 0, .1);
516  GLHelper::setColor(darker);
517  GLHelper::drawBoxLine(Position(3.8, 0), 90., 1, .3);
518  glTranslated(0, 0, .1);
519  glColor3d(0, 0, 0);
520  GLHelper::drawBoxLine(Position(4.3, .2), 90., 1, .06);
521  GLHelper::drawBoxLine(Position(4.3, -.2), 90., 1, .06);
522  GLHelper::drawBoxLine(Position(5.3, .2), 90., 3, .03);
523  GLHelper::drawBoxLine(Position(5.3, -.2), 90., 3, .03);
524  glPopMatrix();
525  break;
526  case SVS_BUS:
527  case SVS_BUS_COACH:
528  case SVS_BUS_FLEXIBLE:
529  case SVS_RAIL:
530  case SVS_RAIL_CAR:
531  case SVS_RAIL_CARGO:
532  case SVS_E_VEHICLE:
533  case SVS_ANT:
534  case SVS_SHIP:
535  case SVS_EMERGENCY:
536  case SVS_FIREBRIGADE:
537  case SVS_POLICE:
538  case SVS_RICKSHAW:
539  break;
540  default: // same as passenger/sedan
544  break;
545  }
546  /*
547  glBegin(GL_TRIANGLE_FAN);
548  glVertex2d(.5,.5); // center - strip begin
549  glVertex2d(0, .5); // center, front
550  glVertex2d(0, .8); // ... clockwise ... (vehicle right side)
551  glVertex2d(0.08, .94);
552  glVertex2d(0.25, 1.);
553  glVertex2d(0.95, 1.);
554  glVertex2d(1., .9);
555  glVertex2d(1., .1); // (vehicle left side)
556  glVertex2d(0.95, 0.);
557  glVertex2d(0.25, 0.);
558  glVertex2d(0.08, .06);
559  glVertex2d(0, .2); //
560  glVertex2d(0, .5); // center, front (close)
561  glEnd();
562 
563  glPolygonOffset(0, -4.5);
564  glColor3d(1, 1, 1); // front
565  glBegin(GL_TRIANGLE_FAN);
566  glVertex2d(0.1,0.5);
567  glVertex2d(0.025,0.5);
568  glVertex2d(0.025,0.75);
569  glVertex2d(0.27,0.9);
570  glVertex2d(0.27,0.1);
571  glVertex2d(0.025,0.25);
572  glVertex2d(0.025,0.5);
573  glEnd();
574 
575  glColor3d(0, 0, 0); // front glass
576  glBegin(GL_TRIANGLE_FAN);
577  glVertex2d(0.35,0.5);
578  glVertex2d(0.3,0.5);
579  glVertex2d(0.3,0.9);
580  glVertex2d(0.43,0.8);
581  glVertex2d(0.43,0.2);
582  glVertex2d(0.3,0.1);
583  glVertex2d(0.3,0.5);
584  glEnd();
585 
586  glBegin(GL_TRIANGLE_FAN); // back glass
587  glVertex2d(0.92,0.5);
588  glVertex2d(0.90,0.5);
589  glVertex2d(0.90,0.8);
590  glVertex2d(0.95,0.9);
591  glVertex2d(0.95,0.1);
592  glVertex2d(0.90,0.2);
593  glVertex2d(0.90,0.5);
594  glEnd();
595 
596  glBegin(GL_TRIANGLE_FAN); // right glass
597  glVertex2d(0.36,0.07);
598  glVertex2d(0.34,0.03);
599  glVertex2d(0.94,0.03);
600  glVertex2d(0.87,0.13);
601  glVertex2d(0.45,0.13);
602  glVertex2d(0.34,0.03);
603  glEnd();
604 
605  glBegin(GL_TRIANGLE_FAN); // left glass
606  glVertex2d(0.36,1.-0.07);
607  glVertex2d(0.34,1.-0.03);
608  glVertex2d(0.94,1.-0.03);
609  glVertex2d(0.87,1.-0.13);
610  glVertex2d(0.45,1.-0.13);
611  glVertex2d(0.34,1.-0.03);
612  glEnd();
613  */
614 
615  glPopMatrix();
616 }
617 
618 
619 bool
620 GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, const std::string& file, const GUIGlObject* o, const double width, double length) {
621  if (file != "") {
622  int textureID = GUITexturesHelper::getTextureID(file);
623  if (textureID > 0) {
624  const double exaggeration = s.vehicleSize.getExaggeration(s, o);
625  const double halfWidth = width / 2.0 * exaggeration;
626  GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, 0, halfWidth, length * exaggeration);
627  return true;
628  }
629  }
630  return false;
631 }
632 
633 
634 /****************************************************************************/
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
double vehiclePoly_ShipSuperStructure[]
double vehiclePoly_PassengerSedanRightGlass[]
render as a rail
double vehiclePoly_PassengerHatchbackBackGlass[]
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
double vehiclePoly_PassengerWagonBackGlass[]
double vehiclePoly_Rickshaw[]
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
double vehiclePoly_EmergencyLadder3[]
double vehiclePoly_EVehicleBody[]
render as a motorcycle
double vehiclePoly_PassengerCarBodyFront[]
Stores the information about how to visualize structures.
render as a transport vehicle
render as a flexible city bus
double vehiclePoly_ShipDeck[]
double vehiclePoly_EmergencySign[]
double vehiclePoly_PassengerSedanBackGlass[]
double vehiclePoly_PassengerVanLeftGlass[]
automated car (with cruise controllers)
render as a sedan passenger vehicle ("Stufenheck")
double vehiclePoly_EmergencyLadder2[]
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
double vehiclePoly_PassengerFrontGlass[]
double vehiclePoly_TransportBody[]
double vehiclePoly_Cyclist[]
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
static const RGBColor GREY
Definition: RGBColor.h:199
static void drawPoly(const double *poses, const double offset)
draw poly
double vehiclePoly_DeliveryMediumLeftGlass[]
double vehiclePoly_EVehicleBackGlass[]
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
render as a hatchback passenger vehicle ("Fliessheck")
render as a bus
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
not defined
double vehiclePoly_EmergencyLadder7[]
render as a bicycle
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
render as a (city) rail without locomotive
double vehiclePoly_Emergency[]
double vehiclePoly_PassengerSedanLeftGlass[]
double vehiclePoly_PassengerCarBody[]
render as a van
double vehiclePoly_PassengerVanRightGlass[]
render as a passenger vehicle
render as a police car
double vehiclePoly_Emergency2[]
double vehiclePoly_EmergencyLadder5[]
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
double vehiclePoly_TransportFrontGlass[]
render as a cargo train
render as a fire brigade
double vehiclePoly_PassengerVanBodyFront[]
double vehiclePoly_PassengerVanBody[]
double vehiclePoly_EmergencyLadder4[]
render as a giant ant
render as a pedestrian
render as a moped
double vehiclePoly_TransportLeftGlass[]
double vehiclePoly_Ship[]
double vehiclePoly_PassengerVanBackGlass[]
double vehiclePoly_TransportRightGlass[]
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
render as a arbitrary ship
double vehiclePoly_PassengerHatchbackRightGlass[]
double vehiclePoly_DeliveryMediumRightGlass[]
double vehiclePoly_EVehicleFrontGlass[]
render as an emergency vehicle
render as a (futuristic) e-vehicle
static bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, const std::string &file, const GUIGlObject *o, const double width, double length)
try to draw vehicle as raster image and return true if sucessful
render as a rickshaw
double vehiclePoly_PassengerVanFrontGlass[]
GUIVisualizationSizeSettings vehicleSize
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
double vehiclePoly_EmergencyLadder[]
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
render as a transport vehicle with one trailer
render as a wagon passenger vehicle ("Combi")
double vehiclePoly_EmergencyLadder6[]
render as a coach
double vehiclePoly_PassengerHatchbackLeftGlass[]
render as a semi-trailer transport vehicle ("Sattelschlepper")
render as a trolley bus
double vehiclePoly_PassengerWagonLeftGlass[]
double vehiclePoly_PassengerWagonRightGlass[]
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622