Added Asset selection in Render3D component view (Not functional yet!)
This commit is contained in:
parent
042dc3a457
commit
ec8045c4f4
@ -8,24 +8,40 @@ void Inspector::Draw()
|
|||||||
ShowComponents();
|
ShowComponents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void AddComponent(YoggieEngine::Entity selected , int i) {
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
selected.AddComponent<YoggieEngine::ScriptComponent>();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
selected.AddComponent<YoggieEngine::CameraComponent>();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
selected.AddComponent<YoggieEngine::LightComponent>();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
selected.AddComponent<YoggieEngine::Render3DComponent>();
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::AddComponentDropDown()
|
void Inspector::AddComponentDropDown()
|
||||||
{
|
{
|
||||||
static char* names[] = { "Script Component", "Camera Component", "Light Component" };
|
static char* names[] = { "Script Component", "Camera Component", "Light Component", "Render3D"};
|
||||||
if (ImGui::Button("Add Component"))
|
if (ImGui::Button("Add Component"))
|
||||||
ImGui::OpenPopup("Component picker");
|
ImGui::OpenPopup("Component picker");
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::BeginPopup("Component picker")) {
|
if (ImGui::BeginPopup("Component picker")) {
|
||||||
|
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(names); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(names); i++) {
|
||||||
if (ImGui::MenuItem(names[i])) {
|
if (ImGui::MenuItem(names[i]))
|
||||||
std::cout << "Add a " << names[i] << " to "
|
AddComponent(selected, i);
|
||||||
<< selected.GetComponent<YoggieEngine::IdentifierComponent>().name << std::endl;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|
||||||
}
|
}
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
}
|
}
|
||||||
@ -63,13 +79,35 @@ void Inspector::ShowComponents()
|
|||||||
|
|
||||||
if (selected.HasComponent<YoggieEngine::Render3DComponent>()) {
|
if (selected.HasComponent<YoggieEngine::Render3DComponent>()) {
|
||||||
auto& render3d = selected.GetComponent<YoggieEngine::Render3DComponent>();
|
auto& render3d = selected.GetComponent<YoggieEngine::Render3DComponent>();
|
||||||
|
const char* AssetNames[]{ "Asset1" , "Asset2" };
|
||||||
if (ImGui::CollapsingHeader("Render3D", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Render3D", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
|
||||||
|
if (ImGui::Button("Select Renderable Asset"))
|
||||||
|
ImGui::OpenPopup("Renderable_list_popup");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted(render3d.mesh.elements.empty() ? "<None>" : "ASSET_GUID_OR_ID");
|
||||||
|
if (ImGui::BeginPopup("Renderable_list_popup")) {
|
||||||
|
ImGui::Text("None");
|
||||||
|
ImGui::Separator();
|
||||||
|
for (int i = 0; i < IM_ARRAYSIZE(AssetNames); i++) {
|
||||||
|
if(ImGui::Selectable(AssetNames[i]))
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::ColorEdit3("Colour", glm::value_ptr(render3d.color));
|
ImGui::ColorEdit3("Colour", glm::value_ptr(render3d.color));
|
||||||
|
|
||||||
ImGui::Checkbox("Use static rendering:", &render3d.isStatic);
|
ImGui::Checkbox("Use static rendering:", &render3d.isStatic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static bool deferred = true;
|
static bool deferred = true;
|
||||||
|
|
||||||
|
|
||||||
if (selected.HasComponent<YoggieEngine::LightComponent>()) {
|
if (selected.HasComponent<YoggieEngine::LightComponent>()) {
|
||||||
auto& light = selected.GetComponent<YoggieEngine::LightComponent>();
|
auto& light = selected.GetComponent<YoggieEngine::LightComponent>();
|
||||||
if (ImGui::CollapsingHeader("Light", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Light", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
@ -187,6 +187,9 @@ void SubmitVegetationDemo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Submit( Render3DComponent& renderComponent, TransformComponent& transform) {
|
void Renderer::Submit( Render3DComponent& renderComponent, TransformComponent& transform) {
|
||||||
|
if (renderComponent.mesh.elements.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
if (renderComponent.VAO == 0 || renderComponent.IBO == 0)
|
if (renderComponent.VAO == 0 || renderComponent.IBO == 0)
|
||||||
{
|
{
|
||||||
if (renderComponent.VAO != 0)
|
if (renderComponent.VAO != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user