Etterna 0.74.4
Loading...
Searching...
No Matches
ModelTypes.h
1/* ModelTypes - Types defined in msLib.h. C arrays converted to use std::vector
2 */
3
4#ifndef MODEL_TYPES_H
5#define MODEL_TYPES_H
6
7#include "RageUtil/Misc/RageTypes.h"
8
10{
11 uint16_t nVertexIndices[3];
12};
13
14struct msMesh
15{
16 std::string sName;
17 char nMaterialIndex;
18
19 std::vector<RageModelVertex> Vertices;
20
21 // OPTIMIZATION: If all verts in a mesh are transformed by the same bone,
22 // then send the transform to the graphics card for the whole mesh instead
23 // of transforming each vertex on the CPU;
24 char m_iBoneIndex; // -1 = no bone
25
26 std::vector<msTriangle> Triangles;
27};
28
29class RageTexture;
30
31// merge this into Sprite?
33{
34 public:
37
38 void LoadBlank();
39 void Load(const std::string& sTexOrIniFile);
40 void Unload();
41 void Update(float fDelta);
42
43 auto GetCurrentTexture() -> RageTexture*;
44
45 [[nodiscard]] auto GetNumStates() const -> int;
46 void SetState(int iNewState);
47 [[nodiscard]] auto GetAnimationLengthSeconds() const -> float;
48 void SetSecondsIntoAnimation(float fSeconds);
49 [[nodiscard]] auto GetSecondsIntoAnimation() const -> float;
50 auto GetTextureTranslate() -> RageVector2;
51
52 bool m_bSphereMapped;
53 BlendMode m_BlendMode;
54
55 [[nodiscard]] auto NeedsNormals() const -> bool { return m_bSphereMapped; }
56
57 private:
58 RageVector2 m_vTexOffset;
59 RageVector2 m_vTexVelocity;
60
61 int m_iCurState;
62 float m_fSecsIntoFrame;
63 struct AnimatedTextureState
64 {
65 AnimatedTextureState(RageTexture* pTexture_,
66 float fDelaySecs_,
67 RageVector2 vTranslate_)
68 : pTexture(pTexture_)
69 , fDelaySecs(fDelaySecs_)
70 , vTranslate(vTranslate_)
71 {
72 }
73
74 RageTexture* pTexture;
75 float fDelaySecs;
76 RageVector2 vTranslate;
77 };
78
79 std::vector<AnimatedTextureState> vFrames;
80};
81
83{
84 int nFlags;
85 std::string sName;
86 RageColor Ambient;
87 RageColor Diffuse;
88 RageColor Specular;
89 RageColor Emissive;
90 float fShininess;
91 float fTransparency;
92
93 AnimatedTexture diffuse;
94 AnimatedTexture alpha;
95
96 [[nodiscard]] auto NeedsNormals() const -> bool
97 {
98 return diffuse.NeedsNormals() || alpha.NeedsNormals();
99 }
100};
101
103{
104 float fTime{};
105 RageVector3 Position;
106};
107
109{
110 float fTime{};
111 RageVector4 Rotation;
112};
113
114struct msBone
115{
116 int nFlags;
117 std::string sName;
118 std::string sParentName;
119 RageVector3 Position;
120 RageVector3 Rotation;
121
122 std::vector<msPositionKey> PositionKeys;
123 std::vector<msRotationKey> RotationKeys;
124};
125
127{
128 [[nodiscard]] auto FindBoneByName(const std::string& sName) const -> int
129 {
130 for (unsigned i = 0; i < Bones.size(); i++) {
131 if (Bones[i].sName == sName) {
132 return i;
133 }
134 }
135 return -1;
136 }
137
138 auto LoadMilkshapeAsciiBones(const std::string& sAniName, std::string sPath)
139 -> bool;
140
141 std::vector<msBone> Bones;
142 int nTotalFrames;
143};
144
146{
147 RageMatrix m_Relative;
148 RageMatrix m_Absolute;
149 RageMatrix m_Final;
150};
151
152#endif
Definition ModelTypes.h:33
Definition RageTexture.h:14
Definition RageTypes.h:332
Definition RageTypes.h:599
Definition RageTypes.h:101
Definition RageTypes.h:172
Definition RageTypes.h:249
Definition ModelTypes.h:127
Definition ModelTypes.h:115
Definition ModelTypes.h:83
Definition ModelTypes.h:15
Definition ModelTypes.h:103
Definition ModelTypes.h:109
Definition ModelTypes.h:10
Definition ModelTypes.h:146