@@ -118,7 +118,7 @@ void GridMapVisual::computeVisualization(float alpha, bool showGridLines, bool f
118118
119119 // Compute the color data for each cell.
120120 ColoringMethod coloringMethod;
121- if (flatColor) {
121+ if (flatColor || noColor ) {
122122 coloringMethod = ColoringMethod::FLAT;
123123 } else if (mapLayerColor) {
124124 coloringMethod = ColoringMethod::COLOR_LAYER;
@@ -145,44 +145,44 @@ void GridMapVisual::computeVisualization(float alpha, bool showGridLines, bool f
145145 // Add vertices for mesh.
146146 for (size_t i = 0 ; i < rows; ++i) {
147147 for (size_t j = 0 ; j < cols; ++j) {
148- std::vector<int > vertices;
149- std::vector<Ogre::ColourValue> colors;
150-
151- // Add the vertex to the scene
152- grid_map::Index index (i, j);
153- if (!isValid (index (0 ), index (1 ))) {
154- continue ;
155- }
156- grid_map::Position position = topLeft.array () - index.cast <double >() * resolution;
157- manualObject_->position (position (0 ), position (1 ), heightOrFlatData (index (0 ), index (1 )));
148+ if (!noColor) {
149+ std::vector<int > vertices;
150+ std::vector<Ogre::ColourValue> colors;
151+
152+ // Add the vertex to the scene
153+ grid_map::Index index (i, j);
154+ if (!isValid (index (0 ), index (1 ))) {
155+ continue ;
156+ }
157+ grid_map::Position position = topLeft.array () - index.cast <double >() * resolution;
158+ manualObject_->position (position (0 ), position (1 ), heightOrFlatData (index (0 ), index (1 )));
158159
159- const Ogre::ColourValue& color = colorValues (index (0 ), index (1 ));
160- manualObject_->colour (color.r , color.g , color.b , alpha);
160+ const Ogre::ColourValue& color = colorValues (index (0 ), index (1 ));
161+ manualObject_->colour (color.r , color.g , color.b , alpha);
161162
162- indexToOgreIndex (index (0 ), index (1 )) = ogreIndex;
163- ogreIndex++;
163+ indexToOgreIndex (index (0 ), index (1 )) = ogreIndex;
164+ ogreIndex++;
164165
165- // We can only add triangles to the top left side of the current vertex if we have data.
166- if (i == 0 || j == 0 ) {
167- continue ;
168- }
166+ // We can only add triangles to the top left side of the current vertex if we have data.
167+ if (i == 0 || j == 0 ) {
168+ continue ;
169+ }
169170
170- // Add triangles and grid to scene.
171- std::vector<int > vertexIndices;
172- for (size_t k = 0 ; k < 2 ; k++) {
173- for (size_t l = 0 ; l < 2 ; l++) {
174- grid_map::Index index (i - k, j - l);
175- if (!isValid (index (0 ), index (1 ))) {
176- continue ;
171+ // Add triangles and grid to scene.
172+ std::vector<int > vertexIndices;
173+ for (size_t k = 0 ; k < 2 ; k++) {
174+ for (size_t l = 0 ; l < 2 ; l++) {
175+ grid_map::Index index (i - k, j - l);
176+ if (!isValid (index (0 ), index (1 ))) {
177+ continue ;
178+ }
179+ vertexIndices.emplace_back (indexToOgreIndex (index (0 ), index (1 )));
177180 }
178- vertexIndices.emplace_back (indexToOgreIndex (index (0 ), index (1 )));
179181 }
180- }
181182
182- // Plot triangles if we have enough vertices.
183- if (vertexIndices.size () > 2 ) {
184- // Create one or two triangles from the vertices depending on how many vertices we have.
185- if (!noColor) {
183+ // Plot triangles if we have enough vertices.
184+ if (vertexIndices.size () > 2 ) {
185+ // Create one or two triangles from the vertices depending on how many vertices we have.
186186 if (vertexIndices.size () == 3 ) {
187187 manualObject_->triangle (vertexIndices[0 ], vertexIndices[1 ], vertexIndices[2 ]);
188188 } else {
0 commit comments