- else
- {
- nsegs=1;
- float c=cos(dir);
- float s=sin(dir);
- for(unsigned i=0; i<2; ++i)
- {
- for(unsigned j=0; j<profile.size(); ++j)
- {
- unsigned k=j&~1;
- float dy=profile[k+1].y-profile[k].y;
- float dz=profile[k+1].z-profile[k].z;
- float d=sqrt(dy*dy+dz*dz);
- va_builder.normal(s*dz/d, -c*dz/d, dy/d);
-
- float len=(part.dead_end && i==1 && j>=6) ? length/2 : length;
- Point p(x+c*len*i-s*profile[j].y, y+s*len*i+c*profile[j].y, profile[j].z+i*track.get_slope());
- va_builder.vertex(p.x, p.y, p.z);
- if(profile[j].z==0)
- border.push_back(p);
- }
- }
- }
-
- for(unsigned i=0; i<nsegs; ++i)
- {
- for(unsigned j=0; j<3; ++j)
- {
- base_seq.push_back(base_index+i*psize+j*2);
- base_seq.push_back(base_index+(i+1)*psize+j*2);
- base_seq.push_back(base_index+(i+1)*psize+1+j*2);
- base_seq.push_back(base_index+i*psize+1+j*2);
- }
- for(unsigned j=3; j<9; ++j)
- {
- rail_seq.push_back(base_index+i*psize+j*2);
- rail_seq.push_back(base_index+(i+1)*psize+j*2);
- rail_seq.push_back(base_index+(i+1)*psize+1+j*2);
- rail_seq.push_back(base_index+i*psize+1+j*2);
- }
- route_seq[part.route].push_back(base_index+i*psize+18);
- route_seq[part.route].push_back(base_index+(i+1)*psize+18);
- route_seq[part.route].push_back(base_index+(i+1)*psize+19);
- route_seq[part.route].push_back(base_index+i*psize+19);
- }
-
- base_index+=(nsegs+1)*psize;