Exemple #1
0
void loadPointLight(FILE *inFP, entity_t *ent, char *token){
    char *attributes[] = {"color","brightness","center",NULL};
    int ndx;
    
    assert(ent->magic == ENTITY_T);
    pointlight_t *pointlight = ent->entDerived;
    assert(pointlight->magic == POINTLIGHT_T);
    
    ndx = getindex(token,attributes);
    
    switch(ndx) {
        case 0:
            pointlight->color = readColor(inFP, "Could not read light color");
            break;
        case 1:
            pointlight->brightness = readDouble(inFP, "Could not read light brightness");
            break;
        case 2:
            pointlight->center = readTuple(inFP, "Could not read light center");
            break;
        default:
            loadEntity(inFP, ent, token);
            break;
        }
}
Exemple #2
0
/**
 * \brief load the definition of the block comments in this syntax
 * \param nodes the node list from which the definition of the block comments should be loaded
 * \param list the links of block comment definitions
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the block comments on this syntax from the node list passed as a parameter
 * into the list of block comments passed as a parameter.
 */
bool	QsvLangDef::loadBlockComments( QDomNodeList nodes, QList<QsvEntityBlockComment> &list )
{
	QDomNode node;
	int i, size = nodes.size();

	i = list.size();

	for( i=0; i<size; i++ )
	{
		node = nodes.at( i );

		QsvEntityBlockComment e;
		if (!loadEntity( node, e )) return false;
		e.startRegex = node.toElement().elementsByTagName("start-regex").item(0).toElement().text();
		e.endRegex   = node.toElement().elementsByTagName("end-regex").item(0).toElement().text();

		// WTF???
		e.startRegex.replace( "\\\\", "\\" );
		e.endRegex.replace( "\\\\", "\\" );
		
		list << e;
	}

	return true;
}
Exemple #3
0
/**
 * \brief load the definition of the strings from the node list
 * \param nodes the node list from which the definition of the line comments should be loaded
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the strings on this syntax from the node list passed as a parameter.
 */
bool	QsvLangDef::loadStrings( QDomNodeList nodes )
{
	QDomNode node;
	QString s;
	int i, size = nodes.size();

	for( i=0; i<size; i++ )
	{
		QsvEntityString e;
		node = nodes.at( i );

		if (!loadEntity( node, e )) return false;

		e.atEOL      = isTrue( node.attributes().namedItem("end-at-line-end").nodeValue() );
		e.startRegex = node.toElement().elementsByTagName("start-regex").item(0).toElement().text();
		e.endRegex   = node.toElement().elementsByTagName("end-regex").item(0).toElement().text();

		// WTF???
		e.startRegex.replace( "\\\\", "\\" );
		e.endRegex.replace( "\\\\", "\\" );
		
		stringsDefs << e;
	}

	return true;
}
Exemple #4
0
void SplashState::initialize() {
	_loop.reset();
	_loop.setTickDuration(    ONE_SEC /  60);
	_loop.setFrameDuration(   ONE_SEC /  60);
	_loop.setMaxFrameDuration(_loop.frameDuration() * 3);
	_loop.setFrameMargin(     _loop.frameDuration() / 2);

	window()->onResize.connect(std::bind(&SplashState::resizeEvent, this))
	        .track(_slotTracker);

	_skipInput = _inputs.addInput("skip");
	_inputs.mapScanCode(_skipInput, SDL_SCANCODE_ESCAPE);

	_splash = loadEntity("titlescreen.json", _entities.root());
	_splash.place(Vector3(0, 0, 0));

//	EntityRef text = loadEntity("text.json", _entities.root());
//	text.place(Vector3(160, 90, .5));

//	loader()->load<SoundLoader>("sound.ogg");
//	loader()->load<MusicLoader>("shapeout.ogg");

	loader()->waitAll();

	// Set to true to debug OpenGL calls
	renderer()->context()->setLogCalls(false);

	_initialized = true;
}
Exemple #5
0
void CWorld::LoadLOD()
{
	loadMob();	
	loadShop();
	loadSkill();
	loadSkillTree();
	loadArmorPreview();
	loadSSkill();
	loadAction();
	loadItemData();	
	loadSetItemData();
	loadAffinity();
	loadMakeItem();
	loadCatalog();
	loadEvent();
	loadNPCHelp();
	loadCombo();
	loadBigpet();
	loadRareOption();
	loadOption();
	loadTitleData();
	loadQuest();
	loadLacarette();
	loadZone();
	loadNotice();
	loadEntity();
	loadZoneData();
	loadTEventString();
	loadLevelUpGuide();
	loadChangeEquipment();
	LoadItemCollection();
	LoadItemCompose();
}
Exemple #6
0
View::Management::EntityDialog::EntityDialog(Model::Domain::Entity *entity, QWidget *parent)
    : QDialog(parent), _entity(entity)
{
    createWidgets();
    createConnections();
    setTitle();
    setMinimumWidth(ENTITY_DIALOG_MINIMUM_SIZE);
    loadEntity();
}
Exemple #7
0
bool Map::load (const std::string& name)
{
	ScopedPtr<IMapContext> ctx(getMapContext(name));

	resetCurrentMap();

	if (name.empty()) {
		info(LOG_MAP, "no map name given");
		return false;
	}

	info(LOG_MAP, "load map " + name);

	if (!ctx->load(false)) {
		error(LOG_MAP, "failed to load the map " + name);
		return false;
	}

	ctx->save();
	_settings = ctx->getSettings();
	_startPositions = ctx->getStartPositions();
	_name = ctx->getName();
	_title = ctx->getTitle();
	_width = getSetting(msn::WIDTH, "-1").toInt();
	_height = getSetting(msn::HEIGHT, "-1").toInt();
	_solution = getSolution();
	const std::string solutionSteps = string::toString(_solution.length());
	_settings.insert(std::make_pair("best", solutionSteps));
	info(LOG_MAP, "Solution has " + solutionSteps + " steps");

	if (_width <= 0 || _height <= 0) {
		error(LOG_MAP, "invalid map dimensions given");
		return false;
	}

	const std::vector<MapTileDefinition>& mapTileList = ctx->getMapTileDefinitions();
	for (std::vector<MapTileDefinition>::const_iterator i = mapTileList.begin(); i != mapTileList.end(); ++i) {
		const SpriteType& t = i->spriteDef->type;
		info(LOG_MAP, "sprite type: " + t.name + ", " + i->spriteDef->id);
		MapTile *mapTile = new MapTile(*this, i->x, i->y, getEntityTypeForSpriteType(t));
		mapTile->setSpriteID(i->spriteDef->id);
		mapTile->setAngle(randBetweenf(-0.1, 0.1f));
		loadEntity(mapTile);
	}

	info(LOG_MAP, String::format("map loading done with %i tiles", mapTileList.size()));

	ctx->onMapLoaded();

	_frontend->onMapLoaded();
	const LoadMapMessage msg(_name, _title);
	_serviceProvider->getNetwork().sendToAllClients(msg);

	_mapRunning = true;
	return true;
}
Exemple #8
0
void FDPLoader::parseSource(DOMNode* pSource)
{
	DOMNodeIterator* iterator = m_pDoc->createNodeIterator(pSource, 
		DOMNodeFilter::SHOW_ELEMENT | DOMNodeFilter::SHOW_ATTRIBUTE, NULL, true);
	// use the tree walker to print out the text nodes.
	for ( DOMNode* current = iterator->nextNode(); current != 0; current = iterator->nextNode() )
	{
		if(XercesString(current->getNodeName()) == "entity")
			loadEntity(current);
	}
}
Exemple #9
0
Platform *Map::getPlatform (MapTile *mapTile, int *start, int *end, gridSize offset)
{
	const int mapY = mapTile->getGridY() + offset + EPSILON;
	if (*start == -1 || *end == -1)
		getPlatformDimensions(mapTile->getGridX(), mapTile->getGridY(), start, end);

	PlatformYMapConstIter iy = _platforms.find(mapY);
	if (iy != _platforms.end()) {
		PlatformXMapConstIter ix = iy->second.find(*start);
		if (ix != iy->second.end()) {
			return ix->second;
		}
	}

	info(LOG_MAP, String::format("create a new platform at %i:%i to %i:%i", *start, mapY, *end, mapY));
	const int width = *end - *start + 1;
	const gridSize height = 0.015f;
	const gridCoord x = *start + width / 2.0f;
	const gridSize y = mapTile->getGridY() + offset;

	b2PolygonShape shape;
	shape.SetAsBox(width / 2.0f, height);

	b2FixtureDef fixture;
	fixture.shape = &shape;
	fixture.friction = 0.4f;
	fixture.restitution = 0.0f;
	fixture.density = 0.0f;

	b2BodyDef bd;
	bd.position.Set(x, y);
	bd.type = b2_kinematicBody;
	bd.fixedRotation = true;

	Platform *platform = new Platform(*this);
	addToWorld(fixture, bd, platform);
	loadEntity(platform);

	_platforms[mapY][*start] = platform;

#ifdef DEBUG
	PlatformYMapConstIter iy2 = _platforms.find(mapY);
	assert(iy2 != _platforms.end());
	PlatformXMapConstIter ix2 = iy2->second.find(*start);
	assert(ix2 != iy->second.end());
#endif

	return platform;
}
bool VehicleRenderable::loadSceneNodes(TinyXml::TiXmlElement* ele)
{
	TinyXml::TiXmlElement* nodeEle = ele->FirstChildElement("node");
	while (nodeEle)
	{
		Ogre::String name = getAttrib(nodeEle, "name");
		Ogre::SceneNode* node = NULL;

		if (name.empty())
			node = mAttachNode->createChildSceneNode();
		else
			node = mAttachNode->createChildSceneNode(name);

		mSceneNodes.push_back(node);

		Ogre::LogManager::getSingleton().
			logMessage("VehicleRenderable : parsing <" + name + "> node...");

		//process position
		TinyXml::TiXmlElement* pos = nodeEle->FirstChildElement("position");
		node->setPosition(parseVector3(pos));
		node->setInitialState();

		//process scale
		TinyXml::TiXmlElement* scale = nodeEle->FirstChildElement("scale");
		node->setScale(parseVector3(scale));
		node->setInitialState();

		//process rotate
		TinyXml::TiXmlElement* rotate = nodeEle->FirstChildElement("rotation");
		node->setOrientation(parseQuaternion(rotate));
		node->setInitialState();

		//process entities
		TinyXml::TiXmlElement* entity = nodeEle->FirstChildElement("entity");
		while (entity)
		{
			if (!loadEntity(entity, node))
				return false;

			entity = entity->NextSiblingElement("entity");
		}

		nodeEle = nodeEle->NextSiblingElement("node");
	}

	return true;
}
Exemple #11
0
/**
 * \brief load the definition of the line commends from the node list
 * \param nodes the node list from which the definition of the line comments should be loaded
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the line comments on this syntax from the list of
 * node list passed as a parameter.
 * 
 */
bool	QsvLangDef::loadLineComments( QDomNodeList nodes )
{
	QDomNode node;
	int i, size = nodes.size();

	for( i=0; i<size; i++ )
	{
		QsvEntityLineComment e;
		node = nodes.at( i );

		if (!loadEntity( node, e )) return false;
		e.start = node.toElement().elementsByTagName("start-regex").item(0).toElement().text();

		// WTF???
		e.start.replace( "\\\\", "\\" );
		
		lineCommentsDefs << e;
	}

	return true;
}
Exemple #12
0
/**
 * \brief load the keyword definition list from
 * \param nodes the node list from which the definition of the block comments should be loaded
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the keywords list on this syntax from the node list passed as a parameter.
 */
bool	QsvLangDef::loadKeywordList( QDomNodeList nodes )
{
	QDomNodeList strs;
	QDomNode str;
	QString s;

	int i, size = nodes.size();
	int j;
	
	for( i=0; i<size; i++ )
	{
		QsvEntityKeywordList e;
		QDomNode node = nodes.at( i );
		
		if (!loadEntity( node, e )) return false;
		e.list.clear();

		e.caseSensitive               = isTrue( node.attributes().namedItem("case-sensitive").nodeValue() );
		e.matchEmptyStringAtBeginning = isTrue( node.attributes().namedItem("match-empty-string-at-beginning").nodeValue() );
		e.matchEmptyStringAtEnd       = isTrue( node.attributes().namedItem("match-empty-string-at-end").nodeValue() );
		e.startRegex                  = node.attributes().namedItem("beginning-regex").nodeValue();
		e.endRegex                    = node.attributes().namedItem("end-regex").nodeValue();

		// WTF???
		e.startRegex.replace( "\\\\", "\\" );
		e.endRegex.replace( "\\\\", "\\" );
		
		// read strings
		strs = node.toElement().elementsByTagName("keyword");
		for( j=0; j<strs.size(); j++ )
		{
			str = strs.item( j );
			e.list << str.toElement().text();
		}
		
		keywordListDefs << e;
	}	

	return true;
}
Exemple #13
0
void entityManager::loadData( string loadlistFileName )
{
    string data;

    ifstream input;
    stringstream ss;
    input.open(loadlistFileName);

    input>>data;

    if(!input.good())
    {
        cout<<"Failed to load "<<loadlistFileName<<"!"<<endl;
        return;
    }

    //look up every filename attached to an object we want to load
    while(input.good())
    {

        //create a new entity for our shiny new object
        entity* newObj = loadEntity(data);

        if(newObj!=NULL)
        {
            //add them to the object list
            newObj->next = head;
            head = newObj;
            entityCount++; 
        }       

        input>>data;
    }

    input.close();

    cout<<"Successfully loaded data from "<<loadlistFileName<<"!"<<endl;

}
Exemple #14
0
/**
 * \brief load the definition of the patterns in this syntax
 * \param nodes the node list from which the definition of the patterns should be loaded
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the patterns on this syntax from the node list passed as a parameter.
 *
 * TODO
 *   define what are patterns
 */
bool	QsvLangDef::loadPatternItems( QDomNodeList nodes )
{
	QDomNode node;
	int i, size = nodes.size();

	i = patternItems.size();

	for( i=0; i<size; i++ )
	{
		node = nodes.at( i );

		QsvEntityPatternItem e;
		if (!loadEntity( node, e )) return false;
		e.regex = node.toElement().elementsByTagName("regex").item(0).toElement().text();

		// WTF???
// 		e.regex.replace( "\\\\", "\\" );
		e.regex.replace( "\\n", "$" );
		
		patternItems << e;
	}

	return true;
}
Exemple #15
0
bool Map::load (const std::string& name)
{
	ScopedPtr<IMapContext> ctx(getMapContext(name));

	resetCurrentMap();

	if (name.empty()) {
		info(LOG_MAP, "no map name given");
		return false;
	}

	info(LOG_MAP, "load map " + name);

	if (!ctx->load(false)) {
		error(LOG_MAP, "failed to load the map " + name);
		return false;
	}
	ctx->save();
	_settings = ctx->getSettings();
	_startPositions = ctx->getStartPositions();
	_name = ctx->getName();
	_title = ctx->getTitle();
	_theme = &ctx->getTheme();
	_settings.insert(std::make_pair(msn::THEME, _theme->name));
	_wind = getSetting(msn::WIND, msd::WIND).toFloat();
	_gravity = getSetting(msn::GRAVITY, string::toString(msdv::GRAVITY)).toFloat();
	_width = getSetting(msn::WIDTH, "-1").toInt();
	_height = getSetting(msn::HEIGHT, "-1").toInt();
	_finishPoints = getSetting(msn::POINTS, string::toString(msdv::POINTS)).toInt();
	_referenceTime = getSetting(msn::REFERENCETIME, string::toString(msdv::REFERENCETIME)).toInt();
	_waterChangeSpeed = getSetting(msn::WATER_CHANGE, msd::WATER_CHANGE).toFloat();
	_waterRisingDelay = getSetting(msn::WATER_RISING_DELAY, msd::WATER_RISING_DELAY).toFloat();
	_waterFallingDelay = getSetting(msn::WATER_FALLING_DELAY, msd::WATER_FALLING_DELAY).toFloat();
	_activateflyingNPC = getSetting(msn::FLYING_NPC, msd::FLYING_NPC).toBool();
	_activateFishNPC = getSetting(msn::FISH_NPC, msd::FISH_NPC).toBool();
	_waterHeight = getSetting(msn::WATER_HEIGHT, msd::WATER_HEIGHT).toFloat();
	_transferedPackageLimit = getSetting(msn::PACKAGE_TRANSFER_COUNT, msd::PACKAGE_TRANSFER_COUNT).toInt();
	// TODO: properly implement a warmup phase
	_warmupPhase = 0;

	info(LOG_MAP, "theme: " + _theme->name);
	info(LOG_MAP, "reference time: " + string::toString(_referenceTime));

	if (_width <= 0 || _height <= 0) {
		error(LOG_MAP, "invalid map dimensions given");
		return false;
	}

	_spawnFlyingNPCTime = getSetting(msn::NPC_INITIAL_SPAWN_TIME, string::toString(4000 + rand() % SPAWN_FLYING_NPC_DELAY)).toInt();
	_spawnFishNPCTime = getSetting(msn::NPC_INITIAL_SPAWN_TIME, string::toString(4000 + rand() % SPAWN_FISH_NPC_DELAY)).toInt();
	_initialGeyserDelay = getSetting(msn::GEYSER_INITIAL_DELAY_TIME, string::toString(3000)).toInt();

	if (_transferedPackageLimit <= 0) {
		error(LOG_MAP, "there is nothing to do in this map - set the npc or package limits");
		return false;
	}

	initPhysics();
	info(LOG_MAP, "physics initialized");

	std::vector<MapTile*> mapTilesWithBody;

	const std::vector<MapTileDefinition>& mapTileList = ctx->getMapTileDefinitions();
	for (std::vector<MapTileDefinition>::const_iterator i = mapTileList.begin(); i != mapTileList.end(); ++i) {
		MapTile *mapTile = createMapTileWithoutBody(i->spriteDef, i->x, i->y, i->angle);
		if (!mapTile->isDecoration() && !mapTile->isWindow())
			mapTilesWithBody.push_back(mapTile);
		loadEntity(mapTile);
	}

	const std::vector<CaveTileDefinition>& caveList = ctx->getCaveTileDefinitions();
	for (std::vector<CaveTileDefinition>::const_iterator i = caveList.begin(); i != caveList.end(); ++i) {
		MapTile *mapTile = new CaveMapTile(*this, i->spriteDef->id, i->x, i->y, *i->type, i->delay);
		mapTile->setGridDimensions(i->spriteDef->width, i->spriteDef->height, 0);
		mapTilesWithBody.push_back(mapTile);
		loadEntity(mapTile);
	}

	for (std::vector<MapTile*>::iterator i = mapTilesWithBody.begin(); i != mapTilesWithBody.end(); ++i) {
		MapTile* mapTile = *i;
		mapTile->createBody();
	}

	info(LOG_MAP, "init platforms");
	for (Map::EntityListIter i = _entities.begin(); i != _entities.end(); ++i) {
		IEntity* entity = *i;
		if (!entity->isGround())
			continue;
		MapTile *mapTile = static_cast<MapTile*>(entity);
		int start = -1;
		int end = -1;
		const int y = mapTile->getGridY() - 1.0f + EPSILON;
		getPlatformDimensions(mapTile->getGridX(), y, &start, &end);
		if (start == -1 || end == -1) {
			continue;
		}
		getPlatform(mapTile, &start, &end);
	}

	info(LOG_MAP, "init caves");
	for (Map::EntityListIter i = _entities.begin(); i != _entities.end(); ++i) {
		IEntity* entity = *i;
		if (!entity->isCave())
			continue;
		CaveMapTile *cave = static_cast<CaveMapTile*>(entity);
		_caves.push_back(cave);
	}

	// do another loop when we have all caves - we have to know each of the caves in order to initialize them properly
	for (Map::CaveListIter i = _caves.begin(); i != _caves.end(); ++i) {
		CaveMapTile* cave = *i;
		initCave(cave);
	}

	const std::vector<EmitterDefinition>& emitterList = ctx->getEmitterDefinitions();
	for (std::vector<EmitterDefinition>::const_iterator i = emitterList.begin(); i != emitterList.end(); ++i) {
		const EntityType &type = *i->type;
		if (type.isNone())
			continue;
		EntityEmitter *entity = new EntityEmitter(*this, i->x, i->y, i->amount, i->delay, type, i->settings);
		loadEntity(entity);
	}

	if (!hasPackageTarget()) {
		error(LOG_MAP, "there is no package target in this map");
		return false;
	}

	info(LOG_MAP, "map loading done");

	ctx->onMapLoaded();

	_frontend->onMapLoaded();
	const LoadMapMessage msg(_name, _title);
	_serviceProvider->getNetwork().sendToClients(0, msg);

	_mapRunning = true;
	return true;
}
Exemple #16
0
entity* entityManager::loadEntity(string fileName)
{
    string data;
    entity* newObj = new entity(simConfig);

    //now load each of THOSE files, this time creating an entity based on their data
    ifstream objectFile;
    objectFile.open(fileName);
    int line = 0; //tracks what stage of file loading we are in
    
    //objectFile>>data;
    getline(objectFile, data);

    //if it failed to open, skip over this file
    if(!objectFile.good())
    {
        cout<<"Failed to load object! "<<fileName<<endl;
        delete newObj;

        return NULL;
    }

    while(objectFile.good())
    {
        if(line>=10) // all objects past number 8 should be moons
        {
            //create a new entity for our shiny new object
            entity* newMoon = loadEntity(data);
            
            if(newMoon!=NULL)
            {
                //add them to the object list
                newMoon->next = head;
                head = newMoon;
                entityCount++; 
                //newMoon->next = newObj->children;
                //newObj->children = newMoon;

                newMoon->parent = newObj;
            }      
        }
        else
        {
            switch(line)
            {
                case 0:
                    newObj->name = data;
                    cout<<"Object name: "<<data<<endl;
                    break;
                case 2:
                    newObj->orbitalPeriod = atof(data.c_str());
                    break;
                case 3:
                    newObj->rotationPeriod = atof(data.c_str());
                    break;
                case 4:
                    newObj->semimajorAxis = atof(data.c_str());
                    break;
                case 5:
                    newObj->diameter = atof(data.c_str());
                    break;
                case 6:
                    newObj->tilt = atof(data.c_str());
                    break;
                case 7:
                    newObj->orbitTilt = atof(data.c_str());
                    break;
                case 8:
                    newObj->rotationPeriod *= atoi(data.c_str());
                    break;
                case 9://check if we need a camera of this object
                    if(atoi(data.c_str()) == 1)
                    {
                    Camera* newCamera = new Camera(newObj);
                    if(simConfig->presetCameras == NULL)
                        simConfig->presetCameras = newCamera;
                    else
                    {
                        Camera* iterator = simConfig->presetCameras;
                        while(iterator->next!=NULL)
                            iterator = iterator->next;

                        iterator->next = newCamera;
                    }
                    cout<<"New camera created for "<<newObj->name<<"!"<<endl;
                }
                break;
            case 1:
                cout<<"Model file path: "<<data<<endl;

                //oh god monster code section//open the file
                const aiScene* scene = import.ReadFile("../bin/models/"+data+newObj->name+".obj", aiProcess_Triangulate);

                if(scene != NULL)
                {

                    //iterate across the meshes in the scene
                    for(unsigned int mIndex = 0; mIndex < scene->mNumMeshes; mIndex++)
                    {
                        aiMesh* m = scene->mMeshes[mIndex];
                        //iterate across faces in the mesh
                        for(unsigned int fIndex = 0; fIndex < m->mNumFaces; fIndex++)
                        {
                            aiFace* f = &(m->mFaces[fIndex]);
                            //iterate across indices in the face
                            for(unsigned int iIndex = 0; iIndex < f->mNumIndices; iIndex++)
                            {
                                const int index = f->mIndices[iIndex];

                                //push each vertex onto the entity vertices
                                Vertex v;
                                v.position[0] = m->mVertices[index].x;
                                v.position[1] = m->mVertices[index].y;
                                v.position[2] = m->mVertices[index].z;

                                //get the material
                                aiMaterial* material = scene->mMaterials[m->mMaterialIndex];
                                aiColor3D color (0.f,0.f,0.f);
                                material->Get(AI_MATKEY_COLOR_DIFFUSE,color);

                                if(m->HasTextureCoords(0))
                                {

                                    aiVector3D textureCoord = m->mTextureCoords[0][index];

                                    v.uv[0] = textureCoord.x;
                                    v.uv[1] = textureCoord.y;
                                }
                                else
                                {
                                    v.uv[0] = 0.0f;
                                    v.uv[1] = 0.0f;
                                }

                                newObj->vertices.push_back(v);
                            }
                        }

                        //get texture file name
                        aiString fname;
                        char newname[512];
                        string textPath = "../bin/models/" + data;

                        strcpy(newname, textPath.c_str());
                        
                        scene->mMaterials[m->mMaterialIndex]->GetTexture(aiTextureType_DIFFUSE, 0, &fname);

                        //add mat name to end of it
                        strcat(newname, fname.data);

                        //give it its texture
                        newObj->texID = simConfig->texCount;
                        simConfig->texCount++;

                        FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;

                        BYTE * bits(0);
                        FIBITMAP * dib(0);
                        fif = FreeImage_GetFileType(newname, 0);
                        //if still unknown, try to guess the file format from the file extension
                        if(fif == FIF_UNKNOWN)
                            fif = FreeImage_GetFIFFromFilename(newname);

                        if(fif == FIF_UNKNOWN)
                            cout<<"WE DON'T KNOW WHAT FIF THIS IS!"<<endl;

                        if(FreeImage_FIFSupportsReading(fif))
                            dib = FreeImage_Load(fif, newname, 0);
                        else
                            cout<<"Bad texture file format!"<<endl;

                        if(!dib)
                        {
                            cout<<"Dib failed to load! Are your file paths set up properly?? "<<newname<<endl;
                        }

                        bits = FreeImage_GetBits(dib);
                        //get the image width and height
                        newObj->texWidth = FreeImage_GetWidth(dib);
                        newObj->texHeight = FreeImage_GetHeight(dib);
                        cout<<"Texture "<<newname<<" image size: "<<newObj->texWidth<<"px by "<<newObj->texHeight<<"px"<<endl;
                        //if this somehow one of these failed (they shouldn't), return failure

                        //generate an OpenGL texture ID for this texture
                        glGenTextures(1, &newObj->texID);
                        glBindTexture( GL_TEXTURE_2D, newObj->texID);
                        //store the texture data for OpenGL use
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, newObj->texWidth, newObj->texHeight, 0, GL_BGR, GL_UNSIGNED_BYTE, bits);

                        FreeImage_Unload(dib);
                    }
                }
                break;
            }
        }

        line++;

        objectFile>>data;
    }
    objectFile.close();

    return newObj;
}