#include "scene.h"
#include "object/camera/camera.h"
#include "render/renderapi.h"
#include "object/mesh/actor.h"
#include "render/asset/shader.h"
#include "data/property/actor_property.h"
#include "asset/resource_manager.h"
#include "asset/file_manager.h"
namespace engineapi {
	Scene::Scene()
	{
		mCamera = new Camera();
		int flags = 1;
		auto shader = ResourceManager::GetSingleton().LoaderEmplaceResource<Shader>();
		shader->Name(type_name<BoneVertex>().View());
		shader->mVert = ResourceManager::GetSingleton().Load<ShaderProgram>("/engine/assets/shader/simple.vert");
		shader->mFrag = ResourceManager::GetSingleton().Load<ShaderProgram>("/engine/assets/shader/simple.frag");
		RenderAPI::GetSingleton().LoadShader(*shader);
		//Material* material = new Material("/engine/assets/shader/simple.shader", flags);
		{
			ActorProperty property;
			property.id = 1;
			property.flags = flags;
			property.path = "/engine/assets/models/cube.obj";
			actor1 = ActorMesh::New(property);
			actor1->LoadMesh();
			//actor1->Ptr().SetMaterial(material);
		}
		{
			ActorProperty property;
			property.id = 1;
			property.flags = flags;
			property.path = "/engine/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);
		//}
	}
	void Scene::AddGameObject(GameObject* gameObject)
	{
	}
}
