CommonLibSSE (Parapets fork)
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 FORMTYPE = FormType::Grass;
16
18 {
23 kBothAtLeast = 4,
24 kBothAtMost = 5,
27 };
28
30 {
31 enum RecordFlag : std::uint32_t
32 {
33 kDeleted = 1 << 5,
34 kIgnored = 1 << 12
35 };
36 };
37
38 struct GRASS_DATA // DATA
39 {
40 enum class Flag
41 {
42 kNone = 0,
43 kVertexLighting = 1 << 0,
44 kUniformScale = 1 << 1,
45 kFitSlope = 1 << 2
46 };
47
48 std::int8_t density; // 00
49 std::int8_t minSlopeDegrees; // 01
50 std::int8_t maxSlopeDegrees; // 02
51 std::uint8_t pad03; // 03
52 std::uint16_t distanceFromWaterLevel; // 04
53 std::uint16_t pad06; // 06
55 float positionRange; // 0C
56 float heightRange; // 10
57 float colorRange; // 14
58 float wavePeriod; // 18
60 std::uint8_t pad1D; // 1D
61 std::uint16_t pad1E; // 1E
62 };
63 static_assert(sizeof(GRASS_DATA) == 0x20);
64
65 ~TESGrass() override; // 00
66
67 // override (TESBoundObject)
68 void InitializeData() override; // 04
69 bool Load(TESFile* a_mod) override; // 06
70 void InitItemImpl() override; // 13
71
72 // add
73 [[nodiscard]] virtual std::uint8_t GetDensity() const; // 53 - { return data.density; }
74 virtual bool SetDensity(std::uint8_t a_density); // 54 - { if (a_density > 100) return false; data.density = a_density; return true; }
75 [[nodiscard]] virtual std::uint8_t GetMinSlopeDegrees() const; // 55 - { return data.minSlope; }
76 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; }
77 [[nodiscard]] virtual std::uint8_t GetMaxSlopeDegrees() const; // 57 - { return data.maxSlope; }
78 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; }
79 [[nodiscard]] virtual float GetMinSlope() const; // 59 - { return data.minSlopeDegrees * 1deg; }
80 [[nodiscard]] virtual float GetMaxSlope() const; // 5A - { return data.maxSlopeDegrees * 1deg; }
81 [[nodiscard]] virtual std::uint16_t GetDistanceFromWaterLevel() const; // 5B - { return data.distanceFromWaterLevel; }
82 virtual void SetDistanceFromWaterLevel(std::uint16_t a_unitsFromWater); // 5C - { data.distanceFromWaterLevel = a_unitsFromWater; }
83 [[nodiscard]] virtual GRASS_WATER_STATE GetUnderwaterState() const; // 5D - { return data.underwater; }
84 virtual void SetUnderwaterState(GRASS_WATER_STATE a_waterState); // 5E - { data.underwater = a_waterState; }
85 [[nodiscard]] virtual float GetPositionRange() const; // 5F - { return data.positionRange; }
86 virtual bool SetPositionRange(float a_positionRange); // 60 - { if (a_positionRange < 0.0 || a_positionRange > 512.0) return false; data.positionRange = a_positionRange; return true; }
87 [[nodiscard]] virtual float GetHeightRange() const; // 61 - { return data.heightRange; }
88 virtual bool SetHeightRange(float a_heightRange); // 62 - { if (a_heightRange < 0.0 || a_heightRange > 1.0) return false; data.heightRange = a_heightRange; return true; }
89 [[nodiscard]] virtual float GetColorRange() const; // 63 - { return data.colorRange; }
90 virtual bool SetColorRange(float a_colorRange); // 64 - { if (a_colorRange < 0.0 || a_colorRange > 1.0) return false; data.colorRange = a_colorRange; return true; }
91 [[nodiscard]] virtual float GetWavePeriod() const; // 65 - { return data.wavePeriod; }
92 virtual bool SetWavePeriod(float a_wavePeriod); // 66 - { if (a_wavePeriod <= 0.0) return false; data.wavePeriod = a_wavePeriod; return true; }
93 [[nodiscard]] virtual bool GetVertexLighting() const; // 67 - { return data.flags & 1; }
94 virtual void SetVertexLighting(bool a_set); // 68 - { if (a_set) data.flags |= 0x1; else data.flags &= 0xFE; }
95 [[nodiscard]] virtual bool GetUniformScaling() const; // 69 - { return (data.flags >> 1) & 1; }
96 virtual void SetUniformScaling(bool a_set); // 6A - { if (a_set) data.flags |= 0x2; else data.flags &= 0xFD; }
97 [[nodiscard]] virtual bool GetFitToSlope() const; // 6B - { return (data.flags >> 2) & 1; }
98 virtual void SetFitToSlope(bool a_set); // 6C - { if (a_set) data.flags |= 0x4; else data.flags &= 0xFB; }
99
100 // members
101 GRASS_DATA data; // 58 - DATA
102 };
103 static_assert(sizeof(TESGrass) == 0x78);
104}
Definition: TESBoundObject.h:24
Definition: TESFile.h:14
Definition: TESGrass.h:12
GRASS_WATER_STATE
Definition: TESGrass.h:18
virtual std::uint8_t GetMinSlopeDegrees() const
virtual float GetMinSlope() const
bool Load(TESFile *a_mod) override
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:15
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:101
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:216
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_TESGrass
Definition: Offsets_RTTI.h:6000
Definition: TESGrass.h:39
std::uint16_t distanceFromWaterLevel
Definition: TESGrass.h:52
std::int8_t minSlopeDegrees
Definition: TESGrass.h:49
stl::enumeration< GRASS_WATER_STATE, std::uint32_t > underwater
Definition: TESGrass.h:54
std::int8_t density
Definition: TESGrass.h:48
float positionRange
Definition: TESGrass.h:55
std::uint16_t pad1E
Definition: TESGrass.h:61
float wavePeriod
Definition: TESGrass.h:58
std::uint8_t pad03
Definition: TESGrass.h:51
float heightRange
Definition: TESGrass.h:56
stl::enumeration< Flag, std::uint8_t > flags
Definition: TESGrass.h:59
std::int8_t maxSlopeDegrees
Definition: TESGrass.h:50
Flag
Definition: TESGrass.h:41
float colorRange
Definition: TESGrass.h:57
std::uint8_t pad1D
Definition: TESGrass.h:60
std::uint16_t pad06
Definition: TESGrass.h:53
Definition: TESGrass.h:30
RecordFlag
Definition: TESGrass.h:32
@ kIgnored
Definition: TESGrass.h:34
@ kDeleted
Definition: TESGrass.h:33