CommandPtr Commands_Create(const string& name, const core::Ptree& el, Provider* pro) { if(name == "bindbuffer") { return CommandPtr(new BindBufferCommand(el, pro)); } else if(name == "setu2") { return CommandPtr(new SetVec2Uniform(el, pro)); } else { throw FseException(name + " is not a valid command"); } }
void LocationParser_ns::createCommand(uint id) { ctxt.nextToken = 1; ctxt.cmd = CommandPtr(new Command); ctxt.cmd->_id = id; ctxt.cmd->_valid = true; }
CommandPtr get (std::string const & which) { Instancer * instancer = m_factory[which]; if (instancer) { CommandPtr ret (instancer->get ()); return ret; } else { m_factory.erase (which); return CommandPtr (new ExternalCommand ()); } }
CommandPtr DropColumn::reverse() const { if (!m_column.isValid()) return CommandPtr(); return CommandPtr(new AddColumn(column(), tableName())); }
void AppServer::initialize( ) { _status = StatusPtr( new Status ); _command = CommandPtr( new Command ); _log = LogPtr( new Log ); _connect = ConnectPtr( new Connect ); }
CommandPtr Create(ftp::Client& client, const std::string& argStr, const Args& args) const { if (!creator) return nullptr; return CommandPtr(creator->Create(client, argStr, args)); }
Handle VertexCommandManager::createCommand(const char *dbg_name) { lock_t l(m_mutex_processing); return m_commands.push(CommandPtr(new Command(dbg_name))); }
bool processNode(ireon::client::CfgNodes::node::iterator itNode, const String& parentNodeName) { //uint nodeId = itNode->id(); // TODO: rename attribute to 'type' //_log(_debug,_loc,_("read type = ")); String nodeType = itNode->name(); //_log(_debug,_loc,_("'%s'.\n"),nodeType.c_str()); // read info about node position //_log(_debug,_loc,_("read position = ")); long double posX = itNode->position().x(); long double posY = itNode->position().y(); long double posZ = itNode->position().z(); // read info about node rotation long double rotQX = itNode->rotation().qx(); long double rotQY = itNode->rotation().qy(); long double rotQZ = itNode->rotation().qz(); long double rotQW = itNode->rotation().qw(); // read info about node scale long double scaleX = itNode->scale().x(); long double scaleY = itNode->scale().y(); long double scaleZ = itNode->scale().z(); // node linked with entity-object if (itNode->entity().present()) { // create info about linked with this entity material and mesh String pathToData = "..\\data\\"; String entityType = getEntityTypeFromNodeType(nodeType); String entityName = nodeType; String entityMesh = entityType; entityMesh.append(".mesh"); String entityMeshFile = pathToData; entityMeshFile.append("models\\").append(entityType).append(".mesh"); String entityMaterialFile = pathToData; entityMaterialFile.append("materials\\scripts\\").append(entityType).append(".material");; // create static object prototype, etc entity prototype - for multiply creating from this prototype static objects CStaticPrototype* staticProto = new CStaticPrototype(); staticProto->setMeshFileFullPath(entityMeshFile); staticProto->setMaterialFileFullPath(entityMaterialFile); staticProto->setName(entityType.c_str()); staticProto->setMeshName(entityMesh.c_str()); Vector3 scale3; scale3.x = scaleX; scale3.y = scaleY; scale3.z = scaleZ; staticProto->setScale(scale3); // all proto must be accessed from proto manager CPrototypeManager::getSingletonPtr()->addObject(staticProto); // create object and add him in static collection CStaticObject* staticObject = (CStaticObject*)CObjectFactory::getSingletonPtr()->createProduct("static", staticProto ); // apply info about node on static object // apply name staticObject->setName(entityName.c_str()); // apply rotation Quaternion rotQ; rotQ.x = static_cast<Real> (rotQX); rotQ.y = static_cast<Real> (rotQY); rotQ.z = static_cast<Real> (rotQZ); rotQ.w = static_cast<Real> (rotQW); CDispatcher::getSingletonPtr()->executeNow( CommandPtr( new CRotateAbsoluteStaticObjectCommand( entityName, rotQ))); // apply position Vector3 pos; pos.x = posX; pos.y = posY; pos.z = posZ; CDispatcher::getSingletonPtr()->executeNow( CommandPtr( new CMoveAbsoluteStaticObjectCommand( entityName, pos))); } // recursive call for node linked this node for ( ireon::client::CfgNode::node::iterator it = itNode->node().begin(); it != itNode->node().end(); ++it ) { if (!processNode(it, nodeType)) return false; } return true; }
void test() { CommandsContainer container; boost::bind(dymmy,1)(); container.createCommand( CommandPtr( new Command(boost::bind(dymmy,1)) ) ); }