本文整理汇总了C++中Renderable::certifyParams方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::certifyParams方法的具体用法?C++ Renderable::certifyParams怎么用?C++ Renderable::certifyParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::certifyParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Component *ComponentFactory::createComponent(int type, std::map<std::string,std::string> params)
{
switch (type)
{
case COMPONENT_TYPE_DATA_BOUNDINGBOX:
{
printf("adding component BOUNDINGBOX\n");
//AxisAlignedBoundingBox *bb = new AxisAlignedBoundingBox(id_ref++);
//parse parameters
//parameters for Location:
// int {x, y, z}
int type = -1;
for (std::map<std::string,std::string>::iterator it = params.begin(); it != params.end(); it++)
{
if (it->first.compare("bb_type") == 0)
type = atoi(it->second.c_str());
else
continue;
}
if (type != -1)
{
switch (type)
{
case BOUNDINGBOX_TYPE_AXISALIGNED:
{
AxisAlignedBoundingBox *bb = new AxisAlignedBoundingBox(id_ref++);
for (std::map<std::string,std::string>::iterator it = params.begin(); it != params.end(); it++)
{
if (it->first.compare("half_x") == 0)
bb->halfVectors.x = strtof(it->second.c_str(), NULL);
else if (it->first.compare("half_y") == 0)
bb->halfVectors.y = strtof(it->second.c_str(), NULL);
else if (it->first.compare("offset_x") == 0)
bb->offsetVectors.x = atoi(it->second.c_str());
else if (it->first.compare("offset_y") == 0)
bb->offsetVectors.y = atoi(it->second.c_str());
else if (it->first.compare("r") == 0)
bb->zeroAxis = strtof(it->second.c_str(), NULL);
}
bb->certifyParams();
return bb;
break;
}
}
}
else
{
return NULL;
}
break;
}
case COMPONENT_TYPE_DATA_TRANSFORM:
{
printf("adding component TRANSFORM\n");
Transform *t = new Transform(id_ref++);
for (std::map<std::string,std::string>::iterator it = params.begin(); it != params.end(); it++)
{
if (it->first.compare("x") == 0)
t->xyz.x = atoi(it->second.c_str());
else if (it->first.compare("y") == 0)
t->xyz.y = atoi(it->second.c_str());
else if (it->first.compare("z") == 0)
t->xyz.z = atoi(it->second.c_str());
else if (it->first.compare("w") == 0)
t->wh.x = strtof(it->second.c_str(), NULL);
else if (it->first.compare("h") == 0)
t->wh.y = strtof(it->second.c_str(), NULL);
else if (it->first.compare("r") == 0)
t->r = strtof(it->second.c_str(), NULL);
}
t->certifyParams();
return t;
break;
}
/*case COMPONENT_TYPE_DATA_LOCATION:
{
Location *l = new Location(id_ref++);
//parse parameters
//parameters for Location:
// int {x, y, z}
for (std::map<std::string,std::string>::iterator it = params.begin(); it != params.end(); it++)
{
if (it->first.compare("x") == 0)
l->xyz.x = atoi(it->second.c_str());
else if (it->first.compare("y") == 0)
l->xyz.y = atoi(it->second.c_str());
else if (it->first.compare("z") == 0)
l->xyz.z = atoi(it->second.c_str());
}
return l;
break;
}*/
case COMPONENT_TYPE_EVENT_PHYSICAL:
{
printf("adding component PHYSICAL\n");
//.........这里部分代码省略.........