-
Notifications
You must be signed in to change notification settings - Fork 929
/
fog.hpp
38 lines (28 loc) · 922 Bytes
/
fog.hpp
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
#ifndef OPENMW_COMPONENTS_NIFOSG_FOG_H
#define OPENMW_COMPONENTS_NIFOSG_FOG_H
#include <osg/Fog>
namespace NifOsg
{
// osg::Fog-based wrapper for NiFogProperty that autocalculates the fog start and end distance.
class Fog : public osg::Fog
{
public:
Fog();
Fog(const Fog& copy, const osg::CopyOp& copyop);
META_StateAttribute(NifOsg, Fog, FOG)
int compare(const StateAttribute& sa) const override
{
if (const int base = osg::Fog::compare(sa); base != 0)
return base;
const Fog& rhs = static_cast<const Fog&>(sa);
COMPARE_StateAttribute_Parameter(mDepth);
return 0;
}
void setDepth(float depth) { mDepth = depth; }
float getDepth() const { return mDepth; }
void apply(osg::State& state) const override;
private:
float mDepth{ 1.f };
};
}
#endif