MCPcopy Create free account
hub / github.com/MyGUI/mygui / buildQuadVertex

Method buildQuadVertex

UnitTests/UnitTest_TextureAnimations/WobbleNodeAnimator.cpp:142–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140 }
141
142 void WobbleNodeAnimator::buildQuadVertex(MyGUI::VectorQuadData& _data)
143 {
144 int count_w = getCountX();
145 int count_h = getCountY();
146
147 for (int rx = 0; rx < count_w + 1; rx++)
148 {
149 for (int ry = 0; ry < count_h + 1; ry++)
150 {
151 MyGUI::FloatPoint point((float)rx / (float)count_w, (float)ry / (float)count_h);
152
153 float drageffect = 0;
154 if (mInertiaMode)
155 {
156 float drageffect1 = squaredDistance(point, MyGUI::FloatPoint(0, 0)) * mResizeStrength;
157 float drageffect2 = squaredDistance(point, MyGUI::FloatPoint(1, 1)) * mResizeStrength;
158
159 drageffect = std::min(drageffect1, drageffect2);
160 }
161 else
162 {
163 drageffect = squaredDistance(mInertiaPoint, point) * mDragStrength;
164 }
165
166 float fx = getLeft() + getWidth() * point.left;
167 float fy = getTop() + getHeight() * point.top;
168
169 MyGUI::FloatPoint vert(fx + (-mDragOffset.left) * drageffect, fy + mDragOffset.top * drageffect);
170
171 if (rx < count_w && ry < count_h)
172 {
173 _data[rx + ry * count_w].vertex[MyGUI::QuadData::CornerLT].x = vert.left;
174 _data[rx + ry * count_w].vertex[MyGUI::QuadData::CornerLT].y = vert.top;
175 }
176
177 if (rx > 0 && ry > 0)
178 {
179 _data[(rx - 1) + (ry - 1) * count_w].vertex[MyGUI::QuadData::CornerRB].x = vert.left;
180 _data[(rx - 1) + (ry - 1) * count_w].vertex[MyGUI::QuadData::CornerRB].y = vert.top;
181 }
182
183 if (rx > 0 && ry < count_h)
184 {
185 _data[(rx - 1) + ry * count_w].vertex[MyGUI::QuadData::CornerRT].x = vert.left;
186 _data[(rx - 1) + ry * count_w].vertex[MyGUI::QuadData::CornerRT].y = vert.top;
187 }
188
189 if (rx < count_w && ry > 0)
190 {
191 _data[rx + (ry - 1) * count_w].vertex[MyGUI::QuadData::CornerLB].x = vert.left;
192 _data[rx + (ry - 1) * count_w].vertex[MyGUI::QuadData::CornerLB].y = vert.top;
193 }
194 }
195 }
196 }
197
198 void WobbleNodeAnimator::create()
199 {

Callers

nothing calls this directly

Calls 7

squaredDistanceFunction · 0.85
minFunction · 0.85
getLeftFunction · 0.85
getWidthFunction · 0.85
getTopFunction · 0.85
getHeightFunction · 0.85
FloatPointFunction · 0.50

Tested by

no test coverage detected