MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateFace

Method updateFace

Engine/source/scene/reflector.cpp:351–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void CubeReflector::updateFace( const ReflectParams &params, U32 faceidx, Point3F explicitPostion)
352{
353 GFXDEBUGEVENT_SCOPE( CubeReflector_UpdateFace, ColorI::WHITE );
354
355 // store current matrices
356 GFXTransformSaver saver;
357
358 // set projection to 90 degrees vertical and horizontal
359 F32 left, right, top, bottom;
360 MathUtils::makeFrustum( &left, &right, &top, &bottom, M_HALFPI_F, 1.0f, mDesc->nearDist );
361 GFX->setFrustum( left, right, bottom, top, mDesc->nearDist, mDesc->farDist );
362
363 // We don't use a special clipping projection, but still need to initialize
364 // this for objects like SkyBox which will use it during a reflect pass.
365 gClientSceneGraph->setNonClipProjection( GFX->getProjectionMatrix() );
366
367 // Standard view that will be overridden below.
368 VectorF vLookatPt(0.0f, 0.0f, 0.0f), vUpVec(0.0f, 0.0f, 0.0f), vRight(0.0f, 0.0f, 0.0f);
369
370 switch( faceidx )
371 {
372 case 0 : // D3DCUBEMAP_FACE_POSITIVE_X:
373 vLookatPt = VectorF( 1.0f, 0.0f, 0.0f );
374 vUpVec = VectorF( 0.0f, 1.0f, 0.0f );
375 break;
376 case 1 : // D3DCUBEMAP_FACE_NEGATIVE_X:
377 vLookatPt = VectorF( -1.0f, 0.0f, 0.0f );
378 vUpVec = VectorF( 0.0f, 1.0f, 0.0f );
379 break;
380 case 2 : // D3DCUBEMAP_FACE_POSITIVE_Y:
381 vLookatPt = VectorF( 0.0f, 1.0f, 0.0f );
382 vUpVec = VectorF( 0.0f, 0.0f,-1.0f );
383 break;
384 case 3 : // D3DCUBEMAP_FACE_NEGATIVE_Y:
385 vLookatPt = VectorF( 0.0f, -1.0f, 0.0f );
386 vUpVec = VectorF( 0.0f, 0.0f, 1.0f );
387 break;
388 case 4 : // D3DCUBEMAP_FACE_POSITIVE_Z:
389 vLookatPt = VectorF( 0.0f, 0.0f, 1.0f );
390 vUpVec = VectorF( 0.0f, 1.0f, 0.0f );
391 break;
392 case 5: // D3DCUBEMAP_FACE_NEGATIVE_Z:
393 vLookatPt = VectorF( 0.0f, 0.0f, -1.0f );
394 vUpVec = VectorF( 0.0f, 1.0f, 0.0f );
395 break;
396 }
397
398 // create camera matrix
399 VectorF cross = mCross( vUpVec, vLookatPt );
400 cross.normalizeSafe();
401
402 MatrixF matView(true);
403 matView.setColumn( 0, cross );
404 matView.setColumn( 1, vLookatPt );
405 matView.setColumn( 2, vUpVec );
406
407 if (explicitPostion == Point3F::Max)
408 {

Callers 1

updateReflectionMethod · 0.80

Calls 15

makeFrustumFunction · 0.85
setFrustumMethod · 0.80
setNonClipProjectionMethod · 0.80
getProjectionMatrixMethod · 0.80
setColumnMethod · 0.80
setActiveRenderTargetMethod · 0.80
registerGlobalLightsMethod · 0.80
renderSceneNoLightsMethod · 0.80
mCrossFunction · 0.50
normalizeSafeMethod · 0.45

Tested by

no test coverage detected