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

Method begin

Engine/source/util/imposterCapture.cpp:363–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363void ImposterCapture::begin( TSShapeInstance *shapeInst,
364 S32 dl,
365 S32 dim,
366 F32 radius,
367 const Point3F &center )
368{
369 mShapeInstance = shapeInst;
370 mDl = dl;
371 mDim = dim;
372 mRadius = radius;
373 mCenter = center;
374
375 mBlackTex.set( mDim, mDim, GFXFormatR8G8B8A8_SRGB, &GFXRenderTargetSRGBProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
376 mWhiteTex.set( mDim, mDim, GFXFormatR8G8B8A8_SRGB, &GFXRenderTargetSRGBProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
377 mNormalTex.set( mDim, mDim, GFXFormatR8G8B8A8, &GFXRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
378 mDepthBuffer.set( mDim, mDim, GFXFormatD24S8, &GFXZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
379
380 // copy the black render target data into a bitmap
381 mBlackBmp = new GBitmap;
382 mBlackBmp->allocateBitmap(mDim, mDim, false, GFXFormatR8G8B8);
383
384 // copy the white target data into a bitmap
385 mWhiteBmp = new GBitmap;
386 mWhiteBmp->allocateBitmap(mDim, mDim, false, GFXFormatR8G8B8);
387
388 // Setup viewport and frustrum to do orthographic projection.
389 RectI viewport( 0, 0, mDim, mDim );
390 GFX->setViewport( viewport );
391 GFX->setOrtho( -mRadius, mRadius, -mRadius, mRadius, 1, 20.0f * mRadius );
392
393 // Position camera looking out the X axis.
394 MatrixF cameraMatrix( true );
395 cameraMatrix.setColumn( 0, Point3F( 0, 0, 1 ) );
396 cameraMatrix.setColumn( 1, Point3F( 1, 0, 0 ) );
397 cameraMatrix.setColumn( 2, Point3F( 0, 1, 0 ) );
398
399 // setup scene state required for TS mesh render...this is messy and inefficient;
400 // should have a mode where most of this is done just once (and then
401 // only the camera matrix changes between snapshots).
402 // note that we use getFrustum here, but we set up an ortho projection above.
403 // it doesn't seem like the scene state object pays attention to whether the projection is
404 // ortho or not. this could become a problem if some code downstream tries to
405 // reconstruct the projection matrix using the dimensions and doesn't
406 // realize it should be ortho. at the moment no code is doing that.
407 F32 left, right, top, bottom, nearPlane, farPlane;
408 bool isOrtho;
409 GFX->getFrustum( &left, &right, &bottom, &top, &nearPlane, &farPlane, &isOrtho );
410 Frustum frust( isOrtho, left, right, top, bottom, nearPlane, farPlane, cameraMatrix );
411
412 // Set up render pass.
413
414 mRenderPass = new RenderPassManager();
415 mRenderPass->assignName( "DiffuseRenderPass" );
416 mMeshRenderBin = new RenderMeshMgr();
417 mRenderPass->addManager( mMeshRenderBin );
418
419 // Set up scene state.
420

Callers 15

undoMethod · 0.45
redoMethod · 0.45
clearStackMethod · 0.45
removeActionMethod · 0.45
onMessageReceivedMethod · 0.45
isRegisteredEventMethod · 0.45
unregisterAllEventsMethod · 0.45
unregisterEventMethod · 0.45
removeMethod · 0.45
removeAllMethod · 0.45
dumpEventsMethod · 0.45
dumpSubscribersMethod · 0.45

Calls 15

avarFunction · 0.85
allocateBitmapMethod · 0.80
setOrthoMethod · 0.80
setColumnMethod · 0.80
getFrustumMethod · 0.80
assignNameMethod · 0.80
addManagerMethod · 0.80
getProjectionMatrixMethod · 0.80
setSceneStateMethod · 0.80
setFadeOverrideMethod · 0.80
Point3FClass · 0.50

Tested by

no test coverage detected