Camera width resize with viewport. GetMainCamera exposed to scripts #362
|
@ -113,8 +113,7 @@
|
||||||
Pitch: 0
|
Pitch: 0
|
||||||
Yaw: 0
|
Yaw: 0
|
||||||
Roll: 0
|
Roll: 0
|
||||||
Width: 1319
|
Width: 1175
|
||||||
Height: 622
|
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
|
|
@ -144,8 +144,24 @@ namespace SHADE
|
||||||
//std::cout << EVENT_DATA->resizeWidth << std::endl;
|
//std::cout << EVENT_DATA->resizeWidth << std::endl;
|
||||||
//std::cout << EVENT_DATA->resizeHeight << std::endl;
|
//std::cout << EVENT_DATA->resizeHeight << std::endl;
|
||||||
screenAspectRatio = (float)EVENT_DATA->resizeWidth / (float)EVENT_DATA->resizeHeight;
|
screenAspectRatio = (float)EVENT_DATA->resizeWidth / (float)EVENT_DATA->resizeHeight;
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
auto editor = SHSystemManager::GetSystem<SHEditor>();
|
||||||
|
if (editor->editorState != SHEditor::State::PLAY)
|
||||||
|
return eventPtr->handle;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SHEDITOR
|
||||||
|
|
||||||
|
for (auto& director : directorHandleList)
|
||||||
|
{
|
||||||
|
auto camera = SHComponentManager::GetComponent_s<SHCameraComponent>(director->mainCameraEID);
|
||||||
|
if (camera)
|
||||||
|
{
|
||||||
|
camera->SetWidth(EVENT_DATA->resizeWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return eventPtr->handle;
|
return eventPtr->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,4 +590,9 @@ namespace SHADE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHCameraComponent* SHCameraSystem::GetMainCamera() const noexcept
|
||||||
|
{
|
||||||
|
return SHComponentManager::GetComponent_s<SHCameraComponent>(directorHandleList[0]->mainCameraEID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace SHADE
|
||||||
void SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix, bool takePos) noexcept;
|
void SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix, bool takePos) noexcept;
|
||||||
void CameraLookAt(SHCameraComponent& camera, SHVec3 target) noexcept;
|
void CameraLookAt(SHCameraComponent& camera, SHVec3 target) noexcept;
|
||||||
void UpdateEditorArm(double dt,bool active ,SHVec3 const& targetPos) noexcept;
|
void UpdateEditorArm(double dt,bool active ,SHVec3 const& targetPos) noexcept;
|
||||||
|
SHCameraComponent* GetMainCamera() const noexcept;
|
||||||
|
|
||||||
SHVec2 GetCameraWidthHeight(size_t index) noexcept;
|
SHVec2 GetCameraWidthHeight(size_t index) noexcept;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue