MCPcopy Create free account
hub / github.com/assimp/assimp / OnPreRender

Method OnPreRender

tools/assimp_view/Background.cpp:224–304  ·  view source on GitHub ↗

-------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

222}
223//-------------------------------------------------------------------------------
224void CBackgroundPainter::OnPreRender() {
225 if (SIMPLE_COLOR != eMode) {
226 // clear the z-buffer only (in wireframe mode we must also clear
227 // the color buffer )
228 if (g_sOptions.eDrawMode == RenderOptions::WIREFRAME) {
229 g_piDevice->Clear(0, nullptr, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET,
230 D3DCOLOR_ARGB(0xff, 100, 100, 100), 1.0f, 0);
231 } else {
232 g_piDevice->Clear(0, nullptr, D3DCLEAR_ZBUFFER, 0, 1.0f, 0);
233 }
234
235 if (TEXTURE_2D == eMode) {
236 RECT sRect;
237 GetWindowRect(GetDlgItem(g_hDlg, IDC_RT), &sRect);
238 sRect.right -= sRect.left;
239 sRect.bottom -= sRect.top;
240
241 struct SVertex {
242 float x, y, z, w, u, v;
243 };
244
245 UINT dw;
246 this->piSkyBoxEffect->Begin(&dw, 0);
247 this->piSkyBoxEffect->BeginPass(0);
248
249 SVertex as[4];
250 as[1].x = 0.0f;
251 as[1].y = 0.0f;
252 as[1].z = 0.2f;
253 as[1].w = 1.0f;
254 as[1].u = 0.0f;
255 as[1].v = 0.0f;
256
257 as[3].x = (float)sRect.right;
258 as[3].y = 0.0f;
259 as[3].z = 0.2f;
260 as[3].w = 1.0f;
261 as[3].u = 1.0f;
262 as[3].v = 0.0f;
263
264 as[0].x = 0.0f;
265 as[0].y = (float)sRect.bottom;
266 as[0].z = 0.2f;
267 as[0].w = 1.0f;
268 as[0].u = 0.0f;
269 as[0].v = 1.0f;
270
271 as[2].x = (float)sRect.right;
272 as[2].y = (float)sRect.bottom;
273 as[2].z = 0.2f;
274 as[2].w = 1.0f;
275 as[2].u = 1.0f;
276 as[2].v = 1.0f;
277
278 as[0].x -= 0.5f;
279 as[1].x -= 0.5f;
280 as[2].x -= 0.5f;
281 as[3].x -= 0.5f;

Callers 1

RenderFullSceneMethod · 0.80

Calls 4

GetFVFMethod · 0.80
ClearMethod · 0.45
BeginMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected