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

Method renderObject

Engine/source/environment/cloudLayer.cpp:333–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mi )
334{
335 GFXTransformSaver saver;
336
337 if (!mTextureAsset || !mTextureAsset->isAssetValid())
338 return;
339
340 const Point3F &camPos = state->getCameraPosition();
341 MatrixF xfm(true);
342 xfm.setPosition(camPos);
343 GFX->multWorld(xfm);
344
345 if ( state->isReflectPass() )
346 GFX->setProjectionMatrix( state->getSceneManager()->getNonClipProjection() );
347
348 GFX->setShader( mShader );
349 GFX->setShaderConstBuffer( mShaderConsts );
350 GFX->setStateBlock( mStateblock );
351
352 // Set all the shader consts...
353
354 MatrixF xform(GFX->getProjectionMatrix());
355 xform *= GFX->getViewMatrix();
356 xform *= GFX->getWorldMatrix();
357
358 mShaderConsts->setSafe( mModelViewProjSC, xform );
359
360 mShaderConsts->setSafe( mEyePosWorldSC, camPos );
361
362 LightInfo *lightinfo = LIGHTMGR->getSpecialLight(LightManager::slSunLightType);
363 const LinearColorF &sunlight = state->getAmbientLightColor();
364
365 Point3F ambientColor( sunlight.red, sunlight.green, sunlight.blue );
366 mShaderConsts->setSafe( mAmbientColorSC, ambientColor );
367
368 const LinearColorF &sunColor = lightinfo->getColor();
369 Point3F data( sunColor.red, sunColor.green, sunColor.blue );
370 mShaderConsts->setSafe( mSunColorSC, data );
371
372 mShaderConsts->setSafe( mSunVecSC, lightinfo->getDirection() );
373
374 for ( U32 i = 0; i < TEX_COUNT; i++ )
375 mShaderConsts->setSafe( mTexOffsetSC[i], mTexOffset[i] );
376
377 Point3F scale( mTexScale[0], mTexScale[1], mTexScale[2] );
378 mShaderConsts->setSafe( mTexScaleSC, scale );
379
380 Point3F color;
381 color.set( mBaseColor.red, mBaseColor.green, mBaseColor.blue );
382 mShaderConsts->setSafe( mBaseColorSC, color );
383
384 mShaderConsts->setSafe( mCoverageSC, mCoverage );
385
386 mShaderConsts->setSafe( mExposureSC, mExposure );
387
388 GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), getTextureResource());
389 GFX->setVertexBuffer( mVB );
390 GFX->setPrimitiveBuffer( mPB );

Callers

nothing calls this directly

Calls 15

isAssetValidMethod · 0.80
multWorldMethod · 0.80
isReflectPassMethod · 0.80
setProjectionMatrixMethod · 0.80
setShaderConstBufferMethod · 0.80
getProjectionMatrixMethod · 0.80
getSpecialLightMethod · 0.80
setVertexBufferMethod · 0.80
setPrimitiveBufferMethod · 0.80
setPositionMethod · 0.45
getSceneManagerMethod · 0.45
setShaderMethod · 0.45

Tested by

no test coverage detected