本文整理汇总了C++中Primitive::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::setColor方法的具体用法?C++ Primitive::setColor怎么用?C++ Primitive::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Primitive
的用法示例。
在下文中一共展示了Primitive::setColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSegment
Primitive* Schlange::createSegment(int index, const OdeHandle& odeHandle){
Primitive* p;
p = new Capsule(conf.segmDia * 0.8, conf.segmLength);
// if (index==0)
// p = new Box(conf.segmLength*.1,conf.segmLength*.9, conf.segmLength*.6);
p->setTexture("Images/whitemetal_farbig_small.rgb");
p->init(odeHandle, conf.segmMass, osgHandle);
if(index==0)
p->setColor(conf.headColor);
else
p->setColor(conf.bodyColor);
return p;
}
示例2: prmSetColor
bool Commands::prmSetColor(int argc, char** argv) {
const Line* cur_state = CommandLine::getState();
// if state is blank we have nothing selected
// print error message and skip
if (cur_state) {
if (cur_state->toCommandID() == Commands::primitive_get_cmd_id) {
float r = atof(argv[1]);
float g = atof(argv[2]);
float b = atof(argv[3]);
if (r >= 0.0 && g >= 0.0 && b >= 0.0 &&
r <= 1.0 && g <= 1.0 && b <= 1.0)
{
Primitive* prm = dynamic_cast<Primitive*>(
Renderable::get(cur_state->tokens[1]));
prm->setColor(r, g, b);
return true;
} else {
fprintf(stderr, "ERROR input values for %s must be 3 numerical values between 0.0 and 1.0 (inclusive)\n",
argv[0]);
}
} else {
fprintf(stderr, "ERROR %s requires that you have a Primitive selected\n",
argv[0]);
}
} else {
fprintf(stderr, "ERROR %s requires that you have a Primitive selected\n",
argv[0]);
}
return false;
}