void DotSceneLoader::processEntity(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	// Process attributes
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::String id = getAttrib(XMLNode, "id");
	Ogre::String meshFile = getAttrib(XMLNode, "meshFile");
	Ogre::String materialFile = getAttrib(XMLNode, "materialFile");
	bool isStatic = getAttribBool(XMLNode, "static", false);;
	bool castShadows = getAttribBool(XMLNode, "castShadows", true);

	// TEMP: Maintain a list of static and dynamic objects
	if (isStatic)
		staticObjects.push_back(name);
	else
		dynamicObjects.push_back(name);

	rapidxml::xml_node<>* pElement;

	// Process vertexBuffer (?)
	pElement = XMLNode->first_node("vertexBuffer");
	if (pElement)
		;//processVertexBuffer(pElement);

	// Process indexBuffer (?)
	pElement = XMLNode->first_node("indexBuffer");
	if (pElement)
		;//processIndexBuffer(pElement);

	// Create the entity
	Ogre::Entity *pEntity = 0;
	try
	{
		Ogre::MeshManager::getSingleton().load(meshFile, m_sGroupName);
		pEntity = mSceneMgr->createEntity(name, meshFile);
		pEntity->setCastShadows(castShadows);
		pParent->attachObject(pEntity);

		if (!materialFile.empty())
			pEntity->setMaterialName(materialFile);
	}
	catch (Ogre::Exception &/*e*/)
	{
		Ogre::LogManager::getSingleton().logMessage("[DotSceneLoader] Error loading an entity!");
	}

	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		processUserDataReference(pElement, pEntity);


}
void DotSceneLoader::processEntity(TiXmlElement *xmlNode, Node *parent) {
	// Process attributes
	std::string name = getAttrib(xmlNode, "name");
	std::string id = getAttrib(xmlNode, "id");
	std::string meshFile = getAttrib(xmlNode, "meshFile");
	std::string materialFile = getAttrib(xmlNode, "materialFile");
	bool isStatic = getAttribBool(xmlNode, "static", false);
	bool castShadows = getAttribBool(xmlNode, "castShadows", true);

	// TEMP: Maintain a list of static and dynamic objects
	if(isStatic)
		staticObjects.push_back(name);
	else
		dynamicObjects.push_back(name);

	TiXmlElement *element;

	// Process vertexBuffer (?)
	element = xmlNode->FirstChildElement("vertexBuffer");
	if(element)
		; //processVertexBuffer(pElement);

	// Process indexBuffer (?)
	element = xmlNode->FirstChildElement("indexBuffer");
	if(element)
		; //processIndexBuffer(pElement);

	// Create the entity
	ModelInstance *modelInstance = 0;
	try {
		std::map<std::string, std::string> options;

		options["only-geometry"] = "true";
		options["geometry-name"] = file::getFilename(meshFile);

		compiler->compile(meshFile.c_str(), options);
		Model* model = (Model*)manager->loadResource(ModelKey(file::getFilename(meshFile)));

		ModelInstance* entity = scene->createModelInstance(model, model->getBoundingBox(), parent);
	} catch(Exception &/*e*/) {
	}

	// Process userDataReference (?)
	element = xmlNode->FirstChildElement("userDataReference");
	if(element)
		processUserDataReference(element, modelInstance);

}
void DotSceneLoader::processPlane(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::Real distance = getAttribReal(XMLNode, "distance");
	Ogre::Real width = getAttribReal(XMLNode, "width");
	Ogre::Real height = getAttribReal(XMLNode, "height");
	int xSegments = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "xSegments"));
	int ySegments = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "ySegments"));
	int numTexCoordSets = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "numTexCoordSets"));
	Ogre::Real uTile = getAttribReal(XMLNode, "uTile");
	Ogre::Real vTile = getAttribReal(XMLNode, "vTile");
	Ogre::String material = getAttrib(XMLNode, "material");
	bool hasNormals = getAttribBool(XMLNode, "hasNormals");
	Ogre::Vector3 normal = parseVector3(XMLNode->first_node("normal"));
	Ogre::Vector3 up = parseVector3(XMLNode->first_node("upVector"));

	Ogre::Plane plane(normal, distance);
	Ogre::MeshPtr res = Ogre::MeshManager::getSingletonPtr()->createPlane(
		name + "mesh", "General", plane, width, height, xSegments, ySegments, hasNormals,
		numTexCoordSets, uTile, vTile, up);
	Ogre::Entity* ent = mSceneMgr->createEntity(name, name + "mesh");

	ent->setMaterialName(material);

	pParent->attachObject(ent);
}
void DotSceneLoader::processTerrain(rapidxml::xml_node<>* XMLNode)
{
    Ogre::Real worldSize = getAttribReal(XMLNode, "worldSize");
    int mapSize = Ogre::StringConverter::parseInt(XMLNode->first_attribute("mapSize")->value());
    int rows = Ogre::StringConverter::parseInt(XMLNode->first_attribute("rows")->value());
    int columns = Ogre::StringConverter::parseInt(XMLNode->first_attribute("columns")->value());
    bool colourmapEnabled = getAttribBool(XMLNode, "colourmapEnabled");
    int colourMapTextureSize = Ogre::StringConverter::parseInt(XMLNode->first_attribute("colourMapTextureSize")->value());

    Ogre::Vector3 lightdir(0, -0.3, 0.75);
    lightdir.normalise();
    Ogre::Light* l = mSceneMgr->createLight("tstLight");
    l->setType(Ogre::Light::LT_DIRECTIONAL);
    l->setDirection(lightdir);
    l->setDiffuseColour(Ogre::ColourValue(1.0, 1.0, 1.0));
    l->setSpecularColour(Ogre::ColourValue(0.4, 0.4, 0.4));
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.6, 0.6, 0.6));

    mTerrainGlobalOptions->setMaxPixelError(1);
    mTerrainGlobalOptions->setCompositeMapDistance(2000);
    mTerrainGlobalOptions->setLightMapDirection(lightdir);
    mTerrainGlobalOptions->setCompositeMapAmbient(mSceneMgr->getAmbientLight());
    mTerrainGlobalOptions->setCompositeMapDiffuse(l->getDiffuseColour());

    mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mSceneMgr, Ogre::Terrain::ALIGN_X_Z, mapSize, worldSize);
    mTerrainGroup->setOrigin(Ogre::Vector3::ZERO);

    rapidxml::xml_node<>* pElement;
    rapidxml::xml_node<>* pPageElement;

    // Process terrain pages (*)
    pElement = XMLNode->first_node("terrainPages");
    while(pElement)
    {
        pPageElement = pElement->first_node("terrainPage");
        while(pPageElement)
        {
            processTerrainPage(pPageElement);
            pPageElement = pPageElement->next_sibling("terrainPage");
        }
        pElement = pElement->next_sibling("terrainPages");
    }
    mTerrainGroup->loadAllTerrains(true);

    // process blendmaps
    pElement = XMLNode->first_node("terrainPages");
    while(pElement)
    {
        pPageElement = pElement->first_node("terrainPage");
        while(pPageElement)
        {
            processBlendmaps(pPageElement);
            pPageElement = pPageElement->next_sibling("terrainPage");
        }
        pElement = pElement->next_sibling("terrainPages");
    }
    mTerrainGroup->freeTemporaryResources();
    //mTerrain->setPosition(mTerrainPosition);
}
void DotSceneLoader::processSkyBox(rapidxml::xml_node<>* XMLNode)
{
	// Process attributes
	Ogre::String material = getAttrib(XMLNode, "material", "BaseWhite");
	Ogre::Real distance = getAttribReal(XMLNode, "distance", 5000);
	bool drawFirst = getAttribBool(XMLNode, "drawFirst", true);
	bool active = getAttribBool(XMLNode, "active", false);
	if (!active)
		return;

	rapidxml::xml_node<>* pElement;

	// Process rotation (?)
	Ogre::Quaternion rotation = Ogre::Quaternion::IDENTITY;
	pElement = XMLNode->first_node("rotation");
	if (pElement)
		rotation = parseQuaternion(pElement);

	// Setup the sky box
	mSceneMgr->setSkyBox(true, material, distance, drawFirst, rotation, m_sGroupName);
}
void DotSceneLoader::processSkyDome(rapidxml::xml_node<>* XMLNode)
{
	// Process attributes
	Ogre::String material = XMLNode->first_attribute("material")->value();
	Ogre::Real curvature = getAttribReal(XMLNode, "curvature", 10);
	Ogre::Real tiling = getAttribReal(XMLNode, "tiling", 8);
	Ogre::Real distance = getAttribReal(XMLNode, "distance", 4000);
	bool drawFirst = getAttribBool(XMLNode, "drawFirst", true);
	bool active = getAttribBool(XMLNode, "active", false);
	if (!active)
		return;

	rapidxml::xml_node<>* pElement;

	// Process rotation (?)
	Ogre::Quaternion rotation = Ogre::Quaternion::IDENTITY;
	pElement = XMLNode->first_node("rotation");
	if (pElement)
		rotation = parseQuaternion(pElement);

	// Setup the sky dome
	mSceneMgr->setSkyDome(true, material, curvature, tiling, distance, drawFirst, rotation, 16, 16, -1, m_sGroupName);
}
void DotSceneLoader::processSkyPlane(rapidxml::xml_node<>* XMLNode)
{
	// Process attributes
	Ogre::String material = getAttrib(XMLNode, "material");
	Ogre::Real planeX = getAttribReal(XMLNode, "planeX", 0);
	Ogre::Real planeY = getAttribReal(XMLNode, "planeY", -1);
	Ogre::Real planeZ = getAttribReal(XMLNode, "planeX", 0);
	Ogre::Real planeD = getAttribReal(XMLNode, "planeD", 5000);
	Ogre::Real scale = getAttribReal(XMLNode, "scale", 1000);
	Ogre::Real bow = getAttribReal(XMLNode, "bow", 0);
	Ogre::Real tiling = getAttribReal(XMLNode, "tiling", 10);
	bool drawFirst = getAttribBool(XMLNode, "drawFirst", true);

	// Setup the sky plane
	Ogre::Plane plane;
	plane.normal = Ogre::Vector3(planeX, planeY, planeZ);
	plane.d = planeD;
	mSceneMgr->setSkyPlane(true, plane, material, scale, tiling, drawFirst, bow, 1, 1, m_sGroupName);
}
void DotSceneLoader::processSkyBox(TiXmlElement *xmlNode) {
#if 0
	// Process attributes
	std::string material = getAttrib(xmlNode, "material");
	float distance = getAttribReal(xmlNode, "distance", 5000);
	bool drawFirst = getAttribBool(xmlNode, "drawFirst", true);

	TiXmlElement *pElement;

	// Process rotation (?)
	math::Quaternion rotation = math::Quaternion::IDENTITY;
	pElement = xmlNode->FirstChildElement("rotation");
	if(pElement)
	rotation = parseQuaternion(pElement);

	// Setup the sky box
	sceneManager->setSkyBox(true, material, distance, drawFirst, rotation, m_sGroupName);
#endif
}
void DotSceneLoader::processSkyPlane(TiXmlElement *xmlNode) {
#if 0
	// Process attributes
	std::string material = getAttrib(xmlNode, "material");
	float planeX = getAttribReal(xmlNode, "planeX", 0);
	float planeY = getAttribReal(xmlNode, "planeY", -1);
	float planeZ = getAttribReal(xmlNode, "planeX", 0);
	float planeD = getAttribReal(xmlNode, "planeD", 5000);
	float scale = getAttribReal(xmlNode, "scale", 1000);
	float bow = getAttribReal(xmlNode, "bow", 0);
	float tiling = getAttribReal(xmlNode, "tiling", 10);
	bool drawFirst = getAttribBool(xmlNode, "drawFirst", true);

	// Setup the sky plane
	Plane plane;
	plane.normal = math::Vector3(planeX, planeY, planeZ);
	plane.d = planeD;
	sceneManager->setSkyPlane(true, plane, material, scale, tiling, drawFirst, bow, 1, 1, m_sGroupName);
#endif
}
void DotSceneLoader::processSkyDome(TiXmlElement *xmlNode) {
#if 0
	// Process attributes
	std::string material = xmlNode->Attribute("material");
	float curvature = getAttribReal(xmlNode, "curvature", 10);
	float tiling = getAttribReal(xmlNode, "tiling", 8);
	float distance = getAttribReal(xmlNode, "distance", 4000);
	bool drawFirst = getAttribBool(xmlNode, "drawFirst", true);

	TiXmlElement *pElement;

	// Process rotation (?)
	math::Quaternion rotation = math::Quaternion::IDENTITY;
	pElement = xmlNode->FirstChildElement("rotation");
	if(pElement)
	rotation = parseQuaternion(pElement);

	// Setup the sky dome
	sceneManager->setSkyDome(true, material, curvature, tiling, distance, drawFirst, rotation, 16, 16, -1, m_sGroupName);
#endif
}
void DotSceneLoader::processNode(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	// Construct the node's name
	Ogre::String name = m_sPrependNode + getAttrib(XMLNode, "name");

	// Create the scene node
	Ogre::SceneNode *pNode;
	if (name.empty())
	{
		// Let Ogre choose the name
		if (pParent)
			pNode = pParent->createChildSceneNode();
		else
			pNode = mAttachNode->createChildSceneNode();
	}
	else
	{
		// Provide the name
		if (pParent)
			pNode = pParent->createChildSceneNode(name);
		else
			pNode = mAttachNode->createChildSceneNode(name);
	}

	// Process other attributes
	Ogre::String id = getAttrib(XMLNode, "id");
	bool isTarget = getAttribBool(XMLNode, "isTarget");

	rapidxml::xml_node<>* pElement;

	// Process position (?)
	pElement = XMLNode->first_node("position");
	if (pElement)
	{
		pNode->setPosition(parseVector3(pElement));
		pNode->setInitialState();
	}

	// Process rotation (?)
	pElement = XMLNode->first_node("rotation");
	if (pElement)
	{
		pNode->setOrientation(parseQuaternion(pElement));
		pNode->setInitialState();
	}

	// Process scale (?)
	pElement = XMLNode->first_node("scale");
	if (pElement)
	{
		pNode->setScale(parseVector3(pElement));
		pNode->setInitialState();
	}

	// Process lookTarget (?)
	pElement = XMLNode->first_node("lookTarget");
	if (pElement)
		processLookTarget(pElement, pNode);

	// Process trackTarget (?)
	pElement = XMLNode->first_node("trackTarget");
	if (pElement)
		processTrackTarget(pElement, pNode);

	// Process node (*)
	pElement = XMLNode->first_node("node");
	while (pElement)
	{
		processNode(pElement, pNode);
		pElement = pElement->next_sibling("node");
	}

	// Process entity (*)
	pElement = XMLNode->first_node("entity");
	while (pElement)
	{
		processEntity(pElement, pNode);
		pElement = pElement->next_sibling("entity");
	}

	// Process light (*)
	//pElement = XMLNode->first_node("light");
	//while(pElement)
	//{
	//    processLight(pElement, pNode);
	//    pElement = pElement->next_sibling("light");
	//}

	// Process camera (*)
	pElement = XMLNode->first_node("camera");
	while (pElement)
	{
		processCamera(pElement, pNode);
		pElement = pElement->next_sibling("camera");
	}

	// Process particleSystem (*)
	pElement = XMLNode->first_node("particleSystem");
	while (pElement)
	{
		processParticleSystem(pElement, pNode);
		pElement = pElement->next_sibling("particleSystem");
	}

	// Process billboardSet (*)
	pElement = XMLNode->first_node("billboardSet");
	while (pElement)
	{
		processBillboardSet(pElement, pNode);
		pElement = pElement->next_sibling("billboardSet");
	}

	// Process plane (*)
	pElement = XMLNode->first_node("plane");
	while (pElement)
	{
		processPlane(pElement, pNode);
		pElement = pElement->next_sibling("plane");
	}

	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		processUserDataReference(pElement, pNode);
}
void DotSceneLoader::processLight(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	// Process attributes
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::String id = getAttrib(XMLNode, "id");

	// Create the light
	Ogre::Light *pLight = mSceneMgr->createLight(name);
	if (pParent)
		pParent->attachObject(pLight);

	Ogre::String sValue = getAttrib(XMLNode, "type");
	if (sValue == "point")
		pLight->setType(Ogre::Light::LT_POINT);
	else if (sValue == "directional")
		pLight->setType(Ogre::Light::LT_DIRECTIONAL);
	else if (sValue == "spot")
		pLight->setType(Ogre::Light::LT_SPOTLIGHT);
	else if (sValue == "radPoint")
		pLight->setType(Ogre::Light::LT_POINT);

	pLight->setVisible(getAttribBool(XMLNode, "visible", true));
	pLight->setCastShadows(getAttribBool(XMLNode, "castShadows", true));

	rapidxml::xml_node<>* pElement;

	// Process position (?)
	pElement = XMLNode->first_node("position");
	if (pElement)
		pLight->setPosition(parseVector3(pElement));

	// Process normal (?)
	pElement = XMLNode->first_node("normal");
	if (pElement)
		pLight->setDirection(parseVector3(pElement));

	pElement = XMLNode->first_node("directionVector");
	if (pElement)
	{
		pLight->setDirection(parseVector3(pElement));
		mLightDirection = parseVector3(pElement);
	}

	// Process colourDiffuse (?)
	pElement = XMLNode->first_node("colourDiffuse");
	if (pElement)
		pLight->setDiffuseColour(parseColour(pElement));

	// Process colourSpecular (?)
	pElement = XMLNode->first_node("colourSpecular");
	if (pElement)
		pLight->setSpecularColour(parseColour(pElement));

	if (sValue != "directional")
	{
		// Process lightRange (?)
		pElement = XMLNode->first_node("lightRange");
		if (pElement)
			processLightRange(pElement, pLight);

		// Process lightAttenuation (?)
		pElement = XMLNode->first_node("lightAttenuation");
		if (pElement)
			processLightAttenuation(pElement, pLight);
	}
	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		;//processUserDataReference(pElement, pLight);
}
Example #13
0
void DotSceneLoader::processTerrainPage(rapidxml::xml_node<>* XMLNode)
{
    Ogre::String name = getAttrib(XMLNode, "name");
    int pageX = Ogre::StringConverter::parseInt(XMLNode->first_attribute("pageX")->value());
    int pageY = Ogre::StringConverter::parseInt(XMLNode->first_attribute("pageY")->value());
    Ogre::Real worldSize = getAttribReal(XMLNode, "worldSize");
    int mapSize = Ogre::StringConverter::parseInt(XMLNode->first_attribute("mapSize")->value());
    bool colourmapEnabled = getAttribBool(XMLNode, "colourmapEnabled");
    int colourmapTexturesize = Ogre::StringConverter::parseInt(XMLNode->first_attribute("colourmapTexturesize")->value());
    int layerCount = Ogre::StringConverter::parseInt(XMLNode->first_attribute("layerCount")->value());

    Ogre::String filename = mTerrainGroup->generateFilename(pageX, pageY);
    if (Ogre::ResourceGroupManager::getSingleton().resourceExists(mTerrainGroup->getResourceGroup(), filename))
    {
        mTerrainGroup->defineTerrain(pageX, pageY);
    }
    else
    {
        rapidxml::xml_node<>* pElement;

        pElement = XMLNode->first_node("position");
        if(pElement)
            mTerrainPosition = parseVector3(pElement);

        Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource(name + Ogre::String(".ohm"), "General" );
        size_t size = stream.get()->size();
        if(size != mapSize * mapSize * 4)
        {
            OGRE_EXCEPT( Ogre::Exception::ERR_INTERNAL_ERROR, "Size of stream does not match terrainsize!", "TerrainPage" );
        }
        float* buffer = OGRE_ALLOC_T(float, size, Ogre::MEMCATEGORY_GEOMETRY);
        stream->read(buffer, size);

        Ogre::Terrain::ImportData& imp = mTerrainGroup->getDefaultImportSettings();
        imp.terrainSize = mapSize;
        imp.worldSize = worldSize;
        imp.inputFloat = buffer;
        imp.inputImage = 0;
        imp.deleteInputData = true;
        imp.minBatchSize = 33;
        imp.maxBatchSize = 65;

        imp.layerList.resize(layerCount);

        int count = 0;

        // Process layers (*)
        rapidxml::xml_node<>* pTerrainLayer;
        rapidxml::xml_node<>* pTerrainTextures;
        rapidxml::xml_node<>* pTerrainTexture;
        pElement = XMLNode->first_node("layers");
        while(pElement)
        {
            pTerrainLayer = pElement->first_node("layer");
            while(pTerrainLayer)
            {
                int worldSize = Ogre::StringConverter::parseInt(pTerrainLayer->first_attribute("worldSize")->value());
                pTerrainTextures = pTerrainLayer->first_node("textures");
                pTerrainTexture = pTerrainTextures->first_node("texture");
                while(pTerrainTexture)
                {
                    imp.layerList[count].textureNames.push_back(getAttrib(pTerrainTexture,"name",""));
                    imp.layerList[count].worldSize = (Ogre::Real)worldSize;
                    pTerrainTexture = pTerrainTexture->next_sibling("texture");
                }
                count++;
                // do stuff
                pTerrainLayer = pTerrainLayer->next_sibling("layer");
            }
            pElement = pElement->next_sibling("layers");
        }

        mTerrainGroup->defineTerrain(pageX, pageY, &imp);
    }
}
void DotSceneLoader::processNode(TiXmlElement *xmlNode, Node *pParent) {
	// Construct the node's name
	std::string name = getAttrib(xmlNode, "name");

	// Create the scene node
	Node *node;
	if(name.empty()) {
		// Let Ogre choose the name
		if(pParent) {
			node = scene->createNode();
			pParent->addChild(node);
		} else {
			node = scene->createNode();
			rootNode->addChild(node);
		}
	} else {
		// Provide the name
		if(pParent) {
			node = scene->createNode(/*name*/);
			pParent->addChild(node);
		} else {
			node = scene->createNode(/*name*/);
			rootNode->addChild(node);
		}
	}

	// Process other attributes
	std::string id = getAttrib(xmlNode, "id");
	bool isTarget = getAttribBool(xmlNode, "isTarget");

	TiXmlElement *element;

	// Process position (?)
	element = xmlNode->FirstChildElement("position");
	if(element) {
		node->setPosition(parseVector3(element));
	}

	// Process rotation (?)
	element = xmlNode->FirstChildElement("rotation");
	if(element) {
		node->setOrientation(parseQuaternion(element));
	}

	// Process scale (?)
	element = xmlNode->FirstChildElement("scale");
	if(element) {
		node->setScale(parseVector3(element));
	}

	// Process lookTarget (?)
	element = xmlNode->FirstChildElement("lookTarget");
	if(element)
		processLookTarget(element, node);

	// Process trackTarget (?)
	element = xmlNode->FirstChildElement("trackTarget");
	if(element)
		processTrackTarget(element, node);

	// Process node (*)
	element = xmlNode->FirstChildElement("node");
	while(element) {
		processNode(element, node);
		element = element->NextSiblingElement("node");
	}

	// Process entity (*)
	element = xmlNode->FirstChildElement("entity");
	while(element) {
		processEntity(element, node);
		element = element->NextSiblingElement("entity");
	}

	// Process light (*)
	element = xmlNode->FirstChildElement("light");
	while(element) {
		processLight(element, node);
		element = element->NextSiblingElement("light");
	}

	// Process camera (*)
	element = xmlNode->FirstChildElement("camera");
	while(element) {
		processCamera(element, node);
		element = element->NextSiblingElement("camera");
	}

	// Process particleSystem (*)
	element = xmlNode->FirstChildElement("particleSystem");
	while(element) {
		processParticleSystem(element, node);
		element = element->NextSiblingElement("particleSystem");
	}

	// Process billboardSet (*)
	element = xmlNode->FirstChildElement("billboardSet");
	while(element) {
		processBillboardSet(element, node);
		element = element->NextSiblingElement("billboardSet");
	}

	// Process plane (*)
	element = xmlNode->FirstChildElement("plane");
	while(element) {
		processPlane(element, node);
		element = element->NextSiblingElement("plane");
	}

	// Process userDataReference (?)
	element = xmlNode->FirstChildElement("userDataReference");
	if(element)
		processUserDataReference(element, node);
}
void DotSceneLoader::processLight(TiXmlElement *xmlNode, Node *pParent) {
	// Process attributes
	std::string name = getAttrib(xmlNode, "name");
	std::string id = getAttrib(xmlNode, "id");
	std::string sValue = getAttrib(xmlNode, "type");

	Light* light = 0;

	if(sValue == "point") {
		light = scene->createPointLight();
	}
	//	else if(sValue == "directional")
	//		pLight->setType(Light::LT_DIRECTIONAL);
	//	else if(sValue == "spot")
	//		pLight->setType(Light::LT_SPOTLIGHT);
	//	else if(sValue == "radPoint")
	//		pLight->setType(Light::LT_POINT);

	// Create the light
	if(pParent) {
		//lightEntity->addComponent(new NodeAdapter(pParent));
	}

	//light->setVisible(getAttribBool(xmlNode, "visible", true));
	light->castShadow(getAttribBool(xmlNode, "castShadows", true));

	TiXmlElement *pElement;

	// Process position (?)
	pElement = xmlNode->FirstChildElement("position");
	if(pElement)
		light->setPosition(parseVector3(pElement));

	// Process normal (?)
	pElement = xmlNode->FirstChildElement("normal");
	if(pElement)
		light->setDirection(parseVector3(pElement));

	// Process colourDiffuse (?)
	pElement = xmlNode->FirstChildElement("colourDiffuse");
	if(pElement)
		light->setDiffuse(parseColour(pElement));

	// Process colourSpecular (?)
	pElement = xmlNode->FirstChildElement("colourSpecular");
	if(pElement)
		light->setSpecular(parseColour(pElement));

	// Process lightRange (?)
	pElement = xmlNode->FirstChildElement("lightRange");
	if(pElement)
		processLightRange(pElement, light);

	// Process lightAttenuation (?)
	pElement = xmlNode->FirstChildElement("lightAttenuation");
	if(pElement)
		processLightAttenuation(pElement, light);

	// Process userDataReference (?)
	pElement = xmlNode->FirstChildElement("userDataReference");
	if(pElement)
		; //processUserDataReference(pElement, pLight);

	//light->setAmbient(math::Vector3(0.5, 0.5, 0.5));
	//light->setDiffuse(math::Vector3(1.0, 1.0, 1.0));
	//light->setSpecular(math::Vector3(0.5, 0.5, 0.5));
	//light->setPosition(math::Vector3(0.0, 10.0, 0.0));
	//light->setAttenuations(math::Vector3(100.0, 1.0, 1.0));
	light->setDirection(math::Vector3(0.5, -1.0, 0.0).normalize());
	light->castShadow(true);
}