mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-11 22:41:26 +00:00
Camera reset now every time cell object->view is pressed.
This commit is contained in:
parent
3030cc2d3a
commit
c6ec473280
6 changed files with 12 additions and 15 deletions
|
@ -810,6 +810,7 @@ if (APPLE)
|
||||||
set(\${default_embedded_path_var} \"\${path}\" PARENT_SCOPE)
|
set(\${default_embedded_path_var} \"\${path}\" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
cmake_policy(SET CMP0009 OLD)
|
cmake_policy(SET CMP0009 OLD)
|
||||||
fixup_bundle(\"${INSTALLED_OPENMW_APP}\" \"${PLUGINS}\" \"\")
|
fixup_bundle(\"${INSTALLED_OPENMW_APP}\" \"${PLUGINS}\" \"\")
|
||||||
fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\")
|
fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\")
|
||||||
|
|
|
@ -38,7 +38,9 @@ namespace CSMWorld
|
||||||
/// \note The worldspace part of \a id is ignored
|
/// \note The worldspace part of \a id is ignored
|
||||||
static std::pair<CellCoordinates, bool> fromId (const std::string& id);
|
static std::pair<CellCoordinates, bool> fromId (const std::string& id);
|
||||||
|
|
||||||
|
/// \return cell coordinates such that given world coordinates are in it.
|
||||||
static std::pair<int, int> coordinatesToCellIndex (float x, float y);
|
static std::pair<int, int> coordinatesToCellIndex (float x, float y);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator== (const CellCoordinates& left, const CellCoordinates& right);
|
bool operator== (const CellCoordinates& left, const CellCoordinates& right);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "editmode.hpp"
|
#include "editmode.hpp"
|
||||||
#include "mask.hpp"
|
#include "mask.hpp"
|
||||||
|
#include "cameracontroller.hpp"
|
||||||
|
|
||||||
bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
||||||
{
|
{
|
||||||
|
@ -477,12 +478,15 @@ void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint)
|
||||||
{
|
{
|
||||||
char ignore1; // : or ;
|
char ignore1; // : or ;
|
||||||
char ignore2; // #
|
char ignore2; // #
|
||||||
|
// Current coordinate
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
// Loop throught all the coordinates to add them to selection
|
||||||
while (stream >> ignore1 >> ignore2 >> x >> y)
|
while (stream >> ignore1 >> ignore2 >> x >> y)
|
||||||
selection.add (CSMWorld::CellCoordinates (x, y));
|
selection.add (CSMWorld::CellCoordinates (x, y));
|
||||||
|
|
||||||
/// \todo adjust camera position
|
// Setup camera
|
||||||
|
mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hint[0]=='r')
|
else if (hint[0]=='r')
|
||||||
|
|
|
@ -83,6 +83,8 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual ~PagedWorldspaceWidget();
|
virtual ~PagedWorldspaceWidget();
|
||||||
|
|
||||||
|
/// \brief Decodes the the hint string to set of cell that are rendered.
|
||||||
|
/// Calculates avarage of cell's coordinates to be new camera location.
|
||||||
void useViewHint (const std::string& hint);
|
void useViewHint (const std::string& hint);
|
||||||
|
|
||||||
void setCellSelection(const CSMWorld::CellSelection& selection);
|
void setCellSelection(const CSMWorld::CellSelection& selection);
|
||||||
|
|
|
@ -31,7 +31,6 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
: QWidget(parent, f)
|
: QWidget(parent, f)
|
||||||
, mRootNode(0)
|
, mRootNode(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
osgViewer::CompositeViewer& viewer = CompositeViewer::get();
|
osgViewer::CompositeViewer& viewer = CompositeViewer::get();
|
||||||
|
|
||||||
osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
|
osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
|
||||||
|
@ -314,15 +313,7 @@ void SceneWidget::keyReleaseEvent (QKeyEvent *event)
|
||||||
|
|
||||||
void SceneWidget::update(double dt)
|
void SceneWidget::update(double dt)
|
||||||
{
|
{
|
||||||
if (mCamPositionSet)
|
mCurrentCamControl->update(dt);
|
||||||
{
|
|
||||||
mCurrentCamControl->update(dt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp);
|
|
||||||
mCamPositionSet = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
|
void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
|
||||||
|
|
|
@ -121,9 +121,6 @@ namespace CSVRender
|
||||||
|
|
||||||
std::map<std::pair<Qt::MouseButton, bool>, std::string> mButtonMapping;
|
std::map<std::pair<Qt::MouseButton, bool>, std::string> mButtonMapping;
|
||||||
|
|
||||||
private:
|
|
||||||
bool mCamPositionSet;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue