123 Ogre::SimpleSpline spline;
127 spline.setAutoCalculate(
false);
130 spline.addPoint(pp->position);
132 spline.recalcTangents();
135 for (
int i_point = 0; i_point < po->
getNumPoints(); i_point++)
143 for (
int i_seg = 1; i_seg <= num_segments; i_seg++)
147 po->
road->
addBlock(pp->position, pp->rotation, pp->type, pp->width, pp->bwidth, pp->bheight, pp->pillartype);
151 const float progress =
static_cast<float>(i_seg) /
static_cast<float>(num_segments);
154 const Ogre::Vector3 smooth_pos = spline.interpolate(i_point - 1, progress);
155 const Ogre::Quaternion smooth_rot = Quaternion::nlerp(progress, prev_pp->rotation, pp->rotation);
156 const float smooth_width = Math::lerp(prev_pp->width, pp->width, progress);
157 const float smooth_bwidth = Math::lerp(prev_pp->bwidth, pp->bwidth, progress);
158 const float smooth_bheight = Math::lerp(prev_pp->bheight, pp->bheight, progress);
160 po->
road->
addBlock(smooth_pos, smooth_rot, pp->type, smooth_width, smooth_bwidth, smooth_bheight, pp->pillartype);
167 po->
road->
addBlock(pp->position, pp->rotation, pp->type, pp->width, pp->bwidth, pp->bheight, pp->pillartype);
void addBlock(Ogre::Vector3 pos, Ogre::Quaternion rot, RoadType type, float width, float bwidth, float bheight, int pillartype=1)