File: detourdebugdraw.hpp

package info (click to toggle)
openmw 0.49.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,992 kB
  • sloc: cpp: 372,479; xml: 2,149; sh: 1,403; python: 797; makefile: 26
file content (58 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef OPENMW_COMPONENTS_SCENEUTIL_DETOURDEBUGDRAW_H
#define OPENMW_COMPONENTS_SCENEUTIL_DETOURDEBUGDRAW_H

#include <DebugDraw.h>

#include <osg/Geometry>

namespace osg
{
    class Group;
}

namespace SceneUtil
{
    class DebugDraw : public duDebugDraw
    {
    public:
        explicit DebugDraw(osg::Group& group, const osg::ref_ptr<osg::StateSet>& stateSet, const osg::Vec3f& shift,
            float recastInvertedScaleFactor);

        void depthMask(bool state) override;

        void texture(bool state) override;

        void begin(osg::PrimitiveSet::Mode mode, float size);

        void begin(duDebugDrawPrimitives prim, float size) override;

        void vertex(const float* pos, unsigned int color) override;

        void vertex(const float x, const float y, const float z, unsigned int color) override;

        void vertex(const float* pos, unsigned int color, const float* uv) override;

        void vertex(
            const float x, const float y, const float z, unsigned int color, const float u, const float v) override;

        void end() override;

    private:
        osg::Group& mGroup;
        osg::ref_ptr<osg::StateSet> mStateSet;
        osg::Vec3f mShift;
        float mRecastInvertedScaleFactor;
        osg::PrimitiveSet::Mode mMode;
        float mSize;
        osg::ref_ptr<osg::Vec3Array> mVertices;
        osg::ref_ptr<osg::Vec4Array> mColors;

        void addVertex(osg::Vec3f&& position);

        void addColor(osg::Vec4f&& value);
    };

    osg::ref_ptr<osg::StateSet> makeDetourGroupStateSet();
}

#endif