mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-22 13:53:06 +00:00
Address remaining conversion warnings in components
This commit is contained in:
parent
a8831651bb
commit
cb82d37992
9 changed files with 66 additions and 68 deletions
|
|
@ -195,7 +195,7 @@ namespace DetourNavigator
|
||||||
TileId NavMeshDb::getMaxTileId()
|
TileId NavMeshDb::getMaxTileId()
|
||||||
{
|
{
|
||||||
TileId tileId{ 0 };
|
TileId tileId{ 0 };
|
||||||
request(*mDb, mGetMaxTileId, &tileId, 1);
|
request(*mDb, mGetMaxTileId, &tileId.mValue, 1);
|
||||||
return tileId;
|
return tileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ namespace DetourNavigator
|
||||||
ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
|
ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
|
||||||
{
|
{
|
||||||
Tile result;
|
Tile result;
|
||||||
auto row = std::tie(result.mTileId, result.mVersion);
|
auto row = std::tie(result.mTileId.mValue, result.mVersion.mValue);
|
||||||
const std::vector<std::byte> compressedInput = Misc::compress(input);
|
const std::vector<std::byte> compressedInput = Misc::compress(input);
|
||||||
if (&row == request(*mDb, mFindTile, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
|
if (&row == request(*mDb, mFindTile, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
|
||||||
return {};
|
return {};
|
||||||
|
|
@ -214,7 +214,7 @@ namespace DetourNavigator
|
||||||
ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
|
ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
|
||||||
{
|
{
|
||||||
TileData result;
|
TileData result;
|
||||||
auto row = std::tie(result.mTileId, result.mVersion, result.mData);
|
auto row = std::tie(result.mTileId.mValue, result.mVersion.mValue, result.mData);
|
||||||
const std::vector<std::byte> compressedInput = Misc::compress(input);
|
const std::vector<std::byte> compressedInput = Misc::compress(input);
|
||||||
if (&row == request(*mDb, mGetTileData, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
|
if (&row == request(*mDb, mGetTileData, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
|
||||||
return {};
|
return {};
|
||||||
|
|
@ -255,14 +255,14 @@ namespace DetourNavigator
|
||||||
ShapeId NavMeshDb::getMaxShapeId()
|
ShapeId NavMeshDb::getMaxShapeId()
|
||||||
{
|
{
|
||||||
ShapeId shapeId{ 0 };
|
ShapeId shapeId{ 0 };
|
||||||
request(*mDb, mGetMaxShapeId, &shapeId, 1);
|
request(*mDb, mGetMaxShapeId, &shapeId.mValue, 1);
|
||||||
return shapeId;
|
return shapeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ShapeId> NavMeshDb::findShapeId(std::string_view name, ShapeType type, const Sqlite3::ConstBlob& hash)
|
std::optional<ShapeId> NavMeshDb::findShapeId(std::string_view name, ShapeType type, const Sqlite3::ConstBlob& hash)
|
||||||
{
|
{
|
||||||
ShapeId shapeId;
|
ShapeId shapeId;
|
||||||
if (&shapeId == request(*mDb, mFindShapeId, &shapeId, 1, name, type, hash))
|
if (&shapeId.mValue == request(*mDb, mFindShapeId, &shapeId.mValue, 1, name, type, hash))
|
||||||
return {};
|
return {};
|
||||||
return shapeId;
|
return shapeId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,11 +130,11 @@ namespace ESMTerrain
|
||||||
osg::ref_ptr<const LandObject> land = getLand(ESM::ExteriorCellLocation(cellX, cellY, worldspace));
|
osg::ref_ptr<const LandObject> land = getLand(ESM::ExteriorCellLocation(cellX, cellY, worldspace));
|
||||||
const ESM::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : nullptr;
|
const ESM::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : nullptr;
|
||||||
const int landSize = ESM::getLandSize(worldspace);
|
const int landSize = ESM::getLandSize(worldspace);
|
||||||
int startRow = (origin.x() - cellX) * landSize;
|
int startRow = static_cast<int>((origin.x() - cellX) * landSize);
|
||||||
int startColumn = (origin.y() - cellY) * landSize;
|
int startColumn = static_cast<int>((origin.y() - cellY) * landSize);
|
||||||
|
|
||||||
int endRow = startRow + size * (landSize - 1) + 1;
|
int endRow = static_cast<int>(startRow + size * (landSize - 1) + 1);
|
||||||
int endColumn = startColumn + size * (landSize - 1) + 1;
|
int endColumn = static_cast<int>(startColumn + size * (landSize - 1) + 1);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
|
@ -283,8 +283,8 @@ namespace ESMTerrain
|
||||||
|
|
||||||
const auto handleSample = [&](std::size_t cellShiftX, std::size_t cellShiftY, std::size_t row, std::size_t col,
|
const auto handleSample = [&](std::size_t cellShiftX, std::size_t cellShiftY, std::size_t row, std::size_t col,
|
||||||
std::size_t vertX, std::size_t vertY) {
|
std::size_t vertX, std::size_t vertY) {
|
||||||
const int cellX = startCellX + cellShiftX;
|
const int cellX = startCellX + static_cast<int>(cellShiftX);
|
||||||
const int cellY = startCellY + cellShiftY;
|
const int cellY = startCellY + static_cast<int>(cellShiftY);
|
||||||
const std::pair cell{ cellX, cellY };
|
const std::pair cell{ cellX, cellY };
|
||||||
const ESM::ExteriorCellLocation cellLocation(cellX, cellY, worldspace);
|
const ESM::ExteriorCellLocation cellLocation(cellX, cellY, worldspace);
|
||||||
|
|
||||||
|
|
@ -311,7 +311,7 @@ namespace ESMTerrain
|
||||||
if (heightData != nullptr)
|
if (heightData != nullptr)
|
||||||
height = heightData->getHeights()[col * cellSize + row];
|
height = heightData->getHeights()[col * cellSize + row];
|
||||||
if (alteration)
|
if (alteration)
|
||||||
height += getAlteredHeight(col, row);
|
height += getAlteredHeight(static_cast<int>(col), static_cast<int>(row));
|
||||||
|
|
||||||
const std::size_t vertIndex = vertX * numVerts + vertY;
|
const std::size_t vertIndex = vertX * numVerts + vertY;
|
||||||
|
|
||||||
|
|
@ -325,7 +325,7 @@ namespace ESMTerrain
|
||||||
|
|
||||||
if (normalData != nullptr)
|
if (normalData != nullptr)
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; i < 3; ++i)
|
for (unsigned short i = 0; i < 3; ++i)
|
||||||
normal[i] = normalData->getNormals()[srcArrayIndex + i];
|
normal[i] = normalData->getNormals()[srcArrayIndex + i];
|
||||||
|
|
||||||
normal.normalize();
|
normal.normalize();
|
||||||
|
|
@ -333,11 +333,11 @@ namespace ESMTerrain
|
||||||
|
|
||||||
// Normals apparently don't connect seamlessly between cells
|
// Normals apparently don't connect seamlessly between cells
|
||||||
if (col == cellSize - 1 || row == cellSize - 1)
|
if (col == cellSize - 1 || row == cellSize - 1)
|
||||||
fixNormal(normal, cellLocation, col, row, cache);
|
fixNormal(normal, cellLocation, static_cast<int>(col), static_cast<int>(row), cache);
|
||||||
|
|
||||||
// some corner normals appear to be complete garbage (z < 0)
|
// some corner normals appear to be complete garbage (z < 0)
|
||||||
if ((row == 0 || row == cellSize - 1) && (col == 0 || col == cellSize - 1))
|
if ((row == 0 || row == cellSize - 1) && (col == 0 || col == cellSize - 1))
|
||||||
averageNormal(normal, cellLocation, col, row, cache);
|
averageNormal(normal, cellLocation, static_cast<int>(col), static_cast<int>(row), cache);
|
||||||
|
|
||||||
assert(normal.z() > 0);
|
assert(normal.z() > 0);
|
||||||
|
|
||||||
|
|
@ -346,16 +346,16 @@ namespace ESMTerrain
|
||||||
osg::Vec4ub color(255, 255, 255, 255);
|
osg::Vec4ub color(255, 255, 255, 255);
|
||||||
|
|
||||||
if (colourData != nullptr)
|
if (colourData != nullptr)
|
||||||
for (std::size_t i = 0; i < 3; ++i)
|
for (unsigned short i = 0; i < 3; ++i)
|
||||||
color[i] = colourData->getColors()[srcArrayIndex + i];
|
color[i] = colourData->getColors()[srcArrayIndex + i];
|
||||||
|
|
||||||
// Does nothing by default, override in OpenMW-CS
|
// Does nothing by default, override in OpenMW-CS
|
||||||
if (alteration)
|
if (alteration)
|
||||||
adjustColor(col, row, heightData, color);
|
adjustColor(static_cast<int>(col), static_cast<int>(row), heightData, color);
|
||||||
|
|
||||||
// Unlike normals, colors mostly connect seamlessly between cells, but not always...
|
// Unlike normals, colors mostly connect seamlessly between cells, but not always...
|
||||||
if (col == cellSize - 1 || row == cellSize - 1)
|
if (col == cellSize - 1 || row == cellSize - 1)
|
||||||
fixColour(color, cellLocation, col, row, cache);
|
fixColour(color, cellLocation, static_cast<int>(col), static_cast<int>(row), cache);
|
||||||
|
|
||||||
colours[vertIndex] = color;
|
colours[vertIndex] = color;
|
||||||
};
|
};
|
||||||
|
|
@ -445,7 +445,7 @@ namespace ESMTerrain
|
||||||
|
|
||||||
unsigned char* const baseBlendmap = getOrCreateBlendmap(ESM::FormId::fromUint32(ltex.base.formId));
|
unsigned char* const baseBlendmap = getOrCreateBlendmap(ESM::FormId::fromUint32(ltex.base.formId));
|
||||||
int starty = (static_cast<int>(sample.mDstCol) - 1) * quadSize;
|
int starty = (static_cast<int>(sample.mDstCol) - 1) * quadSize;
|
||||||
int startx = sample.mDstRow * quadSize;
|
int startx = static_cast<int>(sample.mDstRow) * quadSize;
|
||||||
for (int y = std::max(0, starty + 1); y <= starty + quadSize && y < blendmapSize; ++y)
|
for (int y = std::max(0, starty + 1); y <= starty + quadSize && y < blendmapSize; ++y)
|
||||||
{
|
{
|
||||||
unsigned char* const row = baseBlendmap + (blendmapSize - y - 1) * blendmapSize;
|
unsigned char* const row = baseBlendmap + (blendmapSize - y - 1) * blendmapSize;
|
||||||
|
|
@ -465,9 +465,9 @@ namespace ESMTerrain
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int index = (blendmapSize - starty - y - 1) * blendmapSize + startx + x;
|
size_t index = static_cast<size_t>((blendmapSize - starty - y - 1) * blendmapSize + startx + x);
|
||||||
int delta = std::clamp(static_cast<int>(v.opacity * 255), 0, 255);
|
auto delta = static_cast<unsigned char>(std::clamp(static_cast<int>(v.opacity * 255.f), 0, 255));
|
||||||
baseBlendmap[index] = std::max(0, baseBlendmap[index] - delta);
|
baseBlendmap[index] = std::max<unsigned char>(0, baseBlendmap[index] - delta);
|
||||||
layerBlendmap[index] = delta;
|
layerBlendmap[index] = delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -567,7 +567,7 @@ namespace ESMTerrain
|
||||||
|
|
||||||
float Storage::getHeightAt(const osg::Vec3f& worldPos, ESM::RefId worldspace)
|
float Storage::getHeightAt(const osg::Vec3f& worldPos, ESM::RefId worldspace)
|
||||||
{
|
{
|
||||||
const float cellSize = ESM::getCellSize(worldspace);
|
const float cellSize = static_cast<float>(ESM::getCellSize(worldspace));
|
||||||
int cellX = static_cast<int>(std::floor(worldPos.x() / cellSize));
|
int cellX = static_cast<int>(std::floor(worldPos.x() / cellSize));
|
||||||
int cellY = static_cast<int>(std::floor(worldPos.y() / cellSize));
|
int cellY = static_cast<int>(std::floor(worldPos.y() / cellSize));
|
||||||
|
|
||||||
|
|
@ -645,7 +645,8 @@ namespace ESMTerrain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Solve plane equation for z
|
// Solve plane equation for z
|
||||||
return (-plane.getNormal().x() * nX - plane.getNormal().y() * nY - plane[3]) / plane.getNormal().z() * cellSize;
|
return static_cast<float>(
|
||||||
|
(-plane.getNormal().x() * nX - plane.getNormal().y() * nY - plane[3]) / plane.getNormal().z() * cellSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
const LandObject* Storage::getLand(ESM::ExteriorCellLocation cellLocation, LandCache& cache)
|
const LandObject* Storage::getLand(ESM::ExteriorCellLocation cellLocation, LandCache& cache)
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ namespace Fx
|
||||||
if constexpr (std::is_fundamental_v<UType>)
|
if constexpr (std::is_fundamental_v<UType>)
|
||||||
{
|
{
|
||||||
mUniform->template setValue<UType>(mValue);
|
mUniform->template setValue<UType>(mValue);
|
||||||
range = mUniform->template getMax<UType>() - mUniform->template getMin<UType>();
|
range = static_cast<float>(mUniform->template getMax<UType>() - mUniform->template getMin<UType>());
|
||||||
min = mUniform->template getMin<UType>();
|
min = static_cast<float>(mUniform->template getMin<UType>());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -155,9 +155,9 @@ namespace Fx
|
||||||
void notifyMouseWheel(MyGUI::Widget* /*sender*/, int rel)
|
void notifyMouseWheel(MyGUI::Widget* /*sender*/, int rel)
|
||||||
{
|
{
|
||||||
if (rel > 0)
|
if (rel > 0)
|
||||||
increment(mUniform->mStep);
|
increment(static_cast<T>(mUniform->mStep));
|
||||||
else
|
else
|
||||||
increment(-mUniform->mStep);
|
increment(static_cast<T>(-mUniform->mStep));
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyMouseButtonDragged(MyGUI::Widget* /*sender*/, int left, int top, MyGUI::MouseButton id)
|
void notifyMouseButtonDragged(MyGUI::Widget* /*sender*/, int left, int top, MyGUI::MouseButton id)
|
||||||
|
|
@ -169,15 +169,15 @@ namespace Fx
|
||||||
|
|
||||||
// allow finer tuning when shift is pressed
|
// allow finer tuning when shift is pressed
|
||||||
constexpr double scaling = 20.0;
|
constexpr double scaling = 20.0;
|
||||||
T step
|
T step = static_cast<T>(
|
||||||
= MyGUI::InputManager::getInstance().isShiftPressed() ? mUniform->mStep / scaling : mUniform->mStep;
|
MyGUI::InputManager::getInstance().isShiftPressed() ? mUniform->mStep / scaling : mUniform->mStep);
|
||||||
|
|
||||||
if (step == 0)
|
if (step == 0)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_integral_v<T>)
|
if constexpr (std::is_integral_v<T>)
|
||||||
step = 1;
|
step = 1;
|
||||||
else
|
else
|
||||||
step = mUniform->mStep;
|
step = static_cast<T>(mUniform->mStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta > 0)
|
if (delta > 0)
|
||||||
|
|
@ -209,9 +209,9 @@ namespace Fx
|
||||||
void notifyButtonClicked(MyGUI::Widget* sender)
|
void notifyButtonClicked(MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
if (sender == mButtonDecrease)
|
if (sender == mButtonDecrease)
|
||||||
increment(-mUniform->mStep);
|
increment(static_cast<T>(-mUniform->mStep));
|
||||||
else if (sender == mButtonIncrease)
|
else if (sender == mButtonIncrease)
|
||||||
increment(mUniform->mStep);
|
increment(static_cast<T>(mUniform->mStep));
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::Button* mButtonDecrease{ nullptr };
|
MyGUI::Button* mButtonDecrease{ nullptr };
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ namespace LuaUtil
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendType(out, SerializedType::LONG_STRING);
|
appendType(out, SerializedType::LONG_STRING);
|
||||||
appendValue<uint32_t>(out, str.size());
|
appendValue<uint32_t>(out, static_cast<uint32_t>(str.size()));
|
||||||
}
|
}
|
||||||
out.append(str.data(), str.size());
|
out.append(str.data(), str.size());
|
||||||
}
|
}
|
||||||
|
|
@ -83,14 +83,14 @@ namespace LuaUtil
|
||||||
assert(!typeName.empty() && typeName.size() <= 64);
|
assert(!typeName.empty() && typeName.size() <= 64);
|
||||||
if (typeName.size() <= 8 && dataSize < 16)
|
if (typeName.size() <= 8 && dataSize < 16)
|
||||||
{ // Compact form: 0b1SSSSTTT. SSSS = dataSize, TTT = (typeName size - 1).
|
{ // Compact form: 0b1SSSSTTT. SSSS = dataSize, TTT = (typeName size - 1).
|
||||||
unsigned char t = CUSTOM_COMPACT_FLAG | (dataSize << 3) | (typeName.size() - 1);
|
auto t = static_cast<unsigned char>(CUSTOM_COMPACT_FLAG | (dataSize << 3) | (typeName.size() - 1));
|
||||||
out.push_back(t);
|
out.push_back(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Full form: 0b01TTTTTT + 32bit dataSize.
|
{ // Full form: 0b01TTTTTT + 32bit dataSize.
|
||||||
unsigned char t = CUSTOM_FULL_FLAG | (typeName.size() - 1);
|
auto t = static_cast<unsigned char>(CUSTOM_FULL_FLAG | (typeName.size() - 1));
|
||||||
out.push_back(t);
|
out.push_back(t);
|
||||||
appendValue<uint32_t>(out, dataSize);
|
appendValue<uint32_t>(out, static_cast<uint32_t>(dataSize));
|
||||||
}
|
}
|
||||||
out.append(typeName.data(), typeName.size());
|
out.append(typeName.data(), typeName.size());
|
||||||
appendData(out, data, dataSize);
|
appendData(out, data, dataSize);
|
||||||
|
|
@ -156,8 +156,8 @@ namespace LuaUtil
|
||||||
{
|
{
|
||||||
appendType(out, SerializedType::TRANSFORM_M);
|
appendType(out, SerializedType::TRANSFORM_M);
|
||||||
osg::Matrixf matrix = data.as<TransformM>().mM;
|
osg::Matrixf matrix = data.as<TransformM>().mM;
|
||||||
for (size_t i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
for (size_t j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
appendValue<double>(out, matrix(i, j));
|
appendValue<double>(out, matrix(i, j));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ namespace LuaUtil
|
||||||
{
|
{
|
||||||
appendType(out, SerializedType::TRANSFORM_Q);
|
appendType(out, SerializedType::TRANSFORM_Q);
|
||||||
osg::Quat quat = data.as<TransformQ>().mQ;
|
osg::Quat quat = data.as<TransformQ>().mQ;
|
||||||
for (size_t i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
appendValue<double>(out, quat[i]);
|
appendValue<double>(out, quat[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -304,16 +304,16 @@ namespace LuaUtil
|
||||||
throw std::runtime_error("Unexpected end of table during deserialization.");
|
throw std::runtime_error("Unexpected end of table during deserialization.");
|
||||||
case SerializedType::VEC2:
|
case SerializedType::VEC2:
|
||||||
{
|
{
|
||||||
float x = getValue<double>(binaryData);
|
float x = static_cast<float>(getValue<double>(binaryData));
|
||||||
float y = getValue<double>(binaryData);
|
float y = static_cast<float>(getValue<double>(binaryData));
|
||||||
sol::stack::push<osg::Vec2f>(lua, osg::Vec2f(x, y));
|
sol::stack::push<osg::Vec2f>(lua, osg::Vec2f(x, y));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SerializedType::VEC3:
|
case SerializedType::VEC3:
|
||||||
{
|
{
|
||||||
float x = getValue<double>(binaryData);
|
float x = static_cast<float>(getValue<double>(binaryData));
|
||||||
float y = getValue<double>(binaryData);
|
float y = static_cast<float>(getValue<double>(binaryData));
|
||||||
float z = getValue<double>(binaryData);
|
float z = static_cast<float>(getValue<double>(binaryData));
|
||||||
sol::stack::push<osg::Vec3f>(lua, osg::Vec3f(x, y, z));
|
sol::stack::push<osg::Vec3f>(lua, osg::Vec3f(x, y, z));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -322,7 +322,7 @@ namespace LuaUtil
|
||||||
osg::Matrixf mat;
|
osg::Matrixf mat;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
mat(i, j) = getValue<double>(binaryData);
|
mat(i, j) = static_cast<float>(getValue<double>(binaryData));
|
||||||
sol::stack::push<TransformM>(lua, asTransform(mat));
|
sol::stack::push<TransformM>(lua, asTransform(mat));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -336,10 +336,10 @@ namespace LuaUtil
|
||||||
}
|
}
|
||||||
case SerializedType::VEC4:
|
case SerializedType::VEC4:
|
||||||
{
|
{
|
||||||
float x = getValue<double>(binaryData);
|
float x = static_cast<float>(getValue<double>(binaryData));
|
||||||
float y = getValue<double>(binaryData);
|
float y = static_cast<float>(getValue<double>(binaryData));
|
||||||
float z = getValue<double>(binaryData);
|
float z = static_cast<float>(getValue<double>(binaryData));
|
||||||
float w = getValue<double>(binaryData);
|
float w = static_cast<float>(getValue<double>(binaryData));
|
||||||
sol::stack::push<osg::Vec4f>(lua, osg::Vec4f(x, y, z, w));
|
sol::stack::push<osg::Vec4f>(lua, osg::Vec4f(x, y, z, w));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ namespace Misc
|
||||||
throw std::logic_error(std::string("Invalid hex color: ") += hex);
|
throw std::logic_error(std::string("Invalid hex color: ") += hex);
|
||||||
Color col;
|
Color col;
|
||||||
col.mValue.a() = 1;
|
col.mValue.a() = 1;
|
||||||
for (size_t i = 0; i < 3; i++)
|
for (unsigned i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
auto sub = hex.substr(i * 2, 2);
|
auto sub = hex.substr(i * 2, 2);
|
||||||
int v = 0;
|
unsigned char v = 0;
|
||||||
auto [_, ec] = std::from_chars(sub.data(), sub.data() + sub.size(), v, 16);
|
auto [_, ec] = std::from_chars(sub.data(), sub.data() + sub.size(), v, 16);
|
||||||
if (ec != std::errc())
|
if (ec != std::errc())
|
||||||
throw std::logic_error(std::string("Invalid hex color: ") += hex);
|
throw std::logic_error(std::string("Invalid hex color: ") += hex);
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Misc
|
||||||
std::string Color::toHex() const
|
std::string Color::toHex() const
|
||||||
{
|
{
|
||||||
std::string result(6, '0');
|
std::string result(6, '0');
|
||||||
for (size_t i = 0; i < 3; i++)
|
for (unsigned i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
int b = static_cast<int>(mValue[i] * 255.0f);
|
int b = static_cast<int>(mValue[i] * 255.0f);
|
||||||
char* start = result.data() + i * 2;
|
char* start = result.data() + i * 2;
|
||||||
|
|
|
||||||
|
|
@ -1554,8 +1554,7 @@ namespace NifOsg
|
||||||
|
|
||||||
const auto& uvlist = niGeometryData->mUVList;
|
const auto& uvlist = niGeometryData->mUVList;
|
||||||
int textureStage = 0;
|
int textureStage = 0;
|
||||||
for (std::vector<unsigned int>::const_iterator it = boundTextures.begin(); it != boundTextures.end();
|
for (auto it = boundTextures.begin(); it != boundTextures.end(); ++it, ++textureStage)
|
||||||
++it, ++textureStage)
|
|
||||||
{
|
{
|
||||||
unsigned int uvSet = *it;
|
unsigned int uvSet = *it;
|
||||||
if (uvSet >= uvlist.size())
|
if (uvSet >= uvlist.size())
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,8 @@ namespace Resource
|
||||||
{
|
{
|
||||||
if (NifOsg::FlipController* flipctrl = dynamic_cast<NifOsg::FlipController*>(&ctrl))
|
if (NifOsg::FlipController* flipctrl = dynamic_cast<NifOsg::FlipController*>(&ctrl))
|
||||||
{
|
{
|
||||||
for (std::vector<osg::ref_ptr<osg::Texture2D>>::iterator it = flipctrl->getTextures().begin();
|
for (const osg::ref_ptr<osg::Texture2D>& tex : flipctrl->getTextures())
|
||||||
it != flipctrl->getTextures().end(); ++it)
|
|
||||||
{
|
{
|
||||||
osg::Texture* tex = *it;
|
|
||||||
tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter);
|
tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter);
|
||||||
tex->setFilter(osg::Texture::MAG_FILTER, mMagFilter);
|
tex->setFilter(osg::Texture::MAG_FILTER, mMagFilter);
|
||||||
tex->setMaxAnisotropy(mMaxAnisotropy);
|
tex->setMaxAnisotropy(mMaxAnisotropy);
|
||||||
|
|
|
||||||
|
|
@ -283,8 +283,8 @@ namespace Terrain
|
||||||
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
|
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
|
||||||
int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize,
|
int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize,
|
||||||
bool debugChunks, ESM::RefId worldspace, double expiryDelay)
|
bool debugChunks, ESM::RefId worldspace, double expiryDelay)
|
||||||
: TerrainGrid(parent, compileRoot, resourceSystem, storage, nodeMask, worldspace, expiryDelay, preCompileMask,
|
: TerrainGrid(
|
||||||
borderMask)
|
parent, compileRoot, resourceSystem, storage, nodeMask, worldspace, expiryDelay, preCompileMask, borderMask)
|
||||||
, mViewDataMap(new ViewDataMap)
|
, mViewDataMap(new ViewDataMap)
|
||||||
, mQuadTreeBuilt(false)
|
, mQuadTreeBuilt(false)
|
||||||
, mLodFactor(lodFactor)
|
, mLodFactor(lodFactor)
|
||||||
|
|
|
||||||
|
|
@ -176,14 +176,14 @@ namespace Gui
|
||||||
|
|
||||||
void HBox::align()
|
void HBox::align()
|
||||||
{
|
{
|
||||||
unsigned int count = getChildCount();
|
const size_t count = getChildCount();
|
||||||
size_t hStretchedCount = 0;
|
int hStretchedCount = 0;
|
||||||
int totalWidth = 0;
|
int totalWidth = 0;
|
||||||
int totalHeight = 0;
|
int totalHeight = 0;
|
||||||
std::vector<std::pair<MyGUI::IntSize, bool>> sizes;
|
std::vector<std::pair<MyGUI::IntSize, bool>> sizes;
|
||||||
sizes.resize(count);
|
sizes.resize(count);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
MyGUI::Widget* w = getChildAt(i);
|
MyGUI::Widget* w = getChildAt(i);
|
||||||
bool hstretch = w->getUserString("HStretch") == "true";
|
bool hstretch = w->getUserString("HStretch") == "true";
|
||||||
|
|
@ -221,7 +221,7 @@ namespace Gui
|
||||||
}
|
}
|
||||||
|
|
||||||
int curX = 0;
|
int curX = 0;
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
curX += mPadding;
|
curX += mPadding;
|
||||||
|
|
@ -328,13 +328,13 @@ namespace Gui
|
||||||
|
|
||||||
void VBox::align()
|
void VBox::align()
|
||||||
{
|
{
|
||||||
unsigned int count = getChildCount();
|
const size_t count = getChildCount();
|
||||||
size_t vStretchedCount = 0;
|
int vStretchedCount = 0;
|
||||||
int totalHeight = 0;
|
int totalHeight = 0;
|
||||||
int totalWidth = 0;
|
int totalWidth = 0;
|
||||||
std::vector<std::pair<MyGUI::IntSize, bool>> sizes;
|
std::vector<std::pair<MyGUI::IntSize, bool>> sizes;
|
||||||
sizes.resize(count);
|
sizes.resize(count);
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
MyGUI::Widget* w = getChildAt(i);
|
MyGUI::Widget* w = getChildAt(i);
|
||||||
|
|
||||||
|
|
@ -375,7 +375,7 @@ namespace Gui
|
||||||
}
|
}
|
||||||
|
|
||||||
int curY = 0;
|
int curY = 0;
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
curY += mPadding;
|
curY += mPadding;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue