2026-02-03 03:53:40 +01:00

50 lines
1.2 KiB
ActionScript

class CameraComponentRender {
Entity entity;
CameraComponentRender(Entity _entity) {
entity = _entity;
}
void render() {
if (!entity.hasCameraComponent())
return;
CameraComponent cameraComponent = entity.getCameraComponent();
float fov = cameraComponent.fov;
float aspect = cameraComponent.aspectRatio;
float nearZ = cameraComponent.nearZ;
float farZ = cameraComponent.farZ;
fov = ImGui::magicSlider("Fo ", f v, 0.1);
if (fov > 180)
fov = 180;
if (fov < 0)
fov = 0;
aspect = ImGui::magicSlider("Aspect Rati ", aspe t, 0.1);
if (aspect < 0.1)
aspect = 0.1;
nearZ = ImGui::magicSlider("Near ", nea Z, 0.1);
if (nearZ < 0)
nearZ = 0;
farZ = ImGui::magicSlider("Far ", fa Z, 0.1);
if (farZ < 0)
farZ = 0;
if (nearZ > farZ)
farZ = nearZ;
cameraComponent.fov = fov;
cameraComponent.aspectRatio = aspect;
cameraComponent.nearZ = nearZ;
cameraComponent.farZ = farZ;
}
void remove() {
if (ImGui::menuItem("Remove )) {
entity.removeCameraComponent();
}
}
}