/** * generates a model node based on a minimal geometry resource and attaches it to the joint eye */ Joint* Gaze::createGazeAux(Joint* eye) { if(m_gazeaux_res == 0) { m_gazeaux_res = h3dAddResource(H3DResTypes::Geometry, "_gazeaux_geo",0); if( !h3dIsResLoaded(m_gazeaux_res) ) if(!loadGazeAuxRes(m_gazeaux_res)) GameLog::errorMessage( "IKComponent: failed to load gazeaux resource" ); } H3DNode node = h3dAddModelNode( eye->getHordeID(), "_gazeaux_", m_gazeaux_res); return Joint::getInstance(node); }
void QModelNode::addRepresentation() { m_resourceID = h3dAddResource(H3DResTypes::Geometry, qPrintable(m_xmlNode.attribute("geometry")), 0); // Load resource immediately since a later call to loadResourceFromDisk results in a bad behaviour of the Horde3D engine QString resourceName = h3dutGetResourcePath(H3DResTypes::Geometry); if( !resourceName.isEmpty() && !resourceName.endsWith('/') && !resourceName.endsWith('\\')) resourceName += '/'; resourceName += geometry(); QFile file(QFileInfo(resourceName).absoluteFilePath()); if (!file.open(QIODevice::ReadOnly)) qWarning("Error opening resource %s (%s)", qPrintable(m_xmlNode.attribute("geometry")), qPrintable( QFileInfo(resourceName).absoluteFilePath() )); // Stupid return value, if false it can also be the case that the resource was loaded before instead of that their was an error h3dLoadResource(m_resourceID, file.readAll().constData(), file.size()); file.close(); QSceneNode* parentNode = static_cast<QSceneNode*>(parent()); unsigned int rootID = parentNode ? parentNode->hordeId() : H3DRootNode; m_hordeID = h3dAddModelNode(rootID, qPrintable(m_xmlNode.attribute("name", "ATTENTION No Node Name")), m_resourceID); float x, y, z, rx, ry, rz, sx, sy, sz; getTransformation(x,y,z,rx,ry,rz,sx,sy,sz); h3dSetNodeTransform(m_hordeID, x, y, z, rx, ry, rz, sx, sy, sz); h3dSetNodeParamI(m_hordeID, H3DModel::SWSkinningI, softwareSkinning()); h3dSetNodeParamF(m_hordeID, H3DModel::LodDist1F, 0, lodDist1()); h3dSetNodeParamF(m_hordeID, H3DModel::LodDist2F, 0, lodDist2()); h3dSetNodeParamF(m_hordeID, H3DModel::LodDist3F, 0, lodDist3()); h3dSetNodeParamF(m_hordeID, H3DModel::LodDist4F, 0, lodDist4()); // Attachment QDomElement attachment = m_xmlNode.firstChildElement("Attachment"); SceneTreeModel* model = static_cast<SceneTreeModel*>(m_model); AttachmentPlugIn* plugIn = model->nodeFactory()->attachmentPlugIn(); if (!attachment.isNull() && plugIn != 0) plugIn->initNodeAttachment(this); }