CommonLibSSE NG
Loading...
Searching...
No Matches
TESGrass.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/F/FormTypes.h"
5#include "RE/T/TESModel.h"
6
7namespace RE
8{
9 class TESGrass :
10 public TESBoundObject, // 00
11 public TESModel // 30
12 {
13 public:
14 inline static constexpr auto RTTI = RTTI_TESGrass;
15 inline static constexpr auto VTABLE = VTABLE_TESGrass;
16 inline static constexpr auto FORMTYPE = FormType::Grass;
17
19 {
24 kBothAtLeast = 4,
25 kBothAtMost = 5,
28 };
29
31 {
32 enum RecordFlag : std::uint32_t
33 {
34 kDeleted = 1 << 5,
35 kIgnored = 1 << 12
36 };
37 };
38
39 struct GRASS_DATA // DATA
40 {
41 enum class Flag
42 {
43 kNone = 0,
44 kVertexLighting = 1 << 0,
45 kUniformScale = 1 << 1,
46 kFitSlope = 1 << 2
47 };
48
49 std::int8_t density; // 00
50 std::int8_t minSlopeDegrees; // 01
51 std::int8_t maxSlopeDegrees; // 02
52 std::uint8_t pad03; // 03
53 std::uint16_t distanceFromWaterLevel; // 04
54 std::uint16_t pad06; // 06
56 float positionRange; // 0C
57 float heightRange; // 10
58 float colorRange; // 14
59 float wavePeriod; // 18
61 std::uint8_t pad1D; // 1D
62 std::uint16_t pad1E; // 1E
63 };
64 static_assert(sizeof(GRASS_DATA) == 0x20);
65
66 ~TESGrass() override; // 00
67
68 // override (TESBoundObject)
69 void InitializeData() override; // 04
70 bool Load(TESFile* a_mod) override; // 06
71 void InitItemImpl() override; // 13
72
73 // add
74 [[nodiscard]] virtual std::uint8_t GetDensity() const; // 53 - { return data.density; }
75 virtual bool SetDensity(std::uint8_t a_density); // 54 - { if (a_density > 100) return false; data.density = a_density; return true; }
76 [[nodiscard]] virtual std::uint8_t GetMinSlopeDegrees() const; // 55 - { return data.minSlope; }
77 virtual bool SetMinSlopeDegrees(std::uint8_t a_minSlope); // 56 - { if (a_minSlope > 90 || a_minSlope > data.maxSlopeDegrees) return false; data.minSlopeDegrees = a_minSlope; return true; }
78 [[nodiscard]] virtual std::uint8_t GetMaxSlopeDegrees() const; // 57 - { return data.maxSlope; }
79 virtual bool SetMaxSlopeDegrees(std::uint8_t a_maxSlope); // 58 - { if (a_maxSlope > 90 || a_maxSlope < data.minSlopeDegrees) return false; data.maxSlopeDegrees = a_maxSlope; return true; }
80 [[nodiscard]] virtual float GetMinSlope() const; // 59 - { return data.minSlopeDegrees * 1deg; }
81 [[nodiscard]] virtual float GetMaxSlope() const; // 5A - { return data.maxSlopeDegrees * 1deg; }
82 [[nodiscard]] virtual std::uint16_t GetDistanceFromWaterLevel() const; // 5B - { return data.distanceFromWaterLevel; }
83 virtual void SetDistanceFromWaterLevel(std::uint16_t a_unitsFromWater); // 5C - { data.distanceFromWaterLevel = a_unitsFromWater; }
84 [[nodiscard]] virtual GRASS_WATER_STATE GetUnderwaterState() const; // 5D - { return data.underwater; }
85 virtual void SetUnderwaterState(GRASS_WATER_STATE a_waterState); // 5E - { data.underwater = a_waterState; }
86 [[nodiscard]] virtual float GetPositionRange() const; // 5F - { return data.positionRange; }
87 virtual bool SetPositionRange(float a_positionRange); // 60 - { if (a_positionRange < 0.0 || a_positionRange > 512.0) return false; data.positionRange = a_positionRange; return true; }
88 [[nodiscard]] virtual float GetHeightRange() const; // 61 - { return data.heightRange; }
89 virtual bool SetHeightRange(float a_heightRange); // 62 - { if (a_heightRange < 0.0 || a_heightRange > 1.0) return false; data.heightRange = a_heightRange; return true; }
90 [[nodiscard]] virtual float GetColorRange() const; // 63 - { return data.colorRange; }
91 virtual bool SetColorRange(float a_colorRange); // 64 - { if (a_colorRange < 0.0 || a_colorRange > 1.0) return false; data.colorRange = a_colorRange; return true; }
92 [[nodiscard]] virtual float GetWavePeriod() const; // 65 - { return data.wavePeriod; }
93 virtual bool SetWavePeriod(float a_wavePeriod); // 66 - { if (a_wavePeriod <= 0.0) return false; data.wavePeriod = a_wavePeriod; return true; }
94 [[nodiscard]] virtual bool GetVertexLighting() const; // 67 - { return data.flags & 1; }
95 virtual void SetVertexLighting(bool a_set); // 68 - { if (a_set) data.flags |= 0x1; else data.flags &= 0xFE; }
96 [[nodiscard]] virtual bool GetUniformScaling() const; // 69 - { return (data.flags >> 1) & 1; }
97 virtual void SetUniformScaling(bool a_set); // 6A - { if (a_set) data.flags |= 0x2; else data.flags &= 0xFD; }
98 [[nodiscard]] virtual bool GetFitToSlope() const; // 6B - { return (data.flags >> 2) & 1; }
99 virtual void SetFitToSlope(bool a_set); // 6C - { if (a_set) data.flags |= 0x4; else data.flags &= 0xFB; }
100
101 // members
102 GRASS_DATA data; // 58 - DATA
103 };
104 static_assert(sizeof(TESGrass) == 0x78);
105}
Definition TESBoundObject.h:24
Definition TESFile.h:15
Definition TESGrass.h:12
GRASS_WATER_STATE
Definition TESGrass.h:19
virtual std::uint8_t GetMinSlopeDegrees() const
virtual float GetMinSlope() const
bool Load(TESFile *a_mod) override
static constexpr auto VTABLE
Definition TESGrass.h:15
virtual float GetMaxSlope() const
virtual std::uint8_t GetMaxSlopeDegrees() const
virtual void SetDistanceFromWaterLevel(std::uint16_t a_unitsFromWater)
static constexpr auto RTTI
Definition TESGrass.h:14
static constexpr auto FORMTYPE
Definition TESGrass.h:16
virtual bool SetPositionRange(float a_positionRange)
virtual float GetHeightRange() const
virtual void SetUniformScaling(bool a_set)
virtual bool SetWavePeriod(float a_wavePeriod)
virtual bool SetMinSlopeDegrees(std::uint8_t a_minSlope)
GRASS_DATA data
Definition TESGrass.h:102
virtual bool GetUniformScaling() const
virtual std::uint16_t GetDistanceFromWaterLevel() const
virtual float GetPositionRange() const
virtual bool GetFitToSlope() const
virtual void SetFitToSlope(bool a_set)
virtual void SetVertexLighting(bool a_set)
virtual void SetUnderwaterState(GRASS_WATER_STATE a_waterState)
virtual float GetColorRange() const
virtual bool SetColorRange(float a_colorRange)
virtual float GetWavePeriod() const
virtual std::uint8_t GetDensity() const
virtual GRASS_WATER_STATE GetUnderwaterState() const
void InitializeData() override
virtual bool SetMaxSlopeDegrees(std::uint8_t a_maxSlope)
void InitItemImpl() override
virtual bool SetHeightRange(float a_heightRange)
virtual bool GetVertexLighting() const
virtual bool SetDensity(std::uint8_t a_density)
~TESGrass() override
Definition TESModel.h:16
Definition PCH.h:223
Definition AbsorbEffect.h:6
constexpr REL::VariantID RTTI_TESGrass(685054, 392808, 0x1edea58)
constexpr std::array< REL::VariantID, 2 > VTABLE_TESGrass
Definition Offsets_VTABLE.h:502
Definition TESGrass.h:40
std::uint16_t distanceFromWaterLevel
Definition TESGrass.h:53
std::int8_t minSlopeDegrees
Definition TESGrass.h:50
stl::enumeration< GRASS_WATER_STATE, std::uint32_t > underwater
Definition TESGrass.h:55
std::int8_t density
Definition TESGrass.h:49
float positionRange
Definition TESGrass.h:56
std::uint16_t pad1E
Definition TESGrass.h:62
float wavePeriod
Definition TESGrass.h:59
std::uint8_t pad03
Definition TESGrass.h:52
float heightRange
Definition TESGrass.h:57
stl::enumeration< Flag, std::uint8_t > flags
Definition TESGrass.h:60
std::int8_t maxSlopeDegrees
Definition TESGrass.h:51
Flag
Definition TESGrass.h:42
float colorRange
Definition TESGrass.h:58
std::uint8_t pad1D
Definition TESGrass.h:61
std::uint16_t pad06
Definition TESGrass.h:54
Definition TESGrass.h:31
RecordFlag
Definition TESGrass.h:33
@ kIgnored
Definition TESGrass.h:35
@ kDeleted
Definition TESGrass.h:34