mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Place camera farther away, improves preview camera placement.
This commit is contained in:
parent
09bce73c33
commit
7d9dddfa38
@ -94,7 +94,13 @@ namespace CSVRender
|
|||||||
|
|
||||||
void CameraController::setSceneBounds(const osg::BoundingBox& bounds, const osg::Vec3d& up)
|
void CameraController::setSceneBounds(const osg::BoundingBox& bounds, const osg::Vec3d& up)
|
||||||
{
|
{
|
||||||
osg::Vec3d eye = osg::Vec3d(bounds.xMax(), bounds.yMax(), bounds.zMax());
|
osg::Vec3d minBounds = bounds.corner(0) - bounds.center();
|
||||||
|
osg::Vec3d maxBounds = bounds.corner(7) - bounds.center();
|
||||||
|
|
||||||
|
osg::Vec3d camOffset = up * maxBounds > 0 ? maxBounds : minBounds;
|
||||||
|
camOffset *= 2;
|
||||||
|
|
||||||
|
osg::Vec3d eye = camOffset + bounds.center();
|
||||||
osg::Vec3d center = bounds.center();
|
osg::Vec3d center = bounds.center();
|
||||||
|
|
||||||
getCamera()->setViewMatrixAsLookAt(eye, center, up);
|
getCamera()->setViewMatrixAsLookAt(eye, center, up);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user