
#include "stdafx.h"
#include "CRenderObject.h"

C_RENDER_OBJECT_0::~C_RENDER_OBJECT_0()
{
	Delete();
}

void C_RENDER_OBJECT_0::Add(C_2DOBJECT_0 *o)
{
	_v2dObject.push_back(o);
}

void C_RENDER_OBJECT_0::Add(C_3DOBJECT_0 *o)
{
	_v3dObject.push_back(o);
}

void C_RENDER_OBJECT_0::Render()
{
	// 2D
	for(std::vector<C_2DOBJECT_0*>::iterator i = _v2dObject.begin(); i < _v2dObject.end();i++)
	{	
		(*i)->Render();
		//i->Render();
	}
	// 3D
	for(std::vector<C_3DOBJECT_0*>::iterator ii = _v3dObject.begin(); ii < _v3dObject.end();ii++)
	{	
		(*ii)->Render();
		//i->Render();
	}
}

void C_RENDER_OBJECT_0::Delete()
{
	// 2D
	for(std::vector<C_2DOBJECT_0*>::iterator i = _v2dObject.begin(); i < _v2dObject.end();i++)
	{	
		delete (*i);
		_v2dObject.erase(i);
	}
	
	// 3D
	for(std::vector<C_3DOBJECT_0*>::iterator ii = _v3dObject.begin(); ii < _v3dObject.end();ii++)
	{	
		delete (*ii);
		_v3dObject.erase(ii);
	}
}