本文整理汇总了C++中X3DAttributes::getSFFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ X3DAttributes::getSFFloat方法的具体用法?C++ X3DAttributes::getSFFloat怎么用?C++ X3DAttributes::getSFFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X3DAttributes
的用法示例。
在下文中一共展示了X3DAttributes::getSFFloat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startSphere
int OgreNodeHandler::startSphere(const X3DAttributes &attr) {
std::cout << "Start Sphere\n";
int index = attr.getAttributeIndex(ID::radius);
float radius = index == -1 ? 1.0 : attr.getSFFloat(index);
const string name = createUniqueName(attr, "sphere");
GeomUtils::createSphere(name , radius, 20, 20, true, false);
_currentMesh = MeshManager::getSingleton().getByName(name);
_currentEntity = _sceneManager->createEntity(_shapeName, name);
return 1;
}
示例2: startDirectionalLight
int OgreNodeHandler::startDirectionalLight(const X3DAttributes &attr) {
Light* light = _sceneManager->createLight(createUniqueName(attr, "directionalLight"));
light->setType(Ogre::Light::LT_DIRECTIONAL);
// Get the X3D values;
SFVec3f direction;
SFColor color;
int index = attr.getAttributeIndex(ID::direction);
if (index != -1)
{
direction = attr.getSFVec3f(index);
}
else
direction.z = -1;
index = attr.getAttributeIndex(ID::color);
if (index != -1)
{
color = attr.getSFColor(index);
}
else
color.r = color.g = color.b = 1;
index = attr.getAttributeIndex(ID::intensity);
float intensity = (index == -1) ? 1 : attr.getSFFloat(index);
index = attr.getAttributeIndex(ID::on);
bool on = (index == -1) ? true : attr.getSFBool(index);
// Set the Ogre values
light->setDirection(direction.x, direction.y, direction.z);
Ogre::ColourValue colourValue(color.r, color.g, color.b);
colourValue *= intensity;
light->setDiffuseColour(colourValue);
light->setSpecularColour(colourValue);
light->setVisible(on);
_nodeStack.top()->attachObject(light);
return 1;
}
示例3: startMaterial
virtual int startMaterial(const X3DAttributes& attr)
{
testEvent(11, "start Material");
int index = attr.getAttributeIndex(ID::diffuseColor);
assert(index != -1);
SFColor diffuseColor;
attr.getSFColor(index, diffuseColor);
assert(diffuseColor.r == 1.0);
assert(diffuseColor.g == 0.0);
assert(diffuseColor.b == 0.0);
cout << "Diffuse Color is: " << diffuseColor.r << " " << diffuseColor.g << " " << diffuseColor.b << endl;
index = attr.getAttributeIndex(ID::transparency);
assert(index != -1);
float transparency = attr.getSFFloat(index);
assert(transparency == 0.1f);
return CONTINUE;
}
示例4: startMaterial
int OgreNodeHandler::startMaterial(const X3DAttributes &attr) {
std::cout << "Start Material" << std::endl;
if (!_currentMaterial.isNull())
{
Pass* pass = _currentMaterial->getTechnique(0)->getPass(0);
int index = attr.getAttributeIndex(ID::ambientIntensity);
float ambientIntensity = (index == -1) ? 0.2f : attr.getSFFloat(index);
index = attr.getAttributeIndex(ID::transparency);
float transparency = (index == -1) ? 0.0f : attr.getSFFloat(index);
SFColor diffuseColor;
index = attr.getAttributeIndex(ID::diffuseColor);
if (index != -1)
{
diffuseColor = attr.getSFColor(index);
}
else
{
diffuseColor.r = diffuseColor.g = diffuseColor.b = 0.8;
}
SFColor specularColor;
index = attr.getAttributeIndex(ID::specularColor);
if (index != -1)
{
specularColor = attr.getSFColor(index);
}
SFColor emissiveColor;
index = attr.getAttributeIndex(ID::emissiveColor);
if (index != -1)
{
emissiveColor = attr.getSFColor(index);
}
index = attr.getAttributeIndex(ID::shininess);
float shininess = (index == -1) ? 0.2f : attr.getSFFloat(index);
shininess = Math::Clamp(shininess * 128.0f, 0.0f, 128.0f);
pass->setAmbient(ambientIntensity * diffuseColor.r,
ambientIntensity * diffuseColor.g,
ambientIntensity * diffuseColor.b);
pass->setDiffuse(diffuseColor.r,
diffuseColor.g,
diffuseColor.b,
1.0f - transparency);
pass->setSpecular(specularColor.r,
specularColor.g,
specularColor.b,
1.0f - transparency);
pass->setSelfIllumination(emissiveColor.r,
emissiveColor.g,
emissiveColor.b);
pass->setShininess( shininess );
pass->setLightingEnabled(true);
}
return 1;
}