MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / setAnimationFrame

Method setAnimationFrame

src/logic/visuals/StaticMeshVisual.cpp:88–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void StaticMeshVisual::setAnimationFrame(size_t submeshIndex, size_t frame)
89{
90 std::string tx = getDiffuseTexture(submeshIndex);
91
92 // Find the last number
93 size_t dot = tx.find_last_of('.');
94 if (dot != std::string::npos && dot > 0)
95 {
96 size_t dig = dot;
97 do
98 {
99 dig--;
100
101 if (!isdigit(tx[dig]))
102 break;
103
104 } while (dig != 0);
105
106 // Not a valid animation-name
107 if (dig == 0)
108 return;
109
110 std::string ext = tx.substr(dot);
111
112 // Strip the end with the number
113 tx = tx.substr(0, dig + 1);
114
115 // Add frame and ext
116 tx += std::to_string(frame) + ext;
117
118 std::string oldTex = getDiffuseTexture(submeshIndex);
119 setDiffuseTexture(submeshIndex, tx);
120
121 //if(oldTex == getDiffuseTexture(submeshIndex))
122 // LogWarn() << "Head-tex not found!";
123 }
124}
125
126void StaticMeshVisual::updateCollision()
127{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected