sculpto
scene_object_config_window.cpp
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file scene_object_config_window.cpp
3 * \brief Scene object components configuration GUI window class implementation module.
4 *
5 * \author Sabitov Kirill
6 * \date 09 July 2022
7 *********************************************************************/
8
9#include "sclpch.h"
11
12const char scl::scene_object_config_window::AddComponentComboItemsCames[7][64] = {
13 "Select component",
14 "Transform Component",
15 "Camera Component",
16 "Point Light Component",
17 "Directional Light Component",
18 "Spot Light Component"
19};
20
22
24{
25 this->ConfiguringObject = ConfiguringObject;
26 ResetData();
27}
28
29void scl::scene_object_config_window::ResetData()
30{
31 CurrentSubmeshIndex = 0;
32 GBufferPreviewColorAttachment = 0;
33 CurrentAddingComponentIndex = 0;
34 CameraProjectionTypeIndex = 0;
35
36 memset(NameTextBuffer, 0, 128);
37
38 SubmeshSelectComboItems.clear();
39 if (ConfiguringObject.HasComponent<mesh_component>())
40 {
41 auto &mesh = ConfiguringObject.GetComponent<mesh_component>().Mesh;
42 size_t submeshes_count = mesh->SubMeshes.size();
43 if (submeshes_count != SubmeshSelectComboItems.size())
44 {
45 SubmeshSelectComboItems.resize(submeshes_count);
46 for (int i = 0; i < submeshes_count; i++)
47 SubmeshSelectComboItems[i] = std::string("Mesh No.") + std::to_string(i);
48 }
49 }
50}
51
53{
54 ImGui::Begin("Scene Object Configuration");
55 {
56 if (!ConfiguringObject.IsOk())
57 {
58 ImGui::End();
59 return;
60 }
61
62 auto window_size = ImGui::GetWindowSize();
63 PanelWidth = (float)window_size.x - 15;
64
65 if (ConfiguringObject.HasComponent<name_component>())
66 DrawComponentPanel<name_component>();
67 if ((IsTransformComponent = ConfiguringObject.HasComponent<transform_component>()))
68 DrawComponentPanel<transform_component>();
69 if (ConfiguringObject.HasComponent<native_script_component>())
70 DrawComponentPanel<native_script_component>();
71 if ((IsMeshComponent = ConfiguringObject.HasComponent<mesh_component>()))
72 DrawComponentPanel<mesh_component>();
73 if ((IsCameraComponent = ConfiguringObject.HasComponent<camera_component>()))
74 DrawComponentPanel<camera_component>();
75 if ((IsPointLightComponent = ConfiguringObject.HasComponent<point_light_component>()))
76 DrawComponentPanel<point_light_component>();
77 if ((IsDirectionalLightComponent = ConfiguringObject.HasComponent<directional_light_component>()))
78 DrawComponentPanel<directional_light_component>();
79 if ((IsSpotLightComponent = ConfiguringObject.HasComponent<spot_light_component>()))
80 DrawComponentPanel<spot_light_component>();
81 ImGui::NewLine();
82
83 DrawAddComponentPanel();
84 }
85 ImGui::End();
86}
Definition: mesh.h:31
std::vector< submesh_data > SubMeshes
Definition: mesh.h:46
void SetConfiguringObject(scene_object ConfiguringObject)
Scene object components configuration GUI window class declaration module.
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.