本文整理汇总了C++中Floor::addPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::addPoint方法的具体用法?C++ Floor::addPoint怎么用?C++ Floor::addPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::addPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawObject
void GLBox::drawObject(const QDomDocument &doc)
{
QDomElement root = doc.documentElement().toElement();
QDomElement texture1 = root.elementsByTagName("textures").item(0).toElement();
for (QDomNode i = texture1.firstChild(); !i.isNull(); i = i.nextSibling())
{
QDomElement e = i.toElement();
QString name = e.attribute("name");
QString file = e.attribute("file");
QString color = e.attribute("color", "0xFFFFFF");
QString xscale = e.attribute("xscale", "1.0");
QString yscale = e.attribute("yscale", "1.0");
qDebug()<<"Adding Texture:"<<name<<color<<file<<xscale<<yscale;
textures[name] = Texture(color.toUInt(0, 16), file, xscale.toFloat(), yscale.toFloat());
}
QDomElement item = root.elementsByTagName("items").item(0).toElement();
for (QDomNode i = item.firstChild(); !i.isNull(); i = i.nextSibling())
{
QDomElement e = i.toElement();
QString x = e.attribute("x");
QString y = e.attribute("y");
QString z = e.attribute("z");
QString rotation = e.attribute("rotation", "0.0");
QString type = e.attribute("type");
if (type == "wall")
{
QString length = e.attribute("length");
QString innerTexture = e.attribute("innerTexture");
QString outerTexture = e.attribute("outerTexture");
QString height = e.attribute("height", "10.0");
QString thickness = e.attribute("thickness", "0.5");
qDebug()<<"Adding Wall:"<<x<<y<<z<<rotation<<length<<innerTexture<<outerTexture<<height<<thickness;
Wall *wall = new Wall(x.toFloat(), y.toFloat(), z.toFloat(), rotation.toFloat(), length.toFloat(), textures[innerTexture], textures[outerTexture], height.toFloat(), thickness.toFloat());
// now we start parsing the windows
for (QDomNode w = e.firstChild(); !w.isNull(); w = w.nextSibling()) {
QDomElement tmp = w.toElement();
if (tmp.tagName() == "window") {
QString position = tmp.attribute("position");
QString length = tmp.attribute("length");
QString texture = tmp.attribute("texture");
QString lowerHeight = tmp.attribute("lowerHeight", "3.0");
QString upperHeight = tmp.attribute("upperHeight", "7.0");
wall->addWindow(position.toFloat(), length.toFloat(), textures[texture], lowerHeight.toFloat(), upperHeight.toFloat());
qDebug()<<"Added Window:"<<position<<length<<texture<<lowerHeight<<upperHeight;
}
else if (tmp.tagName() == "door") {
QString position = tmp.attribute("position");
QString length = tmp.attribute("length");
QString texture = tmp.attribute("texture");
QString height = tmp.attribute("height", "7.0");
wall->addDoor(position.toFloat(), length.toFloat(), textures[texture], height.toFloat());
qDebug()<<"Added Door:"<<position<<length<<texture<<height;
}
}
addObject(wall);
} else if (type == "floor") {
QString texture = e.attribute("texture");
qDebug()<<"Adding Floor:"<<x<<y<<z<<rotation;
Floor *floor = new Floor(x.toFloat(), y.toFloat(), z.toFloat(), rotation.toFloat(), textures[texture]);
// now we start parsing the windows
for (QDomNode w = e.firstChild(); !w.isNull(); w = w.nextSibling()) {
QDomElement tmp = w.toElement();
if (tmp.tagName() == "point") {
QString x = tmp.attribute("x");
QString y = tmp.attribute("y");
floor->addPoint(x.toFloat(), y.toFloat());
qDebug()<<"Added Point:"<<x<<y;
}
}
addObject(floor);
}
}
}