#include "scene.h"
#include "object/camera/camera.h"
#include "render/renderapi.h"
#include "object/mesh/actor.h"
#include "data/property/actor_property.h"
namespace engineapi {
	Scene::Scene()
	{
		mCamera = new Camera();
		auto flags = Asset::ASSET_SHARED_FLAG | Asset::ASSET_ASYNC_FLAG;
		Material* material = new Material("assets/shader/simple", flags);
		{
			ActorProperty property;
			property.id = 1;
			property.flags = flags;
			property.path = "assets/models/cube.obj";
			actor1 = ActorMesh::New(property);
			actor1->Ptr().SetMaterial(material);
		}
		{
			ActorProperty property;
			property.id = 1;
			property.flags = flags;
			property.path = "assets/models/box.ply";
			actor2 = ActorMesh::New(property);
			actor2->Ptr().SetMaterial(material);
		}
	}
	Scene::~Scene()
	{
	}
	void Scene::Update()
	{
	}
	void Scene::Render()
	{
		RenderAPI::GetSingletonPtr()->Render(*mCamera);
		auto meshs = actor1->Ptr().GetMeshs();
		for (auto it : meshs) {
			RenderAPI::GetSingletonPtr()->DrawStaticMesh(it);
		}
		//RenderAPI::GetSingletonPtr()->DrawStaticMesh(actor2);
	}
	void Scene::AddGameObject(GameObject* gameObject)
	{
	}
}
