mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-29 09:04:28 +00:00
Fix most conversion warnings in components
This commit is contained in:
parent
98291f1377
commit
f7292680d6
46 changed files with 298 additions and 256 deletions
|
|
@ -13,7 +13,7 @@
|
|||
static osg::Vec3 sphereCoordToCartesian(float theta, float phi, float r)
|
||||
{
|
||||
osg::Vec3 returnVec = osg::Vec3(0.0, 0.0, 0.0);
|
||||
float phiToHorizontal = osg::PI_2 - phi;
|
||||
float phiToHorizontal = osg::PI_2f - phi;
|
||||
returnVec.x() = std::cos(theta);
|
||||
returnVec.y() = std::sin(theta);
|
||||
returnVec.z() = std::sin(phiToHorizontal);
|
||||
|
|
@ -36,9 +36,9 @@ static void generateWireCube(osg::Geometry& geom, float dim)
|
|||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
osg::Vec3 vert1 = osg::Vec3(indexPos[i].x() - 0.5, indexPos[i].y() - 0.5, 0.5);
|
||||
osg::Vec3 vert1 = osg::Vec3(indexPos[i].x() - 0.5f, indexPos[i].y() - 0.5f, 0.5f);
|
||||
int next = (i + 1) % 4;
|
||||
osg::Vec3 vert2 = osg::Vec3(indexPos[next].x() - 0.5, indexPos[next].y() - 0.5, 0.5);
|
||||
osg::Vec3 vert2 = osg::Vec3(indexPos[next].x() - 0.5f, indexPos[next].y() - 0.5f, 0.5f);
|
||||
|
||||
vertices->push_back(vert1 * dim);
|
||||
vertices->push_back(vert2 * dim);
|
||||
|
|
@ -59,7 +59,7 @@ static void generateWireCube(osg::Geometry& geom, float dim)
|
|||
|
||||
geom.setVertexArray(vertices);
|
||||
geom.setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
|
||||
geom.addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, vertices->size()));
|
||||
geom.addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, static_cast<GLsizei>(vertices->size())));
|
||||
}
|
||||
|
||||
static void generateCube(osg::Geometry& geom, float dim)
|
||||
|
|
@ -68,14 +68,13 @@ static void generateCube(osg::Geometry& geom, float dim)
|
|||
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
|
||||
osg::ref_ptr<osg::DrawElementsUShort> indices = new osg::DrawElementsUShort(osg::DrawElementsUShort::TRIANGLES, 0);
|
||||
|
||||
for (int iFace = 0; iFace < 6; iFace++)
|
||||
for (GLushort iFace = 0; iFace < 6; iFace++)
|
||||
{
|
||||
osg::Vec3f normale(0., 0., 0.);
|
||||
osg::Vec3f u(0., 0., 0.);
|
||||
osg::Vec3f v(0., 0., 0.);
|
||||
int axis = iFace / 2;
|
||||
int dir = iFace % 2 == 0 ? -1 : 1;
|
||||
float floatDir = dir;
|
||||
GLushort axis = iFace / 2;
|
||||
float floatDir = iFace % 2 == 0 ? -1.f : 1.f;
|
||||
normale[axis] = floatDir;
|
||||
u[(axis + 1) % 3] = 1.0;
|
||||
v[(axis + 2) % 3] = 1.0;
|
||||
|
|
@ -85,20 +84,20 @@ static void generateCube(osg::Geometry& geom, float dim)
|
|||
float iu = iPoint % 2 == 1
|
||||
? floatDir
|
||||
: -floatDir; // This is to get the right triangle orientation when the normal changes*
|
||||
float iv = iPoint / 2 == 1 ? 1.0 : -1.0;
|
||||
float iv = iPoint / 2 == 1 ? 1.f : -1.f;
|
||||
osg::Vec3f point = (u * iu) + (v * iv);
|
||||
point = (point + normale);
|
||||
point = point * (dim * 0.5f);
|
||||
vertices->push_back(point);
|
||||
normals->push_back(normale);
|
||||
}
|
||||
int startVertex(iFace * 4);
|
||||
int newFace1[] = { startVertex, startVertex + 1, startVertex + 2 };
|
||||
GLushort startVertex(iFace * 4);
|
||||
GLushort newFace1[] = { startVertex, startVertex + 1u, startVertex + 2u };
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
indices->push_back(newFace1[i]);
|
||||
}
|
||||
int newFace2[] = { startVertex + 2, startVertex + 1, startVertex + 3 };
|
||||
GLushort newFace2[] = { startVertex + 2u, startVertex + 1u, startVertex + 3u };
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
indices->push_back(newFace2[i]);
|
||||
|
|
@ -123,25 +122,25 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
|||
// top disk
|
||||
for (int i = 0; i < subdiv; i++)
|
||||
{
|
||||
float theta = (float(i) / float(subdiv)) * osg::PI * 2.;
|
||||
osg::Vec3 pos = sphereCoordToCartesian(theta, osg::PI_2f, 1.);
|
||||
float theta = (float(i) / float(subdiv)) * osg::PIf * 2.f;
|
||||
osg::Vec3 pos = sphereCoordToCartesian(theta, osg::PI_2f, 1.f);
|
||||
pos *= radius;
|
||||
pos.z() = height / 2.;
|
||||
pos.z() = height / 2.f;
|
||||
vertices->push_back(pos);
|
||||
normals->push_back(topNormal);
|
||||
iVertex += 1;
|
||||
}
|
||||
auto centerTop = iVertex;
|
||||
auto centerTop = static_cast<GLushort>(iVertex);
|
||||
// centerTop
|
||||
{
|
||||
vertices->push_back(osg::Vec3(0., 0., height / 2.));
|
||||
vertices->push_back(osg::Vec3(0.f, 0.f, height / 2.f));
|
||||
normals->push_back(topNormal);
|
||||
iVertex += 1;
|
||||
}
|
||||
auto centerBot = iVertex;
|
||||
auto centerBot = static_cast<GLushort>(iVertex);
|
||||
// centerBot
|
||||
{
|
||||
vertices->push_back(osg::Vec3(0., 0., -height / 2));
|
||||
vertices->push_back(osg::Vec3(0.f, 0.f, -height / 2));
|
||||
normals->push_back(-topNormal);
|
||||
iVertex += 1;
|
||||
}
|
||||
|
|
@ -149,10 +148,10 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
|||
auto beginBot = iVertex;
|
||||
for (int i = 0; i < subdiv; i++)
|
||||
{
|
||||
float theta = float(i) / float(subdiv) * osg::PI * 2.;
|
||||
osg::Vec3 pos = sphereCoordToCartesian(theta, osg::PI_2f, 1.);
|
||||
float theta = float(i) / float(subdiv) * osg::PIf * 2.f;
|
||||
osg::Vec3 pos = sphereCoordToCartesian(theta, osg::PI_2f, 1.f);
|
||||
pos *= radius;
|
||||
pos.z() = -height / 2.;
|
||||
pos.z() = -height / 2.f;
|
||||
vertices->push_back(pos);
|
||||
normals->push_back(-topNormal);
|
||||
iVertex += 1;
|
||||
|
|
@ -161,13 +160,13 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
|||
int beginSide = iVertex;
|
||||
for (int i = 0; i < subdiv; i++)
|
||||
{
|
||||
float theta = float(i) / float(subdiv) * osg::PI * 2.;
|
||||
osg::Vec3 normal = sphereCoordToCartesian(theta, osg::PI_2f, 1.);
|
||||
float theta = float(i) / float(subdiv) * osg::PIf * 2.f;
|
||||
osg::Vec3 normal = sphereCoordToCartesian(theta, osg::PI_2f, 1.f);
|
||||
auto posTop = normal;
|
||||
posTop *= radius;
|
||||
auto posBot = posTop;
|
||||
posTop.z() = height / 2.;
|
||||
posBot.z() = -height / 2.;
|
||||
posTop.z() = height / 2.f;
|
||||
posBot.z() = -height / 2.f;
|
||||
vertices->push_back(posTop);
|
||||
normals->push_back(normal);
|
||||
iVertex += 1;
|
||||
|
|
@ -180,10 +179,10 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
|||
for (int i = 0; i < subdiv; i++)
|
||||
{
|
||||
auto nextVert = (i + 1) % subdiv;
|
||||
auto v1 = (beginSide + 2 * i);
|
||||
auto v2 = (beginSide + 2 * i + 1);
|
||||
auto v3 = (beginSide + 2 * nextVert);
|
||||
auto v4 = (beginSide + 2 * nextVert + 1);
|
||||
auto v1 = static_cast<GLushort>(beginSide + 2 * i);
|
||||
auto v2 = static_cast<GLushort>(beginSide + 2 * i + 1);
|
||||
auto v3 = static_cast<GLushort>(beginSide + 2 * nextVert);
|
||||
auto v4 = static_cast<GLushort>(beginSide + 2 * nextVert + 1);
|
||||
indices->push_back(v1);
|
||||
indices->push_back(v2);
|
||||
indices->push_back(v4);
|
||||
|
|
@ -195,11 +194,11 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
|||
for (int i = 0; i < subdiv; i++)
|
||||
{
|
||||
auto nextVert = (i + 1) % subdiv;
|
||||
auto top1 = (beginTop + i);
|
||||
auto top2 = (beginTop + nextVert);
|
||||
auto top1 = static_cast<GLushort>(beginTop + i);
|
||||
auto top2 = static_cast<GLushort>(beginTop + nextVert);
|
||||
|
||||
auto bot1 = (beginBot + i);
|
||||
auto bot2 = (beginBot + nextVert);
|
||||
auto bot1 = static_cast<GLushort>(beginBot + i);
|
||||
auto bot2 = static_cast<GLushort>(beginBot + nextVert);
|
||||
|
||||
indices->push_back(top2);
|
||||
indices->push_back(centerTop);
|
||||
|
|
@ -239,7 +238,7 @@ namespace Debug
|
|||
lines.setVertexArray(vertices);
|
||||
lines.setNormalArray(color, osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
lines.addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, vertices->size()));
|
||||
lines.addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, static_cast<GLsizei>(vertices->size())));
|
||||
}
|
||||
|
||||
DebugCustomDraw::DebugCustomDraw()
|
||||
|
|
@ -395,5 +394,5 @@ void Debug::DebugDrawer::addLine(const osg::Vec3& start, const osg::Vec3& end, c
|
|||
colors->push_back(color);
|
||||
colors->dirty();
|
||||
|
||||
primitive->setCount(vertices->size());
|
||||
primitive->setCount(static_cast<GLsizei>(vertices->size()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,8 @@ namespace Debug
|
|||
void DebugGroup::push(osg::State& state) const
|
||||
{
|
||||
if (isValid())
|
||||
PushDebugGroup::sInstance->glPushDebugGroup(mSource, mId, mMessage.size(), mMessage.c_str());
|
||||
PushDebugGroup::sInstance->glPushDebugGroup(
|
||||
mSource, mId, static_cast<GLsizei>(mMessage.size()), mMessage.c_str());
|
||||
}
|
||||
|
||||
void DebugGroup::pop(osg::State& state) const
|
||||
|
|
|
|||
|
|
@ -1039,7 +1039,7 @@ namespace DetourNavigator
|
|||
if (const auto& cachedTileData = job->mCachedTileData)
|
||||
{
|
||||
Log(Debug::Debug) << "Update db tile by job " << job->mId;
|
||||
job->mGeneratedNavMeshData->mUserId = cachedTileData->mTileId;
|
||||
job->mGeneratedNavMeshData->mUserId = static_cast<unsigned>(cachedTileData->mTileId);
|
||||
mDb->updateTile(cachedTileData->mTileId, mVersion, serialize(*job->mGeneratedNavMeshData));
|
||||
return;
|
||||
}
|
||||
|
|
@ -1051,7 +1051,7 @@ namespace DetourNavigator
|
|||
return;
|
||||
}
|
||||
|
||||
job->mGeneratedNavMeshData->mUserId = mNextTileId;
|
||||
job->mGeneratedNavMeshData->mUserId = static_cast<unsigned>(mNextTileId);
|
||||
Log(Debug::Debug) << "Insert db tile by job " << job->mId;
|
||||
mDb->insertTile(mNextTileId, job->mWorldspace, job->mChangedTile, mVersion, job->mInput,
|
||||
serialize(*job->mGeneratedNavMeshData));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace DetourNavigator
|
|||
std::array<dtPolyRef, 16> path;
|
||||
dtRaycastHit hit;
|
||||
hit.path = path.data();
|
||||
hit.maxPath = path.size();
|
||||
hit.maxPath = static_cast<int>(path.size());
|
||||
if (dtStatus status = navMeshQuery.raycast(ref, start.ptr(), end.ptr(), &queryFilter, options, &hit);
|
||||
dtStatusFailed(status) || hit.pathCount == 0)
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ namespace DetourNavigator
|
|||
triangles.emplace_back(makeRecastMeshTriangle(vertices, AreaType_ground));
|
||||
});
|
||||
shape.processAllTriangles(&callback, aabbMin, aabbMax);
|
||||
const osg::Vec2f aabbShift
|
||||
= (osg::Vec2f(aabbMax.x(), aabbMax.y()) - osg::Vec2f(aabbMin.x(), aabbMin.y())) * 0.5;
|
||||
const btVector3 aabbShift = (aabbMax - aabbMin) * 0.5;
|
||||
const osg::Vec2f tileShift = osg::Vec2f(heightfield.mMinX, heightfield.mMinY) * scale;
|
||||
const osg::Vec2f localShift = aabbShift + tileShift;
|
||||
const osg::Vec2f localShift
|
||||
= osg::Vec2f(static_cast<float>(aabbShift.x()), static_cast<float>(aabbShift.y())) + tileShift;
|
||||
const float cellSize = static_cast<float>(heightfield.mCellSize);
|
||||
const osg::Vec3f cellShift(heightfield.mCellPosition.x() * cellSize, heightfield.mCellPosition.y() * cellSize,
|
||||
(heightfield.mMinHeight + heightfield.mMaxHeight) * 0.5f);
|
||||
|
|
@ -238,7 +238,8 @@ namespace DetourNavigator
|
|||
const float stepSize = getHeightfieldScale(cellSize, size);
|
||||
const int halfCellSize = cellSize / 2;
|
||||
const auto local = [&](float v, float offset) { return (v - offset + halfCellSize) / stepSize; };
|
||||
const auto index = [&](float v, int add) { return std::clamp<int>(static_cast<int>(v) + add, 0, size); };
|
||||
const auto index
|
||||
= [&](float v, int add) { return std::clamp<int>(static_cast<int>(v) + add, 0, static_cast<int>(size)); };
|
||||
const std::size_t minX = index(std::round(local(intersection->mMin.x(), shift.x())), -1);
|
||||
const std::size_t minY = index(std::round(local(intersection->mMin.y(), shift.y())), -1);
|
||||
const std::size_t maxX = index(std::round(local(intersection->mMax.x(), shift.x())), 1);
|
||||
|
|
|
|||
|
|
@ -79,8 +79,10 @@ namespace DetourNavigator
|
|||
inline TileBounds makeTileBounds(const RecastSettings& settings, const TilePosition& tilePosition)
|
||||
{
|
||||
return TileBounds{
|
||||
osg::Vec2f(tilePosition.x(), tilePosition.y()) * getTileSize(settings),
|
||||
osg::Vec2f(tilePosition.x() + 1, tilePosition.y() + 1) * getTileSize(settings),
|
||||
osg::Vec2f(static_cast<float>(tilePosition.x()), static_cast<float>(tilePosition.y()))
|
||||
* getTileSize(settings),
|
||||
osg::Vec2f(static_cast<float>(tilePosition.x() + 1), static_cast<float>(tilePosition.y() + 1))
|
||||
* getTileSize(settings),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +99,7 @@ namespace DetourNavigator
|
|||
|
||||
inline float getMaxNavmeshAreaRadius(const Settings& settings)
|
||||
{
|
||||
return std::floor(std::sqrt(settings.mMaxTilesNumber / osg::PI)) - 1;
|
||||
return std::floor(std::sqrt(settings.mMaxTilesNumber / osg::PIf)) - 1;
|
||||
}
|
||||
|
||||
// Returns tile bounds in real coordinates
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@ namespace DetourNavigator
|
|||
|
||||
inline TileBounds maxCellTileBounds(const osg::Vec2i& position, int size)
|
||||
{
|
||||
return TileBounds{ osg::Vec2f(static_cast<float>(position.x()), static_cast<float>(position.y())) * static_cast<float>(size),
|
||||
osg::Vec2f(static_cast<float>(position.x() + 1), static_cast<float>(position.y() + 1)) * static_cast<float>(size) };
|
||||
return TileBounds{ osg::Vec2f(static_cast<float>(position.x()), static_cast<float>(position.y()))
|
||||
* static_cast<float>(size),
|
||||
osg::Vec2f(static_cast<float>(position.x() + 1), static_cast<float>(position.y() + 1))
|
||||
* static_cast<float>(size) };
|
||||
}
|
||||
|
||||
inline TileBounds makeObjectTileBounds(const btCollisionShape& shape, const btTransform& transform)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace ESM
|
|||
// The exact value of mDuration only matters for repeating packages.
|
||||
// Previously mRemainingDuration could be negative even when mDuration was 0. Checking for > 0 should
|
||||
// fix old saves.
|
||||
mData.mDuration = std::max<float>(mRemainingDuration > 0, mRemainingDuration);
|
||||
mData.mDuration = static_cast<int16_t>(std::max<float>(mRemainingDuration > 0, mRemainingDuration));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ namespace ESM
|
|||
// The exact value of mDuration only matters for repeating packages.
|
||||
// Previously mRemainingDuration could be negative even when mDuration was 0. Checking for > 0 should
|
||||
// fix old saves.
|
||||
mData.mDuration = std::max<float>(mRemainingDuration > 0, mRemainingDuration);
|
||||
mData.mDuration = static_cast<int16_t>(std::max<float>(mRemainingDuration > 0, mRemainingDuration));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ namespace ESM
|
|||
effects[i] = MagicEffect::Effects::ResistMagicka;
|
||||
for (short i = MagicEffect::Effects::AbsorbAttribute; i <= MagicEffect::Effects::AbsorbSkill; ++i)
|
||||
effects[i] = MagicEffect::Effects::ResistMagicka;
|
||||
for (short i = MagicEffect::Effects::WeaknessToFire; i <= MagicEffect::Effects::WeaknessToNormalWeapons; ++i)
|
||||
for (short i = MagicEffect::Effects::WeaknessToFire; i <= MagicEffect::Effects::WeaknessToNormalWeapons;
|
||||
++i)
|
||||
effects[i] = MagicEffect::Effects::ResistMagicka;
|
||||
|
||||
effects[MagicEffect::Effects::Burden] = MagicEffect::Effects::ResistMagicka;
|
||||
|
|
@ -541,7 +542,7 @@ namespace ESM
|
|||
{
|
||||
std::map<std::string_view, int, Misc::StringUtils::CiComp> map;
|
||||
for (size_t i = 0; i < strings.size(); i++)
|
||||
map[strings[i]] = i;
|
||||
map[strings[i]] = static_cast<int>(i);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ namespace Gui
|
|||
// Underscore, use for NotDefined marker (used for glyphs not existing in the font)
|
||||
additional.emplace(95, MyGUI::FontCodeType::NotDefined);
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
for (unsigned char i = 0; i < 256; i++)
|
||||
{
|
||||
float x1 = data[i].top_left.x * width;
|
||||
float y1 = data[i].top_left.y * height;
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ namespace Fx
|
|||
int scaledHeight = height;
|
||||
|
||||
if (mWidthRatio)
|
||||
scaledWidth = width * mWidthRatio.value();
|
||||
scaledWidth = static_cast<int>(width * mWidthRatio.value());
|
||||
else if (mWidth)
|
||||
scaledWidth = mWidth.value();
|
||||
|
||||
if (mHeightRatio > 0.f)
|
||||
scaledHeight = height * mHeightRatio.value();
|
||||
scaledHeight = static_cast<int>(height * mHeightRatio.value());
|
||||
else if (mHeight)
|
||||
scaledHeight = mHeight.value();
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ namespace Fx
|
|||
if (arg.isArray())
|
||||
{
|
||||
for (size_t i = 0; i < arg.getArray().size(); ++i)
|
||||
uniform->setElement(i, arg.getArray()[i]);
|
||||
uniform->setElement(static_cast<unsigned int>(i), arg.getArray()[i]);
|
||||
uniform->dirty();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -334,8 +334,8 @@ namespace LuaUtil
|
|||
|
||||
void ScriptsContainer::insertHandler(std::vector<Handler>& list, int scriptId, sol::function fn)
|
||||
{
|
||||
size_t pos = list.size();
|
||||
list.emplace_back();
|
||||
int pos = list.size() - 1;
|
||||
while (pos > 0 && list[pos - 1].mScriptId > scriptId)
|
||||
{
|
||||
list[pos] = std::move(list[pos - 1]);
|
||||
|
|
@ -370,9 +370,9 @@ namespace LuaUtil
|
|||
return;
|
||||
}
|
||||
EventHandlerList& list = it->second;
|
||||
for (int i = list.size() - 1; i >= 0; --i)
|
||||
for (size_t i = list.size(); i > 0; --i)
|
||||
{
|
||||
const Handler& h = list[i];
|
||||
const Handler& h = list[i - 1];
|
||||
try
|
||||
{
|
||||
sol::object res = LuaUtil::call({ this, h.mScriptId }, h.mFn, object);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ namespace LuaUi
|
|||
// mCoord could be zero, prevent division by 0
|
||||
// use arbitrary large numbers to prevent performance issues
|
||||
if (mTileSize.width <= 0)
|
||||
mTileSize.width = 1e7;
|
||||
mTileSize.width = 10000000;
|
||||
if (mTileSize.height <= 0)
|
||||
mTileSize.height = 1e7;
|
||||
mTileSize.height = 10000000;
|
||||
|
||||
MyGUI::TileRect::_updateView();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace LuaUi
|
|||
{
|
||||
MyGUI::ILayer* p = refresh();
|
||||
MyGUI::IntSize size = p->getSize();
|
||||
return osg::Vec2f(size.width, size.height);
|
||||
return osg::Vec2f(static_cast<float>(size.width), static_cast<float>(size.height));
|
||||
}
|
||||
|
||||
struct Options
|
||||
|
|
|
|||
|
|
@ -11,11 +11,16 @@
|
|||
|
||||
namespace LuaUi
|
||||
{
|
||||
template <typename T>
|
||||
constexpr bool isMyGuiIntVector()
|
||||
{
|
||||
return std::is_same<T, MyGUI::IntPoint>() || std::is_same<T, MyGUI::IntSize>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr bool isMyGuiVector()
|
||||
{
|
||||
return std::is_same<T, MyGUI::IntPoint>() || std::is_same<T, MyGUI::IntSize>()
|
||||
|| std::is_same<T, MyGUI::FloatPoint>() || std::is_same<T, MyGUI::FloatSize>();
|
||||
return isMyGuiIntVector<T>() || std::is_same<T, MyGUI::FloatPoint>() || std::is_same<T, MyGUI::FloatSize>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -42,7 +47,9 @@ namespace LuaUi
|
|||
return sol::nullopt;
|
||||
|
||||
LuaT luaT = opt.as<LuaT>();
|
||||
if constexpr (isMyGuiVector<T>())
|
||||
if constexpr (isMyGuiIntVector<T>())
|
||||
return T(static_cast<int>(luaT.x()), static_cast<int>(luaT.y()));
|
||||
else if constexpr (isMyGuiVector<T>())
|
||||
return T(luaT.x(), luaT.y());
|
||||
else if constexpr (isMyGuiColor<T>())
|
||||
return T(luaT.r(), luaT.g(), luaT.b(), luaT.a());
|
||||
|
|
|
|||
|
|
@ -179,16 +179,17 @@ namespace LuaUi
|
|||
auto keySym = SDL_Keysym();
|
||||
keySym.sym = SDLUtil::myGuiKeyToSdl(code);
|
||||
keySym.scancode = SDL_GetScancodeFromKey(keySym.sym);
|
||||
keySym.mod = SDL_GetModState();
|
||||
keySym.mod = static_cast<Uint16>(SDL_GetModState());
|
||||
return sol::make_object(lua(), keySym);
|
||||
}
|
||||
|
||||
sol::object WidgetExtension::mouseEvent(
|
||||
int left, int top, MyGUI::MouseButton button = MyGUI::MouseButton::None) const
|
||||
{
|
||||
osg::Vec2f position(left, top);
|
||||
osg::Vec2f position(static_cast<float>(left), static_cast<float>(top));
|
||||
MyGUI::IntPoint absolutePosition = mWidget->getAbsolutePosition();
|
||||
osg::Vec2f offset = position - osg::Vec2f(absolutePosition.left, absolutePosition.top);
|
||||
osg::Vec2f offset = position
|
||||
- osg::Vec2f(static_cast<float>(absolutePosition.left), static_cast<float>(absolutePosition.top));
|
||||
sol::table table = makeTable();
|
||||
int sdlButton = SDLUtil::myGuiMouseButtonToSdl(button);
|
||||
table["position"] = position;
|
||||
|
|
@ -328,8 +329,8 @@ namespace LuaUi
|
|||
MyGUI::IntSize pSize = parentSize();
|
||||
MyGUI::IntSize newSize;
|
||||
newSize = mAbsoluteCoord.size();
|
||||
newSize.width += mRelativeCoord.width * pSize.width;
|
||||
newSize.height += mRelativeCoord.height * pSize.height;
|
||||
newSize.width += static_cast<int>(mRelativeCoord.width * pSize.width);
|
||||
newSize.height += static_cast<int>(mRelativeCoord.height * pSize.height);
|
||||
return newSize;
|
||||
}
|
||||
|
||||
|
|
@ -340,8 +341,8 @@ namespace LuaUi
|
|||
MyGUI::IntSize pSize = parentSize();
|
||||
MyGUI::IntPoint newPosition;
|
||||
newPosition = mAbsoluteCoord.point();
|
||||
newPosition.left += mRelativeCoord.left * pSize.width - mAnchor.width * size.width;
|
||||
newPosition.top += mRelativeCoord.top * pSize.height - mAnchor.height * size.height;
|
||||
newPosition.left += static_cast<int>(mRelativeCoord.left * pSize.width - mAnchor.width * size.width);
|
||||
newPosition.top += static_cast<int>(mRelativeCoord.top * pSize.height - mAnchor.height * size.height);
|
||||
return newPosition;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ namespace LuaUi
|
|||
mPreviousMouse.top = top;
|
||||
|
||||
sol::table table = makeTable();
|
||||
table["position"] = osg::Vec2f(mCoord.left, mCoord.top);
|
||||
table["size"] = osg::Vec2f(mCoord.width, mCoord.height);
|
||||
table["position"] = osg::Vec2f(static_cast<float>(mCoord.left), static_cast<float>(mCoord.top));
|
||||
table["size"] = osg::Vec2f(static_cast<float>(mCoord.width), static_cast<float>(mCoord.height));
|
||||
triggerEvent("windowDrag", table);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ namespace MyGUIPlatform
|
|||
reinterpret_cast<const char*>(vbo->getArray(0)->getDataPointer()) + 16);
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, batch.mVertexCount);
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(batch.mVertexCount));
|
||||
|
||||
if (batch.mStateSet)
|
||||
{
|
||||
|
|
@ -328,7 +328,8 @@ namespace MyGUIPlatform
|
|||
|
||||
osg::UByteArray* OSGVertexBuffer::create()
|
||||
{
|
||||
mVertexArray[mCurrentBuffer] = new osg::UByteArray(mNeedVertexCount * sizeof(MyGUI::Vertex));
|
||||
mVertexArray[mCurrentBuffer]
|
||||
= new osg::UByteArray(static_cast<unsigned int>(mNeedVertexCount * sizeof(MyGUI::Vertex)));
|
||||
|
||||
mBuffer[mCurrentBuffer] = new osg::VertexBufferObject;
|
||||
mBuffer[mCurrentBuffer]->setDataVariance(osg::Object::DYNAMIC);
|
||||
|
|
@ -404,7 +405,7 @@ namespace MyGUIPlatform
|
|||
mSceneRoot->addChild(mGuiRoot.get());
|
||||
|
||||
osg::ref_ptr<osg::Viewport> vp = mViewer->getCamera()->getViewport();
|
||||
setViewSize(vp->width(), vp->height());
|
||||
setViewSize(static_cast<int>(vp->width()), static_cast<int>(vp->height()));
|
||||
|
||||
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
|
||||
mIsInitialise = true;
|
||||
|
|
@ -500,7 +501,7 @@ namespace MyGUIPlatform
|
|||
|
||||
mGuiRoot->setViewport(0, 0, width, height);
|
||||
|
||||
mViewSize.set(width * mInvScalingFactor, height * mInvScalingFactor);
|
||||
mViewSize.set(static_cast<int>(width * mInvScalingFactor), static_cast<int>(height * mInvScalingFactor));
|
||||
|
||||
mInfo.maximumDepth = 1;
|
||||
mInfo.hOffset = 0;
|
||||
|
|
|
|||
|
|
@ -699,7 +699,7 @@ namespace Nif
|
|||
assert(r != nullptr);
|
||||
assert(r->recType != RC_MISSING);
|
||||
r->recName = std::move(rec);
|
||||
r->recIndex = i;
|
||||
r->recIndex = static_cast<unsigned>(i);
|
||||
r->read(&nif);
|
||||
mRecords[i] = std::move(r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -664,13 +664,13 @@ namespace Nif
|
|||
mDynamicVertexSize = (data & 0xF0) >> 0x04;
|
||||
mUV1Offset = (data & 0xF00) >> 0x08;
|
||||
mUV2Offset = (data & 0xF000) >> 0x0C;
|
||||
mNormalOffset = (data & 0xF0000) >> 0x10;
|
||||
mTangentOffset = (data & 0xF00000) >> 0x14;
|
||||
mNormalOffset = static_cast<uint8_t>((data & 0xF0000) >> 0x10);
|
||||
mTangentOffset = static_cast<uint8_t>((data & 0xF00000) >> 0x14);
|
||||
mColorOffset = (data & 0xF000000) >> 0x18;
|
||||
mSkinningDataOffset = (data & 0xF0000000) >> 0x1C;
|
||||
mLandscapeDataOffset = (data & 0xF00000000) >> 0x20;
|
||||
mEyeDataOffset = (data & 0xF000000000) >> 0x24;
|
||||
mFlags = (data & 0xFFF00000000000) >> 0x2C;
|
||||
mLandscapeDataOffset = static_cast<uint8_t>((data & 0xF00000000) >> 0x20);
|
||||
mEyeDataOffset = static_cast<uint8_t>((data & 0xF000000000) >> 0x24);
|
||||
mFlags = static_cast<uint16_t>((data & 0xFFF00000000000) >> 0x2C);
|
||||
if (nif->getBethVersion() == NIFFile::BethVersion::BETHVER_SSE)
|
||||
mFlags |= BSVertexDesc::VertexAttribute::Full_Precision;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace
|
|||
osg::Matrix modelView = *cv->getModelViewMatrix();
|
||||
|
||||
// attempt to preserve scale
|
||||
float mag[3];
|
||||
double mag[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
mag[i] = std::sqrt(modelView(0, i) * modelView(0, i) + modelView(1, i) * modelView(1, i)
|
||||
|
|
@ -1083,7 +1083,7 @@ namespace NifOsg
|
|||
texture2d->setTextureSize(image->s(), image->t());
|
||||
texture2d->setWrap(osg::Texture::WRAP_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE);
|
||||
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE);
|
||||
unsigned int texUnit = boundTextures.size();
|
||||
auto texUnit = static_cast<unsigned int>(boundTextures.size());
|
||||
if (stateset)
|
||||
{
|
||||
stateset->setTextureAttributeAndModes(texUnit, texture2d, osg::StateAttribute::ON);
|
||||
|
|
@ -1244,12 +1244,12 @@ namespace NifOsg
|
|||
auto particleNode = static_cast<const Nif::NiParticles*>(nifNode);
|
||||
if (particleNode->mData.empty())
|
||||
{
|
||||
partsys->setQuota(partctrl->mParticles.size());
|
||||
partsys->setQuota(static_cast<int>(partctrl->mParticles.size()));
|
||||
return;
|
||||
}
|
||||
|
||||
auto particledata = static_cast<const Nif::NiParticlesData*>(particleNode->mData.getPtr());
|
||||
partsys->setQuota(particledata->mNumParticles);
|
||||
partsys->setQuota(static_cast<int>(particledata->mNumParticles));
|
||||
|
||||
osg::BoundingBox box;
|
||||
|
||||
|
|
@ -1342,7 +1342,7 @@ namespace NifOsg
|
|||
{
|
||||
for (const auto& emitterPair : mEmitterQueue)
|
||||
{
|
||||
size_t recIndex = emitterPair.first;
|
||||
auto recIndex = static_cast<unsigned>(emitterPair.first);
|
||||
FindGroupByRecIndex findEmitterNode(recIndex);
|
||||
rootNode->accept(findEmitterNode);
|
||||
osg::Group* emitterNode = findEmitterNode.mFound;
|
||||
|
|
@ -1488,15 +1488,15 @@ namespace NifOsg
|
|||
const std::vector<unsigned short>& trueTriangles = partition.mTrueTriangles;
|
||||
if (!trueTriangles.empty())
|
||||
{
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::TRIANGLES, trueTriangles.size(), trueTriangles.data()));
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES,
|
||||
static_cast<unsigned>(trueTriangles.size()), trueTriangles.data()));
|
||||
}
|
||||
for (const auto& strip : partition.mTrueStrips)
|
||||
{
|
||||
if (strip.size() < 3)
|
||||
continue;
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(), strip.data()));
|
||||
osg::PrimitiveSet::TRIANGLE_STRIP, static_cast<unsigned>(strip.size()), strip.data()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1511,8 +1511,8 @@ namespace NifOsg
|
|||
const std::vector<unsigned short>& triangles = data->mTriangles;
|
||||
if (triangles.empty())
|
||||
return;
|
||||
geometry->addPrimitiveSet(
|
||||
new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, triangles.size(), triangles.data()));
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::TRIANGLES, static_cast<unsigned>(triangles.size()), triangles.data()));
|
||||
}
|
||||
else if (niGeometry->recType == Nif::RC_NiTriStrips)
|
||||
{
|
||||
|
|
@ -1522,8 +1522,8 @@ namespace NifOsg
|
|||
{
|
||||
if (strip.size() < 3)
|
||||
continue;
|
||||
geometry->addPrimitiveSet(
|
||||
new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(), strip.data()));
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::TRIANGLE_STRIP, static_cast<unsigned>(strip.size()), strip.data()));
|
||||
hasGeometry = true;
|
||||
}
|
||||
if (!hasGeometry)
|
||||
|
|
@ -1535,8 +1535,8 @@ namespace NifOsg
|
|||
const auto& line = data->mLines;
|
||||
if (line.empty())
|
||||
return;
|
||||
geometry->addPrimitiveSet(
|
||||
new osg::DrawElementsUShort(osg::PrimitiveSet::LINES, line.size(), line.data()));
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::LINES, static_cast<unsigned>(line.size()), line.data()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1544,17 +1544,18 @@ namespace NifOsg
|
|||
const auto& normals = niGeometryData->mNormals;
|
||||
const auto& colors = niGeometryData->mColors;
|
||||
if (!vertices.empty())
|
||||
geometry->setVertexArray(new osg::Vec3Array(vertices.size(), vertices.data()));
|
||||
geometry->setVertexArray(new osg::Vec3Array(static_cast<unsigned>(vertices.size()), vertices.data()));
|
||||
if (!normals.empty())
|
||||
geometry->setNormalArray(
|
||||
new osg::Vec3Array(normals.size(), normals.data()), osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(new osg::Vec3Array(static_cast<unsigned>(normals.size()), normals.data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
if (!colors.empty())
|
||||
geometry->setColorArray(new osg::Vec4Array(colors.size(), colors.data()), osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(new osg::Vec4Array(static_cast<unsigned>(colors.size()), colors.data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
const auto& uvlist = niGeometryData->mUVList;
|
||||
int textureStage = 0;
|
||||
for (std::vector<unsigned int>::const_iterator it = boundTextures.begin(); it != boundTextures.end();
|
||||
++it, ++textureStage)
|
||||
++it, ++textureStage)
|
||||
{
|
||||
unsigned int uvSet = *it;
|
||||
if (uvSet >= uvlist.size())
|
||||
|
|
@ -1566,7 +1567,8 @@ namespace NifOsg
|
|||
uvSet = 0;
|
||||
}
|
||||
|
||||
geometry->setTexCoordArray(textureStage, new osg::Vec2Array(uvlist[uvSet].size(), uvlist[uvSet].data()),
|
||||
geometry->setTexCoordArray(textureStage,
|
||||
new osg::Vec2Array(static_cast<unsigned>(uvlist[uvSet].size()), uvlist[uvSet].data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
|
||||
|
|
@ -1650,8 +1652,9 @@ namespace NifOsg
|
|||
osg::ref_ptr<SceneUtil::MorphGeometry> morphGeom = new SceneUtil::MorphGeometry;
|
||||
morphGeom->setSourceGeometry(geom);
|
||||
for (unsigned int i = 0; i < morphs.size(); ++i)
|
||||
morphGeom->addMorphTarget(
|
||||
new osg::Vec3Array(morphs[i].mVertices.size(), morphs[i].mVertices.data()), 0.f);
|
||||
morphGeom->addMorphTarget(new osg::Vec3Array(static_cast<unsigned>(morphs[i].mVertices.size()),
|
||||
morphs[i].mVertices.data()),
|
||||
0.f);
|
||||
|
||||
osg::ref_ptr<GeomMorpherController> morphctrl = new GeomMorpherController(nimorphctrl);
|
||||
setupController(ctrl.getPtr(), morphctrl, animflags);
|
||||
|
|
@ -1678,8 +1681,8 @@ namespace NifOsg
|
|||
return;
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry(new osg::Geometry);
|
||||
geometry->addPrimitiveSet(
|
||||
new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, triangles.size(), triangles.data()));
|
||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(
|
||||
osg::PrimitiveSet::TRIANGLES, static_cast<unsigned>(triangles.size()), triangles.data()));
|
||||
|
||||
osg::ref_ptr<osg::Drawable> drawable = geometry;
|
||||
|
||||
|
|
@ -1743,16 +1746,16 @@ namespace NifOsg
|
|||
}
|
||||
|
||||
if (!vertices.empty())
|
||||
geometry->setVertexArray(new osg::Vec3Array(vertices.size(), vertices.data()));
|
||||
geometry->setVertexArray(new osg::Vec3Array(static_cast<unsigned>(vertices.size()), vertices.data()));
|
||||
if (!normals.empty())
|
||||
geometry->setNormalArray(
|
||||
new osg::Vec3Array(normals.size(), normals.data()), osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(new osg::Vec3Array(static_cast<unsigned>(normals.size()), normals.data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
if (!colors.empty())
|
||||
geometry->setColorArray(
|
||||
new osg::Vec4ubArray(colors.size(), colors.data()), osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(new osg::Vec4ubArray(static_cast<unsigned>(colors.size()), colors.data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
if (!uvlist.empty())
|
||||
geometry->setTexCoordArray(
|
||||
0, new osg::Vec2Array(uvlist.size(), uvlist.data()), osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setTexCoordArray(0, new osg::Vec2Array(static_cast<unsigned>(uvlist.size()), uvlist.data()),
|
||||
osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
// This is the skinning data Fallout 4 provides
|
||||
// TODO: support Skyrim SE skinning data
|
||||
|
|
@ -2124,7 +2127,7 @@ namespace NifOsg
|
|||
}
|
||||
}
|
||||
|
||||
const unsigned int texUnit = boundTextures.size();
|
||||
const auto texUnit = static_cast<unsigned>(boundTextures.size());
|
||||
if (tex.mEnabled)
|
||||
{
|
||||
if (tex.mSourceTexture.empty() && texprop->mController.empty())
|
||||
|
|
@ -2632,7 +2635,7 @@ namespace NifOsg
|
|||
if (!texprop->mSourceTexture.empty())
|
||||
{
|
||||
const unsigned int uvSet = 0;
|
||||
unsigned int texUnit = boundTextures.size();
|
||||
unsigned int texUnit = static_cast<unsigned>(boundTextures.size());
|
||||
attachExternalTexture("diffuseMap", texprop->mSourceTexture, texprop->wrapS(), texprop->wrapT(),
|
||||
uvSet, stateset, boundTextures);
|
||||
{
|
||||
|
|
|
|||
|
|
@ -487,7 +487,8 @@ namespace NifOsg
|
|||
}
|
||||
else
|
||||
{
|
||||
int randomIndex = static_cast<int>(std::floor(Misc::Rng::rollClosedProbability() * (mTargets.size() - 1)));
|
||||
int randomIndex
|
||||
= static_cast<int>(std::floor(Misc::Rng::rollClosedProbability() * (mTargets.size() - 1)));
|
||||
recIndex = mTargets[randomIndex];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ namespace Resource
|
|||
shape->mCollisionBox.mExtents[0] = static_cast<float>(aabbMax[0] - aabbMin[0]) / 2.0f;
|
||||
shape->mCollisionBox.mExtents[1] = static_cast<float>(aabbMax[1] - aabbMin[1]) / 2.0f;
|
||||
shape->mCollisionBox.mExtents[2] = static_cast<float>(aabbMax[2] - aabbMin[2]) / 2.0f;
|
||||
shape->mCollisionBox.mCenter = osg::Vec3f(
|
||||
static_cast<float>(aabbMax[0] + aabbMin[0]) / 2.0f, static_cast<float>(aabbMax[1] + aabbMin[1]) / 2.0f, static_cast<float>(aabbMax[2] + aabbMin[2]) / 2.0f);
|
||||
shape->mCollisionBox.mCenter = osg::Vec3f(static_cast<float>(aabbMax[0] + aabbMin[0]) / 2.0f,
|
||||
static_cast<float>(aabbMax[1] + aabbMin[1]) / 2.0f, static_cast<float>(aabbMax[2] + aabbMin[2]) / 2.0f);
|
||||
shape->mCollisionShape.reset(triangleMeshShape.release());
|
||||
|
||||
return shape;
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ namespace Resource
|
|||
class SharedStateManager : public osgDB::SharedStateManager
|
||||
{
|
||||
public:
|
||||
unsigned int getNumSharedTextures() const { return _sharedTextureList.size(); }
|
||||
size_t getNumSharedTextures() const { return _sharedTextureList.size(); }
|
||||
|
||||
unsigned int getNumSharedStateSets() const { return _sharedStateSetList.size(); }
|
||||
size_t getNumSharedStateSets() const { return _sharedStateSetList.size(); }
|
||||
|
||||
void clearCache()
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ namespace Resource
|
|||
{
|
||||
public:
|
||||
SetFilterSettingsControllerVisitor(
|
||||
osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, int maxAnisotropy)
|
||||
osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, float maxAnisotropy)
|
||||
: mMinFilter(minFilter)
|
||||
, mMagFilter(magFilter)
|
||||
, mMaxAnisotropy(maxAnisotropy)
|
||||
|
|
@ -170,7 +170,7 @@ namespace Resource
|
|||
if (NifOsg::FlipController* flipctrl = dynamic_cast<NifOsg::FlipController*>(&ctrl))
|
||||
{
|
||||
for (std::vector<osg::ref_ptr<osg::Texture2D>>::iterator it = flipctrl->getTextures().begin();
|
||||
it != flipctrl->getTextures().end(); ++it)
|
||||
it != flipctrl->getTextures().end(); ++it)
|
||||
{
|
||||
osg::Texture* tex = *it;
|
||||
tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter);
|
||||
|
|
@ -183,7 +183,7 @@ namespace Resource
|
|||
private:
|
||||
osg::Texture::FilterMode mMinFilter;
|
||||
osg::Texture::FilterMode mMagFilter;
|
||||
int mMaxAnisotropy;
|
||||
float mMaxAnisotropy;
|
||||
};
|
||||
|
||||
/// Set texture filtering settings on textures contained in StateSets.
|
||||
|
|
@ -191,7 +191,7 @@ namespace Resource
|
|||
{
|
||||
public:
|
||||
SetFilterSettingsVisitor(
|
||||
osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, int maxAnisotropy)
|
||||
osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, float maxAnisotropy)
|
||||
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
||||
, mMinFilter(minFilter)
|
||||
, mMagFilter(magFilter)
|
||||
|
|
@ -233,7 +233,7 @@ namespace Resource
|
|||
private:
|
||||
osg::Texture::FilterMode mMinFilter;
|
||||
osg::Texture::FilterMode mMagFilter;
|
||||
int mMaxAnisotropy;
|
||||
float mMaxAnisotropy;
|
||||
};
|
||||
|
||||
// Check Collada extra descriptions
|
||||
|
|
@ -461,7 +461,7 @@ namespace Resource
|
|||
, mBgsmFileManager(bgsmFileManager)
|
||||
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
||||
, mMagFilter(osg::Texture::LINEAR)
|
||||
, mMaxAnisotropy(1)
|
||||
, mMaxAnisotropy(1.f)
|
||||
, mUnRefImageDataAfterApply(false)
|
||||
, mParticleSystemMask(~0u)
|
||||
{
|
||||
|
|
@ -1129,7 +1129,7 @@ namespace Resource
|
|||
}
|
||||
|
||||
void SceneManager::setFilterSettings(
|
||||
const std::string& magfilter, const std::string& minfilter, const std::string& mipmap, int maxAnisotropy)
|
||||
const std::string& magfilter, const std::string& minfilter, const std::string& mipmap, float maxAnisotropy)
|
||||
{
|
||||
osg::Texture::FilterMode min = osg::Texture::LINEAR;
|
||||
osg::Texture::FilterMode mag = osg::Texture::LINEAR;
|
||||
|
|
@ -1163,7 +1163,7 @@ namespace Resource
|
|||
|
||||
mMinFilter = min;
|
||||
mMagFilter = mag;
|
||||
mMaxAnisotropy = std::max(1, maxAnisotropy);
|
||||
mMaxAnisotropy = std::max(1.f, maxAnisotropy);
|
||||
|
||||
SetFilterSettingsControllerVisitor setFilterSettingsControllerVisitor(mMinFilter, mMagFilter, mMaxAnisotropy);
|
||||
SetFilterSettingsVisitor setFilterSettingsVisitor(mMinFilter, mMagFilter, mMaxAnisotropy);
|
||||
|
|
@ -1225,13 +1225,16 @@ namespace Resource
|
|||
if (mIncrementalCompileOperation)
|
||||
{
|
||||
std::lock_guard<OpenThreads::Mutex> lock(*mIncrementalCompileOperation->getToCompiledMutex());
|
||||
stats->setAttribute(frameNumber, "Compiling", mIncrementalCompileOperation->getToCompile().size());
|
||||
stats->setAttribute(
|
||||
frameNumber, "Compiling", static_cast<double>(mIncrementalCompileOperation->getToCompile().size()));
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mSharedStateMutex);
|
||||
stats->setAttribute(frameNumber, "Texture", mSharedStateManager->getNumSharedTextures());
|
||||
stats->setAttribute(frameNumber, "StateSet", mSharedStateManager->getNumSharedStateSets());
|
||||
stats->setAttribute(
|
||||
frameNumber, "Texture", static_cast<double>(mSharedStateManager->getNumSharedTextures()));
|
||||
stats->setAttribute(
|
||||
frameNumber, "StateSet", static_cast<double>(mSharedStateManager->getNumSharedStateSets()));
|
||||
}
|
||||
|
||||
Resource::reportStats("Node", frameNumber, mCache->getStats(), *stats);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ namespace Resource
|
|||
/// @warning It is unsafe to call this method while the draw thread is using textures! call
|
||||
/// Viewer::stopThreading first.
|
||||
void setFilterSettings(
|
||||
const std::string& magfilter, const std::string& minfilter, const std::string& mipmap, int maxAnisotropy);
|
||||
const std::string& magfilter, const std::string& minfilter, const std::string& mipmap, float maxAnisotropy);
|
||||
|
||||
/// Apply filter settings to the given texture. Note, when loading an object through this scene manager (i.e.
|
||||
/// calling getTemplate or createInstance) the filter settings are applied automatically. This method is
|
||||
|
|
@ -263,7 +263,7 @@ namespace Resource
|
|||
|
||||
osg::Texture::FilterMode mMinFilter;
|
||||
osg::Texture::FilterMode mMagFilter;
|
||||
int mMaxAnisotropy;
|
||||
float mMaxAnisotropy;
|
||||
bool mUnRefImageDataAfterApply;
|
||||
|
||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ namespace SceneUtil
|
|||
|
||||
bool getModeUsage(ModeUsage& usage) const override
|
||||
{
|
||||
usage.usesMode(GL_LIGHT0 + mIndex);
|
||||
usage.usesMode(static_cast<GLMode>(GL_LIGHT0 + mIndex));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ namespace SceneUtil
|
|||
|
||||
void apply(osg::State& state) const override
|
||||
{
|
||||
int lightNum = GL_LIGHT0 + mIndex;
|
||||
GLenum lightNum = static_cast<GLenum>(GL_LIGHT0 + mIndex);
|
||||
glLightfv(lightNum, GL_AMBIENT, mNullptr.ptr());
|
||||
glLightfv(lightNum, GL_DIFFUSE, mNullptr.ptr());
|
||||
glLightfv(lightNum, GL_SPECULAR, mNullptr.ptr());
|
||||
|
|
@ -365,7 +365,7 @@ namespace SceneUtil
|
|||
bool getModeUsage(ModeUsage& usage) const override
|
||||
{
|
||||
for (size_t i = 0; i < mLights.size(); ++i)
|
||||
usage.usesMode(GL_LIGHT0 + static_cast<int>(mIndex) + i);
|
||||
usage.usesMode(static_cast<GLMode>(GL_LIGHT0 + mIndex + i));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ namespace SceneUtil
|
|||
{
|
||||
LightManager* mLightManager;
|
||||
|
||||
virtual ~StateSetGenerator() {}
|
||||
virtual ~StateSetGenerator() = default;
|
||||
|
||||
virtual osg::ref_ptr<osg::StateSet> generate(const LightManager::LightList& lightList, size_t frameNum) = 0;
|
||||
|
||||
|
|
@ -451,7 +451,8 @@ namespace SceneUtil
|
|||
new FFPLightStateAttribute(mLightManager->getStartLight(), std::move(lights)), osg::StateAttribute::ON);
|
||||
|
||||
for (size_t i = 0; i < lightList.size(); ++i)
|
||||
stateset->setMode(GL_LIGHT0 + mLightManager->getStartLight() + static_cast<int>(i), osg::StateAttribute::ON);
|
||||
stateset->setMode(
|
||||
GL_LIGHT0 + mLightManager->getStartLight() + static_cast<int>(i), osg::StateAttribute::ON);
|
||||
|
||||
// need to push some dummy attributes to ensure proper state tracking
|
||||
// lights need to reset to their default when the StateSet is popped
|
||||
|
|
@ -774,7 +775,8 @@ namespace SceneUtil
|
|||
int stride = -1;
|
||||
|
||||
ext->glGetActiveUniformBlockiv(handle, 0, GL_UNIFORM_BLOCK_DATA_SIZE, &totalBlockSize);
|
||||
ext->glGetActiveUniformsiv(handle, static_cast<GLsizei>(index.size()), index.data(), GL_UNIFORM_ARRAY_STRIDE, &stride);
|
||||
ext->glGetActiveUniformsiv(
|
||||
handle, static_cast<GLsizei>(index.size()), index.data(), GL_UNIFORM_ARRAY_STRIDE, &stride);
|
||||
|
||||
std::array<const char*, 3> names = {
|
||||
"LightBuffer[0].packedColors",
|
||||
|
|
@ -785,7 +787,8 @@ namespace SceneUtil
|
|||
std::vector<int> offsets(names.size());
|
||||
|
||||
ext->glGetUniformIndices(handle, static_cast<GLsizei>(names.size()), names.data(), indices.data());
|
||||
ext->glGetActiveUniformsiv(handle, static_cast<GLsizei>(indices.size()), indices.data(), GL_UNIFORM_OFFSET, offsets.data());
|
||||
ext->glGetActiveUniformsiv(
|
||||
handle, static_cast<GLsizei>(indices.size()), indices.data(), GL_UNIFORM_OFFSET, offsets.data());
|
||||
|
||||
mTemplate->configureLayout(offsets[0], offsets[1], offsets[2], totalBlockSize, stride);
|
||||
}
|
||||
|
|
@ -1291,7 +1294,7 @@ namespace SceneUtil
|
|||
const osg::Transform* transform = node->asTransform();
|
||||
if (transform)
|
||||
{
|
||||
for (size_t i = 0; i < transform->getNumChildren(); ++i)
|
||||
for (unsigned int i = 0; i < transform->getNumChildren(); ++i)
|
||||
nodeBound.expandBy(transform->getChild(i)->getBound());
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3344,7 +3344,7 @@ void SceneUtil::MWShadowTechnique::DebugHUD::addAnotherShadowMap()
|
|||
size_t shadowMapNumber = mDebugCameras.size();
|
||||
|
||||
mDebugCameras.push_back(new osg::Camera);
|
||||
mDebugCameras[shadowMapNumber]->setViewport(200 * shadowMapNumber, 0, 200, 200);
|
||||
mDebugCameras[shadowMapNumber]->setViewport(static_cast<int>(200 * shadowMapNumber), 0, 200, 200);
|
||||
mDebugCameras[shadowMapNumber]->setRenderOrder(osg::Camera::POST_RENDER);
|
||||
mDebugCameras[shadowMapNumber]->setClearColor(osg::Vec4(1.0, 1.0, 0.0, 1.0));
|
||||
mDebugCameras[shadowMapNumber]->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
||||
|
|
|
|||
|
|
@ -52,14 +52,17 @@ namespace SceneUtil
|
|||
assert(edgeIndexCount < std::numeric_limits<unsigned int>::max());
|
||||
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array(static_cast<unsigned int>(vertexCount));
|
||||
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(static_cast<unsigned int>(vertexCount));
|
||||
osg::ref_ptr<PType> pointIndices = new PType(osg::PrimitiveSet::TRIANGLES, static_cast<unsigned int>(pointIndexCount));
|
||||
osg::ref_ptr<LType> lineIndices = new LType(osg::PrimitiveSet::LINES, static_cast<unsigned int>(edgeIndexCount));
|
||||
osg::ref_ptr<PType> pointIndices
|
||||
= new PType(osg::PrimitiveSet::TRIANGLES, static_cast<unsigned int>(pointIndexCount));
|
||||
osg::ref_ptr<LType> lineIndices
|
||||
= new LType(osg::PrimitiveSet::LINES, static_cast<unsigned int>(edgeIndexCount));
|
||||
|
||||
// Add each point/node
|
||||
for (size_t pointIndex = 0; pointIndex < pathgrid.mPoints.size(); ++pointIndex)
|
||||
{
|
||||
const ESM::Pathgrid::Point& point = pathgrid.mPoints[pointIndex];
|
||||
osg::Vec3f position = osg::Vec3f(static_cast<float>(point.mX), static_cast<float>(point.mY), static_cast<float>(point.mZ));
|
||||
osg::Vec3f position = osg::Vec3f(
|
||||
static_cast<float>(point.mX), static_cast<float>(point.mY), static_cast<float>(point.mZ));
|
||||
|
||||
size_t vertexOffset = pointIndex * DiamondTotalVertexCount;
|
||||
size_t indexOffset = pointIndex * DiamondIndexCount;
|
||||
|
|
@ -73,7 +76,8 @@ namespace SceneUtil
|
|||
|
||||
for (unsigned short i = 0; i < DiamondIndexCount; ++i)
|
||||
{
|
||||
pointIndices->setElement(static_cast<unsigned int>(indexOffset + i), static_cast<unsigned int>(vertexOffset + DiamondIndices[i]));
|
||||
pointIndices->setElement(static_cast<unsigned int>(indexOffset + i),
|
||||
static_cast<unsigned int>(vertexOffset + DiamondIndices[i]));
|
||||
}
|
||||
|
||||
// Connectors
|
||||
|
|
@ -96,8 +100,10 @@ namespace SceneUtil
|
|||
const ESM::Pathgrid::Point& from = pathgrid.mPoints[edge.mV0];
|
||||
const ESM::Pathgrid::Point& to = pathgrid.mPoints[edge.mV1];
|
||||
|
||||
osg::Vec3f fromPos = osg::Vec3f(static_cast<float>(from.mX), static_cast<float>(from.mY), static_cast<float>(from.mZ));
|
||||
osg::Vec3f toPos = osg::Vec3f(static_cast<float>(to.mX), static_cast<float>(to.mY), static_cast<float>(to.mZ));
|
||||
osg::Vec3f fromPos
|
||||
= osg::Vec3f(static_cast<float>(from.mX), static_cast<float>(from.mY), static_cast<float>(from.mZ));
|
||||
osg::Vec3f toPos
|
||||
= osg::Vec3f(static_cast<float>(to.mX), static_cast<float>(to.mY), static_cast<float>(to.mZ));
|
||||
osg::Vec3f dir = toPos - fromPos;
|
||||
dir.normalize();
|
||||
|
||||
|
|
@ -153,7 +159,9 @@ namespace SceneUtil
|
|||
for (size_t it = 0; it < selected.size(); ++it)
|
||||
{
|
||||
const ESM::Pathgrid::Point& point = pathgrid.mPoints[selected[it]];
|
||||
osg::Vec3f position = osg::Vec3f(static_cast<float>(point.mX), static_cast<float>(point.mY), static_cast<float>(point.mZ)) + wireOffset;
|
||||
osg::Vec3f position = osg::Vec3f(static_cast<float>(point.mX), static_cast<float>(point.mY),
|
||||
static_cast<float>(point.mZ))
|
||||
+ wireOffset;
|
||||
|
||||
size_t vertexOffset = it * DiamondVertexCount;
|
||||
size_t indexOffset = it * DiamondWireframeIndexCount;
|
||||
|
|
@ -171,7 +179,8 @@ namespace SceneUtil
|
|||
|
||||
for (unsigned short i = 0; i < DiamondWireframeIndexCount; ++i)
|
||||
{
|
||||
indices->setElement(static_cast<unsigned int>(indexOffset + i), static_cast<unsigned int>(vertexOffset + DiamondWireframeIndices[i]));
|
||||
indices->setElement(static_cast<unsigned int>(indexOffset + i),
|
||||
static_cast<unsigned int>(vertexOffset + DiamondWireframeIndices[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ namespace SceneUtil
|
|||
normal->push_back(osg::Vec3f(0, 0, 1));
|
||||
waterGeom->setNormalArray(normal, osg::Array::BIND_OVERALL);
|
||||
|
||||
waterGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, static_cast<GLsizei>(verts->size())));
|
||||
waterGeom->addPrimitiveSet(
|
||||
new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, static_cast<GLsizei>(verts->size())));
|
||||
waterGeom->setComputeBoundingBoxCallback(new WaterBoundCallback);
|
||||
waterGeom->setCullingActive(false);
|
||||
return waterGeom;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace SDLUtil
|
|||
_setWindowScale();
|
||||
}
|
||||
|
||||
InputWrapper::~InputWrapper() {}
|
||||
InputWrapper::~InputWrapper() = default;
|
||||
|
||||
void InputWrapper::_setWindowScale()
|
||||
{
|
||||
|
|
@ -47,8 +47,8 @@ namespace SDLUtil
|
|||
SDL_GetWindowSize(mSDLWindow, &w, &h);
|
||||
int dw, dh;
|
||||
SDL_GL_GetDrawableSize(mSDLWindow, &dw, &dh);
|
||||
mScaleX = dw / w;
|
||||
mScaleY = dh / h;
|
||||
mScaleX = static_cast<Uint16>(dw / w);
|
||||
mScaleY = static_cast<Uint16>(dh / h);
|
||||
}
|
||||
|
||||
void InputWrapper::capture(bool windowEventsOnly)
|
||||
|
|
@ -320,8 +320,8 @@ namespace SDLUtil
|
|||
{
|
||||
SDL_WarpMouseInWindow(mSDLWindow, x, y);
|
||||
mWarpCompensate = true;
|
||||
mWarpX = x;
|
||||
mWarpY = y;
|
||||
mWarpX = static_cast<Uint16>(x);
|
||||
mWarpY = static_cast<Uint16>(y);
|
||||
}
|
||||
|
||||
/// \brief Locks the pointer to the window
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ namespace
|
|||
{
|
||||
lineDirectivePosition = 0;
|
||||
}
|
||||
lineNumber += std::count(source.begin() + lineDirectivePosition, source.begin() + foundPos, '\n');
|
||||
lineNumber
|
||||
+= static_cast<int>(std::count(source.begin() + lineDirectivePosition, source.begin() + foundPos, '\n'));
|
||||
return lineNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Stereo
|
|||
|
||||
bool getTextureViewSupportedImpl(unsigned int contextID)
|
||||
{
|
||||
if (!osg::isGLExtensionOrVersionSupported(contextID, "ARB_texture_view", 4.3))
|
||||
if (!osg::isGLExtensionOrVersionSupported(contextID, "ARB_texture_view", 4.3f))
|
||||
{
|
||||
Log(Debug::Verbose) << "Disabling texture views (opengl extension \"ARB_texture_view\" not supported)";
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace Stereo
|
|||
return *sInstance;
|
||||
}
|
||||
|
||||
Manager::Manager(osgViewer::Viewer* viewer, bool enableStereo, double near, double far)
|
||||
Manager::Manager(osgViewer::Viewer* viewer, bool enableStereo, float near, float far)
|
||||
: mViewer(viewer)
|
||||
, mMainCamera(mViewer->getCamera())
|
||||
, mUpdateCallback(new StereoUpdateCallback(this))
|
||||
|
|
@ -182,8 +182,8 @@ namespace Stereo
|
|||
{
|
||||
if (mEyeResolutionOverriden)
|
||||
return mEyeResolutionOverride;
|
||||
auto width = mMainCamera->getViewport()->width() / 2;
|
||||
auto height = mMainCamera->getViewport()->height();
|
||||
auto width = static_cast<int>(mMainCamera->getViewport()->width() / 2);
|
||||
auto height = static_cast<int>(mMainCamera->getViewport()->height());
|
||||
|
||||
return osg::Vec2i(width, height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,13 +78,13 @@ namespace Stereo
|
|||
//! @Param enableMultiview whether or not to make use of the GL_OVR_Multiview extension, if supported.
|
||||
//! @Param near defines distance to near camera clipping plane from view point.
|
||||
//! @Param far defines distance to far camera clipping plane from view point.
|
||||
explicit Manager(osgViewer::Viewer* viewer, bool enableStereo, double near, double far);
|
||||
explicit Manager(osgViewer::Viewer* viewer, bool enableStereo, float near, float far);
|
||||
~Manager();
|
||||
|
||||
//! Called during update traversal
|
||||
void update();
|
||||
|
||||
void updateSettings(double near, double far)
|
||||
void updateSettings(float near, float far)
|
||||
{
|
||||
mNear = near;
|
||||
mFar = far;
|
||||
|
|
@ -146,8 +146,8 @@ namespace Stereo
|
|||
std::shared_ptr<MultiviewFramebuffer> mMultiviewFramebuffer;
|
||||
bool mEyeResolutionOverriden;
|
||||
osg::Vec2i mEyeResolutionOverride;
|
||||
double mNear;
|
||||
double mFar;
|
||||
float mNear;
|
||||
float mFar;
|
||||
|
||||
std::array<View, 2> mView;
|
||||
std::array<osg::Matrixd, 2> mViewOffsetMatrix;
|
||||
|
|
|
|||
|
|
@ -60,15 +60,18 @@ namespace Stereo
|
|||
// that view matrix will already convert points to a camera space
|
||||
// with opengl conventions. So we need to convert offsets to opengl
|
||||
// conventions.
|
||||
float y = position.y();
|
||||
float z = position.z();
|
||||
position.y() = z;
|
||||
position.z() = -y;
|
||||
|
||||
y = orientation.y();
|
||||
z = orientation.z();
|
||||
orientation.y() = z;
|
||||
orientation.z() = -y;
|
||||
{
|
||||
float y = position.y();
|
||||
float z = position.z();
|
||||
position.y() = z;
|
||||
position.z() = -y;
|
||||
}
|
||||
{
|
||||
double y = orientation.y();
|
||||
double z = orientation.z();
|
||||
orientation.y() = z;
|
||||
orientation.z() = -y;
|
||||
}
|
||||
|
||||
osg::Matrix viewMatrix;
|
||||
viewMatrix.setTrans(-position);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace
|
|||
template <typename IndexArrayType>
|
||||
osg::ref_ptr<IndexArrayType> createIndexBuffer(unsigned int flags, unsigned int verts)
|
||||
{
|
||||
using IndexType = IndexArrayType::value_type;
|
||||
// LOD level n means every 2^n-th vertex is kept, but we currently handle LOD elsewhere.
|
||||
size_t lodLevel = 0; //(flags >> (4*4));
|
||||
|
||||
|
|
@ -45,23 +46,23 @@ namespace
|
|||
// diamond pattern
|
||||
if ((row + col % 2) % 2 == 1)
|
||||
{
|
||||
indices->push_back(verts * (col + increment) + row);
|
||||
indices->push_back(verts * (col + increment) + row + increment);
|
||||
indices->push_back(verts * col + row + increment);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row + increment));
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row + increment));
|
||||
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * (col + increment) + row);
|
||||
indices->push_back(verts * (col) + row + increment);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col) + row + increment));
|
||||
}
|
||||
else
|
||||
{
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * (col + increment) + row + increment);
|
||||
indices->push_back(verts * col + row + increment);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row + increment));
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row + increment));
|
||||
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * (col + increment) + row);
|
||||
indices->push_back(verts * (col + increment) + row + increment);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + increment) + row + increment));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -77,22 +78,22 @@ namespace
|
|||
size_t outerStep = static_cast<size_t>(1) << (lodDeltas[Terrain::South] + lodLevel);
|
||||
for (size_t col = 0; col < verts - 1; col += outerStep)
|
||||
{
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * (col + outerStep) + row);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + outerStep) + row));
|
||||
// Make sure not to touch the right edge
|
||||
if (col + outerStep == verts - 1)
|
||||
indices->push_back(verts * (col + outerStep - innerStep) + row + innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + outerStep - innerStep) + row + innerStep));
|
||||
else
|
||||
indices->push_back(verts * (col + outerStep) + row + innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + outerStep) + row + innerStep));
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col + i == 0 || col + i == verts - 1 - innerStep)
|
||||
continue;
|
||||
indices->push_back(verts * (col) + row);
|
||||
indices->push_back(verts * (col + i + innerStep) + row + innerStep);
|
||||
indices->push_back(verts * (col + i) + row + innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col) + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + i + innerStep) + row + innerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + i) + row + innerStep));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,22 +102,22 @@ namespace
|
|||
outerStep = size_t(1) << (lodDeltas[Terrain::North] + lodLevel);
|
||||
for (size_t col = 0; col < verts - 1; col += outerStep)
|
||||
{
|
||||
indices->push_back(verts * (col + outerStep) + row);
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + outerStep) + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
// Make sure not to touch the left edge
|
||||
if (col == 0)
|
||||
indices->push_back(verts * (col + innerStep) + row - innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + innerStep) + row - innerStep));
|
||||
else
|
||||
indices->push_back(verts * col + row - innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row - innerStep));
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col + i == 0 || col + i == verts - 1 - innerStep)
|
||||
continue;
|
||||
indices->push_back(verts * (col + i) + row - innerStep);
|
||||
indices->push_back(verts * (col + i + innerStep) + row - innerStep);
|
||||
indices->push_back(verts * (col + outerStep) + row);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + i) + row - innerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + i + innerStep) + row - innerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + outerStep) + row));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,22 +126,22 @@ namespace
|
|||
outerStep = size_t(1) << (lodDeltas[Terrain::West] + lodLevel);
|
||||
for (row = 0; row < verts - 1; row += outerStep)
|
||||
{
|
||||
indices->push_back(verts * col + row + outerStep);
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row + outerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
// Make sure not to touch the top edge
|
||||
if (row + outerStep == verts - 1)
|
||||
indices->push_back(verts * (col + innerStep) + row + outerStep - innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + innerStep) + row + outerStep - innerStep));
|
||||
else
|
||||
indices->push_back(verts * (col + innerStep) + row + outerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + innerStep) + row + outerStep));
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row + i == 0 || row + i == verts - 1 - innerStep)
|
||||
continue;
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * (col + innerStep) + row + i);
|
||||
indices->push_back(verts * (col + innerStep) + row + i + innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + innerStep) + row + i));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col + innerStep) + row + i + innerStep));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,22 +150,22 @@ namespace
|
|||
outerStep = size_t(1) << (lodDeltas[Terrain::East] + lodLevel);
|
||||
for (row = 0; row < verts - 1; row += outerStep)
|
||||
{
|
||||
indices->push_back(verts * col + row);
|
||||
indices->push_back(verts * col + row + outerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row));
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row + outerStep));
|
||||
// Make sure not to touch the bottom edge
|
||||
if (row == 0)
|
||||
indices->push_back(verts * (col - innerStep) + row + innerStep);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col - innerStep) + row + innerStep));
|
||||
else
|
||||
indices->push_back(verts * (col - innerStep) + row);
|
||||
indices->push_back(static_cast<IndexType>(verts * (col - innerStep) + row));
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row + i == 0 || row + i == verts - 1 - innerStep)
|
||||
continue;
|
||||
indices->push_back(verts * col + row + outerStep);
|
||||
indices->push_back(verts * (col - innerStep) + row + i + innerStep);
|
||||
indices->push_back(verts * (col - innerStep) + row + i);
|
||||
indices->push_back(static_cast<IndexType>(verts * col + row + outerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col - innerStep) + row + i + innerStep));
|
||||
indices->push_back(static_cast<IndexType>(verts * (col - innerStep) + row + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Terrain
|
|||
border->setColorArray(colors.get());
|
||||
border->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
|
||||
border->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, vertices->size()));
|
||||
border->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, static_cast<GLsizei>(vertices->size())));
|
||||
|
||||
osg::ref_ptr<osg::Group> borderGroup = new osg::Group;
|
||||
borderGroup->addChild(border.get());
|
||||
|
|
@ -84,8 +84,8 @@ namespace Terrain
|
|||
|
||||
void CellBorder::createCellBorderGeometry(int x, int y)
|
||||
{
|
||||
auto borderGroup = createBorderGeometry(
|
||||
x, y, 1.f, mWorld->getStorage(), mSceneManager, mBorderMask, mWorld->getWorldspace());
|
||||
auto borderGroup = createBorderGeometry(static_cast<float>(x), static_cast<float>(y), 1.f, mWorld->getStorage(),
|
||||
mSceneManager, mBorderMask, mWorld->getWorldspace());
|
||||
mRoot->addChild(borderGroup);
|
||||
|
||||
mCellBorderNodes[std::make_pair(x, y)] = borderGroup;
|
||||
|
|
|
|||
|
|
@ -206,10 +206,10 @@ namespace Terrain
|
|||
blendmapTextures.push_back(texture);
|
||||
}
|
||||
|
||||
float tileCount = mStorage->getTextureTileCount(chunkSize, mWorldspace);
|
||||
int tileCount = mStorage->getTextureTileCount(chunkSize, mWorldspace);
|
||||
|
||||
return ::Terrain::createPasses(
|
||||
useShaders, mSceneManager, layers, blendmapTextures, tileCount, tileCount, ESM::isEsm4Ext(mWorldspace));
|
||||
return ::Terrain::createPasses(useShaders, mSceneManager, layers, blendmapTextures, tileCount,
|
||||
static_cast<float>(tileCount), ESM::isEsm4Ext(mWorldspace));
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> ChunkManager::createChunk(float chunkSize, const osg::Vec2f& chunkCenter, unsigned char lod,
|
||||
|
|
@ -261,7 +261,8 @@ namespace Terrain
|
|||
if (chunkSize <= 1.f)
|
||||
geometry->setLightListCallback(new SceneUtil::LightListCallback);
|
||||
|
||||
unsigned int numVerts = (mStorage->getCellVertices(mWorldspace) - 1) * chunkSize / (1 << lod) + 1;
|
||||
unsigned int numVerts
|
||||
= static_cast<unsigned>((mStorage->getCellVertices(mWorldspace) - 1) * chunkSize / (1 << lod) + 1);
|
||||
|
||||
geometry->addPrimitiveSet(mBufferCache.getIndexBuffer(numVerts, lodFlags));
|
||||
|
||||
|
|
@ -303,7 +304,7 @@ namespace Terrain
|
|||
layer.mSpecular = false;
|
||||
geometry->setPasses(::Terrain::createPasses(
|
||||
mSceneManager->getForceShaders() || !mSceneManager->getClampLighting(), mSceneManager,
|
||||
std::vector<TextureLayer>(1, layer), std::vector<osg::ref_ptr<osg::Texture2D>>(), 1.f, 1.f));
|
||||
std::vector<TextureLayer>(1, layer), std::vector<osg::ref_ptr<osg::Texture2D>>(), 1, 1.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Terrain
|
|||
getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
}
|
||||
|
||||
CompositeMapRenderer::~CompositeMapRenderer() {}
|
||||
CompositeMapRenderer::~CompositeMapRenderer() = default;
|
||||
|
||||
void CompositeMapRenderer::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace Terrain
|
|||
// should OSG be doing this on its own?
|
||||
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), osg::StateAttribute::TEXTURE);
|
||||
|
||||
for (unsigned int i = compositeMap.mCompiled; i < compositeMap.mDrawables.size(); ++i)
|
||||
for (size_t i = compositeMap.mCompiled; i < compositeMap.mDrawables.size(); ++i)
|
||||
{
|
||||
osg::Drawable* drw = compositeMap.mDrawables[i];
|
||||
osg::StateSet* stateset = drw->getStateSet();
|
||||
|
|
@ -165,7 +165,7 @@ namespace Terrain
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int CompositeMapRenderer::getCompileSetSize() const
|
||||
size_t CompositeMapRenderer::getCompileSetSize() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
return mCompileSet.size();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Terrain
|
|||
~CompositeMap();
|
||||
std::vector<osg::ref_ptr<osg::Drawable>> mDrawables;
|
||||
osg::ref_ptr<osg::Texture2D> mTexture;
|
||||
unsigned int mCompiled;
|
||||
size_t mCompiled;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +52,7 @@ namespace Terrain
|
|||
/// Mark this composite map to be required for the current frame
|
||||
void setImmediate(CompositeMap* map);
|
||||
|
||||
unsigned int getCompileSetSize() const;
|
||||
size_t getCompileSetSize() const;
|
||||
|
||||
private:
|
||||
float mTargetFrameRate;
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ namespace
|
|||
static const osg::ref_ptr<osg::TexMat>& value(const int blendmapScale)
|
||||
{
|
||||
static BlendmapTexMat instance;
|
||||
return instance.get(blendmapScale);
|
||||
return instance.get(static_cast<float>(blendmapScale));
|
||||
}
|
||||
|
||||
const osg::ref_ptr<osg::TexMat>& get(const int blendmapScale)
|
||||
const osg::ref_ptr<osg::TexMat>& get(const float blendmapScale)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(mMutex);
|
||||
auto texMat = mTexMatMap.find(blendmapScale);
|
||||
if (texMat == mTexMatMap.end())
|
||||
{
|
||||
osg::Matrixf matrix;
|
||||
float scale = (blendmapScale / (static_cast<float>(blendmapScale) + 1.f));
|
||||
float scale = (blendmapScale / (blendmapScale + 1.f));
|
||||
matrix.preMultTranslate(osg::Vec3f(0.5f, 0.5f, 0.f));
|
||||
matrix.preMultScale(osg::Vec3f(scale, scale, 1.f));
|
||||
matrix.preMultTranslate(osg::Vec3f(-0.5f, -0.5f, 0.f));
|
||||
|
|
@ -43,8 +43,7 @@ namespace
|
|||
// blendmap, apparently.
|
||||
matrix.preMultTranslate(osg::Vec3f(1.0f / blendmapScale / 4.0f, 1.0f / blendmapScale / 4.0f, 0.f));
|
||||
|
||||
texMat = mTexMatMap.insert(std::make_pair(static_cast<float>(blendmapScale), new osg::TexMat(matrix)))
|
||||
.first;
|
||||
texMat = mTexMatMap.emplace(blendmapScale, new osg::TexMat(matrix)).first;
|
||||
}
|
||||
return texMat->second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Terrain
|
|||
|
||||
inline QuadTreeNode* getParent() { return mParent; }
|
||||
inline QuadTreeNode* getChild(unsigned int i) { return static_cast<QuadTreeNode*>(Group::getChild(i)); }
|
||||
inline unsigned int getNumChildren() const override { return _children.size(); }
|
||||
inline unsigned int getNumChildren() const override { return static_cast<unsigned int>(_children.size()); }
|
||||
|
||||
// osg::Group::addChild() does a lot of unrelated stuff, but we just really want to add a child node.
|
||||
void addChildNode(QuadTreeNode* child)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace Terrain
|
|||
float centerX = (mMinX + mMaxX) / 2.f + (size - origSizeX) / 2.f;
|
||||
float centerY = (mMinY + mMaxY) / 2.f + (size - origSizeY) / 2.f;
|
||||
|
||||
mRootNode = new RootNode(size, osg::Vec2f(centerX, centerY));
|
||||
mRootNode = new RootNode(static_cast<float>(size), osg::Vec2f(centerX, centerY));
|
||||
addChildren(mRootNode);
|
||||
|
||||
mRootNode->initNeighbours();
|
||||
|
|
@ -212,7 +212,8 @@ namespace Terrain
|
|||
// Do not add child nodes for default cells without data.
|
||||
// size = 1 means that the single shape covers the whole cell.
|
||||
if (node->getSize() == 1
|
||||
&& !mStorage->hasData(ESM::ExteriorCellLocation(center.x() - 0.5, center.y() - 0.5, mWorldspace)))
|
||||
&& !mStorage->hasData(ESM::ExteriorCellLocation(
|
||||
static_cast<int>(center.x() - 0.5f), static_cast<int>(center.y() - 0.5f), mWorldspace)))
|
||||
return node;
|
||||
|
||||
if (node->getSize() <= mMinSize)
|
||||
|
|
@ -259,14 +260,14 @@ namespace Terrain
|
|||
, mNodeMask(nodeMask)
|
||||
{
|
||||
}
|
||||
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& chunkCenter, unsigned char lod,
|
||||
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& chunkCenter, unsigned char /*lod*/,
|
||||
unsigned int lodFlags, bool activeGrid, const osg::Vec3f& viewPoint, bool compile)
|
||||
{
|
||||
osg::Vec3f center = { chunkCenter.x(), chunkCenter.y(), 0 };
|
||||
auto chunkBorder = CellBorder::createBorderGeometry(center.x() - size / 2.f, center.y() - size / 2.f, size,
|
||||
mStorage, mSceneManager, mNodeMask, mWorldspace, 5.f, { 1, 0, 0, 0 });
|
||||
osg::ref_ptr<SceneUtil::PositionAttitudeTransform> pat = new SceneUtil::PositionAttitudeTransform;
|
||||
pat->setPosition(-center * ESM::getCellSize(mWorldspace));
|
||||
pat->setPosition(-center * static_cast<float>(ESM::getCellSize(mWorldspace)));
|
||||
pat->addChild(chunkBorder);
|
||||
return pat;
|
||||
}
|
||||
|
|
@ -282,8 +283,8 @@ namespace Terrain
|
|||
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
|
||||
int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize,
|
||||
bool debugChunks, ESM::RefId worldspace, double expiryDelay)
|
||||
: TerrainGrid(
|
||||
parent, compileRoot, resourceSystem, storage, nodeMask, worldspace, expiryDelay, preCompileMask, borderMask)
|
||||
: TerrainGrid(parent, compileRoot, resourceSystem, storage, nodeMask, worldspace, expiryDelay, preCompileMask,
|
||||
borderMask)
|
||||
, mViewDataMap(new ViewDataMap)
|
||||
, mQuadTreeBuilt(false)
|
||||
, mLodFactor(lodFactor)
|
||||
|
|
@ -396,8 +397,8 @@ namespace Terrain
|
|||
for (QuadTreeWorld::ChunkManager* m : mChunkManagers)
|
||||
{
|
||||
osg::ref_ptr<osg::Node> n = m->getChunk(entry.mNode->getSize(), entry.mNode->getCenter(),
|
||||
DefaultLodCallback::getNativeLodLevel(entry.mNode, mMinSize), entry.mLodFlags, activeGrid,
|
||||
vd->getViewPoint(), compile);
|
||||
static_cast<unsigned char>(DefaultLodCallback::getNativeLodLevel(entry.mNode, mMinSize)),
|
||||
entry.mLodFlags, activeGrid, vd->getViewPoint(), compile);
|
||||
if (n)
|
||||
pat->addChild(n);
|
||||
}
|
||||
|
|
@ -487,7 +488,7 @@ namespace Terrain
|
|||
mRootNode->traverseNodes(vd, viewPoint, &lodCallback);
|
||||
}
|
||||
|
||||
const float cellWorldSize = ESM::getCellSize(mWorldspace);
|
||||
const float cellWorldSize = static_cast<float>(ESM::getCellSize(mWorldspace));
|
||||
|
||||
for (unsigned int i = 0; i < vd->getNumEntries(); ++i)
|
||||
{
|
||||
|
|
@ -552,7 +553,7 @@ namespace Terrain
|
|||
vd->setViewPoint(viewPoint);
|
||||
vd->setActiveGrid(grid);
|
||||
|
||||
DefaultLodCallback lodCallback(mLodFactor, mMinSize, mViewDistance, grid, cellWorldSize);
|
||||
DefaultLodCallback lodCallback(mLodFactor, mMinSize, mViewDistance, grid, static_cast<int>(cellWorldSize));
|
||||
mRootNode->traverseNodes(vd, viewPoint, &lodCallback);
|
||||
|
||||
reporter.addTotal(vd->getNumEntries());
|
||||
|
|
@ -568,14 +569,15 @@ namespace Terrain
|
|||
void QuadTreeWorld::reportStats(unsigned int frameNumber, osg::Stats* stats)
|
||||
{
|
||||
if (mCompositeMapRenderer)
|
||||
stats->setAttribute(frameNumber, "Composite", mCompositeMapRenderer->getCompileSetSize());
|
||||
stats->setAttribute(
|
||||
frameNumber, "Composite", static_cast<double>(mCompositeMapRenderer->getCompileSetSize()));
|
||||
}
|
||||
|
||||
void QuadTreeWorld::loadCell(int x, int y)
|
||||
{
|
||||
// fallback behavior only for undefined cells (every other is already handled in quadtree)
|
||||
float dummy;
|
||||
if (mChunkManager && !mStorage->getMinMaxHeights(1, osg::Vec2f(x + 0.5, y + 0.5), mWorldspace, dummy, dummy))
|
||||
if (mChunkManager && !mStorage->getMinMaxHeights(1, osg::Vec2f(x + 0.5f, y + 0.5f), mWorldspace, dummy, dummy))
|
||||
TerrainGrid::loadCell(x, y);
|
||||
else
|
||||
World::loadCell(x, y);
|
||||
|
|
@ -585,7 +587,7 @@ namespace Terrain
|
|||
{
|
||||
// fallback behavior only for undefined cells (every other is already handled in quadtree)
|
||||
float dummy;
|
||||
if (mChunkManager && !mStorage->getMinMaxHeights(1, osg::Vec2f(x + 0.5, y + 0.5), mWorldspace, dummy, dummy))
|
||||
if (mChunkManager && !mStorage->getMinMaxHeights(1, osg::Vec2f(x + 0.5f, y + 0.5f), mWorldspace, dummy, dummy))
|
||||
TerrainGrid::unloadCell(x, y);
|
||||
else
|
||||
World::unloadCell(x, y);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace Terrain
|
|||
class ChunkManager
|
||||
{
|
||||
public:
|
||||
virtual ~ChunkManager() {}
|
||||
virtual ~ChunkManager() = default;
|
||||
ChunkManager() = default;
|
||||
ChunkManager(ESM::RefId worldspace)
|
||||
: ChunkManager()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Terrain
|
|||
class Storage
|
||||
{
|
||||
public:
|
||||
virtual ~Storage() {}
|
||||
virtual ~Storage() = default;
|
||||
|
||||
public:
|
||||
/// Get bounds of the whole terrain in cell units
|
||||
|
|
@ -36,8 +36,8 @@ namespace Terrain
|
|||
virtual bool hasData(ESM::ExteriorCellLocation cellLocation)
|
||||
{
|
||||
float dummy;
|
||||
return getMinMaxHeights(
|
||||
1, osg::Vec2f(cellLocation.mX + 0.5, cellLocation.mY + 0.5), cellLocation.mWorldspace, dummy, dummy);
|
||||
return getMinMaxHeights(1.f, osg::Vec2f(cellLocation.mX + 0.5f, cellLocation.mY + 0.5f),
|
||||
cellLocation.mWorldspace, dummy, dummy);
|
||||
}
|
||||
|
||||
/// Get the minimum and maximum heights of a terrain region.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Terrain
|
|||
|
||||
TerrainDrawable::TerrainDrawable() {}
|
||||
|
||||
TerrainDrawable::~TerrainDrawable() {}
|
||||
TerrainDrawable::~TerrainDrawable() = default;
|
||||
|
||||
TerrainDrawable::TerrainDrawable(const TerrainDrawable& copy, const osg::CopyOp& copyop)
|
||||
: osg::Geometry(copy, copyop)
|
||||
|
|
@ -37,8 +37,8 @@ namespace Terrain
|
|||
|
||||
inline float distance(const osg::Vec3& coord, const osg::Matrix& matrix)
|
||||
{
|
||||
return -((float)coord[0] * (float)matrix(0, 2) + (float)coord[1] * (float)matrix(1, 2)
|
||||
+ (float)coord[2] * (float)matrix(2, 2) + matrix(3, 2));
|
||||
return -(coord[0] * static_cast<float>(matrix(0, 2)) + coord[1] * static_cast<float>(matrix(1, 2))
|
||||
+ coord[2] * static_cast<float>(matrix(2, 2)) + static_cast<float>(matrix(3, 2)));
|
||||
}
|
||||
|
||||
// canot use ClusterCullingCallback::cull: viewpoint != eyepoint
|
||||
|
|
|
|||
Loading…
Reference in a new issue