1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 07:21:12 +00:00

Use line width 1 as the only guaranteed to be supported value by glLineWidth

This commit is contained in:
elsid 2021-11-01 20:54:10 +01:00
parent 6b7363bd59
commit 66390bd8a4
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40
3 changed files with 5 additions and 4 deletions

View File

@ -56,7 +56,7 @@ namespace SceneUtil
mMode = mode;
mVertices = new osg::Vec3Array;
mColors = new osg::Vec4Array;
mSize = size * mRecastInvertedScaleFactor;
mSize = size;
}
void DebugDraw::begin(duDebugDrawPrimitives prim, float size)
@ -93,7 +93,8 @@ namespace SceneUtil
stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
stateSet->setMode(GL_DEPTH, (mDepthMask ? osg::StateAttribute::ON : osg::StateAttribute::OFF));
stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
stateSet->setAttributeAndModes(new osg::LineWidth(mSize));
// TODO: mSize has to be used for the line width, but not for glLineWidth because of the spec limitations
stateSet->setAttributeAndModes(new osg::LineWidth());
stateSet->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
osg::ref_ptr<osg::Geometry> geometry(new osg::Geometry);

View File

@ -15,7 +15,7 @@ namespace SceneUtil
class DebugDraw : public duDebugDraw
{
public:
DebugDraw(osg::Group& group, const osg::Vec3f& shift, float recastInvertedScaleFactor);
explicit DebugDraw(osg::Group& group, const osg::Vec3f& shift, float recastInvertedScaleFactor);
void depthMask(bool state) override;

View File

@ -12,7 +12,7 @@ namespace SceneUtil
{
osg::ref_ptr<osg::Group> createNavMeshGroup(const dtNavMesh& navMesh, const DetourNavigator::Settings& settings)
{
const osg::ref_ptr<osg::Group> group(new osg::Group);
osg::ref_ptr<osg::Group> group(new osg::Group);
DebugDraw debugDraw(*group, osg::Vec3f(0, 0, 10), 1.0f / settings.mRecastScaleFactor);
dtNavMeshQuery navMeshQuery;
navMeshQuery.init(&navMesh, settings.mMaxNavMeshQueryNodes);