Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/TexturedLineRData.cpp
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | case SOverlayTexturedLine::LINECAP_ROUND: | ||||
// Rotate the centerPoint -> corner vector by i*stepAngle radians around the cap plane normal at the center point. | // Rotate the centerPoint -> corner vector by i*stepAngle radians around the cap plane normal at the center point. | ||||
CQuaternion quatRotation; | CQuaternion quatRotation; | ||||
quatRotation.FromAxisAngle(capPlaneNormal, i * stepAngle); | quatRotation.FromAxisAngle(capPlaneNormal, i * stepAngle); | ||||
CVector3D worldPos3D = centerPoint + quatRotation.Rotate(rotationBaseVector); | CVector3D worldPos3D = centerPoint + quatRotation.Rotate(rotationBaseVector); | ||||
// Let v range from 0 to 1 as we move along the semi-circle, keep u fixed at 0 (i.e. curve the left vertical edge | // Let v range from 0 to 1 as we move along the semi-circle, keep u fixed at 0 (i.e. curve the left vertical edge | ||||
// of the texture around the edge of the semicircle) | // of the texture around the edge of the semicircle) | ||||
float u = 0.f; | float u = 0.f; | ||||
float v = clamp((i/(float)(roundCapPoints-1)), 0.f, 1.f); // pos, u, v | float v = Clamp((i / static_cast<float>(roundCapPoints - 1)), 0.f, 1.f); // pos, u, v | ||||
Stan: static_cast | |||||
Not Done Inline Actionsspaces Stan: spaces | |||||
verticesOut.push_back(SVertex(worldPos3D, u, v)); | verticesOut.push_back(SVertex(worldPos3D, u, v)); | ||||
} | } | ||||
// connect back to the other butt-end corner point to complete the semicircle | // connect back to the other butt-end corner point to complete the semicircle | ||||
verticesOut.push_back(SVertex(corner1, 0.f, 1.f)); | verticesOut.push_back(SVertex(corner1, 0.f, 1.f)); | ||||
// now push indices in GL_TRIANGLES order; vertices[indexOffset] is the center vertex, vertices[indexOffset + 1] is the | // now push indices in GL_TRIANGLES order; vertices[indexOffset] is the center vertex, vertices[indexOffset + 1] is the | ||||
// first corner point, then a bunch of radial samples, and then at the end we have the other corner point again. So: | // first corner point, then a bunch of radial samples, and then at the end we have the other corner point again. So: | ||||
Show All 35 Lines |
Wildfire Games · Phabricator
static_cast