오늘은 2의 날이다.
오늘은 2의 날이다.
어 왜 2번 써지지? 어 왜 2번 써지지?
음... 왠지 서글퍼진다. 열심히 뭔갈 만들어도 자랑할 곳이 없다. 아싸의 인생이 원래 이렇지만..
어제에 이어 CameaComponent도 InspectorUI를 만들어주었다.
Camera::Camera(GameObject* gameObject)
:
Component("Camera", gameObject)
{
INSPECTOR_PROPERTY("bool", "IsPerspective", &camOption.isPerspective);
INSPECTOR_PROPERTY("float", "Field Of View", &camOption.fov);
INSPECTOR_PROPERTY("float", "AspectRatio", &camOption.aspectRatio);
INSPECTOR_PROPERTY("float", "Near", &camOption.nearZ);
INSPECTOR_PROPERTY("float", "Far", &camOption.farZ);
}
bool 변수가 추가 되었으므로 EditorUI에도 새로운 변수를 핸들링하도록 만들어 주었다.
void Inspector::Print(const PublicData& data)
{
switch (types[data.type])
{
case Type::Vector3:
{
ImGui::DragFloat3(data.name.c_str(), (float*)(data.ptr), 0.01f, std::numeric_limits<float>::lowest(), std::numeric_limits<float>::infinity());
break;
case Type::Bool:
ImGui::Checkbox("checkbox", (bool*)data.ptr);
break;
}
case Type::Float:
ImGui::DragFloat(data.name.c_str(), (float*)(data.ptr), 0.01f, std::numeric_limits<float>::lowest(), std::numeric_limits<float>::infinity());
break;
default:
break;
}
}
음... 구조를 잘 만든 건지 잘 동작했다. 뭔가 뿌듯하다.
다만 문제점이 있는데, 변수의 포인터에 직접 접근하여 값을 수정하기 때문에 값이 변경되었음을 인지할 방도가 없다. 그래서 프로젝션 매트릭스를 일일이 Update함수에서 세팅해주어야 한다. 이는 너무 낭비가 아닌가 생각된다.
이는 추후 고민해보기로 하고, 또다시 문제가 되어버린 Input 클래스를 수정해보도록 하자... 후... Imgui를 교과서로 삼아서 따라하는 게 낫지 않을까 하는 생각도 든다. 너무 잘만들어 놓으셨네... 나도 언젠가 이런 걸 만들 수 있을까?
'진행과정 기록 > GameEngine' 카테고리의 다른 글
20200225 Rendering 과정 개선(1) (2) | 2020.02.25 |
---|---|
20200224 Grid (0) | 2020.02.24 |
20200221 (0) | 2020.02.21 |
20200219 (1) | 2020.02.19 |
20200211 Node Tree (0) | 2020.02.11 |