本文整理汇总了C++中ParamBlockDesc2::IndextoID方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamBlockDesc2::IndextoID方法的具体用法?C++ ParamBlockDesc2::IndextoID怎么用?C++ ParamBlockDesc2::IndextoID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamBlockDesc2
的用法示例。
在下文中一共展示了ParamBlockDesc2::IndextoID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertIntListBoxAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertIntListBoxAttrib (IParamBlock2* paramBlock,
int index, std::string &name,
int &value)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if (!paramDesc)
return false;
ParamDef& paramDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
int intValue;
Interval validInverval;
BOOL retrieved = false;
retrieved = paramBlock->GetValue((ParamID)index, 0, intValue,
validInverval);
if (retrieved)
{
char* valueName = paramDef.int_name;
if (!IsValidName(valueName))
{
valueName = paramBlock->GetLocalName((ParamID)index);
assertion(IsValidName(valueName), "valueName must be valuable.");
}
name = std::string(valueName);
//3ds Max中数组从1开始,这里的index要减1
value = (intValue==-1) ? -1 : (intValue-1);
}
return true;
}
示例2: ConvertFRGBAAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertFRGBAAttrib(IParamBlock2* paramBlock, int index,
std::string &name, PX2::Float4 &value)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if (!paramDesc)
return false;
ParamDef ¶mDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
Point4 vectorValue;
Interval validInterval;
BOOL retrieved = false;
retrieved = paramBlock->GetValue((ParamID)index, 0 , vectorValue, validInterval);
if(retrieved)
{
TCHAR* valueName = paramDef.int_name;
if (!IsValidName(valueName))
valueName = paramBlock->GetLocalName((ParamID)index );
assertion(IsValidName(valueName), "valueName must be valuable.");
name = std::string(valueName);
value = PX2::Float4(vectorValue.x, vectorValue.y, vectorValue.z,
vectorValue.w);
if(HasAnimation(paramBlock, index))
{
}
}
return true;
}
示例3: ConvertFloatAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertFloatAttrib (IParamBlock2* paramBlock, int index,
std::string &name, float &value)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if(!paramDesc)
return false;
ParamDef ¶mDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
float floatValue;
Interval validInverval;
BOOL retrieved = paramBlock->GetValue((ParamID)index, 0, floatValue, validInverval);
if(!retrieved)
{
return false;
}
char *valueName = paramDef.int_name;
if (!IsValidName(valueName))
{
valueName = paramBlock->GetLocalName((ParamID)index);
assertion(IsValidName(valueName), "valueName must be valuable.");
}
name = std::string(valueName);
//if (!HasAnimation(paramBlock, index))
{
value = floatValue;
return true;
}
return true;
}
示例4: ConvertFloatTabAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertFloatTabAttrib (IParamBlock2* paramBlock, int index,
std::string &name, float *table)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if (!paramDesc)
return false;
ParamDef& paramDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
Interval validInterval;
BOOL retrieved = true;
int count = paramBlock->Count(paramDesc->IndextoID(index));
if (count == 0)
return false;
float* floats = new float[count];
IParamBlock2* params = paramBlock;
for (int i=0; i<count; i++)
{
retrieved &= params->GetValue((ParamID)index, 0 , floats[i], validInterval,
i);
}
if (retrieved && count > 0)
{
TCHAR* valueName = paramDef.int_name;
if (!IsValidName(valueName))
{
valueName = paramBlock->GetLocalName((ParamID)index);
assertion(IsValidName(valueName), "valueName must be valuable.");
}
name = std::string(valueName);
for (int i=0; i<count; i++)
{
table[i] = floats[i];
}
}
return true;
}
示例5: ValidateReturnType
bool mrShaderFilter::ValidateReturnType(ParamBlockDesc2& pbDesc) {
// Go through all the parameters of the block
int count = pbDesc.Count();
for(int i = 0; i < count; ++i) {
const ParamDef& paramDef = pbDesc.GetParamDef(pbDesc.IndextoID(i));
if(ValidType(paramDef.type))
return true;
}
return false;
}
示例6: ConvertBitMapAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertBitMapAttrib(IParamBlock2* paramBlock, int index,
std::string &name,
PX2::Texture2D *&tex2d)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if (!paramDesc)
return false;
ParamDef ¶mDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
PX2_UNUSED(paramDef);
PBBitmap *pb;
Interval validInterval;
char *valueName = 0;
PX2_UNUSED(valueName);
BOOL retrieved = false;
retrieved = paramBlock->GetValue((ParamID)index, 0, pb, validInterval);
char strBitMapName[256];
memset(strBitMapName, 0, 256*sizeof(char));
if (pb)
{
if (BMMGetFullFilename(&pb->bi) == TRUE)
{
strcpy(strBitMapName, pb->bi.Name());
std::string resourcePath;
std::string fullName = std::string(strBitMapName);
std::string::size_type sizeT = fullName.find_first_not_of(mSettings->SrcRootDir);
resourcePath = std::string(strBitMapName).substr(sizeT);
tex2d = PX2::DynamicCast<PX2::Texture2D>(
PX2::ResourceManager::GetSingleton().BlockLoad(strBitMapName));
tex2d->SetResourcePath(resourcePath);
}
}
if (retrieved)
{
valueName = paramDef.int_name;
if (!IsValidName(valueName))
valueName = paramBlock->GetLocalName((ParamID)index);
assertion(IsValidName(valueName), "valueName must be valuable.");
name = valueName;
}
return true;
}
示例7: ConvertStringAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertStringAttrib (IParamBlock2 *paramBlock, int index,
std::string &name, std::string &str)
{
PX2_UNUSED(name);
PX2_UNUSED(str);
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
if (!paramDesc)
return false;
ParamDef ¶mDef = paramDesc->GetParamDef(paramDesc->IndextoID(index));
char *stringValue;
Interval validInverval;
BOOL retrieved = false;
retrieved = paramBlock->GetValue((ParamID)index, 0, stringValue, validInverval);
if (retrieved)
{
char* valueName = paramDef.int_name;
if (!IsValidName(valueName))
{
valueName = paramBlock->GetLocalName((ParamID)index);
}
assertion(IsValidName(valueName), "valueName must be valuable.");
name = valueName;
PX2_UNUSED(name);
assertion(false, "");
}
return true;
}
示例8: ConvertColorAttrib
//----------------------------------------------------------------------------
bool SceneBuilder::ConvertColorAttrib(IParamBlock2 *paramBlock, int index,
std::string &name, PX2::Float4 &color,
int &increment)
{
ParamBlockDesc2 *paramDesc = paramBlock->GetDesc();
int numParams = paramBlock->NumParams();
if (!paramDesc)
return false;
ParamDef &colorParamDef = paramDesc->GetParamDef(
paramDesc->IndextoID(index));
ParamDef &alphaParamDef = paramDesc->GetParamDef(
paramDesc->IndextoID(index+1));
Color colorValue;
float alphaValue = 255.0f;
Interval validInterval;
BOOL retrievedColor = false;
BOOL retrievedAlpha = false;
int alphaIndex = index + 1;
retrievedColor = paramBlock->GetValue((ParamID)index, 0, colorValue,
validInterval);
if (alphaIndex < numParams)
{
int param_type = paramBlock->GetParameterType((ParamID)alphaIndex);
if (param_type == TYPE_FLOAT)
{
retrievedAlpha = paramBlock->GetValue((ParamID)alphaIndex, 0,
alphaValue, validInterval);
}
}
if (retrievedColor)
{
char* valueName = colorParamDef.int_name;
if (!IsValidName(valueName))
{
valueName = paramBlock->GetLocalName((ParamID)index);
}
assertion(IsValidName(valueName), "valueName must be valuable.");
name = std::string(valueName);
Control *colorControl = paramBlock->GetController(index, 0);
PX2_UNUSED(colorControl);
bool hasAlpha = false;
Control *alphaControl = 0;
if (retrievedAlpha)
{
TCHAR *valueAlphaName = alphaParamDef.int_name;
if (!IsValidName(valueAlphaName))
valueName = paramBlock->GetLocalName((ParamID)alphaIndex);
assertion(IsValidName(valueAlphaName), "valueName must be valuable.");
alphaControl = paramBlock->GetController(alphaIndex, 0);
std::string strColorName = valueName;
strColorName += "Alpha";
if (!strcmp(strColorName.c_str(), valueAlphaName))
{
hasAlpha = true;
increment++;
}
else
{
alphaControl = 0;
}
}
if (hasAlpha)
{
color = PX2::Float4(colorValue.r, colorValue.g, colorValue.b,
alphaValue);
}
else
{
color = PX2::Float4(colorValue.r, colorValue.g, colorValue.b, 1.0f);
}
}
return true;
}