本文整理汇总了C++中TSRenderState::setLightQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ TSRenderState::setLightQuery方法的具体用法?C++ TSRenderState::setLightQuery怎么用?C++ TSRenderState::setLightQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSRenderState
的用法示例。
在下文中一共展示了TSRenderState::setLightQuery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepBatchRender
void Projectile::prepBatchRender( SceneRenderState *state )
{
if ( !mProjectileShape )
return;
GFXTransformSaver saver;
// Set up our TS render state.
TSRenderState rdata;
rdata.setSceneState( state );
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( getWorldSphere() );
rdata.setLightQuery( &query );
MatrixF mat = getRenderTransform();
mat.scale( mObjScale );
mat.scale( mDataBlock->scale );
GFX->setWorldMatrix( mat );
mProjectileShape->setDetailFromPosAndScale( state, mat.getPosition(), mObjScale );
mProjectileShape->animate();
mProjectileShape->render( rdata );
}
示例2: prepRenderImage
void TSStatic::prepRenderImage( SceneRenderState* state )
{
if( !mShapeInstance )
return;
Point3F cameraOffset;
getRenderTransform().getColumn(3,&cameraOffset);
cameraOffset -= state->getDiffuseCameraPosition();
F32 dist = cameraOffset.len();
if (dist < 0.01f)
dist = 0.01f;
F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
if ( mForceDetail == -1 )
mShapeInstance->setDetailFromDistance( state, dist * invScale );
else
mShapeInstance->setCurrentDetail( mForceDetail );
if ( mShapeInstance->getCurrentDetail() < 0 )
return;
GFXTransformSaver saver;
// Set up our TS render state.
TSRenderState rdata;
rdata.setSceneState( state );
rdata.setFadeOverride( 1.0f );
rdata.setOriginSort( mUseOriginSort );
// If we have submesh culling enabled then prepare
// the object space frustum to pass to the shape.
Frustum culler;
if ( mMeshCulling )
{
culler = state->getCullingFrustum();
MatrixF xfm( true );
xfm.scale( Point3F::One / getScale() );
xfm.mul( getRenderWorldTransform() );
xfm.mul( culler.getTransform() );
culler.setTransform( xfm );
rdata.setCuller( &culler );
}
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( getWorldSphere() );
rdata.setLightQuery( &query );
MatrixF mat = getRenderTransform();
mat.scale( mObjScale );
GFX->setWorldMatrix( mat );
mShapeInstance->animate();
mShapeInstance->render( rdata );
if ( mRenderNormalScalar > 0 )
{
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
ri->renderDelegate.bind( this, &TSStatic::_renderNormals );
ri->type = RenderPassManager::RIT_Editor;
state->getRenderPass()->addInst( ri );
}
}
示例3: prepRenderImage
void TSStatic::prepRenderImage( SceneRenderState* state )
{
if( !mShapeInstance )
return;
//WLE - Vince
//Lod preloading
GameConnection* connection = GameConnection::getConnectionToServer();
if (connection && !connection->didFirstRender)
{
TSRenderState rdata;
rdata.setSceneState( state );
rdata.setFadeOverride( 1.0f );
rdata.setOriginSort( mUseOriginSort );
for (S32 i = mShapeInstance->getSmallestVisibleDL(); i >= 0; i-- )
{
mShapeInstance->setCurrentDetail( i );
mShapeInstance->render( rdata );
}
}
Point3F cameraOffset;
getRenderTransform().getColumn(3,&cameraOffset);
cameraOffset -= state->getDiffuseCameraPosition();
F32 dist = cameraOffset.len();
if (dist < 0.01f)
dist = 0.01f;
if (mUseAlphaLod)
{
mAlphaLOD = 1.0f;
if ((mAlphaLODStart < mAlphaLODEnd) && mAlphaLODStart > 0.1f)
{
if (mInvertAlphaLod)
{
if (dist <= mAlphaLODStart)
{
return;
}
if (dist < mAlphaLODEnd)
{
mAlphaLOD = ((dist - mAlphaLODStart) / (mAlphaLODEnd - mAlphaLODStart));
}
}
else
{
if (dist >= mAlphaLODEnd)
{
return;
}
if (dist > mAlphaLODStart)
{
mAlphaLOD -= ((dist - mAlphaLODStart) / (mAlphaLODEnd - mAlphaLODStart));
}
}
}
}
F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
if ( mForceDetail == -1 )
mShapeInstance->setDetailFromDistance( state, dist * invScale );
else
mShapeInstance->setCurrentDetail( mForceDetail );
if ( mShapeInstance->getCurrentDetail() < 0 )
return;
GFXTransformSaver saver;
// Set up our TS render state.
TSRenderState rdata;
rdata.setSceneState( state );
rdata.setFadeOverride( 1.0f );
rdata.setOriginSort( mUseOriginSort );
// If we have submesh culling enabled then prepare
// the object space frustum to pass to the shape.
Frustum culler;
if ( mMeshCulling )
{
culler = state->getCullingFrustum();
MatrixF xfm( true );
xfm.scale( Point3F::One / getScale() );
xfm.mul( getRenderWorldTransform() );
xfm.mul( culler.getTransform() );
culler.setTransform( xfm );
rdata.setCuller( &culler );
}
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( getWorldSphere() );
rdata.setLightQuery( &query );
MatrixF mat = getRenderTransform();
mat.scale( mObjScale );
//.........这里部分代码省略.........
示例4: renderWorld
void GuiObjectView::renderWorld( const RectI& updateRect )
{
if( !mModel )
return;
GFXTransformSaver _saveTransforms;
// Determine the camera position, and store off render state.
MatrixF modelview;
MatrixF mv;
Point3F cp;
modelview = GFX->getWorldMatrix();
mv = modelview;
mv.inverse();
mv.getColumn( 3, &cp );
RenderPassManager* renderPass = gClientSceneGraph->getDefaultRenderPass();
S32 time = Platform::getVirtualMilliseconds();
S32 dt = time - mLastRenderTime;
mLastRenderTime = time;
LIGHTMGR->unregisterAllLights();
LIGHTMGR->setSpecialLight( LightManager::slSunLightType, mLight );
GFX->setStateBlock( mDefaultGuiSB );
F32 left, right, top, bottom, nearPlane, farPlane;
bool isOrtho;
GFX->getFrustum( &left, &right, &bottom, &top, &nearPlane, &farPlane, &isOrtho );
Frustum frust( false, left, right, top, bottom, nearPlane, farPlane, MatrixF::Identity );
SceneRenderState state
(
gClientSceneGraph,
SPT_Diffuse,
SceneCameraState( GFX->getViewport(), frust, GFX->getWorldMatrix(), GFX->getProjectionMatrix() ),
renderPass,
false
);
// Set up our TS render state here.
TSRenderState rdata;
rdata.setSceneState( &state );
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( SphereF( Point3F::Zero, 1.0f ) );
rdata.setLightQuery( &query );
// Render primary model.
if( mModel )
{
if( mRunThread )
{
mModel->advanceTime( dt / 1000.f, mRunThread );
mModel->animate();
}
mModel->render( rdata );
}
// Render mounted model.
if( mMountedModel && mMountNode != -1 )
{
GFX->pushWorldMatrix();
GFX->multWorld( mModel->mNodeTransforms[ mMountNode ] );
GFX->multWorld( mMountTransform );
mMountedModel->render( rdata );
GFX->popWorldMatrix();
}
renderPass->renderPass( &state );
// Make sure to remove our fake sun.
LIGHTMGR->unregisterAllLights();
}
示例5: prepRenderImage
void TSStatic::prepRenderImage( SceneRenderState* state )
{
if( !mShapeInstance )
return;
Point3F cameraOffset;
getRenderTransform().getColumn(3,&cameraOffset);
cameraOffset -= state->getDiffuseCameraPosition();
F32 dist = cameraOffset.len();
if (dist < 0.01f)
dist = 0.01f;
if (mUseAlphaFade)
{
mAlphaFade = 1.0f;
if ((mAlphaFadeStart < mAlphaFadeEnd) && mAlphaFadeStart > 0.1f)
{
if (mInvertAlphaFade)
{
if (dist <= mAlphaFadeStart)
{
return;
}
if (dist < mAlphaFadeEnd)
{
mAlphaFade = ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart));
}
}
else
{
if (dist >= mAlphaFadeEnd)
{
return;
}
if (dist > mAlphaFadeStart)
{
mAlphaFade -= ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart));
}
}
}
}
F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
// If we're currently rendering our own reflection we
// don't want to render ourselves into it.
if ( mCubeReflector.isRendering() )
return;
if ( mForceDetail == -1 )
mShapeInstance->setDetailFromDistance( state, dist * invScale );
else
mShapeInstance->setCurrentDetail( mForceDetail );
if ( mShapeInstance->getCurrentDetail() < 0 )
return;
GFXTransformSaver saver;
// Set up our TS render state.
TSRenderState rdata;
rdata.setSceneState( state );
rdata.setFadeOverride( 1.0f );
rdata.setOriginSort( mUseOriginSort );
if ( mCubeReflector.isEnabled() )
rdata.setCubemap( mCubeReflector.getCubemap() );
// Acculumation
rdata.setAccuTex(mAccuTex);
// If we have submesh culling enabled then prepare
// the object space frustum to pass to the shape.
Frustum culler;
if ( mMeshCulling )
{
culler = state->getCullingFrustum();
MatrixF xfm( true );
xfm.scale( Point3F::One / getScale() );
xfm.mul( getRenderWorldTransform() );
xfm.mul( culler.getTransform() );
culler.setTransform( xfm );
rdata.setCuller( &culler );
}
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( getWorldSphere() );
rdata.setLightQuery( &query );
MatrixF mat = getRenderTransform();
mat.scale( mObjScale );
GFX->setWorldMatrix( mat );
if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() )
{
RenderPassManager *pass = state->getRenderPass();
OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();
//.........这里部分代码省略.........
示例6: renderWorld
void GuiMaterialPreview::renderWorld(const RectI &updateRect)
{
// nothing to render, punt
if ( !mModel && !mMountedModel )
return;
S32 time = Platform::getVirtualMilliseconds();
//S32 dt = time - lastRenderTime;
lastRenderTime = time;
F32 left, right, top, bottom, nearPlane, farPlane;
bool isOrtho;
GFX->getFrustum( &left, &right, &bottom, &top, &nearPlane, &farPlane, &isOrtho);
Frustum frust( isOrtho, left, right, bottom, top, nearPlane, farPlane, MatrixF::Identity );
FogData savedFogData = gClientSceneGraph->getFogData();
gClientSceneGraph->setFogData( FogData() ); // no fog in preview window
RenderPassManager* renderPass = gClientSceneGraph->getDefaultRenderPass();
SceneRenderState state
(
gClientSceneGraph,
SPT_Diffuse,
SceneCameraState( GFX->getViewport(), frust, GFX->getWorldMatrix(), GFX->getProjectionMatrix() ),
renderPass,
true
);
// Set up our TS render state here.
TSRenderState rdata;
rdata.setSceneState( &state );
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query;
query.init( SphereF( Point3F::Zero, 1.0f ) );
rdata.setLightQuery( &query );
// Set up pass transforms
renderPass->assignSharedXform(RenderPassManager::View, MatrixF::Identity);
renderPass->assignSharedXform(RenderPassManager::Projection, GFX->getProjectionMatrix());
LIGHTMGR->unregisterAllLights();
LIGHTMGR->setSpecialLight( LightManager::slSunLightType, mFakeSun );
if ( mModel )
mModel->render( rdata );
if ( mMountedModel )
{
// render a weapon
/*
MatrixF mat;
GFX->pushWorldMatrix();
GFX->multWorld( mat );
GFX->popWorldMatrix();
*/
}
renderPass->renderPass( &state );
gClientSceneGraph->setFogData( savedFogData ); // restore fog setting
// Make sure to remove our fake sun
LIGHTMGR->unregisterAllLights();
}
示例7: prepRenderImage
void Forest::prepRenderImage( SceneRenderState *state )
{
PROFILE_SCOPE(Forest_RenderCells);
// TODO: Fix stats.
/*
ForestCellVector &theCells = mData->getCells();
smTotalCells += theCells.size();
// Don't render if we don't have a grid!
if ( theCells.empty() )
return false;
*/
// Prepare to render.
GFXTransformSaver saver;
// Figure out the grid range in the viewing area.
const bool isReflectPass = state->isReflectPass();
const F32 cullScale = isReflectPass ? mReflectionLodScalar : 1.0f;
// If we need to update our cached
// zone state then do it now.
if ( mZoningDirty )
{
mZoningDirty = false;
Vector<ForestCell*> cells;
mData->getCells( &cells );
for ( U32 i=0; i < cells.size(); i++ )
cells[i]->_updateZoning( getSceneManager()->getZoneManager() );
}
// TODO: Move these into the TSForestItemData as something we
// setup once and don't do per-instance.
// Set up the TS render state.
TSRenderState rdata;
rdata.setSceneState( state );
// Use origin sort on all forest elements as
// its alot cheaper than the bounds sort.
rdata.setOriginSort( true );
// We may have some forward lit materials in
// the forest, so pass down a LightQuery for it.
LightQuery lightQuery;
rdata.setLightQuery( &lightQuery );
Frustum culler = state->getFrustum();
// Adjust the far distance if the cull scale has changed.
if ( !mIsEqual( cullScale, 1.0f ) )
{
const F32 visFarDist = culler.getFarDist() * cullScale;
culler.setFarDist( visFarDist );
}
Box3F worldBox;
// Used for debug drawing.
GFXDrawUtil* drawer = GFX->getDrawUtil();
drawer->clearBitmapModulation();
// Go thru the visible cells.
const Box3F &cullerBounds = culler.getBounds();
const Point3F &camPos = state->getDiffuseCameraPosition();
U32 clipMask;
smAverageItemsPerCell = 0.0f;
U32 cellsProcessed = 0;
ForestCell *cell;
// First get all the top level cells which
// intersect the frustum.
Vector<ForestCell*> cellStack;
mData->getCells( culler, &cellStack );
// Get the culling zone state.
const BitVector &zoneState = state->getCullingState().getZoneVisibilityFlags();
// Now loop till we run out of cells.
while ( !cellStack.empty() )
{
// Pop off the next cell.
cell = cellStack.last();
cellStack.pop_back();
const Box3F &cellBounds = cell->getBounds();
// If the cell is empty or its bounds is outside the frustum
// bounds then we have nothing nothing more to do.
if ( cell->isEmpty() || !cullerBounds.isOverlapped( cellBounds ) )
continue;
// Can we cull this cell entirely?
clipMask = culler.testPlanes( cellBounds, Frustum::PlaneMaskAll );
if ( clipMask == -1 )
continue;
//.........这里部分代码省略.........