void CSVRender::Object::update() { clear(); std::string model; int error = 0; // 1 referenceable does not exist, 2 referenceable does not specify a mesh const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables(); int index = referenceables.searchId (mReferenceableId); if (index==-1) error = 1; else { /// \todo check for Deleted state (error 1) model = referenceables.getData (index, referenceables.findColumnIndex (CSMWorld::Columns::ColumnId_Model)). toString().toUtf8().constData(); if (model.empty()) error = 2; } mBaseNode->removeChildren(0, mBaseNode->getNumChildren()); if (error) { mBaseNode->addChild(createErrorCube()); } else { try { std::string path = "meshes\\" + model; mResourceSystem->getSceneManager()->createInstance(path, mBaseNode); } catch (std::exception& e) { // TODO: use error marker mesh std::cerr << e.what() << std::endl; } } }
void CSVRender::Object::update() { clear(); std::string model; int error = 0; // 1 referenceable does not exist, 2 referenceable does not specify a mesh const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables(); int index = referenceables.searchId (mReferenceableId); const ESM::Light* light = NULL; if (index==-1) error = 1; else { /// \todo check for Deleted state (error 1) model = referenceables.getData (index, referenceables.findColumnIndex (CSMWorld::Columns::ColumnId_Model)). toString().toUtf8().constData(); int recordType = referenceables.getData (index, referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_RecordType)).toInt(); if (recordType == CSMWorld::UniversalId::Type_Light) { light = &dynamic_cast<const CSMWorld::Record<ESM::Light>& >(referenceables.getRecord(index)).get(); } if (model.empty()) error = 2; } mBaseNode->removeChildren(0, mBaseNode->getNumChildren()); if (error) { mBaseNode->addChild(createErrorCube()); } else { try { std::string path = "meshes\\" + model; mResourceSystem->getSceneManager()->getInstance(path, mBaseNode); } catch (std::exception& e) { // TODO: use error marker mesh std::cerr << e.what() << std::endl; } } if (light) { const Fallback::Map* fallback = mData.getFallbackMap(); static bool outQuadInLin = fallback->getFallbackBool("LightAttenuation_OutQuadInLin"); static bool useQuadratic = fallback->getFallbackBool("LightAttenuation_UseQuadratic"); static float quadraticValue = fallback->getFallbackFloat("LightAttenuation_QuadraticValue"); static float quadraticRadiusMult = fallback->getFallbackFloat("LightAttenuation_QuadraticRadiusMult"); static bool useLinear = fallback->getFallbackBool("LightAttenuation_UseLinear"); static float linearRadiusMult = fallback->getFallbackFloat("LightAttenuation_LinearRadiusMult"); static float linearValue = fallback->getFallbackFloat("LightAttenuation_LinearValue"); bool isExterior = false; // FIXME SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, Mask_Lighting, isExterior, outQuadInLin, useQuadratic, quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue); } }