mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 03:40:40 +00:00
Reduce scope for normal and color
This commit is contained in:
parent
829f325500
commit
e4584ce5dd
@ -202,9 +202,6 @@ namespace ESMTerrain
|
|||||||
normals.resize(numVerts * numVerts);
|
normals.resize(numVerts * numVerts);
|
||||||
colours.resize(numVerts * numVerts);
|
colours.resize(numVerts * numVerts);
|
||||||
|
|
||||||
osg::Vec3f normal;
|
|
||||||
osg::Vec4ub color;
|
|
||||||
|
|
||||||
LandCache cache;
|
LandCache cache;
|
||||||
|
|
||||||
bool alteration = useAlteration();
|
bool alteration = useAlteration();
|
||||||
@ -272,15 +269,15 @@ namespace ESMTerrain
|
|||||||
positions[vertIndex] = osg::Vec3f((vertX / float(numVerts - 1) - 0.5f) * size * landSizeInUnits,
|
positions[vertIndex] = osg::Vec3f((vertX / float(numVerts - 1) - 0.5f) * size * landSizeInUnits,
|
||||||
(vertY / float(numVerts - 1) - 0.5f) * size * landSizeInUnits, height);
|
(vertY / float(numVerts - 1) - 0.5f) * size * landSizeInUnits, height);
|
||||||
|
|
||||||
if (normalData)
|
osg::Vec3f normal(0, 0, 1);
|
||||||
|
|
||||||
|
if (normalData != nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
normal[i] = normalData->getNormals()[srcArrayIndex + i];
|
normal[i] = normalData->getNormals()[srcArrayIndex + i];
|
||||||
|
|
||||||
normal.normalize();
|
normal.normalize();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
normal = osg::Vec3f(0, 0, 1);
|
|
||||||
|
|
||||||
// Normals apparently don't connect seamlessly between cells
|
// Normals apparently don't connect seamlessly between cells
|
||||||
if (col == landSize - 1 || row == landSize - 1)
|
if (col == landSize - 1 || row == landSize - 1)
|
||||||
@ -294,17 +291,12 @@ namespace ESMTerrain
|
|||||||
|
|
||||||
normals[vertIndex] = normal;
|
normals[vertIndex] = normal;
|
||||||
|
|
||||||
if (colourData)
|
osg::Vec4ub color(255, 255, 255, 255);
|
||||||
{
|
|
||||||
|
if (colourData != nullptr)
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
color[i] = colourData->getColors()[srcArrayIndex + i];
|
color[i] = colourData->getColors()[srcArrayIndex + i];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
color.r() = 255;
|
|
||||||
color.g() = 255;
|
|
||||||
color.b() = 255;
|
|
||||||
}
|
|
||||||
if (alteration)
|
if (alteration)
|
||||||
adjustColor(col, row, heightData, color); // Does nothing by default, override in OpenMW-CS
|
adjustColor(col, row, heightData, color); // Does nothing by default, override in OpenMW-CS
|
||||||
|
|
||||||
@ -312,8 +304,6 @@ namespace ESMTerrain
|
|||||||
if (col == landSize - 1 || row == landSize - 1)
|
if (col == landSize - 1 || row == landSize - 1)
|
||||||
fixColour(color, cellLocation, col, row, cache);
|
fixColour(color, cellLocation, col, row, cache);
|
||||||
|
|
||||||
color.a() = 255;
|
|
||||||
|
|
||||||
colours[vertIndex] = color;
|
colours[vertIndex] = color;
|
||||||
|
|
||||||
++vertX;
|
++vertX;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user