mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Do not use float as loop variable
apps/opencs/view/render/instanceselectionmode.cpp:294:9: warning: Variable 'i' with floating point type 'float' should not be used as a loop counter [clang-analyzer-security.FloatLoopCounter] for (float i = 0.0; i <= resolution; i += 2) ^ ~ ~
This commit is contained in:
parent
5b9ca3b979
commit
7501597813
1 changed files with 2 additions and 2 deletions
|
@ -284,14 +284,14 @@ namespace CSVRender
|
||||||
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry);
|
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry);
|
||||||
|
|
||||||
osg::Vec3Array *vertices = new osg::Vec3Array;
|
osg::Vec3Array *vertices = new osg::Vec3Array;
|
||||||
int resolution = 32;
|
constexpr int resolution = 32;
|
||||||
float radiusPerResolution = radius / resolution;
|
float radiusPerResolution = radius / resolution;
|
||||||
float reciprocalResolution = 1.0f / resolution;
|
float reciprocalResolution = 1.0f / resolution;
|
||||||
float doubleReciprocalRes = reciprocalResolution * 2;
|
float doubleReciprocalRes = reciprocalResolution * 2;
|
||||||
|
|
||||||
osg::Vec4Array *colours = new osg::Vec4Array;
|
osg::Vec4Array *colours = new osg::Vec4Array;
|
||||||
|
|
||||||
for (float i = 0.0; i <= resolution; i += 2)
|
for (int i = 0; i <= resolution; i += 2)
|
||||||
{
|
{
|
||||||
float iShifted = (static_cast<float>(i) - resolution / 2.0f); // i - 16 = -16 ... 16
|
float iShifted = (static_cast<float>(i) - resolution / 2.0f); // i - 16 = -16 ... 16
|
||||||
float xPercentile = iShifted * doubleReciprocalRes;
|
float xPercentile = iShifted * doubleReciprocalRes;
|
||||||
|
|
Loading…
Reference in a new issue