本文整理汇总了C++中FrameBufferObject::editMFColorAttachments方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBufferObject::editMFColorAttachments方法的具体用法?C++ FrameBufferObject::editMFColorAttachments怎么用?C++ FrameBufferObject::editMFColorAttachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBufferObject
的用法示例。
在下文中一共展示了FrameBufferObject::editMFColorAttachments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateStageData
void DeferredShadingStage::updateStageData(
DSStageData *data,
FrameBufferObject *shadingTarget,
RenderPartition *parentPart )
{
FrameBufferObject *gBufferTarget = data->getGBufferTarget();
Int32 targetWidth;
Int32 targetHeight;
Int32 targetLeft;
Int32 targetBottom;
if(shadingTarget != NULL)
{
targetWidth = shadingTarget->getWidth ();
targetHeight = shadingTarget->getHeight();
targetLeft = 0;
targetBottom = 0;
}
else
{
targetWidth = parentPart->getDrawEnv().getPixelWidth ();
targetHeight = parentPart->getDrawEnv().getPixelHeight();
targetLeft = parentPart->getDrawEnv().getPixelLeft ();
targetBottom = parentPart->getDrawEnv().getPixelBottom();
}
if(gBufferTarget->getWidth () != targetWidth ||
gBufferTarget->getHeight() != targetHeight )
{
_targetSizeChanged = true;
}
if(_targetSizeChanged == true)
{
gBufferTarget->setSize(targetWidth, targetHeight);
}
if(getMFPixelFormats()->size() != getMFPixelTypes()->size())
{
SWARNING << "DeferredShadingStage::updateStageData: "
<< "Number of PixelFormats and PixelTypes inconsistent."
<< std::endl;
}
UInt32 lightCount = getMFLights ()->size();
UInt32 bufferCount = osgMin(getMFPixelFormats()->size(),
getMFPixelTypes ()->size() );
// buffers changed - remove them here, recreate below
if((_changeCache & (PixelFormatsFieldMask |
PixelTypesFieldMask )) != 0)
{
gBufferTarget->editMFColorAttachments()->clear ( );
gBufferTarget->editMFColorAttachments()->resize(bufferCount, NULL );
gBufferTarget->editMFDrawBuffers ()->clear ( );
gBufferTarget->editMFDrawBuffers ()->resize(bufferCount, GL_NONE);
}
for(UInt32 i = 0; i < bufferCount; ++i)
{
TextureBuffer *buf =
dynamic_cast<TextureBuffer *>(gBufferTarget->getColorAttachments(i));
if(buf == NULL)
{
TextureBufferUnrecPtr newBuf =
createGBuffer(i, targetWidth, targetHeight);
buf = newBuf;
gBufferTarget->editMFColorAttachments()->replace(i, newBuf );
gBufferTarget->editMFDrawBuffers ()->replace(i, GL_COLOR_ATTACHMENT0_EXT + i);
}
else
{
updateGBuffer(buf, i, targetWidth, targetHeight);
}
}
if((_changeCache & LightsFieldMask) != 0)
{
data->editMFLightChunks ()->resize( lightCount, NULL);
data->editMFShadingStates ()->resize(1 + lightCount, NULL);
data->editMFShadingProgramChunks()->resize(1 + lightCount, NULL);
}
// update shading states
if((_changeCache & (PixelFormatsFieldMask |
PixelTypesFieldMask |
AmbientProgramFieldMask |
LightProgramsFieldMask |
LightsFieldMask )) != 0)
{
// copy ambient and light programs
DSStageData::MFShadingProgramChunksType::const_iterator spcIt =
data->editMFShadingProgramChunks()->begin();
DSStageData::MFShadingProgramChunksType::const_iterator spcEnd =
data->editMFShadingProgramChunks()->end ();
//.........这里部分代码省略.........