void VegetationView::draw(const GameTime& gameTime)
{
	GraphicsManager& manager = getManager();
	const VegetationController& controller = getController();

	GraphicsDevice device = manager.getDevice();

	unsigned long prevCullMode = device.getRenderState(D3DRS_CULLMODE);

	device.setRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

	Matrix world = controller.getWorld() * manager.getWorld();
	const Matrix& view = manager.getView();
	const Matrix& projection = manager.getProjection();

	for (Vegetation::iterator it = vegetation.begin(); it != vegetation.end(); ++it)
	{
		FBXModel& model = it->model;

		model.setClipPlane(manager.getClipPlane());
		model.setCamera(manager.getCamera());
		model.setLight(manager.getLight());
	
		model.draw(device, gameTime, world, view, projection, it->transforms, it->transforms.size(), manager.isRenderShadowMap());
	}

	device.setRenderState(D3DRS_CULLMODE, prevCullMode);
}
void LuckyLeprechauns::toggleWireframe()
{
	GraphicsDevice device = getGraphicsDevice();

	unsigned long fillMode = device.getRenderState(D3DRS_FILLMODE) == D3DFILL_SOLID ? D3DFILL_WIREFRAME : D3DFILL_SOLID;

	device.setRenderState(D3DRS_FILLMODE, fillMode);
}