mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Apply clang-format to code base
This commit is contained in:
parent
f37d0be806
commit
ddb0522bbf
2199 changed files with 118692 additions and 114392 deletions
|
@ -1,10 +1,10 @@
|
|||
#include "recastmesh.hpp"
|
||||
#include "detourdebugdraw.hpp"
|
||||
#include "depth.hpp"
|
||||
#include "detourdebugdraw.hpp"
|
||||
|
||||
#include <components/detournavigator/settings.hpp>
|
||||
#include <components/detournavigator/recastmesh.hpp>
|
||||
#include <components/detournavigator/recastmeshbuilder.hpp>
|
||||
#include <components/detournavigator/settings.hpp>
|
||||
|
||||
#include <RecastDebugDraw.h>
|
||||
|
||||
|
@ -41,8 +41,8 @@ namespace
|
|||
|
||||
namespace SceneUtil
|
||||
{
|
||||
osg::ref_ptr<osg::Group> createRecastMeshGroup(const DetourNavigator::RecastMesh& recastMesh,
|
||||
const DetourNavigator::RecastSettings& settings)
|
||||
osg::ref_ptr<osg::Group> createRecastMeshGroup(
|
||||
const DetourNavigator::RecastMesh& recastMesh, const DetourNavigator::RecastSettings& settings)
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
|
||||
|
@ -56,9 +56,10 @@ namespace SceneUtil
|
|||
{
|
||||
const Mesh heightfieldMesh = makeMesh(heightfield);
|
||||
const int indexShift = static_cast<int>(vertices.size() / 3);
|
||||
std::copy(heightfieldMesh.getVertices().begin(), heightfieldMesh.getVertices().end(), std::back_inserter(vertices));
|
||||
std::transform(heightfieldMesh.getIndices().begin(), heightfieldMesh.getIndices().end(), std::back_inserter(indices),
|
||||
[&] (int index) { return index + indexShift; });
|
||||
std::copy(heightfieldMesh.getVertices().begin(), heightfieldMesh.getVertices().end(),
|
||||
std::back_inserter(vertices));
|
||||
std::transform(heightfieldMesh.getIndices().begin(), heightfieldMesh.getIndices().end(),
|
||||
std::back_inserter(indices), [&](int index) { return index + indexShift; });
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < vertices.size(); i += 3)
|
||||
|
@ -66,15 +67,16 @@ namespace SceneUtil
|
|||
|
||||
const auto normals = calculateNormals(vertices, indices);
|
||||
const auto texScale = 1.0f / (settings.mCellSize * 10.0f);
|
||||
duDebugDrawTriMeshSlope(&debugDraw, vertices.data(), static_cast<int>(vertices.size() / 3),
|
||||
indices.data(), normals.data(), static_cast<int>(indices.size() / 3), settings.mMaxSlope, texScale);
|
||||
duDebugDrawTriMeshSlope(&debugDraw, vertices.data(), static_cast<int>(vertices.size() / 3), indices.data(),
|
||||
normals.data(), static_cast<int>(indices.size() / 3), settings.mMaxSlope, texScale);
|
||||
|
||||
osg::ref_ptr<osg::Material> material = new osg::Material;
|
||||
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
|
||||
const float polygonOffsetFactor = SceneUtil::AutoDepth::isReversed() ? 1.0 : -1.0;
|
||||
const float polygonOffsetUnits = SceneUtil::AutoDepth::isReversed() ? 1.0 : -1.0;
|
||||
osg::ref_ptr<osg::PolygonOffset> polygonOffset = new osg::PolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
|
||||
osg::ref_ptr<osg::PolygonOffset> polygonOffset
|
||||
= new osg::PolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
|
||||
|
||||
osg::ref_ptr<osg::StateSet> stateSet = group->getOrCreateStateSet();
|
||||
stateSet->setAttribute(material);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue