Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file GUIBaseVehicleHelper.cpp
15 : /// @author Pablo Alvarez Lopez
16 : /// @author Mirko Barthauer
17 : /// @date Feb 2018
18 : ///
19 : // Functions used in GUIBaseVehicleHelper and GNEVehicle
20 : /****************************************************************************/
21 : #include <config.h>
22 : #include <utils/foxtools/fxheader.h>
23 :
24 : #include <utils/geom/PositionVector.h>
25 : #include <utils/gui/globjects/GLIncludes.h>
26 : #include <utils/gui/images/GUITexturesHelper.h>
27 : #include <utils/common/SUMOVehicleClass.h>
28 : #include <utils/gui/settings/GUIVisualizationSettings.h>
29 : #include "GLHelper.h"
30 : #include "GUIBaseVehicleHelper.h"
31 :
32 :
33 : // ===========================================================================
34 : // data definitions
35 : // ===========================================================================
36 : /* -------------------------------------------------------------------------
37 : * drawed shapes
38 : * ----------------------------------------------------------------------- */
39 : static const 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 : static const 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 : static const 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 : static const double vehiclePoly_PassengerSedanRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.77, -.47, 0.67, -.37, 0.45, -.37, 0.34, -.47, -10000 };
43 : static const double vehiclePoly_PassengerSedanLeftGlass[] = { 0.36, .43, 0.34, .47, 0.77, .47, 0.67, .37, 0.45, .37, 0.34, .47, -10000 };
44 : static const 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 : static const double vehiclePoly_PassengerHatchbackRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.80, -.37, 0.45, -.37, 0.34, -.47, -10000 };
46 : static const double vehiclePoly_PassengerHatchbackLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.80, .37, 0.45, .37, 0.34, .47, -10000 };
47 : static const 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 : static const double vehiclePoly_PassengerWagonRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.87, -.37, 0.45, -.37, 0.34, -.47, -10000 };
49 : static const double vehiclePoly_PassengerWagonLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.87, .37, 0.45, .37, 0.34, .47, -10000 };
50 : static const 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 : static const 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 : static const 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 : static const 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 : static const double vehiclePoly_PassengerVanRightGlass[] = { 0.36, -.43, 0.20, -.47, 0.98, -.47, 0.91, -.37, 0.31, -.37, 0.20, -.47, -10000 };
56 : static const double vehiclePoly_PassengerVanLeftGlass[] = { 0.36, .43, 0.20, .47, 0.98, .47, 0.91, .37, 0.31, .37, 0.20, .47, -10000 };
57 : static const 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 : static const double vehiclePoly_TaxiSign[] = { .56, .241, .56, -.241, .49, -.241, .49, .241, -10000 };
60 :
61 : static const double vehiclePoly_DeliveryMediumRightGlass[] = { 0.21, -.43, 0.20, -.47, 0.38, -.47, 0.38, -.37, 0.31, -.37, 0.20, -.47, -10000 };
62 : static const double vehiclePoly_DeliveryMediumLeftGlass[] = { 0.21, .43, 0.20, .47, 0.38, .47, 0.38, .37, 0.31, .37, 0.20, .47, -10000 };
63 :
64 : static const 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 };
65 : static const 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 };
66 : static const double vehiclePoly_TransportRightGlass[] = { 0.36, -.47, 0.10, -.48, 1.25, -.48, 1.25, -.4, 0.3, -.4, 0.10, -.48, -10000 };
67 : static const double vehiclePoly_TransportLeftGlass[] = { 0.36, .47, 0.10, .48, 1.25, .48, 1.25, .4, 0.3, .4, 0.10, .48, -10000 };
68 :
69 : static const 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 };
70 : static const 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 };
71 : //static const 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 };
72 : //static const 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 };
73 :
74 : static const 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 };
75 : static const 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 };
76 : static const 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 };
77 :
78 : static const 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 };
79 : static const double vehiclePoly_BicycleSeat[] = { 0.565, 0, 0.570, 0.03, 0.575, 0.05, 0.585, 0.06, 0.645, 0.06, 0.665, 0.07, 0.685, 0.10, 0.695, 0.13, 0.715, 0.16, 0.735, 0.18, 0.742, 0.17, 0.745, 0.16, 0.755, 0.13, 0.76, 0.11, 0.765, 0, 0.76, -0.11, 0.755, -0.13, 0.745, -0.16, 0.742, -0.17, 0.735, -0.18, 0.715, -0.16, 0.695, -0.13, 0.685, -0.10, 0.665, -0.07, 0.645, -0.06, 0.585, -0.06, 0.575, -0.05, 0.57, -0.03, -10000 };
80 : static const double vehiclePoly_MotorcycleSeat[] = { 0.5, 0, 0.503, 0.072, 0.506, 0.097, 0.518, 0.135, 0.539, 0.162, 0.567, 0.183, 0.641, 0.194, 0.698, 0.202, 0.706, 0.194, 0.713, 0.189, 0.721, 0.162, 0.729, 0.132, 0.732, 0.097, 0.734, 0.051, 0.735, 0, 0.734, -0.051, 0.732, -0.097, 0.729, -0.132, 0.721, -0.162, 0.713, -0.189, 0.706, -0.194, 0.698, -0.202, 0.641, -0.194, 0.567, -0.183, 0.539, -0.162, 0.518, -0.135, 0.506, -0.097, 0.503, -0.072, -10000 };
81 :
82 : static const double vehiclePoly_EmergencySign[] = { .2, .5, -.2, .5, -.2, -.5, .2, -.5, -10000 };
83 : static const double vehiclePoly_Emergency[] = { .1, .1, -.1, .1, -.1, -.1, .1, -.1, -10000 };
84 : static const double vehiclePoly_Emergency2[] = { .04, .3, -.04, .3, -.04, -.3, .04, -.3, -10000 };
85 :
86 : static const double vehiclePoly_EmergencyLadder[] = { -.5, .3, .5, .3, .5, .2, -.5, .2, -10000 };
87 : static const double vehiclePoly_EmergencyLadder2[] = { -.5, -.3, .5, -.3, .5, -.2, -.5, -.2, -10000 };
88 : static const double vehiclePoly_EmergencyLadder3[] = { -.45, .3, -.4, .3, -.4, -.3, -.45, -.3, -10000 };
89 : static const double vehiclePoly_EmergencyLadder4[] = { .45, .3, .4, .3, .4, -.3, .45, -.3, -10000 };
90 : static const double vehiclePoly_EmergencyLadder5[] = { .05, .3, .0, .3, .0, -.3, .05, -.3, -10000 };
91 : static const double vehiclePoly_EmergencyLadder6[] = { -.25, .3, -.2, .3, -.2, -.3, -.25, -.3, -10000 };
92 : static const double vehiclePoly_EmergencyLadder7[] = { .25, .3, .2, .3, .2, -.3, .25, -.3, -10000 };
93 :
94 : static const double vehiclePoly_scooterBase[] = { -.17, .5, -.2, .5, -.2, -.5, -.17, -.5, -10000 };
95 : static const double vehiclePoly_scooterBase2[] = { .98, .05, 1., .05, 1., -.05, .98, -.05, -10000 };
96 : static const double vehiclePoly_scooterBase3[] = { -.32, .6, .32, .6, .32, -.6, -.32, -.6, -10000 };
97 :
98 : static const double vehiclePoly_aircraft[] = {0.633, -0.500, 0.609, -0.465, 0.563, -0.460, 0.517, -0.168, 0.413, -0.156, 0.509, -0.053, 0.509, 0.053, 0.413, -0.156, 0.413, 0.156, 0.385, -0.101, 0.385, 0.101, 0.354, -0.058, 0.354, 0.058, 0.109, -0.050, 0.109, 0.050, 0, -0.003, 0, 0.003, 0, 0.003, 0.633, 0.500, 0.633, 0.500, 0.609, 0.465, 0.563, 0.460, 0.517, 0.168, 0.413, 0.156, 0.509, 0.053, 0.385, 0.101, 0.326, 0.158, 0.326, 0.108, 0.413, 0.156, 0.385, 0.101, 0.509, 0.053, 0.509, -0.053, 0.761, 0.043, 0.761, -0.043, 0.830, 0.030, 0.830, -0.030, 0.952, -0.196, 0.933, -0.196, 0.907, -0.008, 0.830, 0.030, 0.933, 0.196, 0.952, 0.196, 0.907, 0.008, 0.830, 0.030, 0.907, -0.008, 1.000, 0.003, 0.907, 0.008, 0.354, -0.058, 0.509, -0.053, 0.413, -0.156, 0.385, -0.101, 0.326, -0.158, 0.326, -0.108, 0.385, -0.101, -10000};
99 : static const double vehiclePoly_aircraftEngines[] = {0.326, -0.158, 0.413, -0.156, 0.326, -0.108, 0.385, -0.101, 0.385, -0.101, 0.385, 0.101, 0.385, 0.101, 0.326, 0.108, 0.413, 0.156, 0.326, 0.158, -10000};
100 : //static const 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 };
101 :
102 : // ===========================================================================
103 : // method definitions
104 : // ===========================================================================
105 :
106 : void
107 1222600 : GUIBaseVehicleHelper::drawPoly(const double* poses, const double offset) {
108 1222600 : GLHelper::pushMatrix();
109 1222600 : glTranslated(0, 0, offset * .1);
110 1222600 : glPolygonOffset(0, (GLfloat) - offset);
111 1222600 : glBegin(GL_TRIANGLE_FAN);
112 : int i = 0;
113 10593137 : while (poses[i] > -999) {
114 9370537 : glVertex2d(poses[i], poses[i + 1]);
115 9370537 : i = i + 2;
116 : }
117 1222600 : glEnd();
118 1222600 : GLHelper::popMatrix();
119 1222600 : }
120 :
121 : void
122 63342 : GUIBaseVehicleHelper::drawAction_drawVehicleAsBoxPlus(const double width, const double length, bool amReversed) {
123 63342 : GLHelper::pushMatrix();
124 63342 : glScaled(width, length, 1.);
125 63342 : glBegin(GL_TRIANGLE_STRIP);
126 63342 : if (amReversed) {
127 0 : glVertex2d(-.5, 0.);
128 0 : glVertex2d(.5, 0.);
129 0 : glVertex2d(-.5, .85);
130 0 : glVertex2d(.5, .85);
131 0 : glVertex2d(0., 1.);
132 : } else {
133 63342 : glVertex2d(0., 0.);
134 63342 : glVertex2d(-.5, .15);
135 63342 : glVertex2d(.5, .15);
136 63342 : glVertex2d(-.5, 1.);
137 63342 : glVertex2d(.5, 1.);
138 : }
139 63342 : glEnd();
140 63342 : GLHelper::popMatrix();
141 63342 : }
142 :
143 :
144 : void
145 8910141 : GUIBaseVehicleHelper::drawAction_drawVehicleAsTrianglePlus(const double width, const double length, bool amReversed) {
146 8910141 : if (length >= 8.) {
147 63342 : drawAction_drawVehicleAsBoxPlus(width, length, amReversed);
148 63342 : return;
149 : }
150 8846799 : GLHelper::pushMatrix();
151 8846799 : glScaled(width, length, 1.);
152 8846799 : glBegin(GL_TRIANGLES);
153 8846799 : if (amReversed) {
154 0 : glVertex2d(0., 1.);
155 0 : glVertex2d(-.5, 0.);
156 0 : glVertex2d(.5, 0.);
157 : } else {
158 8846799 : glVertex2d(0., 0.);
159 8846799 : glVertex2d(-.5, 1.);
160 8846799 : glVertex2d(.5, 1.);
161 : }
162 8846799 : glEnd();
163 8846799 : GLHelper::popMatrix();
164 : }
165 :
166 :
167 : void
168 0 : GUIBaseVehicleHelper::drawAction_drawVehicleAsCircle(const double width, double detail) {
169 0 : const int steps = MIN2(MAX2(16, int(detail / 5)), 64);
170 0 : GLHelper::drawFilledCircle(width / 2, steps);
171 0 : }
172 :
173 : void
174 208912 : GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(const GUIVisualizationSettings& s, const SUMOVehicleShape shape, const double width, const double length,
175 : int carriageIndex, bool isStopped, bool amReversed) {
176 : UNUSED_PARAMETER(s);
177 208912 : RGBColor current = GLHelper::getColor();
178 208912 : RGBColor lighter = current.changedBrightness(51);
179 208912 : RGBColor darker = current.changedBrightness(-51);
180 208912 : GLHelper::pushMatrix();
181 208912 : glRotated(90, 0, 0, 1);
182 :
183 208912 : glScaled(length, width, 1.);
184 :
185 : // If the vehicle is 'logically' reversed then reverse the drawing box
186 : // NB at the moment the only vehicles that will have amReversed set true are trains. Here this supports a train with guiShape="aircraft"
187 208912 : if (amReversed) {
188 749 : glRotatef(180, 0, 0, 1);
189 749 : glTranslated(-1, 0, 0);
190 : }
191 :
192 : // draw main body
193 208912 : switch (shape) {
194 0 : case SUMOVehicleShape::UNKNOWN:
195 0 : drawPoly(vehiclePoly_PassengerCarBody, 4);
196 0 : GLHelper::setColor(lighter);
197 0 : drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
198 0 : glColor3d(0, 0, 0);
199 0 : drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
200 : break;
201 0 : case SUMOVehicleShape::PEDESTRIAN:
202 0 : glTranslated(0, 0, .045);
203 0 : GLHelper::drawFilledCircle(0.25);
204 0 : glTranslated(0, 0, -.045);
205 0 : glScaled(.7, 2, 1);
206 0 : glTranslated(0, 0, .04);
207 0 : GLHelper::setColor(lighter);
208 0 : GLHelper::drawFilledCircle(0.25);
209 0 : glTranslated(0, 0, -.04);
210 : break;
211 551 : case SUMOVehicleShape::BICYCLE:
212 : case SUMOVehicleShape::MOPED:
213 : case SUMOVehicleShape::MOTORCYCLE: {
214 551 : darker = current.changedBrightness(-50);
215 551 : if (!isStopped) {
216 : // body
217 492 : drawPoly(vehiclePoly_Cyclist, 4);
218 : // head
219 492 : GLHelper::pushMatrix();
220 492 : glTranslated(0.4, 0, .5);
221 492 : glScaled(0.1, 0.2, 1);
222 492 : GLHelper::setColor(darker);
223 492 : GLHelper::drawFilledCircle(1);
224 492 : GLHelper::popMatrix();
225 59 : } else if (shape == SUMOVehicleShape::BICYCLE) {
226 : // seat
227 20 : GLHelper::setColor(darker);
228 20 : drawPoly(vehiclePoly_BicycleSeat, 4);
229 : } else {
230 : // seat
231 39 : GLHelper::setColor(darker);
232 39 : drawPoly(vehiclePoly_MotorcycleSeat, 4);
233 : }
234 : // bike frame
235 551 : GLHelper::setColor(RGBColor::GREY);
236 551 : GLHelper::pushMatrix();
237 551 : glTranslated(0.5, 0, .3);
238 551 : glScaled(0.5, 0.05, 1);
239 551 : GLHelper::drawFilledCircle(1);
240 551 : GLHelper::popMatrix();
241 : // handle bar
242 551 : GLHelper::pushMatrix();
243 551 : glTranslated(0.25, 0, .3);
244 551 : glScaled(0.02, 0.5, 1);
245 551 : GLHelper::drawFilledCircle(1);
246 551 : GLHelper::popMatrix();
247 : }
248 : break;
249 201691 : case SUMOVehicleShape::PASSENGER:
250 : case SUMOVehicleShape::PASSENGER_SEDAN:
251 : case SUMOVehicleShape::PASSENGER_HATCHBACK:
252 : case SUMOVehicleShape::PASSENGER_WAGON:
253 : case SUMOVehicleShape::TAXI:
254 201691 : drawPoly(vehiclePoly_PassengerCarBody, 4);
255 201691 : GLHelper::setColor(lighter);
256 201691 : drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
257 201691 : glColor3d(0, 0, 0);
258 201691 : drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
259 : break;
260 0 : case SUMOVehicleShape::PASSENGER_VAN:
261 0 : drawPoly(vehiclePoly_PassengerVanBody, 4);
262 0 : GLHelper::setColor(lighter);
263 0 : drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
264 0 : glColor3d(0, 0, 0);
265 0 : drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
266 0 : drawPoly(vehiclePoly_PassengerVanRightGlass, 4.5);
267 0 : drawPoly(vehiclePoly_PassengerVanLeftGlass, 4.5);
268 0 : drawPoly(vehiclePoly_PassengerVanBackGlass, 4.5);
269 : break;
270 431 : case SUMOVehicleShape::DELIVERY:
271 431 : drawPoly(vehiclePoly_PassengerVanBody, 4);
272 431 : GLHelper::setColor(lighter);
273 431 : drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
274 431 : glColor3d(0, 0, 0);
275 431 : drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
276 431 : drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
277 431 : drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
278 : break;
279 1786 : case SUMOVehicleShape::TRUCK:
280 : case SUMOVehicleShape::TRUCK_SEMITRAILER:
281 : case SUMOVehicleShape::TRUCK_1TRAILER:
282 1786 : if (carriageIndex < 1) {
283 1786 : glScaled(1. / (length), 1, 1.);
284 1786 : drawPoly(vehiclePoly_TransportBody, 4);
285 1786 : glColor3d(0, 0, 0);
286 1786 : drawPoly(vehiclePoly_TransportFrontGlass, 4.5);
287 1786 : drawPoly(vehiclePoly_TransportRightGlass, 4.5);
288 1786 : drawPoly(vehiclePoly_TransportLeftGlass, 4.5);
289 : }
290 : break;
291 1870 : case SUMOVehicleShape::BUS:
292 : case SUMOVehicleShape::BUS_COACH:
293 : case SUMOVehicleShape::BUS_TROLLEY: {
294 : double ml = length;
295 1870 : glScaled(1. / (length), 1, 1.);
296 1870 : glTranslated(0, 0, .04);
297 1870 : glBegin(GL_TRIANGLE_FAN);
298 1870 : glVertex2d(ml / 2., 0);
299 1870 : glVertex2d(0, 0);
300 1870 : glVertex2d(0, -.45);
301 1870 : glVertex2d(0 + .05, -.5);
302 1870 : glVertex2d(ml - .05, -.5);
303 1870 : glVertex2d(ml, -.45);
304 1870 : glVertex2d(ml, .45);
305 1870 : glVertex2d(ml - .05, .5);
306 1870 : glVertex2d(0 + .05, .5);
307 1870 : glVertex2d(0, .45);
308 1870 : glVertex2d(0, 0);
309 1870 : glEnd();
310 1870 : glTranslated(0, 0, -.04);
311 :
312 1870 : glTranslated(0, 0, .045);
313 1870 : glColor3d(0, 0, 0);
314 1870 : glBegin(GL_QUADS);
315 1870 : glVertex2d(0 + .05, .48);
316 1870 : glVertex2d(0 + .05, -.48);
317 1870 : glVertex2d(0 + .15, -.48);
318 1870 : glVertex2d(0 + .15, .48);
319 :
320 1870 : glVertex2d(ml - .1, .45);
321 1870 : glVertex2d(ml - .1, -.45);
322 1870 : glVertex2d(ml - .05, -.45);
323 1870 : glVertex2d(ml - .05, .45);
324 :
325 1870 : glVertex2d(0 + .20, .49);
326 1870 : glVertex2d(0 + .20, .45);
327 1870 : glVertex2d(ml - .20, .45);
328 1870 : glVertex2d(ml - .20, .49);
329 :
330 1870 : glVertex2d(0 + .20, -.49);
331 1870 : glVertex2d(0 + .20, -.45);
332 1870 : glVertex2d(ml - .20, -.45);
333 1870 : glVertex2d(ml - .20, -.49);
334 :
335 1870 : glEnd();
336 1870 : glTranslated(0, 0, -.045);
337 : }
338 : break;
339 0 : case SUMOVehicleShape::BUS_FLEXIBLE:
340 : case SUMOVehicleShape::RAIL:
341 : case SUMOVehicleShape::RAIL_CAR:
342 : case SUMOVehicleShape::RAIL_CARGO: {
343 : // generic rail carriage (see GUIVehicle::drawAction_drawCarriageClass)
344 0 : glRotated(-90, 0, 0, 1);
345 0 : const double xCornerCut = 0.3 / width;
346 0 : const double yCornerCut = 0.4 / length;
347 : const double drawnCarriageLength = 1;
348 : const double halfWidth = 0.5;
349 0 : glBegin(GL_TRIANGLE_FAN);
350 0 : glVertex2d(-halfWidth + xCornerCut, 0);
351 0 : glVertex2d(-halfWidth, yCornerCut);
352 0 : glVertex2d(-halfWidth, drawnCarriageLength - yCornerCut);
353 0 : glVertex2d(-halfWidth + xCornerCut, drawnCarriageLength);
354 0 : glVertex2d(halfWidth - xCornerCut, drawnCarriageLength);
355 0 : glVertex2d(halfWidth, drawnCarriageLength - yCornerCut);
356 0 : glVertex2d(halfWidth, yCornerCut);
357 0 : glVertex2d(halfWidth - xCornerCut, 0);
358 0 : glEnd();
359 : // assume we are only rendering the head of the train (carriage rendering was disabled via param)
360 0 : glTranslated(0, 0, 0.1);
361 0 : glColor3d(0, 0, 0);
362 0 : glBegin(GL_TRIANGLE_FAN);
363 0 : glVertex2d(-halfWidth + 2 * xCornerCut, yCornerCut);
364 0 : glVertex2d(-halfWidth + xCornerCut, 3 * yCornerCut);
365 0 : glVertex2d(halfWidth - xCornerCut, 3 * yCornerCut);
366 0 : glVertex2d(halfWidth - 2 * xCornerCut, yCornerCut);
367 0 : glEnd();
368 : }
369 : break;
370 :
371 0 : case SUMOVehicleShape::E_VEHICLE:
372 0 : drawPoly(vehiclePoly_EVehicleBody, 4);
373 0 : glColor3d(0, 0, 0);
374 0 : drawPoly(vehiclePoly_EVehicleFrontGlass, 4.5);
375 0 : glTranslated(0, 0, .048);
376 0 : GLHelper::setColor(current);
377 0 : glBegin(GL_QUADS);
378 0 : glVertex2d(.3, .5);
379 0 : glVertex2d(.35, .5);
380 0 : glVertex2d(.35, -.5);
381 0 : glVertex2d(.3, -.5);
382 :
383 0 : glVertex2d(.3, -.05);
384 0 : glVertex2d(.7, -.05);
385 0 : glVertex2d(.7, .05);
386 0 : glVertex2d(.3, .05);
387 :
388 0 : glVertex2d(.7, .5);
389 0 : glVertex2d(.65, .5);
390 0 : glVertex2d(.65, -.5);
391 0 : glVertex2d(.7, -.5);
392 0 : glEnd();
393 0 : glTranslated(0, 0, -.048);
394 : //drawPoly(vehiclePoly_EVehicleBackGlass, 4.5);
395 : break;
396 0 : case SUMOVehicleShape::ANT:
397 0 : GLHelper::pushMatrix();
398 : // ant is stretched via vehicle length
399 0 : GLHelper::setColor(darker);
400 : // draw left side
401 0 : GLHelper::drawBoxLine(Position(-0.2, -.10), 350, 0.5, .02);
402 0 : GLHelper::drawBoxLine(Position(-0.3, -.50), 240, 0.4, .03);
403 0 : GLHelper::drawBoxLine(Position(0.3, -.10), 340, 0.8, .03);
404 0 : GLHelper::drawBoxLine(Position(0.05, -.80), 290, 0.6, .04);
405 0 : GLHelper::drawBoxLine(Position(0.4, -.10), 20, 0.8, .03);
406 0 : GLHelper::drawBoxLine(Position(0.65, -.80), 75, 0.6, .04);
407 0 : GLHelper::drawBoxLine(Position(0.5, -.10), 55, 0.8, .04);
408 0 : GLHelper::drawBoxLine(Position(1.1, -.55), 90, 0.6, .04);
409 : // draw right side
410 0 : GLHelper::drawBoxLine(Position(-0.2, .10), 190, 0.5, .02);
411 0 : GLHelper::drawBoxLine(Position(-0.3, .50), 300, 0.4, .03);
412 0 : GLHelper::drawBoxLine(Position(0.3, .10), 200, 0.8, .03);
413 0 : GLHelper::drawBoxLine(Position(0.05, .80), 250, 0.6, .04);
414 0 : GLHelper::drawBoxLine(Position(0.4, .10), 160, 0.8, .03);
415 0 : GLHelper::drawBoxLine(Position(0.65, .80), 105, 0.6, .04);
416 0 : GLHelper::drawBoxLine(Position(0.5, .10), 125, 0.8, .04);
417 0 : GLHelper::drawBoxLine(Position(1.1, .55), 90, 0.6, .04);
418 : // draw body
419 0 : GLHelper::setColor(current);
420 0 : glTranslated(0, 0, 0.1);
421 0 : GLHelper::drawFilledCircle(.25, 16);
422 0 : glTranslated(.4, 0, 0);
423 0 : GLHelper::drawFilledCircle(.2, 16);
424 0 : glTranslated(.4, 0, 0);
425 0 : GLHelper::drawFilledCircle(.3, 16);
426 0 : GLHelper::popMatrix();
427 : break;
428 868 : case SUMOVehicleShape::SHIP: {
429 868 : drawPoly(vehiclePoly_Ship, 4);
430 868 : GLHelper::setColor(current.changedBrightness(-30));
431 868 : drawPoly(vehiclePoly_ShipDeck, 5);
432 868 : GLHelper::setColor(current.changedBrightness(-70));
433 868 : drawPoly(vehiclePoly_ShipSuperStructure, 6);
434 : break;
435 : }
436 0 : case SUMOVehicleShape::EMERGENCY: // similar to delivery
437 0 : drawPoly(vehiclePoly_PassengerVanBody, 4);
438 0 : GLHelper::setColor(darker);
439 0 : drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
440 0 : glColor3d(0, 0, 0);
441 0 : drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
442 0 : drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
443 0 : drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
444 : // first aid sign
445 0 : glTranslated(0.7, 0, 0);
446 0 : glColor3d(.18, .55, .34);
447 0 : drawPoly(vehiclePoly_EmergencySign, 4.5);
448 0 : glColor3d(1, 1, 1);
449 0 : drawPoly(vehiclePoly_Emergency, 5);
450 0 : drawPoly(vehiclePoly_Emergency2, 5);
451 : break;
452 0 : case SUMOVehicleShape::FIREBRIGADE: // similar to delivery in red orange
453 0 : drawPoly(vehiclePoly_PassengerVanBody, 4);
454 0 : GLHelper::setColor(lighter);
455 0 : drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
456 0 : glColor3d(0, 0, 0);
457 0 : drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
458 0 : drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
459 0 : drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
460 : // draw ladder
461 0 : glTranslated(0.7, 0, 0);
462 0 : glColor3d(1, .5, 0);
463 0 : drawPoly(vehiclePoly_EmergencySign, 4.5);
464 0 : glColor3d(.5, .5, .5);
465 0 : drawPoly(vehiclePoly_EmergencyLadder, 5);
466 0 : drawPoly(vehiclePoly_EmergencyLadder2, 5);
467 0 : drawPoly(vehiclePoly_EmergencyLadder3, 5);
468 0 : drawPoly(vehiclePoly_EmergencyLadder4, 5);
469 0 : drawPoly(vehiclePoly_EmergencyLadder5, 5);
470 0 : drawPoly(vehiclePoly_EmergencyLadder6, 5);
471 0 : drawPoly(vehiclePoly_EmergencyLadder7, 5);
472 : break;
473 0 : case SUMOVehicleShape::POLICE: // similar to passenger grey with blue
474 0 : drawPoly(vehiclePoly_PassengerCarBody, 4);
475 0 : GLHelper::setColor(lighter);
476 0 : drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
477 0 : glColor3d(0, 0, 0);
478 0 : drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
479 : // first aid sign
480 0 : glTranslated(0.7, 0, 0);
481 0 : glColor3d(.5, .5, .5);
482 0 : drawPoly(vehiclePoly_EmergencySign, 4.5);
483 0 : glColor3d(0, 0, 1);
484 0 : drawPoly(vehiclePoly_Emergency, 5);
485 0 : drawPoly(vehiclePoly_Emergency2, 5);
486 : break;
487 0 : case SUMOVehicleShape::RICKSHAW: // Rickshaw
488 0 : drawPoly(vehiclePoly_PassengerCarBody, 4);
489 : // wheels
490 0 : GLHelper::setColor(darker);
491 0 : GLHelper::pushMatrix();
492 0 : glTranslated(.5, .5, -0.1);
493 0 : GLHelper::drawFilledCircle(.3, 6);
494 0 : GLHelper::popMatrix();
495 : //other wheel
496 0 : GLHelper::pushMatrix();
497 0 : glTranslated(.5, -.5, -0.1);
498 0 : GLHelper::drawFilledCircle(.3, 6);
499 0 : GLHelper::popMatrix();
500 : break;
501 :
502 1715 : case SUMOVehicleShape::AIRCRAFT: // Aircraft polygon has many points but we do not expect to have high numbers of aircraft being visualised!
503 1715 : GLHelper::pushMatrix();
504 1715 : glBegin(GL_TRIANGLE_STRIP);
505 : {
506 : int i = 0;
507 94325 : while (vehiclePoly_aircraft[i] > -999) {
508 92610 : glVertex2d(vehiclePoly_aircraft[i], vehiclePoly_aircraft[i + 1]);
509 92610 : i = i + 2;
510 : }
511 : }
512 1715 : glEnd();
513 1715 : GLHelper::setColor(current.changedBrightness(-30));
514 1715 : glTranslated(0, 0, 0.1);
515 1715 : glBegin(GL_TRIANGLE_STRIP);
516 : {
517 : int i = 0;
518 18865 : while (vehiclePoly_aircraftEngines[i] > -999) {
519 17150 : glVertex2d(vehiclePoly_aircraftEngines[i], vehiclePoly_aircraftEngines[i + 1]);
520 17150 : i = i + 2;
521 : }
522 : }
523 1715 : glEnd();
524 1715 : GLHelper::popMatrix();
525 : // navigation lights
526 1715 : glColor3d(1.f, 0, 0);
527 1715 : GLHelper::pushMatrix();
528 1715 : glTranslated(0.62, -0.49, 0.1);
529 1715 : GLHelper::drawFilledCircle(-.01, 6);
530 1715 : GLHelper::popMatrix();
531 1715 : glColor3d(0, 1.f, 0);
532 1715 : GLHelper::pushMatrix();
533 1715 : glTranslated(0.62, 0.49, 0.1);
534 1715 : GLHelper::drawFilledCircle(-.01, 6);
535 1715 : GLHelper::popMatrix();
536 : break;
537 :
538 0 : case SUMOVehicleShape::SCOOTER: {
539 0 : RGBColor darker2 = current.changedBrightness(-25);
540 0 : GLHelper::pushMatrix();
541 : // front small oval
542 0 : GLHelper::setColor(darker);
543 0 : glTranslated(0.2, 0, 0.15); // glTranslated(0.3, 0, 0.15);
544 0 : glScaled(0.09, 0.13, 0.7); // was glScaled(0.04, 0.06, 0.7);
545 0 : GLHelper::drawFilledCircle(1, 20);
546 0 : GLHelper::popMatrix();
547 : // handlebar
548 0 : GLHelper::pushMatrix();
549 0 : glTranslated(0.42, 0, 0.1); // was glTranslated(0.5, 0, 0.1);
550 0 : glColor3d(0.3, 0.3, 0.3);
551 0 : drawPoly(vehiclePoly_scooterBase, 5);
552 0 : GLHelper::popMatrix();
553 : // front oval
554 0 : GLHelper::pushMatrix();
555 0 : GLHelper::setColor(darker2);
556 0 : glTranslated(0.17, 0, 0.1); // was glTranslated(0.29, 0, 0.1);
557 0 : glScaled(0.17, 0.19, 0.9); // was glScaled(0.07, 0.08, 0.9);
558 0 : GLHelper::drawFilledCircle(1, 20);
559 0 : GLHelper::popMatrix();
560 : // tail rectangle
561 0 : GLHelper::pushMatrix();
562 0 : glColor3d(0.3, 0.3, 0.3);
563 0 : drawPoly(vehiclePoly_scooterBase2, 5);
564 : // tail oval
565 0 : GLHelper::setColor(darker2);
566 0 : glTranslated(0.83, 0, 0.1); // was glTranslated(0.71, 0, 0.1);
567 0 : glScaled(0.17, 0.17, 0.9); // was glScaled(0.07, 0.08, 0.9);
568 0 : GLHelper::drawFilledCircle(1, 20);
569 0 : GLHelper::popMatrix();
570 : // base oval
571 0 : GLHelper::pushMatrix();
572 0 : GLHelper::setColor(lighter);
573 0 : glTranslated(0.5, 0, 0.1); // was glTranslated(0.5, 0, 0.1);
574 0 : glScaled(0.5, 0.28, 0.9); // was glScaled(0.28, 0.14, 0.9);
575 0 : GLHelper::drawFilledCircle(1, 30);
576 : // center rectangle
577 0 : GLHelper::setColor(current);
578 0 : drawPoly(vehiclePoly_scooterBase3, 5);
579 0 : GLHelper::popMatrix();
580 : break;
581 : }
582 0 : default: // same as passenger
583 0 : drawPoly(vehiclePoly_PassengerCarBody, 4);
584 0 : glColor3d(1, 1, 1);
585 0 : drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
586 0 : glColor3d(0, 0, 0);
587 0 : drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
588 : break;
589 : }
590 :
591 : // draw decorations
592 208912 : switch (shape) {
593 : case SUMOVehicleShape::PEDESTRIAN:
594 : break;
595 180 : case SUMOVehicleShape::BICYCLE:
596 : //glScaled(length, 1, 1.);
597 180 : glBegin(GL_TRIANGLE_FAN);
598 180 : glVertex2d(1 / 2., 0);
599 180 : glVertex2d(0, 0);
600 180 : glVertex2d(0, -.03);
601 180 : glVertex2d(0 + .05, -.05);
602 180 : glVertex2d(1 - .05, -.05);
603 180 : glVertex2d(1, -.03);
604 180 : glVertex2d(1, .03);
605 180 : glVertex2d(1 - .05, .05);
606 180 : glVertex2d(0 + .05, .05);
607 180 : glVertex2d(0, .03);
608 180 : glVertex2d(0, 0);
609 180 : glEnd();
610 : break;
611 371 : case SUMOVehicleShape::MOPED:
612 : case SUMOVehicleShape::MOTORCYCLE:
613 : //glScaled(length, 1, 1.);
614 371 : glBegin(GL_TRIANGLE_FAN);
615 371 : glVertex2d(1 / 2., 0);
616 371 : glVertex2d(0, 0);
617 371 : glVertex2d(0, -.03);
618 371 : glVertex2d(0 + .05, -.2);
619 371 : glVertex2d(1 - .05, -.2);
620 371 : glVertex2d(1, -.03);
621 371 : glVertex2d(1, .03);
622 371 : glVertex2d(1 - .05, .2);
623 371 : glVertex2d(0 + .05, .2);
624 371 : glVertex2d(0, .03);
625 371 : glVertex2d(0, 0);
626 371 : glEnd();
627 : break;
628 201691 : case SUMOVehicleShape::PASSENGER:
629 : case SUMOVehicleShape::PASSENGER_SEDAN:
630 201691 : drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
631 201691 : drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
632 201691 : drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
633 : break;
634 0 : case SUMOVehicleShape::PASSENGER_HATCHBACK:
635 0 : drawPoly(vehiclePoly_PassengerHatchbackRightGlass, 4.5);
636 0 : drawPoly(vehiclePoly_PassengerHatchbackLeftGlass, 4.5);
637 0 : drawPoly(vehiclePoly_PassengerHatchbackBackGlass, 4.5);
638 : break;
639 0 : case SUMOVehicleShape::PASSENGER_WAGON:
640 0 : drawPoly(vehiclePoly_PassengerWagonRightGlass, 4.5);
641 0 : drawPoly(vehiclePoly_PassengerWagonLeftGlass, 4.5);
642 0 : drawPoly(vehiclePoly_PassengerWagonBackGlass, 4.5);
643 : break;
644 : case SUMOVehicleShape::PASSENGER_VAN:
645 : case SUMOVehicleShape::DELIVERY:
646 : break;
647 0 : case SUMOVehicleShape::TAXI:
648 0 : drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
649 0 : drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
650 0 : drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
651 :
652 0 : glTranslated(0, 0, 6);
653 0 : glColor3d(0, 0, 0);
654 : // square-pattern in front
655 0 : glRectd(0.146, 0.24675, 0.171, 0.176);
656 0 : glRectd(0.121, 0.176, 0.146, 0.1055);
657 0 : glRectd(0.146, 0.1055, 0.171, 0.035);
658 0 : glRectd(0.121, 0.035, 0.146, -0.035);
659 0 : glRectd(0.146, -0.1055, 0.171, -0.035);
660 0 : glRectd(0.121, -0.176, 0.146, -0.1055);
661 0 : glRectd(0.146, -0.24675, 0.171, -0.176);
662 : // square-pattern at the back
663 0 : glRectd(0.913, 0.24675, 0.938, 0.176);
664 0 : glRectd(0.888, 0.176, 0.913, 0.1055);
665 0 : glRectd(0.888, 0.176, 0.913, 0.1055);
666 0 : glRectd(0.913, 0.1055, 0.938, 0.035);
667 0 : glRectd(0.888, 0.035, 0.913, -0.035);
668 0 : glRectd(0.913, -0.1055, 0.938, -0.035);
669 0 : glRectd(0.888, -0.176, 0.913, -0.1055);
670 0 : glRectd(0.888, -0.176, 0.913, -0.1055);
671 0 : glRectd(0.913, -0.24675, 0.938, -0.176);
672 :
673 0 : GLHelper::setColor(darker);
674 0 : drawPoly(vehiclePoly_TaxiSign, 5);
675 0 : glScaled(0.2, 0.5, 1);
676 0 : GLHelper::drawText("TAXI", Position(2.58, 0), 5, 0.3, RGBColor::BLACK, 90);
677 0 : break;
678 892 : case SUMOVehicleShape::TRUCK:
679 892 : GLHelper::setColor(current);
680 892 : GLHelper::drawBoxLine(Position(2.3, 0), 90., length - 2.3, .5);
681 892 : break;
682 425 : case SUMOVehicleShape::TRUCK_SEMITRAILER:
683 425 : if (carriageIndex < 0) {
684 0 : GLHelper::setColor(current);
685 0 : GLHelper::drawBoxLine(Position(2.8, 0), 90., length - 2.8, .5);
686 : }
687 : break;
688 469 : case SUMOVehicleShape::TRUCK_1TRAILER: {
689 469 : GLHelper::setColor(current);
690 469 : double l = length - 2.3;
691 469 : if (carriageIndex != 0) {
692 0 : l = l / 2.;
693 0 : GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
694 0 : GLHelper::drawBoxLine(Position(2.3 + l + .5, 0), 90., l - .5, .5);
695 : } else {
696 469 : GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
697 : }
698 : break;
699 : }
700 482 : case SUMOVehicleShape::BUS_TROLLEY:
701 482 : GLHelper::pushMatrix();
702 482 : glTranslated(0, 0, .1);
703 482 : GLHelper::setColor(darker);
704 482 : GLHelper::drawBoxLine(Position(3.8, 0), 90., 1, .3);
705 482 : glTranslated(0, 0, .1);
706 482 : glColor3d(0, 0, 0);
707 482 : GLHelper::drawBoxLine(Position(4.3, .2), 90., 1, .06);
708 482 : GLHelper::drawBoxLine(Position(4.3, -.2), 90., 1, .06);
709 482 : GLHelper::drawBoxLine(Position(5.3, .2), 90., 3, .03);
710 482 : GLHelper::drawBoxLine(Position(5.3, -.2), 90., 3, .03);
711 482 : GLHelper::popMatrix();
712 : break;
713 : case SUMOVehicleShape::BUS:
714 : case SUMOVehicleShape::BUS_COACH:
715 : case SUMOVehicleShape::BUS_FLEXIBLE:
716 : case SUMOVehicleShape::RAIL:
717 : case SUMOVehicleShape::RAIL_CAR:
718 : case SUMOVehicleShape::RAIL_CARGO:
719 : case SUMOVehicleShape::E_VEHICLE:
720 : case SUMOVehicleShape::ANT:
721 : case SUMOVehicleShape::SHIP:
722 : case SUMOVehicleShape::EMERGENCY:
723 : case SUMOVehicleShape::FIREBRIGADE:
724 : case SUMOVehicleShape::POLICE:
725 : case SUMOVehicleShape::RICKSHAW:
726 : case SUMOVehicleShape::AIRCRAFT:
727 : case SUMOVehicleShape::SCOOTER:
728 : break;
729 0 : default: // same as passenger/sedan
730 0 : drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
731 0 : drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
732 0 : drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
733 : break;
734 : }
735 : /*
736 : glBegin(GL_TRIANGLE_FAN);
737 : glVertex2d(.5,.5); // center - strip begin
738 : glVertex2d(0, .5); // center, front
739 : glVertex2d(0, .8); // ... clockwise ... (vehicle right side)
740 : glVertex2d(0.08, .94);
741 : glVertex2d(0.25, 1.);
742 : glVertex2d(0.95, 1.);
743 : glVertex2d(1., .9);
744 : glVertex2d(1., .1); // (vehicle left side)
745 : glVertex2d(0.95, 0.);
746 : glVertex2d(0.25, 0.);
747 : glVertex2d(0.08, .06);
748 : glVertex2d(0, .2); //
749 : glVertex2d(0, .5); // center, front (close)
750 : glEnd();
751 :
752 : glPolygonOffset(0, -4.5);
753 : glColor3d(1, 1, 1); // front
754 : glBegin(GL_TRIANGLE_FAN);
755 : glVertex2d(0.1,0.5);
756 : glVertex2d(0.025,0.5);
757 : glVertex2d(0.025,0.75);
758 : glVertex2d(0.27,0.9);
759 : glVertex2d(0.27,0.1);
760 : glVertex2d(0.025,0.25);
761 : glVertex2d(0.025,0.5);
762 : glEnd();
763 :
764 : glColor3d(0, 0, 0); // front glass
765 : glBegin(GL_TRIANGLE_FAN);
766 : glVertex2d(0.35,0.5);
767 : glVertex2d(0.3,0.5);
768 : glVertex2d(0.3,0.9);
769 : glVertex2d(0.43,0.8);
770 : glVertex2d(0.43,0.2);
771 : glVertex2d(0.3,0.1);
772 : glVertex2d(0.3,0.5);
773 : glEnd();
774 :
775 : glBegin(GL_TRIANGLE_FAN); // back glass
776 : glVertex2d(0.92,0.5);
777 : glVertex2d(0.90,0.5);
778 : glVertex2d(0.90,0.8);
779 : glVertex2d(0.95,0.9);
780 : glVertex2d(0.95,0.1);
781 : glVertex2d(0.90,0.2);
782 : glVertex2d(0.90,0.5);
783 : glEnd();
784 :
785 : glBegin(GL_TRIANGLE_FAN); // right glass
786 : glVertex2d(0.36,0.07);
787 : glVertex2d(0.34,0.03);
788 : glVertex2d(0.94,0.03);
789 : glVertex2d(0.87,0.13);
790 : glVertex2d(0.45,0.13);
791 : glVertex2d(0.34,0.03);
792 : glEnd();
793 :
794 : glBegin(GL_TRIANGLE_FAN); // left glass
795 : glVertex2d(0.36,1.-0.07);
796 : glVertex2d(0.34,1.-0.03);
797 : glVertex2d(0.94,1.-0.03);
798 : glVertex2d(0.87,1.-0.13);
799 : glVertex2d(0.45,1.-0.13);
800 : glVertex2d(0.34,1.-0.03);
801 : glEnd();
802 : */
803 :
804 208912 : GLHelper::popMatrix();
805 208912 : }
806 :
807 :
808 : bool
809 7808 : GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(const GUIVisualizationSettings& /* s */, const std::string& file, const GUIGlObject* /* o */, const double width, double length) {
810 7808 : if (file != "") {
811 7808 : int textureID = GUITexturesHelper::getTextureID(file);
812 7808 : if (textureID > 0) {
813 7808 : GUITexturesHelper::drawTexturedBox(textureID, -width * 0.5, 0, width * 0.5, length);
814 7808 : return true;
815 : }
816 : }
817 : return false;
818 : }
819 :
820 :
821 : /****************************************************************************/
|