void CInstancedMeshSceneNode::updateInstances()
		{
			if (!baseMesh || baseMesh->getMeshBuffer(0)->getVertexBufferCount() != 2)
				return;

			IMeshBuffer* renderBuffer = baseMesh->getMeshBuffer(0);

			box.reset(0, 0, 0);

			const u32 size = instanceNodeArray.size();

			renderBuffer->getVertexBuffer(1)->clear();
			renderBuffer->getVertexBuffer(1)->setDirty();
			renderBuffer->getVertexBuffer(1)->set_used(size);

			for (u32 i = 0; i < size; ++i)
			{
				core::aabbox3df instanceBox = renderBuffer->getBoundingBox();
				instanceNodeArray[i]->getAbsoluteTransformation().transformBoxEx(instanceBox);

				if (!SceneManager->isCulled(instanceNodeArray[i]))
					renderBuffer->getVertexBuffer(1)->setVertex(i, &instanceNodeArray[i]->getAbsoluteTransformation());

				box.addInternalPoint(instanceNodeArray[i]->getAbsolutePosition());
			}

			renderBuffer->getVertexBuffer(1)->setDirty();
		}
		//! renders the node.
		void CInstancedMeshSceneNode::render()
		{
			if (!IsVisible || !SceneManager->getActiveCamera())
				return;

			if (!baseMesh || baseMesh->getMeshBuffer(0)->getVertexBuffer(1)->getVertexCount() == 0)
				return;

			IMeshBuffer* renderBuffer = baseMesh->getMeshBuffer(0);

			video::IVideoDriver* driver = SceneManager->getVideoDriver();
			driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
			driver->setMaterial(readOnlyMaterial ? material : renderBuffer->getMaterial());

			driver->drawMeshBuffer(renderBuffer);

			// for debug purposes only:
			if (DebugDataVisible)
			{
				video::SMaterial m;
				m.Lighting = false;
				driver->setMaterial(m);

				if (DebugDataVisible & scene::EDS_BBOX)
					driver->draw3DBox(box, video::SColor(255, 255, 255, 255));

				if (DebugDataVisible & scene::EDS_BBOX_BUFFERS)
				{
					const u32 size = instanceNodeArray.size();

					for (u32 i = 0; i < size; ++i)
					{
						core::aabbox3df box = renderBuffer->getBoundingBox();
						driver->setTransform(video::ETS_WORLD, instanceNodeArray[i]->getAbsoluteTransformation());
						driver->draw3DBox(box, video::SColor(255, 255, 255, 255));
					}
				}
			}
		}