本文整理汇总了C++中CPUTConfigEntry::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUTConfigEntry::IsValid方法的具体用法?C++ CPUTConfigEntry::IsValid怎么用?C++ CPUTConfigEntry::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPUTConfigEntry
的用法示例。
在下文中一共展示了CPUTConfigEntry::IsValid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
//-----------------------------------------------------------------------------
void CPUTMaterialDX11::BindTextures( CPUTShaderParameters ¶ms, const CPUTModel *pModel, int meshIndex )
{
CPUTAssetLibraryDX11 *pAssetLibrary = (CPUTAssetLibraryDX11*)CPUTAssetLibrary::GetAssetLibrary();
for(params.mTextureCount=0; params.mTextureCount < params.mTextureParameterCount; params.mTextureCount++)
{
cString textureName;
UINT textureCount = params.mTextureCount;
cString tagName = params.mpTextureParameterName[textureCount];
CPUTConfigEntry *pValue = mConfigBlock.GetValueByName(tagName);
if( !pValue->IsValid() )
{
// We didn't find our property in the file. Is it in the global config block?
pValue = mGlobalProperties.GetValueByName(tagName);
}
ASSERT( pValue->IsValid(), L"Can't find texture '" + tagName + L"'." ); // TODO: fix message
textureName = pValue->ValueAsString();
// If the texture name not specified. Load default.dds instead
if( 0 == textureName.length() ) { textureName = _L("default.dds"); }
UINT bindPoint = params.mpTextureParameterBindPoint[textureCount];
ASSERT( bindPoint < CPUT_MATERIAL_MAX_TEXTURE_SLOTS, _L("Texture bind point out of range.") );
if( textureName[0] == '@' )
{
// This is a per-mesh value. Add to per-mesh list.
textureName += ptoc(pModel) + itoc(meshIndex);
} else if( textureName[0] == '#' )
{
// This is a per-mesh value. Add to per-mesh list.
textureName += ptoc(pModel);
}
// Get the sRGB flag (default to true)
cString SRGBName = tagName+_L("sRGB");
CPUTConfigEntry *pSRGBValue = mConfigBlock.GetValueByName(SRGBName);
bool loadAsSRGB = pSRGBValue->IsValid() ? loadAsSRGB = pSRGBValue->ValueAsBool() : true;
if( !mpTexture[textureCount] )
{
mpTexture[textureCount] = pAssetLibrary->GetTexture( textureName, false, loadAsSRGB );
ASSERT( mpTexture[textureCount], _L("Failed getting texture ") + textureName);
}
// The shader file (e.g. .fx) can specify the texture bind point (e.g., t0). Those specifications
// might not be contiguous, and there might be gaps (bind points without assigned textures)
// TODO: Warn about missing bind points?
params.mppBindViews[bindPoint] = ((CPUTTextureDX11*)mpTexture[textureCount])->GetShaderResourceView();
params.mppBindViews[bindPoint]->AddRef();
}
}
示例2: while
//-----------------------------------------------------------------------------
bool CPUTShaderDX11::ShaderRequiresPerModelPayload( CPUTConfigBlock &properties )
{
ID3D11ShaderReflection *pReflector = NULL;
D3DReflect( mpBlob->GetBufferPointer(), mpBlob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**)&pReflector);
// Walk through the shader input bind descriptors.
// If any of them begin with '@', then we need a unique material per model (i.e., we need to clone the material).
int ii=0;
D3D11_SHADER_INPUT_BIND_DESC desc;
HRESULT hr = pReflector->GetResourceBindingDesc( ii++, &desc );
while( SUCCEEDED(hr) )
{
cString tagName = s2ws(desc.Name);
CPUTConfigEntry *pValue = properties.GetValueByName(tagName);
if( !pValue->IsValid() )
{
// We didn't find our property in the file. Is it in the global config block?
pValue = CPUTMaterial::mGlobalProperties.GetValueByName(tagName);
}
cString boundName = pValue->ValueAsString();
if( (boundName.length() > 0) && ((boundName[0] == '@') || (boundName[0] == '#')) )
{
return true;
}
hr = pReflector->GetResourceBindingDesc( ii++, &desc );
}
return false;
}
示例3: ReadProperties
//-----------------------------------------------------------------------------
CPUTResult CPUTRenderStateBlockOGL::ReadProperties(
CPUTConfigFile &file,
const cString &blockName,
const CPUTRenderStateMapEntry *pMap,
void *pDest
)
{
// assert(false);
CPUTConfigBlock *pProperties = file.GetBlockByName(blockName);
if( !pProperties )
{
// Note: We choose not to assert here. The nature of the parameter block is that
// only the values that deviate from default need to be present. It is very
// common that blocks will be missing
return CPUT_ERROR_PARAMETER_BLOCK_NOT_FOUND;
}
UINT count = pProperties->ValueCount();
for( UINT ii=0; ii<count; ii++ )
{
// Get the next property
CPUTConfigEntry *pValue = pProperties->GetValue(ii);
ASSERT( pValue->IsValid(), _L("Invalid Value: '")+pValue->NameAsString()+_L("'.") );
ReadValue( pValue, pMap, pDest );
}
return CPUT_SUCCESS;
} // CPUTRenderStateBlockOGL::ReadProperties()
示例4: memset
//-----------------------------------------------------------------------------
void CPUTMaterialDX11::BindUAVs( CPUTShaderParameters ¶ms, const CPUTModel *pModel, int meshIndex )
{
CPUTConfigEntry *pValue;
CPUTAssetLibraryDX11 *pAssetLibrary = (CPUTAssetLibraryDX11*)CPUTAssetLibrary::GetAssetLibrary();
memset( params.mppBindUAVs, 0, sizeof(params.mppBindUAVs) );
for(params.mUAVCount=0; params.mUAVCount < params.mUAVParameterCount; params.mUAVCount++)
{
cString uavName;
UINT uavCount = params.mUAVCount;
cString tagName = params.mpUAVParameterName[uavCount];
{
pValue = mConfigBlock.GetValueByName(tagName);
if( !pValue->IsValid() )
{
// We didn't find our property in the file. Is it in the global config block?
pValue = mGlobalProperties.GetValueByName(tagName);
}
ASSERT( pValue->IsValid(), L"Can't find UAV '" + tagName + L"'." ); // TODO: fix message
uavName = pValue->ValueAsString();
}
UINT bindPoint = params.mpUAVParameterBindPoint[uavCount];
ASSERT( bindPoint < CPUT_MATERIAL_MAX_UAV_SLOTS, _L("UAV bind point out of range.") );
const CPUTModel *pWhichModel = NULL;
int whichMesh = -1;
if( uavName[0] == '@' )
{
pWhichModel = pModel;
whichMesh = meshIndex;
} else if( uavName[0] == '#' )
{
pWhichModel = pModel;
}
if( !mpUAV[uavCount] )
{
mpUAV[uavCount] = pAssetLibrary->GetBuffer( uavName, pWhichModel, whichMesh );
ASSERT( mpUAV[uavCount], _L("Failed getting UAV ") + uavName);
}
// If has UAV, then add to mppBindUAV
params.mppBindUAVs[bindPoint] = ((CPUTBufferDX11*)mpUAV[uavCount])->GetUnorderedAccessView();
if( params.mppBindUAVs[bindPoint] ) { params.mppBindUAVs[bindPoint]->AddRef();}
}
}
示例5: BindConstantBuffers
//-----------------------------------------------------------------------------
void CPUTMaterialEffectOGL::BindConstantBuffers( CPUTShaderParameters ¶ms, const CPUTModel *pModel, int meshIndex )
{
CPUTAssetLibraryOGL *pAssetLibrary = (CPUTAssetLibraryOGL*)CPUTAssetLibrary::GetAssetLibrary();
for(params.mConstantBufferCount=0; params.mConstantBufferCount < params.mConstantBufferParameterCount; params.mConstantBufferCount++)
{
cString constantBufferName;
UINT constantBufferCount = params.mConstantBufferCount;
// Dirty fix - you should work on std::string in all OS'es ! Why WSTRING ? Whyyyyyyy
#ifndef CPUT_OS_WINDOWS
cString tagName = params.mConstantBufferParameterNames[constantBufferCount];
#else
cString tagName = s2ws(params.mConstantBufferParameterNames[constantBufferCount].c_str());
#endif
CPUTConfigEntry *pValue = mConfigBlock.GetValueByName(tagName);
if( !pValue->IsValid() )
{
// We didn't find our property in the file. Is it in the global config block?
pValue = CPUTMaterial::mGlobalProperties.GetValueByName(tagName);
}
ASSERT( pValue->IsValid(), L"Can't find constant buffer '" + tagName + L"'." ); // TODO: fix message
constantBufferName = pValue->ValueAsString();
UINT bindPoint = params.mConstantBufferBindPoints[constantBufferCount];
ASSERT( bindPoint < CPUT_MATERIAL_MAX_CONSTANT_BUFFER_SLOTS, _L("Constant buffer bind point out of range.") );
params.mBindConstantBufferMin = std::min( params.mBindConstantBufferMin, bindPoint );
params.mBindConstantBufferMax = std::max( params.mBindConstantBufferMax, bindPoint );
if( constantBufferName[0] == '@' )
{
constantBufferName += ptoc(pModel) + itoc(meshIndex);
}
else if( constantBufferName[0] == '#' )
{
constantBufferName += ptoc(pModel);
}
if( !params.mpConstantBuffer[constantBufferCount] )
{
params.mpConstantBuffer[constantBufferCount] = pAssetLibrary->GetConstantBuffer( constantBufferName );
ASSERT( params.mpConstantBuffer[constantBufferCount], _L("Failed getting constant buffer ") + constantBufferName);
}
#ifndef CPUT_FOR_OGLES2
ES3_COMPAT(glUniformBlockBinding(mShaderProgram, bindPoint, bindPoint)); // just use the index as the binding point
#else
#warning "Need to do something with uniform buffers here"
#endif
// If has constant buffer, then add to mppBindConstantBuffer
// params.mppBindConstantBuffers[bindPoint] = ((CPUTBufferOGL*)mpConstantBuffer[constantBufferCount])->GetNativeBuffer();
// if( params.mppBindConstantBuffers[bindPoint] ) {
// params.mppBindConstantBuffers[bindPoint]->AddRef();
// }
}
DEBUG_PRINT(_L("Exit BindConstantBuffers"));
}
示例6: BindUAVs
void CPUTMaterialEffectOGL::BindUAVs( CPUTShaderParameters ¶ms, const CPUTModel *pModel, int meshIndex )
{
#ifdef CPUT_SUPPORT_IMAGE_STORE
CPUTAssetLibraryOGL *pAssetLibrary = (CPUTAssetLibraryOGL*)CPUTAssetLibrary::GetAssetLibrary();
for(params.mUAVCount=0; params.mUAVCount < params.mUAVParameterCount; params.mUAVCount++)
{
cString UAVName;
unsigned int UAVCount = params.mUAVCount;
// Dirty fix
#ifndef CPUT_OS_WINDOWS
cString tagName = params.mpUAVParameterNames[UAVCount];
#else
cString tagName = s2ws(params.mpUAVParameterNames[UAVCount].c_str());
#endif
CPUTConfigEntry *pValue = mConfigBlock.GetValueByName(tagName);
if( !pValue->IsValid() )
{
// We didn't find our property in the file. Is it in the global config block?
pValue = CPUTMaterial::mGlobalProperties.GetValueByName(tagName);
}
ASSERT( pValue->IsValid(), L"Can't find UAV '" + tagName + L"'." ); // TODO: fix message
UAVName = pValue->ValueAsString();
// If the UAV name not specified. Load default.dds instead
if( 0 == UAVName.length() )
{
UAVName = _L("default.dds");
}
UINT bindPoint = params.mUAVCount;//params.mpUAVParameterBindPoints[UAVCount];
params.mpUAVParameterBindPoints.push_back(bindPoint);
// UINT bindPoint = params.mpUAVParameterBindPoint[UAVCount]; mpUAVParameterBindPoints
ASSERT( bindPoint < CPUT_MATERIAL_MAX_UAV_SLOTS, _L("UAV bind point out of range.") );
params.mBindViewMin = std::min( params.mBindViewMin, bindPoint );
params.mBindViewMax = std::max( params.mBindViewMax, bindPoint );
if( UAVName[0] == '@' )
{
// This is a per-mesh value. Add to per-mesh list.
UAVName += ptoc(pModel) + itoc(meshIndex);
} else if( UAVName[0] == '#' )
{
// This is a per-mesh value. Add to per-mesh list.
UAVName += ptoc(pModel);
}
// Get the sRGB flag (default to true)
//#ifndef CPUT_OS_WINDOWS
cString SRGBName = tagName + _L("sRGB");
//#else
// cString SRGBName = tagName + L"sRGB";
//#endif
CPUTConfigEntry *pSRGBValue = mConfigBlock.GetValueByName(SRGBName);
bool loadAsSRGB = pSRGBValue->IsValid() ? loadAsSRGB = pSRGBValue->ValueAsBool() : true;
if( !params.mpUAV[UAVCount] )
{
params.mpUAV[UAVCount] = pAssetLibrary->GetTexture( UAVName, false, loadAsSRGB );
ASSERT( params.mpUAV[UAVCount], _L("Failed getting UAV ") + UAVName);
}
cString ReadName = tagName + _L("READ");
CPUTConfigEntry *pRead = mConfigBlock.GetValueByName(ReadName);
bool read = pRead->IsValid() ? pRead->ValueAsBool() : true;
cString WriteName = tagName + _L("WRITE");
CPUTConfigEntry *pWrite = mConfigBlock.GetValueByName(WriteName);
bool write = pWrite->IsValid() ? pWrite ->ValueAsBool() : true;
if(write && read)
params.mpUAVMode[UAVCount] = GL_READ_WRITE;
else if(read)
params.mpUAVMode[UAVCount] = GL_READ_ONLY;
else
params.mpUAVMode[UAVCount] = GL_WRITE_ONLY;
// The shader file (e.g. .fx) can specify the UAV bind point (e.g., t0). Those specifications
// might not be contiguous, and there might be gaps (bind points without assigned UAVs)
// TODO: Warn about missing bind points?
// params.mppBindViews[bindPoint] = ((CPUTTextureOGL*)mpTexture[textureCount])->GetShaderResourceView();
// params.mppBindViews[bindPoint]->AddRef();
//
// Match up the UAV name in any UAV samplers given in the renderstate file. If there wasn't
// one specified for a particular UAV then it just uses the default sampler.
//
CPUTRenderStateOGL *pRenderState;
pRenderState = ((CPUTRenderStateBlockOGL*)mpRenderStateBlock)->GetState();
mSamplerIDs[UAVCount] = pRenderState->DefaultSamplerID;
for (int renderStateIDX = 0; renderStateIDX < NUM_SAMPLERS_PER_RENDERSTATE; renderStateIDX++) {
if(renderStateIDX<((CPUTRenderStateBlockOGL*)mpRenderStateBlock)->GetNumSamplers())
{
mSamplerIDs[UAVCount] = pRenderState->SamplerIDs[renderStateIDX];
}
}
}
#endif
//.........这里部分代码省略.........
示例7: LoadMaterialEffect
CPUTResult CPUTMaterialEffectOGL::LoadMaterialEffect(
const cString &fileName,
const CPUTModel *pModel,
int meshIndex,
const char **pShaderMacros,
int externalCount,
cString *pExternalName,
float4 *pExternals,
int *pExternalOffset,
int *pExternalSize
){
CPUTResult result = CPUT_SUCCESS;
CPUTConfigEntry *pValue;
mMaterialName = fileName;
mMaterialNameHash = CPUTComputeHash( mMaterialName );
// Open/parse the file
CPUTConfigFile file;
result = file.LoadFile(fileName);
if(CPUTFAILED(result))
{
return result;
}
// Make a local copy of all the parameters
CPUTConfigBlock *pBlock = file.GetBlock(0);
ASSERT( pBlock, _L("Error getting parameter block") );
if( !pBlock )
{
return CPUT_ERROR_PARAMETER_BLOCK_NOT_FOUND;
}
mConfigBlock = *pBlock;
// get necessary device and AssetLibrary pointers
//ID3D11Device *pD3dDevice = CPUT_DX11::GetDevice();
CPUTAssetLibraryOGL *pAssetLibrary = (CPUTAssetLibraryOGL*)CPUTAssetLibrary::GetAssetLibrary();
{
CPUTConfigEntry *pEntryPointName, *pProfileName;
int numFiles = 0;
cString pBase = _L("VertexShaderFileOGL_");
cString pName = pBase + to_cString(numFiles+1);
std::vector<cString> filenames;
while (mConfigBlock.GetValueByName(pName)->IsValid())
{
filenames.push_back(mConfigBlock.GetValueByName(pName)->ValueAsString());
numFiles++;
pName = pBase + to_cString(numFiles+1);
}
if(numFiles > 0)
{
pEntryPointName = mConfigBlock.GetValueByName(_L("VertexShaderMain"));
pProfileName = mConfigBlock.GetValueByName(_L("VertexShaderProfile"));
pAssetLibrary->GetVertexShader(
filenames,
/*pD3dDevice,*/
_L("VertexShaderMain"),
pProfileName->ValueAsString(),
&mpVertexShader,
false,
(CPUT_SHADER_MACRO*)pShaderMacros
);
}
}
#ifdef CPUT_SUPPORT_TESSELLATION
{
int numFiles = 0;
cString pBase = _L("ControlShaderFileOGL_");
cString pName = pBase + to_cString(numFiles+1);
std::vector<cString> filenames;
while (mConfigBlock.GetValueByName(pName)->IsValid())
{
filenames.push_back(mConfigBlock.GetValueByName(pName)->ValueAsString());
numFiles++;
pName = pBase + to_cString(numFiles+1);
}
if(numFiles > 0)
{
pAssetLibrary->GetHullShader(
filenames,
/* pD3dDevice,*/
_L("ControlShaderMain"),
_L(""),
&mpControlShader,
false,
(CPUT_SHADER_MACRO*)pShaderMacros
);
}
}
{
int numFiles = 0;
cString pBase = _L("EvaluationShaderFileOGL_");
cString pName = pBase + to_cString(numFiles+1);
std::vector<cString> filenames;
while (mConfigBlock.GetValueByName(pName)->IsValid())
{
filenames.push_back(mConfigBlock.GetValueByName(pName)->ValueAsString());
numFiles++;
//.........这里部分代码省略.........
示例8: Load
bool CPUTGUIElement::Load(CPUTConfigBlock* pBlock, int* pParent)
{
CPUTConfigEntry* pEntry = NULL;
pEntry = pBlock->GetValueByName(NAME);
if (pEntry->IsValid())
mName= pEntry->ValueAsString();
pEntry = pBlock->GetValueByName(PARENT);
if(pEntry->IsValid())
*pParent = pEntry->ValueAsInt();
pEntry = pBlock->GetValueByName(WIDTH);
if(pEntry->IsValid())
mWidth = pEntry->ValueAsInt();
pEntry = pBlock->GetValueByName(HEIGHT);
if(pEntry->IsValid())
mHeight = pEntry->ValueAsInt();
pEntry = pBlock->GetValueByName(POS_X);
if(pEntry->IsValid())
mRelX = pEntry->ValueAsInt();
pEntry = pBlock->GetValueByName(POS_Y);
if(pEntry->IsValid())
mRelY = pEntry->ValueAsInt();
pEntry = pBlock->GetValueByName(PARENT_RELATIVE);
if(pEntry->IsValid())
mParentRelative = pEntry->ValueAsBool();
pEntry = pBlock->GetValueByName(VISIBLE);
if(pEntry->IsValid())
mVisible = pEntry->ValueAsBool();
pEntry = pBlock->GetValueByName(FOREGROUND_COLOR);
if(pEntry->IsValid())
{
pEntry->ValueAsFloatArray((float*)&mForegroundColor, 4);
mForegroundHighlightColor = mForegroundColor;
}
pEntry = pBlock->GetValueByName(BACKGROUND_COLOR);
if(pEntry->IsValid())
{
pEntry->ValueAsFloatArray((float*)&mBackgroundColor, 4);
mBackgroundHighlightColor = mBackgroundColor;
}
pEntry = pBlock->GetValueByName(FOREGROUND_HIGHLIGHT_COLOR);
if(pEntry->IsValid())
pEntry->ValueAsFloatArray((float*)&mForegroundHighlightColor, 4);
pEntry = pBlock->GetValueByName(BACKGROUND_HIGHLIGHT_COLOR);
if(pEntry->IsValid())
pEntry->ValueAsFloatArray((float*)&mBackgroundHighlightColor, 4);
pEntry = pBlock->GetValueByName(MATERIAL);
if(pEntry->IsValid())
{
cString materialName = pEntry->ValueAsString();
mpSprite = CPUTSprite::CreateSprite(0.0, 0.0, 1.0, 1.0, materialName);
}
pEntry = pBlock->GetValueByName(TEXT_MATERIAL);
if(pEntry->IsValid())
{
cString materialName = pEntry->ValueAsString();
mpTextMaterial = CPUTAssetLibrary::GetAssetLibrary()->GetMaterial(materialName);
}
const cString FONT = _L("font");
pEntry = pBlock->GetValueByName(FONT);
if(pEntry->IsValid())
{
cString fontName;
pEntry->ValueAsString(&fontName);
mpFont = (CPUTFont*)CPUTAssetLibrary::GetAssetLibrary()->GetFontByName(fontName);
if(mpFont == NULL)
{
DEBUG_PRINT(_L("Failed to load font: %s"), fontName.c_str());
}
}
pEntry = pBlock->GetValueByName(TEXT);
cString string;
if(pEntry->IsValid())
{
pEntry->ValueAsString(&string);
SetText(string);
}
pEntry = pBlock->GetValueByName(HIGHLIGHT);
if(pEntry->IsValid())
{
mHighlighted = pEntry->ValueAsBool();
}
pEntry = pBlock->GetValueByName(MOUSE_CLICK);
if(pEntry->IsValid())
{
pEntry->ValueAsString(&mClick.key);
//.........这里部分代码省略.........
示例9: LoadMaterial
//-----------------------------------------------------------------------------
CPUTResult CPUTMaterial::LoadMaterial(
const cString &fileName,
const CPUTModel *pModel,
int meshIndex,
const char **pShaderMacros,
int systemMaterialCount,
cString *pSystemMaterialNames,
int externalCount,
cString *pExternalName,
float4 *pExternals,
int *pExternalOffset,
int *pExternalSize
){
CPUTResult result = CPUT_SUCCESS;
mMaterialName = fileName;
mMaterialNameHash = CPUTComputeHash( mMaterialName );
// Open/parse the file
CPUTConfigFile file;
result = file.LoadFile(fileName);
if(CPUTFAILED(result))
{
return result;
}
// Make a local copy of all the parameters
CPUTConfigBlock *pBlock = file.GetBlock(0);
ASSERT( pBlock, _L("Error getting parameter block") );
if( !pBlock )
{
return CPUT_ERROR_PARAMETER_BLOCK_NOT_FOUND;
}
mConfigBlock = *pBlock;
CPUTAssetLibrary *pAssetLibrary = (CPUTAssetLibrary*)CPUTAssetLibrary::GetAssetLibrary();
mMaterialEffectCount = 0;
if( mConfigBlock.GetValueByName( _L("MultiMaterial") )->ValueAsBool() )
{
// Count materials;
for(;;)
{
CPUTConfigEntry *pValue = mConfigBlock.GetValueByName( _L("Material") + itoc(mMaterialEffectCount) );
if( pValue->IsValid() )
{
++mMaterialEffectCount;
} else
{
break;
}
}
ASSERT(mMaterialEffectCount != 0, _L("MultiMaterial specified, but no sub materials given.") );
// Reserve space for "authored" materials plus system materials
mpMaterialEffectNames = new cString[mMaterialEffectCount+systemMaterialCount];
int ii;
for( ii=0; ii<mMaterialEffectCount; ii++ )
{
CPUTConfigEntry *pValue = mConfigBlock.GetValueByName( _L("Material") + itoc(ii) );
mpMaterialEffectNames[ii] = pAssetLibrary->GetMaterialEffectPath(pValue->ValueAsString(), false);
}
}
else
{
mMaterialEffectCount = 1;
mpMaterialEffectNames = new cString[mMaterialEffectCount+systemMaterialCount];
mpMaterialEffectNames[0] = fileName;
}
CPUT_SHADER_MACRO *pFinalShaderMacros = (CPUT_SHADER_MACRO*)pShaderMacros;
CPUT_SHADER_MACRO *pUserSpecifiedMacros = NULL;
// The real material count includes the system material count
mMaterialEffectCount += systemMaterialCount;
for( int ii=0; ii<systemMaterialCount; ii++ )
{
// Read additional macros from .mtl file
cString macroBlockName = _L("defines") + itoc(ii);
CPUTConfigBlock *pMacrosBlock = file.GetBlockByName(macroBlockName);
int numUserSpecifiedMacros = 0;
if( pMacrosBlock )
{
ReadMacrosFromConfigBlock( pMacrosBlock, (CPUT_SHADER_MACRO*)pShaderMacros, &pUserSpecifiedMacros, &numUserSpecifiedMacros, &pFinalShaderMacros );
}
// System materials "grow" from the end; the 1st system material is at the end of the list.
mpMaterialEffectNames[mMaterialEffectCount-systemMaterialCount+ii] = pSystemMaterialNames[ii];
for( int kk=0; kk<numUserSpecifiedMacros; kk++ )
{
// ReadMacrosFromConfigBlock allocates memory (ws2s does). Delete it here.
SAFE_DELETE(pUserSpecifiedMacros[kk].Name);
SAFE_DELETE(pUserSpecifiedMacros[kk].Definition);
}
SAFE_DELETE_ARRAY( pFinalShaderMacros );
SAFE_DELETE_ARRAY( pUserSpecifiedMacros );
//.........这里部分代码省略.........