This file is indexed.

/usr/include/OpenLayer/LineStripRender.hpp is in libopenlayer-dev 2.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#ifndef OL_LINE_STRIP_RENDER_HPP
#define OL_LINE_STRIP_RENDER_HPP

#include "Rgba.hpp"
#include "Bitmap.hpp"
#include "RawLineStrip.hpp"
#include "Declspec.hpp"

#define OL_NEAR_ZERO 0.001


namespace ol {



template< class std_container_v, class std_container_l >
OL_LIB_DECLSPEC void RawLineStrip< std_container_v, std_container_l >::
LineStripRender( const Rgba *color1, const Rgba *color2, const Bitmap *texture, float lineWidth,
         const Placement &placement, bool connectFirstAndLast ) const {
   
   if( vertices.size() < 2 ) {
      return;
   }
   
#ifdef OL_NO_STATE_CHANGE
   GLboolean texturesEnabled;
   glGetBooleanv( GL_TEXTURE_2D, &texturesEnabled );
#endif
   if( texture ) {
      texture->GetReadyToRender( 1.0 );
   }
   else {
      glDisable( GL_TEXTURE_2D );
   }
   
   // The sum of lengths thus far //
   float sumLengths = 0.0;
   float texturePos = 0.0;
   
   typename std_container_l::const_iterator lengthIter = lengths.begin();
   
   // Find the normal of the beginning of the strip //
   
   Vec2D lastS, last;
   
   typename std_container_v::const_iterator vertexIter = vertices.begin();
   
   if( connectFirstAndLast ) {
      last = vertices.back();
      lastS = vertices.front() - last;
   }
   else {
      last = vertices.front();
      typename std_container_v::const_iterator lastSIter = vertices.begin();
      lastSIter++;
      
      if( *lastSIter == last ) {
   		unsigned int index = 2;
   		while( *lastSIter == last ) {
   			if( vertices.size() <= index )
   				return;
   			lastSIter++;
   			index++;
   			lengthIter++;
   		}
      }
      lastS = *lastSIter - last;
      
      vertexIter++;
   }
   
   lastS /= lastS.GetMagnitude();
   
   glPushMatrix();
   placement.Apply();
   
   // Render the begin of the strip //
   
   glBegin( GL_QUAD_STRIP );
      if( color1 ) {
         color1->Select();
      }
      
      float lastUpperX = last.x + lastS.y * lineWidth;
      float lastUpperY = last.y - lastS.x * lineWidth;
      
      float lastLowerX = last.x - lastS.y * lineWidth;
      float lastLowerY = last.y + lastS.x * lineWidth;
      
      if( !texture ) {
         glVertex2f( lastUpperX, lastUpperY );
         glVertex2f( lastLowerX, lastLowerY );
      }
      else {
         const OlTextureInfo &textureInfo = texture->textureInfo;
         glTexCoord2f( textureInfo.rect.x, textureInfo.rect.y );
         glVertex2f( lastUpperX, lastUpperY );
         glTexCoord2f( textureInfo.rect.x, textureInfo.rect.y + textureInfo.rect.h );
         glVertex2f( lastLowerX, lastLowerY );
      }
      
      
      bool running = true;
      
      while( running ) {
         float x = vertexIter->x;
         float y = vertexIter->y;
         
         vertexIter++;
         
         if( vertexIter == vertices.end() ) {
            if( connectFirstAndLast ) {
               running = false;
               vertexIter = vertices.begin();
            }
            else {
               break;
            }
         }
         
         if( color1 ) {
            float factor = sumLengths / totalLength;
            sumLengths += *lengthIter;
            
            color1->InterpolateWith( *color2, factor ).Select();
         }
         
         if( fabs( x - last.x ) < OL_NEAR_ZERO && fabs( y - last.y ) < OL_NEAR_ZERO ) {
            continue;
         }
         
         // Find the direction vector from the next point to the current one //
         
         float bx = x - vertexIter->x;
         float by = y - vertexIter->y;
         
         float bLength = sqrt( bx * bx + by * by );
         
         if( bLength > -OL_NEAR_ZERO && bLength < OL_NEAR_ZERO ) {
            continue;
         }
         
         bx /= bLength;
         by /= bLength;
         
         // Find the direction vector of the displacement //
         
         float cx = lastS.x + bx;
         float cy = lastS.y + by;
         
         float cLength = sqrt( cx * cx + cy * cy );
         
         float nx, ny;
         
         if( cLength > -OL_NEAR_ZERO && cLength < OL_NEAR_ZERO ) {
            nx = -by;
            ny = bx;
            
            float nRatio = lineWidth/sqrt( nx * nx + ny * ny );
            
            nx *= nRatio;
            ny *= nRatio;
         }
         else {
            cx /= cLength;
            cy /= cLength;
            
            // Make sure that the displacement happens always in the same side //
            
            float diff1 = lastS.x - bx;
            float diff2 = lastS.y - by;
            float diff3 = cx - bx;
            float diff4 = cy - by;
            
            if(( diff1 * diff4 ) - ( diff2 * diff3 ) > 0 ) {
               cx = -cx;
               cy = -cy;
            }
            
            // Find the displacement multiplicator //
            
            float s = lastS.y * cx + (-lastS.x) * cy;
            
            if( fabs( s ) < OL_NEAR_ZERO ) {
               nx = -by;
               ny = bx;
               
               float nRatio = lineWidth/sqrt( nx * nx + ny * ny );
               
               nx *= nRatio;
               ny *= nRatio;
            }
            else {
               nx = cx * lineWidth / s;
               ny = cy * lineWidth / s;
            }
         }
         
         // Find the displaced coordinates //
         
         float upperX = x + nx;
         float upperY = y + ny;
         
         float lowerX = x - nx;
         float lowerY = y - ny;
         
         if( !texture ) {
            glVertex2f( upperX, upperY );
            glVertex2f( lowerX, lowerY );
         }
         else {
            const OlTextureInfo &textureInfo = texture->textureInfo;
            
            texturePos += *lengthIter / textureInfo.imgWidth;
            
            if( texturePos > textureInfo.rect.w ) {
               texturePos = 0.0;
            }
            
            glTexCoord2f( textureInfo.rect.x + texturePos, textureInfo.rect.y );
            glVertex2f( upperX, upperY );
            glTexCoord2f( textureInfo.rect.x + texturePos, textureInfo.rect.y + textureInfo.rect.h );
            glVertex2f( lowerX, lowerY );
            
            typename std_container_v::const_iterator nextIter = vertexIter;
            nextIter++;
            
            bool renderingAllowed = nextIter == vertices.end();
            
            if( !renderingAllowed && connectFirstAndLast ) {
               renderingAllowed = true;
               nextIter = vertices.begin();
            }
            
            if( nextIter != vertices.end() ) {
               glTexCoord2f( textureInfo.rect.x + texturePos, textureInfo.rect.y );
               glVertex2f( upperX, upperY );
               glTexCoord2f( textureInfo.rect.x + texturePos, textureInfo.rect.y + textureInfo.rect.h );
               glVertex2f( lowerX, lowerY );
            }
         }
         
         // Store the information which can be used when calculating the next point //
         
         last.x = x;
         last.y = y;
         
         lastS.x = -bx;
         lastS.y = -by;
         /*
         lastUpperX = upperX;
         lastUpperY = upperY;
         
         lastLowerX = lowerX;
         lastLowerY = lowerY;
         */
         lengthIter++;
      }
      
      if( !connectFirstAndLast ) {
         // Render the end of the strip //
         
         float x = vertices.back().x;
         float y = vertices.back().y;
         
         float upperX = x + lastS.y * lineWidth;
         float upperY = y - lastS.x * lineWidth;
         
         float lowerX = x - lastS.y * lineWidth;
         float lowerY = y + lastS.x * lineWidth;
         
         if( color2 )
            color2->Select();
         
         glVertex2f( upperX, upperY );
         glVertex2f( lowerX, lowerY );
      }   
   glEnd();
   
   glPopMatrix();
   
#ifdef OL_NO_STATE_CHANGE
   if( texturesEnabled ) 
      glEnable( GL_TEXTURE_2D );
   else
      glDisable( GL_TEXTURE_2D );
#endif
}


}



#endif // OL_LINE_STRIP_RENDER_HPP