mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Add OpenMW commits up to 25 Apr 2020
# Conflicts: # .travis.yml # apps/openmw/mwclass/container.cpp # apps/openmw/mwclass/door.cpp
This commit is contained in:
commit
a20f8e77dc
119 changed files with 1285 additions and 763 deletions
|
@ -23,6 +23,7 @@ Debian:
|
|||
artifacts:
|
||||
paths:
|
||||
- build/artifacts/
|
||||
|
||||
MacOS:
|
||||
tags:
|
||||
- macos
|
||||
|
@ -42,18 +43,21 @@ MacOS:
|
|||
|
||||
Windows:
|
||||
tags:
|
||||
- win10
|
||||
- msvc2017
|
||||
except:
|
||||
- branches # because our CI VMs are not public, MRs can't use them and timeout
|
||||
- windows
|
||||
stage: build
|
||||
allow_failure: true
|
||||
script:
|
||||
# - env # turn on for debugging
|
||||
- sh %CI_PROJECT_DIR%/CI/before_script.msvc.sh -c Release -p x64 -v 2017 -V
|
||||
- SET msBuildLocation="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
|
||||
- call %msBuildLocation% MSVC2017_64\OpenMW.sln /t:Build /p:Configuration=Release /m:%NUMBER_OF_PROCESSORS%
|
||||
- 7z a OpenMW_MSVC2017_64_%CI_BUILD_REF_NAME%_%CI_BUILD_ID%.zip %CI_PROJECT_DIR%\MSVC2017_64\Release\
|
||||
- Set-Variable -Name "time" -Value (date -Format "%H:%m")
|
||||
- echo ${time}
|
||||
- echo "started by ${GITLAB_USER_NAME}"
|
||||
# TODO: to anyone wanting to do further work here, we need to figure out how to get the below working
|
||||
# TODO: on gitlab's new shared windows runners. They currently don't have bash or anything else installed
|
||||
# TODO: it is currently just a bare windows 10 with powershell.
|
||||
# - env # turn on for debugging
|
||||
# - sh %CI_PROJECT_DIR%/CI/before_script.msvc.sh -c Release -p x64 -v 2017 -V
|
||||
# - SET msBuildLocation="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
|
||||
# - call %msBuildLocation% MSVC2017_64\OpenMW.sln /t:Build /p:Configuration=Release /m:%NUMBER_OF_PROCESSORS%
|
||||
# - 7z a OpenMW_MSVC2017_64_%CI_BUILD_REF_NAME%_%CI_BUILD_ID%.zip %CI_PROJECT_DIR%\MSVC2017_64\Release\
|
||||
cache:
|
||||
paths:
|
||||
- deps
|
||||
|
|
|
@ -26,7 +26,7 @@ addons:
|
|||
# Audio, Video and Misc. deps
|
||||
libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev,
|
||||
# The other ones from OpenMW ppa
|
||||
libbullet-dev, libopenscenegraph-3.4-dev, libmygui-dev,
|
||||
libbullet-dev, libopenscenegraph-dev, libmygui-dev,
|
||||
# tes3mp stuff
|
||||
libboost-dev, libqt5opengl5-dev, libluajit-5.1-dev
|
||||
]
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
0.47.0
|
||||
------
|
||||
|
||||
Bug #1952: Incorrect particle lighting
|
||||
Bug #3676: NiParticleColorModifier isn't applied properly
|
||||
Bug #5358: ForceGreeting always resets the dialogue window completely
|
||||
Bug #5363: Enchantment autocalc not always 0/1
|
||||
Bug #5364: Script fails/stops if trying to startscript an unknown script
|
||||
Bug #5367: Selecting a spell on an enchanted item per hotkey always plays the equip sound
|
||||
Bug #5369: Spawnpoint in the Grazelands doesn't produce oversized creatures
|
||||
Bug #5370: Opening an unlocked but trapped door uses the key
|
||||
Feature #5362: Show the soul gems' trapped soul in count dialog
|
||||
|
||||
0.46.0
|
||||
|
@ -163,7 +166,6 @@
|
|||
Bug #5099: Non-swimming enemies will enter water if player is water walking
|
||||
Bug #5103: Sneaking state behavior is still inconsistent
|
||||
Bug #5104: Black Dart's enchantment doesn't trigger at low Enchant levels
|
||||
Bug #5105: NPCs start combat with werewolves from any distance
|
||||
Bug #5106: Still can jump even when encumbered
|
||||
Bug #5110: ModRegion with a redundant numerical argument breaks script execution
|
||||
Bug #5112: Insufficient magicka for current spell not reflected on HUD icon
|
||||
|
@ -223,7 +225,7 @@
|
|||
Bug #5345: Dopey Necromancy does not work due to a missing quote
|
||||
Bug #5350: An attempt to launch magic bolt causes "AL error invalid value" error
|
||||
Bug #5352: Light source items' duration is decremented while they aren't visible
|
||||
Feature #1774: Handle AvoidNode
|
||||
Feature #1724: Handle AvoidNode
|
||||
Feature #2229: Improve pathfinding AI
|
||||
Feature #3025: Analogue gamepad movement controls
|
||||
Feature #3442: Default values for fallbacks from ini file
|
||||
|
|
|
@ -66,6 +66,8 @@ set(OPENMW_VERSION_COMMITDATE "")
|
|||
|
||||
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
||||
set(OPENMW_DOC_BASEURL "https://openmw.readthedocs.io/en/master/")
|
||||
|
||||
set(GIT_CHECKOUT FALSE)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||
find_package(Git)
|
||||
|
@ -649,6 +651,7 @@ ENDIF(BUILD_OPENMW OR BUILD_OPENCS)
|
|||
|
||||
# Components
|
||||
add_subdirectory (components)
|
||||
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
||||
|
||||
# Apps and tools
|
||||
if (BUILD_OPENMW_MP)
|
||||
|
|
|
@ -21,7 +21,7 @@ Pull Request Guidelines
|
|||
|
||||
To facilitate the review process, your pull request description should include the following, if applicable:
|
||||
|
||||
* A link back to the bug report or forum discussion that prompted the change. Note: when linking bugs, use the syntax ```[Bug #xyz](https://bugs.openmw.org/issues/#xyz)``` to create a clickable link. Writing only 'Bug #xyz' will unfortunately create a link to the Github pull request with that number instead.
|
||||
* A link back to the bug report or forum discussion that prompted the change. Note: when linking bugs, use the syntax ```[Bug #xyz](https://gitlab.com/OpenMW/openmw/issues/#xyz)``` to create a clickable link. Writing only 'Bug #xyz' will unfortunately create a link to the Github pull request with that number instead.
|
||||
* Summary of the changes made
|
||||
* Reasoning / motivation behind the change
|
||||
* What testing you have carried out to verify the change
|
||||
|
|
|
@ -258,18 +258,37 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
|
|||
if(quiet) continue;
|
||||
|
||||
std::cout << " Refnum: " << ref.mRefNum.mIndex << std::endl;
|
||||
std::cout << " ID: '" << ref.mRefID << "'\n";
|
||||
std::cout << " Owner: '" << ref.mOwner << "'\n";
|
||||
std::cout << " Global: '" << ref.mGlobalVariable << "'" << std::endl;
|
||||
std::cout << " Faction: '" << ref.mFaction << "'" << std::endl;
|
||||
std::cout << " Faction rank: '" << ref.mFactionRank << "'" << std::endl;
|
||||
std::cout << " Enchantment charge: '" << ref.mEnchantmentCharge << "'\n";
|
||||
std::cout << " Uses/health: '" << ref.mChargeInt << "'\n";
|
||||
std::cout << " Gold value: '" << ref.mGoldValue << "'\n";
|
||||
std::cout << " Blocked: '" << static_cast<int>(ref.mReferenceBlocked) << "'" << std::endl;
|
||||
std::cout << " ID: " << ref.mRefID << std::endl;
|
||||
std::cout << " Position: (" << ref.mPos.pos[0] << ", " << ref.mPos.pos[1] << ", " << ref.mPos.pos[2] << ")" << std::endl;
|
||||
if (ref.mScale != 1.f)
|
||||
std::cout << " Scale: " << ref.mScale << std::endl;
|
||||
if (!ref.mOwner.empty())
|
||||
std::cout << " Owner: " << ref.mOwner << std::endl;
|
||||
if (!ref.mGlobalVariable.empty())
|
||||
std::cout << " Global: " << ref.mGlobalVariable << std::endl;
|
||||
if (!ref.mFaction.empty())
|
||||
std::cout << " Faction: " << ref.mFaction << std::endl;
|
||||
if (!ref.mFaction.empty() || ref.mFactionRank != -2)
|
||||
std::cout << " Faction rank: " << ref.mFactionRank << std::endl;
|
||||
std::cout << " Enchantment charge: " << ref.mEnchantmentCharge << std::endl;
|
||||
std::cout << " Uses/health: " << ref.mChargeInt << std::endl;
|
||||
std::cout << " Gold value: " << ref.mGoldValue << std::endl;
|
||||
std::cout << " Blocked: " << static_cast<int>(ref.mReferenceBlocked) << std::endl;
|
||||
std::cout << " Deleted: " << deleted << std::endl;
|
||||
if (!ref.mKey.empty())
|
||||
std::cout << " Key: '" << ref.mKey << "'" << std::endl;
|
||||
std::cout << " Key: " << ref.mKey << std::endl;
|
||||
std::cout << " Lock level: " << ref.mLockLevel << std::endl;
|
||||
if (!ref.mTrap.empty())
|
||||
std::cout << " Trap: " << ref.mTrap << std::endl;
|
||||
if (!ref.mSoul.empty())
|
||||
std::cout << " Soul: " << ref.mSoul << std::endl;
|
||||
if (ref.mTeleport)
|
||||
{
|
||||
std::cout << " Destination position: (" << ref.mDoorDest.pos[0] << ", "
|
||||
<< ref.mDoorDest.pos[1] << ", " << ref.mDoorDest.pos[2] << ")" << std::endl;
|
||||
if (!ref.mDestCell.empty())
|
||||
std::cout << " Destination cell: " << ref.mDestCell << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "maindialog.hpp"
|
||||
|
||||
#include <components/version/version.hpp>
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
|
@ -54,12 +55,15 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
|||
iconWidget->setCurrentRow(0);
|
||||
iconWidget->setFlow(QListView::LeftToRight);
|
||||
|
||||
QPushButton *helpButton = new QPushButton(tr("Help"));
|
||||
QPushButton *playButton = new QPushButton(tr("Play"));
|
||||
buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close"));
|
||||
buttonBox->addButton(helpButton, QDialogButtonBox::HelpRole);
|
||||
buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
|
||||
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
||||
connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
|
||||
|
||||
// Remove what's this? button
|
||||
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
@ -614,3 +618,8 @@ void Launcher::MainDialog::play()
|
|||
if (mGameInvoker->startProcess(QLatin1String("tes3mp-browser"), true))
|
||||
return qApp->quit();
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::help()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("reference/index.html");
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace Launcher
|
|||
public slots:
|
||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void play();
|
||||
void help();
|
||||
|
||||
private slots:
|
||||
void wizardStarted();
|
||||
|
|
|
@ -97,6 +97,10 @@ opencs_units_noqt (view/render
|
|||
cellarrow cellmarker cellborder pathgrid
|
||||
)
|
||||
|
||||
opencs_hdrs_noqt (view/render
|
||||
mask
|
||||
)
|
||||
|
||||
|
||||
opencs_units (view/tools
|
||||
reportsubview reporttable searchsubview searchbox merge
|
||||
|
|
|
@ -271,6 +271,8 @@ void CSMPrefs::State::declare()
|
|||
declareShortcut ("document-file-newaddon", "New Addon", QKeySequence());
|
||||
declareShortcut ("document-file-open", "Open", QKeySequence(Qt::ControlModifier | Qt::Key_O));
|
||||
declareShortcut ("document-file-save", "Save", QKeySequence(Qt::ControlModifier | Qt::Key_S));
|
||||
declareShortcut ("document-help-help", "Help", QKeySequence(Qt::Key_F1));
|
||||
declareShortcut ("document-help-tutorial", "Tutorial", QKeySequence());
|
||||
declareShortcut ("document-file-verify", "Verify", QKeySequence());
|
||||
declareShortcut ("document-file-merge", "Merge", QKeySequence());
|
||||
declareShortcut ("document-file-errorlog", "Open Load Error Log", QKeySequence());
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "../tools/subviews.hpp"
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
#include <components/version/version.hpp>
|
||||
|
||||
#include "viewmanager.hpp"
|
||||
|
@ -315,6 +316,12 @@ void CSVDoc::View::setupHelpMenu()
|
|||
{
|
||||
QMenu *help = menuBar()->addMenu (tr ("Help"));
|
||||
|
||||
QAction* helpInfo = createMenuEntry("Help", ":/info.png", help, "document-help-help");
|
||||
connect (helpInfo, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
|
||||
QAction* tutorial = createMenuEntry("Tutorial", ":/info.png", help, "document-help-tutorial");
|
||||
connect (tutorial, SIGNAL (triggered()), this, SLOT (tutorial()));
|
||||
|
||||
QAction* about = createMenuEntry("About OpenMW-CS", ":./info.png", help, "document-help-about");
|
||||
connect (about, SIGNAL (triggered()), this, SLOT (infoAbout()));
|
||||
|
||||
|
@ -708,6 +715,16 @@ void CSVDoc::View::save()
|
|||
mDocument->save();
|
||||
}
|
||||
|
||||
void CSVDoc::View::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/index.html");
|
||||
}
|
||||
|
||||
void CSVDoc::View::tutorial()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/tour.html");
|
||||
}
|
||||
|
||||
void CSVDoc::View::infoAbout()
|
||||
{
|
||||
// Get current OpenMW version
|
||||
|
|
|
@ -169,6 +169,10 @@ namespace CSVDoc
|
|||
|
||||
void exit();
|
||||
|
||||
static void openHelp();
|
||||
|
||||
static void tutorial();
|
||||
|
||||
void infoAbout();
|
||||
|
||||
void infoAboutQt();
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
#include "editwidget.hpp"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAction>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QString>
|
||||
#include <QApplication>
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
#include "../../model/world/idtablebase.hpp"
|
||||
#include "../../model/world/columns.hpp"
|
||||
#include "../../model/prefs/shortcut.hpp"
|
||||
|
||||
CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent)
|
||||
: QLineEdit (parent), mParser (data), mIsEmpty(true)
|
||||
|
@ -29,6 +35,13 @@ CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent)
|
|||
|
||||
mStateColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Modification);
|
||||
mDescColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Description);
|
||||
|
||||
mHelpAction = new QAction (tr ("Help"), this);
|
||||
connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
mHelpAction->setIcon(QIcon(":/info.png"));
|
||||
addAction (mHelpAction);
|
||||
auto* openHelpShortcut = new CSMPrefs::Shortcut("help", this);
|
||||
openHelpShortcut->associateAction(mHelpAction);
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::textChanged (const QString& text)
|
||||
|
@ -211,3 +224,17 @@ std::string CSVFilter::EditWidget::generateFilter (std::pair< std::string, std::
|
|||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu *menu = createStandardContextMenu();
|
||||
menu->addAction(mHelpAction);
|
||||
menu->exec(event->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/record-filters.html");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace CSVFilter
|
|||
bool mIsEmpty;
|
||||
int mStateColumnIndex;
|
||||
int mDescColumnIndex;
|
||||
QAction *mHelpAction;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -40,6 +41,7 @@ namespace CSVFilter
|
|||
|
||||
private:
|
||||
std::string generateFilter(std::pair<std::string, std::vector<std::string> >& seekedString) const;
|
||||
void contextMenuEvent (QContextMenuEvent *event) override;
|
||||
|
||||
private slots:
|
||||
|
||||
|
@ -51,6 +53,8 @@ namespace CSVFilter
|
|||
|
||||
void filterRowsInserted (const QModelIndex& parent, int start, int end);
|
||||
|
||||
static void openHelp();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,10 +8,9 @@
|
|||
|
||||
#include <osgUtil/LineSegmentIntersector>
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../../model/world/cellcoordinates.hpp"
|
||||
#include "../widget/brushshapes.hpp"
|
||||
#include "mask.hpp"
|
||||
|
||||
CSVRender::BrushDraw::BrushDraw(osg::ref_ptr<osg::Group> parentNode, bool textureMode) :
|
||||
mParentNode(parentNode), mTextureMode(textureMode)
|
||||
|
@ -46,7 +45,7 @@ float CSVRender::BrushDraw::getIntersectionHeight (const osg::Vec3d& point)
|
|||
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::NO_LIMIT);
|
||||
osgUtil::IntersectionVisitor visitor(intersector);
|
||||
|
||||
visitor.setTraversalMask(SceneUtil::Mask_Terrain);
|
||||
visitor.setTraversalMask(Mask_Terrain);
|
||||
|
||||
mParentNode->accept(visitor);
|
||||
|
||||
|
@ -258,7 +257,6 @@ void CSVRender::BrushDraw::update(osg::Vec3d point, int brushSize, CSVWidget::Br
|
|||
{
|
||||
if (mBrushDrawNode->containsNode(mGeometry))
|
||||
mBrushDrawNode->removeChild(mGeometry);
|
||||
mBrushDrawNode->setNodeMask (SceneUtil::Mask_GUI);
|
||||
float radius = (mLandSizeFactor * brushSize) / 2;
|
||||
osg::Vec3d snapToGridPoint = point;
|
||||
if (mTextureMode)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <components/esm/loadcell.hpp>
|
||||
#include <components/esm/loadland.hpp>
|
||||
#include <components/sceneutil/pathgridutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/terrain/terraingrid.hpp>
|
||||
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
@ -22,6 +21,7 @@
|
|||
#include "cellborder.hpp"
|
||||
#include "cellarrow.hpp"
|
||||
#include "cellmarker.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "pathgrid.hpp"
|
||||
#include "terrainstorage.hpp"
|
||||
#include "object.hpp"
|
||||
|
@ -92,7 +92,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
|
|||
|
||||
std::unique_ptr<Object> object (new Object (mData, mCellNode, id, false));
|
||||
|
||||
if (mSubModeElementMask & SceneUtil::Mask_EditorReference)
|
||||
if (mSubModeElementMask & Mask_Reference)
|
||||
object->setSubMode (mSubMode);
|
||||
|
||||
mObjects.insert (std::make_pair (id, object.release()));
|
||||
|
@ -134,7 +134,7 @@ void CSVRender::Cell::updateLand()
|
|||
else
|
||||
{
|
||||
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode,
|
||||
mData.getResourceSystem().get(), mTerrainStorage));
|
||||
mData.getResourceSystem().get(), mTerrainStorage, Mask_Terrain));
|
||||
}
|
||||
|
||||
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
||||
|
@ -434,7 +434,7 @@ void CSVRender::Cell::reloadAssets()
|
|||
|
||||
void CSVRender::Cell::setSelection (int elementMask, Selection mode)
|
||||
{
|
||||
if (elementMask & SceneUtil::Mask_EditorReference)
|
||||
if (elementMask & Mask_Reference)
|
||||
{
|
||||
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||
iter!=mObjects.end(); ++iter)
|
||||
|
@ -451,7 +451,7 @@ void CSVRender::Cell::setSelection (int elementMask, Selection mode)
|
|||
iter->second->setSelected (selected);
|
||||
}
|
||||
}
|
||||
if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
|
||||
if (mPathgrid && elementMask & Mask_Pathgrid)
|
||||
{
|
||||
// Only one pathgrid may be selected, so some operations will only have an effect
|
||||
// if the pathgrid is already focused
|
||||
|
@ -546,12 +546,12 @@ std::vector<osg::ref_ptr<CSVRender::TagBase> > CSVRender::Cell::getSelection (un
|
|||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > result;
|
||||
|
||||
if (elementMask & SceneUtil::Mask_EditorReference)
|
||||
if (elementMask & Mask_Reference)
|
||||
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||
iter!=mObjects.end(); ++iter)
|
||||
if (iter->second->getSelected())
|
||||
result.push_back (iter->second->getTag());
|
||||
if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
|
||||
if (mPathgrid && elementMask & Mask_Pathgrid)
|
||||
if (mPathgrid->isSelected())
|
||||
result.push_back(mPathgrid->getTag());
|
||||
|
||||
|
@ -562,7 +562,7 @@ std::vector<osg::ref_ptr<CSVRender::TagBase> > CSVRender::Cell::getEdited (unsig
|
|||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > result;
|
||||
|
||||
if (elementMask & SceneUtil::Mask_EditorReference)
|
||||
if (elementMask & Mask_Reference)
|
||||
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||
iter!=mObjects.end(); ++iter)
|
||||
if (iter->second->isEdited())
|
||||
|
@ -576,7 +576,7 @@ void CSVRender::Cell::setSubMode (int subMode, unsigned int elementMask)
|
|||
mSubMode = subMode;
|
||||
mSubModeElementMask = elementMask;
|
||||
|
||||
if (elementMask & SceneUtil::Mask_EditorReference)
|
||||
if (elementMask & Mask_Reference)
|
||||
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||
iter!=mObjects.end(); ++iter)
|
||||
iter->second->setSubMode (subMode);
|
||||
|
@ -584,10 +584,10 @@ void CSVRender::Cell::setSubMode (int subMode, unsigned int elementMask)
|
|||
|
||||
void CSVRender::Cell::reset (unsigned int elementMask)
|
||||
{
|
||||
if (elementMask & SceneUtil::Mask_EditorReference)
|
||||
if (elementMask & Mask_Reference)
|
||||
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||
iter!=mObjects.end(); ++iter)
|
||||
iter->second->reset();
|
||||
if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
|
||||
if (mPathgrid && elementMask & Mask_Pathgrid)
|
||||
mPathgrid->resetIndicators();
|
||||
}
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#include "../../model/prefs/shortcutmanager.hpp"
|
||||
|
||||
#include <components/misc/constants.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "mask.hpp"
|
||||
|
||||
CSVRender::CellArrowTag::CellArrowTag (CellArrow *arrow)
|
||||
: TagBase (SceneUtil::Mask_EditorCellArrow), mArrow (arrow)
|
||||
: TagBase (Mask_CellArrow), mArrow (arrow)
|
||||
{}
|
||||
|
||||
CSVRender::CellArrow *CSVRender::CellArrowTag::getCellArrow() const
|
||||
|
@ -174,7 +175,7 @@ CSVRender::CellArrow::CellArrow (osg::Group *cellNode, Direction direction,
|
|||
|
||||
mParentNode->addChild (mBaseNode);
|
||||
|
||||
mBaseNode->setNodeMask (SceneUtil::Mask_EditorCellArrow);
|
||||
mBaseNode->setNodeMask (Mask_CellArrow);
|
||||
|
||||
adjustTransform();
|
||||
buildShape();
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <osg/PrimitiveSet>
|
||||
|
||||
#include <components/esm/loadland.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "mask.hpp"
|
||||
|
||||
#include "../../model/world/cellcoordinates.hpp"
|
||||
|
||||
|
@ -19,7 +20,7 @@ CSVRender::CellBorder::CellBorder(osg::Group* cellNode, const CSMWorld::CellCoor
|
|||
: mParentNode(cellNode)
|
||||
{
|
||||
mBaseNode = new osg::PositionAttitudeTransform();
|
||||
mBaseNode->setNodeMask(SceneUtil::Mask_EditorCellBorder);
|
||||
mBaseNode->setNodeMask(Mask_CellBorder);
|
||||
mBaseNode->setPosition(osg::Vec3f(coords.getX() * CellSize, coords.getY() * CellSize, 10));
|
||||
|
||||
mParentNode->addChild(mBaseNode);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <components/misc/constants.hpp>
|
||||
|
||||
CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker)
|
||||
: TagBase(SceneUtil::Mask_EditorCellMarker), mMarker(marker)
|
||||
: TagBase(Mask_CellMarker), mMarker(marker)
|
||||
{}
|
||||
|
||||
CSVRender::CellMarker *CSVRender::CellMarkerTag::getCellMarker() const
|
||||
|
@ -79,7 +79,7 @@ CSVRender::CellMarker::CellMarker(
|
|||
mMarkerNode->getOrCreateStateSet()->setAttribute(mat);
|
||||
|
||||
mMarkerNode->setUserData(new CellMarkerTag(this));
|
||||
mMarkerNode->setNodeMask(SceneUtil::Mask_EditorCellMarker);
|
||||
mMarkerNode->setNodeMask(Mask_CellMarker);
|
||||
|
||||
mCellNode->addChild(mMarkerNode);
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include <components/resource/imagemanager.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/sceneutil/waterutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../../model/world/cell.hpp"
|
||||
#include "../../model/world/cellcoordinates.hpp"
|
||||
#include "../../model/world/data.hpp"
|
||||
|
||||
#include "mask.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace CSVRender
|
|||
mWaterTransform->setPosition(osg::Vec3f(cellCoords.getX() * CellSize + CellSize / 2.f,
|
||||
cellCoords.getY() * CellSize + CellSize / 2.f, 0));
|
||||
|
||||
mWaterTransform->setNodeMask(SceneUtil::Mask_Water);
|
||||
mWaterTransform->setNodeMask(Mask_Water);
|
||||
mParentNode->addChild(mWaterTransform);
|
||||
|
||||
mWaterNode = new osg::Geode();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../widget/scenetoolbar.hpp"
|
||||
#include "../widget/scenetoolmode.hpp"
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include "mask.hpp"
|
||||
|
||||
#include "object.hpp"
|
||||
#include "worldspacewidget.hpp"
|
||||
|
@ -97,7 +97,7 @@ osg::Vec3f CSVRender::InstanceMode::getScreenCoords(const osg::Vec3f& pos)
|
|||
}
|
||||
|
||||
CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, osg::ref_ptr<osg::Group> parentNode, QWidget *parent)
|
||||
: EditMode (worldspaceWidget, QIcon (":scenetoolbar/editing-instance"), SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain, "Instance editing",
|
||||
: EditMode (worldspaceWidget, QIcon (":scenetoolbar/editing-instance"), Mask_Reference | Mask_Terrain, "Instance editing",
|
||||
parent), mSubMode (0), mSubModeId ("move"), mSelectionMode (0), mDragMode (DragMode_None),
|
||||
mDragAxis (-1), mLocked (false), mUnitScaleDist(1), mParentNode (parentNode)
|
||||
{
|
||||
|
@ -157,13 +157,13 @@ void CSVRender::InstanceMode::activate (CSVWidget::SceneToolbar *toolbar)
|
|||
|
||||
std::string subMode = mSubMode->getCurrentId();
|
||||
|
||||
getWorldspaceWidget().setSubMode (getSubModeFromId (subMode), SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().setSubMode (getSubModeFromId (subMode), Mask_Reference);
|
||||
}
|
||||
|
||||
void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar)
|
||||
{
|
||||
mDragMode = DragMode_None;
|
||||
getWorldspaceWidget().reset (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().reset (Mask_Reference);
|
||||
|
||||
if (mSelectionMode)
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ void CSVRender::InstanceMode::secondaryEditPressed (const WorldspaceHitResult& h
|
|||
|
||||
void CSVRender::InstanceMode::primarySelectPressed (const WorldspaceHitResult& hit)
|
||||
{
|
||||
getWorldspaceWidget().clearSelection (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().clearSelection (Mask_Reference);
|
||||
|
||||
if (hit.tag)
|
||||
{
|
||||
|
@ -251,13 +251,13 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
|
|||
|
||||
WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask());
|
||||
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Reference);
|
||||
if (selection.empty())
|
||||
{
|
||||
// Only change selection at the start of drag if no object is already selected
|
||||
if (hit.tag && CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
|
||||
{
|
||||
getWorldspaceWidget().clearSelection (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().clearSelection (Mask_Reference);
|
||||
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (hit.tag.get()))
|
||||
{
|
||||
CSVRender::Object* object = objectTag->mObject;
|
||||
|
@ -265,7 +265,7 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
|
|||
}
|
||||
}
|
||||
|
||||
selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
|
||||
selection = getWorldspaceWidget().getSelection (Mask_Reference);
|
||||
if (selection.empty())
|
||||
return false;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
|
|||
mDragMode = DragMode_Scale;
|
||||
|
||||
// Calculate scale factor
|
||||
std::vector<osg::ref_ptr<TagBase> > editedSelection = getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > editedSelection = getWorldspaceWidget().getEdited (Mask_Reference);
|
||||
osg::Vec3f center = getScreenCoords(getSelectionCenter(editedSelection));
|
||||
|
||||
int widgetHeight = getWorldspaceWidget().height();
|
||||
|
@ -327,7 +327,7 @@ void CSVRender::InstanceMode::drag (const QPoint& pos, int diffX, int diffY, dou
|
|||
osg::Vec3f offset;
|
||||
osg::Quat rotation;
|
||||
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getEdited (Mask_Reference);
|
||||
|
||||
if (mDragMode == DragMode_Move)
|
||||
{
|
||||
|
@ -484,7 +484,7 @@ void CSVRender::InstanceMode::drag (const QPoint& pos, int diffX, int diffY, dou
|
|||
void CSVRender::InstanceMode::dragCompleted(const QPoint& pos)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection =
|
||||
getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().getEdited (Mask_Reference);
|
||||
|
||||
QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack();
|
||||
|
||||
|
@ -516,7 +516,7 @@ void CSVRender::InstanceMode::dragCompleted(const QPoint& pos)
|
|||
|
||||
void CSVRender::InstanceMode::dragAborted()
|
||||
{
|
||||
getWorldspaceWidget().reset (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().reset (Mask_Reference);
|
||||
mDragMode = DragMode_None;
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ void CSVRender::InstanceMode::dragWheel (int diff, double speedFactor)
|
|||
offset *= diff * speedFactor;
|
||||
|
||||
std::vector<osg::ref_ptr<TagBase> > selection =
|
||||
getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().getEdited (Mask_Reference);
|
||||
|
||||
for (std::vector<osg::ref_ptr<TagBase> >::iterator iter (selection.begin());
|
||||
iter!=selection.end(); ++iter)
|
||||
|
@ -677,12 +677,12 @@ void CSVRender::InstanceMode::subModeChanged (const std::string& id)
|
|||
{
|
||||
mSubModeId = id;
|
||||
getWorldspaceWidget().abortDrag();
|
||||
getWorldspaceWidget().setSubMode (getSubModeFromId (id), SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().setSubMode (getSubModeFromId (id), Mask_Reference);
|
||||
}
|
||||
|
||||
void CSVRender::InstanceMode::deleteSelectedInstances(bool active)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Reference);
|
||||
if (selection.empty()) return;
|
||||
|
||||
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
|
||||
|
@ -695,7 +695,7 @@ void CSVRender::InstanceMode::deleteSelectedInstances(bool active)
|
|||
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (tag.get()))
|
||||
macro.push(new CSMWorld::DeleteCommand(referencesTable, objectTag->mObject->getReferenceId()));
|
||||
|
||||
getWorldspaceWidget().clearSelection (SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().clearSelection (Mask_Reference);
|
||||
}
|
||||
|
||||
void CSVRender::InstanceMode::dropInstance(DropMode dropMode, CSVRender::Object* object, float objectHeight)
|
||||
|
@ -713,9 +713,9 @@ void CSVRender::InstanceMode::dropInstance(DropMode dropMode, CSVRender::Object*
|
|||
osgUtil::IntersectionVisitor visitor(intersector);
|
||||
|
||||
if (dropMode == TerrainSep)
|
||||
visitor.setTraversalMask(SceneUtil::Mask_Terrain);
|
||||
visitor.setTraversalMask(Mask_Terrain);
|
||||
if (dropMode == CollisionSep)
|
||||
visitor.setTraversalMask(SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference);
|
||||
visitor.setTraversalMask(Mask_Terrain | Mask_Reference);
|
||||
|
||||
mParentNode->accept(visitor);
|
||||
|
||||
|
@ -745,9 +745,9 @@ float CSVRender::InstanceMode::getDropHeight(DropMode dropMode, CSVRender::Objec
|
|||
osgUtil::IntersectionVisitor visitor(intersector);
|
||||
|
||||
if (dropMode == Terrain)
|
||||
visitor.setTraversalMask(SceneUtil::Mask_Terrain);
|
||||
visitor.setTraversalMask(Mask_Terrain);
|
||||
if (dropMode == Collision)
|
||||
visitor.setTraversalMask(SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference);
|
||||
visitor.setTraversalMask(Mask_Terrain | Mask_Reference);
|
||||
|
||||
mParentNode->accept(visitor);
|
||||
|
||||
|
@ -784,7 +784,7 @@ void CSVRender::InstanceMode::dropSelectedInstancesToTerrainSeparately()
|
|||
|
||||
void CSVRender::InstanceMode::handleDropMethod(DropMode dropMode, QString commandMsg)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Reference);
|
||||
if (selection.empty())
|
||||
return;
|
||||
|
||||
|
@ -841,7 +841,7 @@ void CSVRender::InstanceMode::handleDropMethod(DropMode dropMode, QString comman
|
|||
CSVRender::DropObjectDataHandler::DropObjectDataHandler(WorldspaceWidget* worldspacewidget)
|
||||
: mWorldspaceWidget(worldspacewidget)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = mWorldspaceWidget->getSelection (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = mWorldspaceWidget->getSelection (Mask_Reference);
|
||||
for(osg::ref_ptr<TagBase> tag: selection)
|
||||
{
|
||||
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (tag.get()))
|
||||
|
@ -850,7 +850,7 @@ CSVRender::DropObjectDataHandler::DropObjectDataHandler(WorldspaceWidget* worlds
|
|||
osg::ref_ptr<osg::Group> objectNodeWithoutGUI = objectTag->mObject->getBaseNode();
|
||||
|
||||
osg::ComputeBoundsVisitor computeBounds;
|
||||
computeBounds.setTraversalMask(SceneUtil::Mask_EditorReference);
|
||||
computeBounds.setTraversalMask(Mask_Reference);
|
||||
objectNodeWithoutGUI->accept(computeBounds);
|
||||
osg::BoundingBox bounds = computeBounds.getBoundingBox();
|
||||
float boundingBoxOffset = 0.0f;
|
||||
|
@ -860,14 +860,14 @@ CSVRender::DropObjectDataHandler::DropObjectDataHandler(WorldspaceWidget* worlds
|
|||
mObjectHeights.emplace_back(boundingBoxOffset);
|
||||
mOldMasks.emplace_back(objectNodeWithGUI->getNodeMask());
|
||||
|
||||
objectNodeWithGUI->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
objectNodeWithGUI->setNodeMask(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CSVRender::DropObjectDataHandler::~DropObjectDataHandler()
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = mWorldspaceWidget->getSelection (SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = mWorldspaceWidget->getSelection (Mask_Reference);
|
||||
int counter = 0;
|
||||
for(osg::ref_ptr<TagBase> tag: selection)
|
||||
{
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
#include "../../model/world/idtable.hpp"
|
||||
#include "../../model/world/commands.hpp"
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "worldspacewidget.hpp"
|
||||
#include "object.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
InstanceSelectionMode::InstanceSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget)
|
||||
: SelectionMode(parent, worldspaceWidget, SceneUtil::Mask_EditorReference)
|
||||
: SelectionMode(parent, worldspaceWidget, Mask_Reference)
|
||||
{
|
||||
mSelectSame = new QAction("Extend selection to instances with same object ID", this);
|
||||
mDeleteSelection = new QAction("Delete selected instances", this);
|
||||
|
@ -38,12 +36,12 @@ namespace CSVRender
|
|||
|
||||
void InstanceSelectionMode::selectSame()
|
||||
{
|
||||
getWorldspaceWidget().selectAllWithSameParentId(SceneUtil::Mask_EditorReference);
|
||||
getWorldspaceWidget().selectAllWithSameParentId(Mask_Reference);
|
||||
}
|
||||
|
||||
void InstanceSelectionMode::deleteSelection()
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(SceneUtil::Mask_EditorReference);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(Mask_Reference);
|
||||
|
||||
CSMWorld::IdTable& referencesTable = dynamic_cast<CSMWorld::IdTable&>(
|
||||
*getWorldspaceWidget().getDocument().getData().getTableModel(CSMWorld::UniversalId::Type_References));
|
||||
|
|
32
apps/opencs/view/render/mask.hpp
Normal file
32
apps/opencs/view/render/mask.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef CSV_RENDER_ELEMENTS_H
|
||||
#define CSV_RENDER_ELEMENTS_H
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
|
||||
/// Node masks used on the OSG scene graph in OpenMW-CS.
|
||||
/// @note See the respective file in OpenMW (apps/openmw/mwrender/vismask.hpp)
|
||||
/// for general usage hints about node masks.
|
||||
/// @copydoc MWRender::VisMask
|
||||
enum Mask
|
||||
{
|
||||
// elements that are part of the actual scene
|
||||
Mask_Reference = 0x2,
|
||||
Mask_Pathgrid = 0x4,
|
||||
Mask_Water = 0x8,
|
||||
Mask_Fog = 0x10,
|
||||
Mask_Terrain = 0x20,
|
||||
|
||||
// used within models
|
||||
Mask_ParticleSystem = 0x100,
|
||||
|
||||
Mask_Lighting = 0x200,
|
||||
|
||||
// control elements
|
||||
Mask_CellMarker = 0x10000,
|
||||
Mask_CellArrow = 0x20000,
|
||||
Mask_CellBorder = 0x40000
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -29,9 +29,9 @@
|
|||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/sceneutil/lightutil.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "actor.hpp"
|
||||
#include "mask.hpp"
|
||||
|
||||
|
||||
const float CSVRender::Object::MarkerShaftWidth = 30;
|
||||
|
@ -58,7 +58,7 @@ namespace
|
|||
|
||||
|
||||
CSVRender::ObjectTag::ObjectTag (Object* object)
|
||||
: TagBase (SceneUtil::Mask_EditorReference), mObject (object)
|
||||
: TagBase (Mask_Reference), mObject (object)
|
||||
{}
|
||||
|
||||
QString CSVRender::ObjectTag::getToolTip (bool hideBasics) const
|
||||
|
@ -140,7 +140,7 @@ void CSVRender::Object::update()
|
|||
if (light)
|
||||
{
|
||||
bool isExterior = false; // FIXME
|
||||
SceneUtil::addLight(mBaseNode, light, isExterior);
|
||||
SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, Mask_Lighting, isExterior);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
|
|||
|
||||
parentNode->addChild (mRootNode);
|
||||
|
||||
mRootNode->setNodeMask(SceneUtil::Mask_EditorReference);
|
||||
mRootNode->setNodeMask(Mask_Reference);
|
||||
|
||||
if (referenceable)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../widget/scenetooltoggle2.hpp"
|
||||
|
||||
#include "editmode.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "cameracontroller.hpp"
|
||||
#include "cellarrow.hpp"
|
||||
#include "terraintexturemode.hpp"
|
||||
|
@ -126,8 +127,8 @@ void CSVRender::PagedWorldspaceWidget::addVisibilitySelectorButtons (
|
|||
CSVWidget::SceneToolToggle2 *tool)
|
||||
{
|
||||
WorldspaceWidget::addVisibilitySelectorButtons (tool);
|
||||
tool->addButton (Button_Terrain, SceneUtil::Mask_Terrain, "Terrain");
|
||||
//tool->addButton (Button_Fog, Mask_Fog, "Fog", "", true);
|
||||
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain");
|
||||
tool->addButton (Button_Fog, Mask_Fog, "Fog", "", true);
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
|
||||
|
@ -141,16 +142,16 @@ void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
|
|||
tool->addButton (
|
||||
new TerrainTextureMode (this, mRootNode, tool), "terrain-texture");
|
||||
tool->addButton (
|
||||
new EditMode (this, QIcon (":placeholder"), SceneUtil::Mask_EditorReference, "Terrain vertex paint editing"),
|
||||
new EditMode (this, QIcon (":placeholder"), Mask_Reference, "Terrain vertex paint editing"),
|
||||
"terrain-vertex");
|
||||
tool->addButton (
|
||||
new EditMode (this, QIcon (":placeholder"), SceneUtil::Mask_EditorReference, "Terrain movement"),
|
||||
new EditMode (this, QIcon (":placeholder"), Mask_Reference, "Terrain movement"),
|
||||
"terrain-move");
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::handleInteractionPress (const WorldspaceHitResult& hit, InteractionType type)
|
||||
{
|
||||
if (hit.tag && hit.tag->getMask()==SceneUtil::Mask_EditorCellArrow)
|
||||
if (hit.tag && hit.tag->getMask()==Mask_CellArrow)
|
||||
{
|
||||
if (CellArrowTag *cellArrowTag = dynamic_cast<CSVRender::CellArrowTag *> (hit.tag.get()))
|
||||
{
|
||||
|
@ -873,9 +874,9 @@ CSVWidget::SceneToolToggle2 *CSVRender::PagedWorldspaceWidget::makeControlVisibi
|
|||
mControlElements = new CSVWidget::SceneToolToggle2 (parent,
|
||||
"Controls & Guides Visibility", ":scenetoolbar/scene-view-marker-c", ":scenetoolbar/scene-view-marker-");
|
||||
|
||||
mControlElements->addButton (1, SceneUtil::Mask_EditorCellMarker, "Cell Marker");
|
||||
mControlElements->addButton (2, SceneUtil::Mask_EditorCellArrow, "Cell Arrows");
|
||||
mControlElements->addButton (4, SceneUtil::Mask_EditorCellBorder, "Cell Border");
|
||||
mControlElements->addButton (1, Mask_CellMarker, "Cell Marker");
|
||||
mControlElements->addButton (2, Mask_CellArrow, "Cell Arrows");
|
||||
mControlElements->addButton (4, Mask_CellBorder, "Cell Border");
|
||||
|
||||
mControlElements->setSelectionMask (0xffffffff);
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <osg/Vec3>
|
||||
|
||||
#include <components/sceneutil/pathgridutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../../model/world/cell.hpp"
|
||||
#include "../../model/world/commands.hpp"
|
||||
|
@ -32,7 +31,7 @@ namespace CSVRender
|
|||
};
|
||||
|
||||
PathgridTag::PathgridTag(Pathgrid* pathgrid)
|
||||
: TagBase(SceneUtil::Mask_Pathgrid), mPathgrid(pathgrid)
|
||||
: TagBase(Mask_Pathgrid), mPathgrid(pathgrid)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,7 +70,7 @@ namespace CSVRender
|
|||
mBaseNode->setPosition(osg::Vec3f(mCoords.getX() * CoordScalar, mCoords.getY() * CoordScalar, 0.f));
|
||||
mBaseNode->setUserData(mTag);
|
||||
mBaseNode->setUpdateCallback(new PathgridNodeCallback());
|
||||
mBaseNode->setNodeMask(SceneUtil::Mask_Pathgrid);
|
||||
mBaseNode->setNodeMask(Mask_Pathgrid);
|
||||
mParent->addChild(mBaseNode);
|
||||
|
||||
mPathgridGeode = new osg::Geode();
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <QPoint>
|
||||
|
||||
#include <components/sceneutil/pathgridutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../../model/prefs/state.hpp"
|
||||
|
||||
|
@ -16,6 +15,7 @@
|
|||
#include "../widget/scenetoolbar.hpp"
|
||||
|
||||
#include "cell.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "pathgrid.hpp"
|
||||
#include "pathgridselectionmode.hpp"
|
||||
#include "worldspacewidget.hpp"
|
||||
|
@ -23,7 +23,7 @@
|
|||
namespace CSVRender
|
||||
{
|
||||
PathgridMode::PathgridMode(WorldspaceWidget* worldspaceWidget, QWidget* parent)
|
||||
: EditMode(worldspaceWidget, QIcon(":placeholder"), SceneUtil::Mask_Pathgrid | SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference,
|
||||
: EditMode(worldspaceWidget, QIcon(":placeholder"), Mask_Pathgrid | Mask_Terrain | Mask_Reference,
|
||||
getTooltip(), parent)
|
||||
, mDragMode(DragMode_None)
|
||||
, mFromNode(0)
|
||||
|
@ -110,7 +110,7 @@ namespace CSVRender
|
|||
|
||||
void PathgridMode::primarySelectPressed(const WorldspaceHitResult& hit)
|
||||
{
|
||||
getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
|
||||
getWorldspaceWidget().clearSelection(Mask_Pathgrid);
|
||||
|
||||
if (hit.tag)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace CSVRender
|
|||
{
|
||||
if (tag->getPathgrid()->getId() != mLastId)
|
||||
{
|
||||
getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
|
||||
getWorldspaceWidget().clearSelection(Mask_Pathgrid);
|
||||
mLastId = tag->getPathgrid()->getId();
|
||||
}
|
||||
|
||||
|
@ -142,12 +142,12 @@ namespace CSVRender
|
|||
}
|
||||
}
|
||||
|
||||
getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
|
||||
getWorldspaceWidget().clearSelection(Mask_Pathgrid);
|
||||
}
|
||||
|
||||
bool PathgridMode::primaryEditStartDrag(const QPoint& pos)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||
|
||||
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ namespace CSVRender
|
|||
if (dynamic_cast<PathgridTag*>(hit.tag.get()))
|
||||
{
|
||||
primarySelectPressed(hit);
|
||||
selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
|
||||
selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace CSVRender
|
|||
{
|
||||
if (mDragMode == DragMode_Move)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(SceneUtil::Mask_Pathgrid);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(Mask_Pathgrid);
|
||||
|
||||
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
{
|
||||
|
@ -233,7 +233,7 @@ namespace CSVRender
|
|||
{
|
||||
if (mDragMode == DragMode_Move)
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
{
|
||||
if (PathgridTag* tag = dynamic_cast<PathgridTag*>(it->get()))
|
||||
|
@ -272,11 +272,11 @@ namespace CSVRender
|
|||
}
|
||||
|
||||
mDragMode = DragMode_None;
|
||||
getWorldspaceWidget().reset(SceneUtil::Mask_Pathgrid);
|
||||
getWorldspaceWidget().reset(Mask_Pathgrid);
|
||||
}
|
||||
|
||||
void PathgridMode::dragAborted()
|
||||
{
|
||||
getWorldspaceWidget().reset(SceneUtil::Mask_Pathgrid);
|
||||
getWorldspaceWidget().reset(Mask_Pathgrid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace CSVRender
|
||||
{
|
||||
PathgridSelectionMode::PathgridSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget)
|
||||
: SelectionMode(parent, worldspaceWidget, SceneUtil::Mask_Pathgrid)
|
||||
: SelectionMode(parent, worldspaceWidget, Mask_Pathgrid)
|
||||
{
|
||||
mRemoveSelectedNodes = new QAction("Remove selected nodes", this);
|
||||
mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this);
|
||||
|
@ -37,7 +37,7 @@ namespace CSVRender
|
|||
|
||||
void PathgridSelectionMode::removeSelectedNodes()
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||
|
||||
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace CSVRender
|
|||
|
||||
void PathgridSelectionMode::removeSelectedEdges()
|
||||
{
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
|
||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||
|
||||
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../widget/scenetoolmode.hpp"
|
||||
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "../../model/prefs/shortcuteventhandler.hpp"
|
||||
|
||||
#include "lighting.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "cameracontroller.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
|
@ -71,7 +71,7 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
|
||||
SceneUtil::LightManager* lightMgr = new SceneUtil::LightManager;
|
||||
lightMgr->setStartLight(1);
|
||||
lightMgr->setLightingMask(SceneUtil::Mask_Lighting);
|
||||
lightMgr->setLightingMask(Mask_Lighting);
|
||||
mRootNode = lightMgr;
|
||||
|
||||
mView->getCamera()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||
|
@ -88,8 +88,6 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
// Add ability to signal osg to show its statistics for debugging purposes
|
||||
mView->addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
mView->getCamera()->setCullMask(~(SceneUtil::Mask_UpdateVisitor));
|
||||
|
||||
viewer.addView(mView);
|
||||
viewer.setDone(false);
|
||||
viewer.realize();
|
||||
|
@ -122,7 +120,7 @@ void RenderWidget::flagAsModified()
|
|||
|
||||
void RenderWidget::setVisibilityMask(int mask)
|
||||
{
|
||||
mView->getCamera()->setCullMask(mask | SceneUtil::Mask_ParticleSystem | SceneUtil::Mask_Lighting);
|
||||
mView->getCamera()->setCullMask(mask | Mask_ParticleSystem | Mask_Lighting);
|
||||
}
|
||||
|
||||
osg::Camera *RenderWidget::getCamera()
|
||||
|
@ -212,7 +210,7 @@ SceneWidget::SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSyste
|
|||
mOrbitCamControl = new OrbitCameraController(this);
|
||||
mCurrentCamControl = mFreeCamControl;
|
||||
|
||||
mOrbitCamControl->setPickingMask(SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain);
|
||||
mOrbitCamControl->setPickingMask(Mask_Reference | Mask_Terrain);
|
||||
|
||||
mOrbitCamControl->setConstRoll( CSMPrefs::get()["3D Scene Input"]["navi-orbit-const-roll"].isTrue() );
|
||||
|
||||
|
@ -221,7 +219,7 @@ SceneWidget::SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSyste
|
|||
|
||||
setLighting(&mLightingDay);
|
||||
|
||||
mResourceSystem->getSceneManager()->setParticleSystemMask(SceneUtil::Mask_ParticleSystem);
|
||||
mResourceSystem->getSceneManager()->setParticleSystemMask(Mask_ParticleSystem);
|
||||
|
||||
// Recieve mouse move event even if mouse button is not pressed
|
||||
setMouseTracking(true);
|
||||
|
@ -350,7 +348,7 @@ void SceneWidget::update(double dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
mCurrentCamControl->setup(mRootNode, SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain, CameraController::WorldUp);
|
||||
mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp);
|
||||
mCamPositionSet = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "../widget/scenetoolmode.hpp"
|
||||
|
||||
#include "mask.hpp"
|
||||
|
||||
class QAction;
|
||||
|
||||
namespace CSVRender
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "tagbase.hpp"
|
||||
|
||||
CSVRender::TagBase::TagBase (SceneUtil::VisMask mask) : mMask (mask) {}
|
||||
CSVRender::TagBase::TagBase (Mask mask) : mMask (mask) {}
|
||||
|
||||
SceneUtil::VisMask CSVRender::TagBase::getMask() const
|
||||
CSVRender::Mask CSVRender::TagBase::getMask() const
|
||||
{
|
||||
return mMask;
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include "mask.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class TagBase : public osg::Referenced
|
||||
{
|
||||
SceneUtil::VisMask mMask;
|
||||
Mask mMask;
|
||||
|
||||
public:
|
||||
|
||||
TagBase (SceneUtil::VisMask mask);
|
||||
TagBase (Mask mask);
|
||||
|
||||
SceneUtil::VisMask getMask() const;
|
||||
Mask getMask() const;
|
||||
|
||||
virtual QString getToolTip (bool hideBasics) const;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include <components/esm/loadland.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../widget/brushshapes.hpp"
|
||||
#include "../widget/modebutton.hpp"
|
||||
|
@ -40,12 +39,13 @@
|
|||
#include "brushdraw.hpp"
|
||||
#include "editmode.hpp"
|
||||
#include "pagedworldspacewidget.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "tagbase.hpp"
|
||||
#include "terrainselection.hpp"
|
||||
#include "worldspacewidget.hpp"
|
||||
|
||||
CSVRender::TerrainShapeMode::TerrainShapeMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent)
|
||||
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-shape"}, SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference, "Terrain land editing", parent),
|
||||
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-shape"}, Mask_Terrain | Mask_Reference, "Terrain land editing", parent),
|
||||
mParentNode(parentNode)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <osg/Group>
|
||||
|
||||
#include <components/esm/loadland.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../widget/modebutton.hpp"
|
||||
#include "../widget/scenetoolbar.hpp"
|
||||
|
@ -37,11 +36,12 @@
|
|||
#include "brushdraw.hpp"
|
||||
#include "editmode.hpp"
|
||||
#include "pagedworldspacewidget.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "object.hpp" // Something small needed regarding pointers from here ()
|
||||
#include "worldspacewidget.hpp"
|
||||
|
||||
CSVRender::TerrainTextureMode::TerrainTextureMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent)
|
||||
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-texture"}, SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference, "Terrain texture editing", parent),
|
||||
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-texture"}, Mask_Terrain | Mask_Reference, "Terrain texture editing", parent),
|
||||
mBrushTexture("L0#0"),
|
||||
mBrushSize(1),
|
||||
mBrushShape(CSVWidget::BrushShape_Point),
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../widget/scenetooltoggle2.hpp"
|
||||
|
||||
#include "cameracontroller.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "tagbase.hpp"
|
||||
|
||||
void CSVRender::UnpagedWorldspaceWidget::update()
|
||||
|
@ -303,8 +304,8 @@ void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
|
|||
CSVWidget::SceneToolToggle2 *tool)
|
||||
{
|
||||
WorldspaceWidget::addVisibilitySelectorButtons (tool);
|
||||
tool->addButton (Button_Terrain, SceneUtil::Mask_Terrain, "Terrain", "", true);
|
||||
//tool->addButton (Button_Fog, Mask_Fog, "Fog");
|
||||
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain", "", true);
|
||||
tool->addButton (Button_Fog, Mask_Fog, "Fog");
|
||||
}
|
||||
|
||||
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
|
||||
|
|
|
@ -26,9 +26,8 @@
|
|||
#include "../widget/scenetooltoggle2.hpp"
|
||||
#include "../widget/scenetoolrun.hpp"
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "object.hpp"
|
||||
#include "mask.hpp"
|
||||
#include "instancemode.hpp"
|
||||
#include "pathgridmode.hpp"
|
||||
#include "cameracontroller.hpp"
|
||||
|
@ -139,7 +138,7 @@ void CSVRender::WorldspaceWidget::settingChanged (const CSMPrefs::Setting *setti
|
|||
{
|
||||
float alpha = setting->toDouble();
|
||||
// getSelection is virtual, thus this can not be called from the constructor
|
||||
auto selection = getSelection(SceneUtil::Mask_EditorReference);
|
||||
auto selection = getSelection(Mask_Reference);
|
||||
for (osg::ref_ptr<TagBase> tag : selection)
|
||||
{
|
||||
if (auto objTag = dynamic_cast<ObjectTag*>(tag.get()))
|
||||
|
@ -346,7 +345,7 @@ unsigned int CSVRender::WorldspaceWidget::getVisibilityMask() const
|
|||
|
||||
void CSVRender::WorldspaceWidget::setInteractionMask (unsigned int mask)
|
||||
{
|
||||
mInteractionMask = mask | SceneUtil::Mask_EditorCellMarker | SceneUtil::Mask_EditorCellArrow;
|
||||
mInteractionMask = mask | Mask_CellMarker | Mask_CellArrow;
|
||||
}
|
||||
|
||||
unsigned int CSVRender::WorldspaceWidget::getInteractionMask() const
|
||||
|
@ -362,9 +361,9 @@ void CSVRender::WorldspaceWidget::setEditLock (bool locked)
|
|||
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
|
||||
CSVWidget::SceneToolToggle2 *tool)
|
||||
{
|
||||
tool->addButton (Button_Reference, SceneUtil::Mask_EditorReference, "Instances");
|
||||
tool->addButton (Button_Water, SceneUtil::Mask_Water, "Water");
|
||||
tool->addButton (Button_Pathgrid, SceneUtil::Mask_Pathgrid, "Pathgrid");
|
||||
tool->addButton (Button_Reference, Mask_Reference, "Instances");
|
||||
tool->addButton (Button_Water, Mask_Water, "Water");
|
||||
tool->addButton (Button_Pathgrid, Mask_Pathgrid, "Pathgrid");
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../../model/world/tablemimedata.hpp"
|
||||
|
||||
#include "scenewidget.hpp"
|
||||
#include "mask.hpp"
|
||||
|
||||
namespace CSMPrefs
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <QString>
|
||||
#include <QtCore/qnamespace.h>
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
@ -155,6 +156,9 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
if (mHelpAction)
|
||||
menu.addAction (mHelpAction);
|
||||
|
||||
menu.exec (event->globalPos());
|
||||
}
|
||||
|
||||
|
@ -387,6 +391,13 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
|||
connect (mEditIdAction, SIGNAL (triggered()), this, SLOT (editCell()));
|
||||
addAction (mEditIdAction);
|
||||
|
||||
mHelpAction = new QAction (tr ("Help"), this);
|
||||
connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
mHelpAction->setIcon(QIcon(":/info.png"));
|
||||
addAction (mHelpAction);
|
||||
CSMPrefs::Shortcut* openHelpShortcut = new CSMPrefs::Shortcut("help", this);
|
||||
openHelpShortcut->associateAction(mHelpAction);
|
||||
|
||||
connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
||||
this, SLOT (tableSizeUpdate()));
|
||||
|
||||
|
@ -561,6 +572,11 @@ void CSVWorld::Table::editCell()
|
|||
emit editRequest(mEditIdAction->getCurrentId(), "");
|
||||
}
|
||||
|
||||
void CSVWorld::Table::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/tables.html");
|
||||
}
|
||||
|
||||
void CSVWorld::Table::viewRecord()
|
||||
{
|
||||
if (!(mModel->getFeatures() & CSMWorld::IdTableBase::Feature_View))
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace CSVWorld
|
|||
QAction *mPreviewAction;
|
||||
QAction *mExtendedDeleteAction;
|
||||
QAction *mExtendedRevertAction;
|
||||
QAction *mHelpAction;
|
||||
TableEditIdAction *mEditIdAction;
|
||||
CSMWorld::IdTableProxyModel *mProxyModel;
|
||||
CSMWorld::IdTableBase *mModel;
|
||||
|
@ -128,6 +129,8 @@ namespace CSVWorld
|
|||
|
||||
void editCell();
|
||||
|
||||
static void openHelp();
|
||||
|
||||
void editRecord();
|
||||
|
||||
void cloneRecord();
|
||||
|
|
|
@ -18,7 +18,7 @@ set(GAME_HEADER
|
|||
source_group(game FILES ${GAME} ${GAME_HEADER})
|
||||
|
||||
add_openmw_dir (mwrender
|
||||
actors objects renderingmanager animation rotatecontroller sky npcanimation
|
||||
actors objects renderingmanager animation rotatecontroller sky npcanimation vismask
|
||||
creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation
|
||||
bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation
|
||||
renderbin actoranimation landmanager navmesh actorspaths recastmesh
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <components/compiler/extensions0.hpp>
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/workqueue.hpp>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
@ -60,6 +59,8 @@
|
|||
#include "mwworld/player.hpp"
|
||||
#include "mwworld/worldimp.hpp"
|
||||
|
||||
#include "mwrender/vismask.hpp"
|
||||
|
||||
#include "mwclass/classes.hpp"
|
||||
|
||||
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||
|
@ -659,7 +660,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||
std::string myguiResources = (mResDir / "mygui").string();
|
||||
osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
|
||||
guiRoot->setName("GUI Root");
|
||||
guiRoot->setNodeMask(SceneUtil::Mask_GUI);
|
||||
guiRoot->setNodeMask(MWRender::Mask_GUI);
|
||||
rootNode->addChild(guiRoot);
|
||||
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(),
|
||||
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <components/esm/loadacti.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
@ -20,6 +19,7 @@
|
|||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace MWClass
|
|||
if (!model.empty())
|
||||
{
|
||||
renderingInterface.getObjects().insertModel(ptr, model, true);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace MWClass
|
|||
}
|
||||
}
|
||||
|
||||
if ((isLocked || isTrapped) && hasKey)
|
||||
if (isLocked && hasKey)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}");
|
||||
|
||||
|
@ -199,8 +199,7 @@ namespace MWClass
|
|||
Disable unilateral unlocking on this client and expect the server's reply to our
|
||||
packet to do it instead
|
||||
*/
|
||||
//if(isLocked)
|
||||
// ptr.getCellRef().unlock();
|
||||
//ptr.getCellRef().unlock();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <components/esm/loaddoor.hpp>
|
||||
#include <components/esm/doorstate.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwrender/animation.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace MWClass
|
|||
if (!model.empty())
|
||||
{
|
||||
renderingInterface.getObjects().insertModel(ptr, model, true);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ namespace MWClass
|
|||
}
|
||||
}
|
||||
|
||||
if ((isLocked || isTrapped) && hasKey)
|
||||
if (isLocked && hasKey)
|
||||
{
|
||||
if(actor == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
|
||||
|
@ -181,8 +181,7 @@ namespace MWClass
|
|||
Disable unilateral unlocking on this client and expect the server's reply to our
|
||||
packet to do it instead
|
||||
*/
|
||||
//if(isLocked)
|
||||
// ptr.getCellRef().unlock(); //Call the function here. because that makes sense.
|
||||
//ptr.getCellRef().unlock(); //Call the function here. because that makes sense.
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <components/esm/loadstat.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwphysics/physicssystem.hpp"
|
||||
|
@ -10,6 +9,7 @@
|
|||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace MWClass
|
|||
if (!model.empty())
|
||||
{
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -355,7 +355,6 @@ namespace MWGui
|
|||
{
|
||||
if (exit())
|
||||
{
|
||||
resetHistory();
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||
}
|
||||
}
|
||||
|
@ -476,8 +475,9 @@ namespace MWGui
|
|||
mDeleteLater.clear();
|
||||
}
|
||||
|
||||
void DialogueWindow::resetHistory()
|
||||
void DialogueWindow::onClose()
|
||||
{
|
||||
// Reset history
|
||||
for (DialogueText* text : mHistoryContents)
|
||||
delete text;
|
||||
mHistoryContents.clear();
|
||||
|
@ -663,7 +663,6 @@ namespace MWGui
|
|||
|
||||
void DialogueWindow::onGoodbyeActivated()
|
||||
{
|
||||
resetHistory();
|
||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
resetReference();
|
||||
|
@ -718,7 +717,6 @@ namespace MWGui
|
|||
|
||||
void DialogueWindow::onReferenceUnavailable()
|
||||
{
|
||||
resetHistory();
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@ namespace MWGui
|
|||
|
||||
void updateTopics();
|
||||
|
||||
void onClose();
|
||||
|
||||
protected:
|
||||
void updateTopicsPane();
|
||||
bool isCompanion(const MWWorld::Ptr& actor);
|
||||
|
@ -156,7 +158,6 @@ namespace MWGui
|
|||
void updateDisposition();
|
||||
void restock();
|
||||
void deleteLater();
|
||||
void resetHistory();
|
||||
|
||||
bool mIsCompanion;
|
||||
std::list<std::string> mKeywords;
|
||||
|
|
|
@ -756,7 +756,8 @@ namespace MWGui
|
|||
&& (type != typeid(ESM::Potion).name()))
|
||||
return;
|
||||
|
||||
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
|
||||
// An object that can be picked up must have a tooltip.
|
||||
if (!object.getClass().hasToolTip(object))
|
||||
return;
|
||||
|
||||
int count = object.getRefData().getCount();
|
||||
|
|
|
@ -116,6 +116,12 @@ void KeyboardNavigation::onFrame()
|
|||
if (!mEnabled)
|
||||
return;
|
||||
|
||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||
|
||||
if (focus == mCurrentFocus)
|
||||
|
@ -215,6 +221,9 @@ bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text, b
|
|||
|
||||
bool KeyboardNavigation::switchFocus(int direction, bool wrap)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
return false;
|
||||
|
||||
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||
|
||||
bool isCycle = (direction == D_Prev || direction == D_Next);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "loadingscreen.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <osg/Texture2D>
|
||||
|
@ -14,13 +16,14 @@
|
|||
#include <components/myguiplatform/myguitexture.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/vfs/manager.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "backgroundimage.hpp"
|
||||
|
||||
namespace MWGui
|
||||
|
@ -66,7 +69,7 @@ namespace MWGui
|
|||
mVFS->normalizeFilename(pattern);
|
||||
|
||||
/* priority given to the left */
|
||||
std::list<std::string> supported_extensions = {".tga", ".dds", ".ktx", ".png", ".bmp", ".jpeg", ".jpg"};
|
||||
const std::array<std::string, 7> supported_extensions {{".tga", ".dds", ".ktx", ".png", ".bmp", ".jpeg", ".jpg"}};
|
||||
|
||||
auto found = index.lower_bound(pattern);
|
||||
while (found != index.end())
|
||||
|
@ -77,7 +80,7 @@ namespace MWGui
|
|||
size_t pos = name.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
for(auto const extension: supported_extensions)
|
||||
for(auto const& extension: supported_extensions)
|
||||
{
|
||||
if (name.compare(pos, name.size() - pos, extension) == 0)
|
||||
{
|
||||
|
@ -334,8 +337,8 @@ namespace MWGui
|
|||
// Turn off rendering except the GUI
|
||||
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
|
||||
int oldCullMask = mViewer->getCamera()->getCullMask();
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(SceneUtil::Mask_GUI|SceneUtil::Mask_PreCompile);
|
||||
mViewer->getCamera()->setCullMask(SceneUtil::Mask_GUI|SceneUtil::Mask_PreCompile);
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile);
|
||||
|
||||
MWBase::Environment::get().getInputManager()->update(0, true, true);
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/workqueue.hpp>
|
||||
|
||||
#include <components/translation/translation.hpp>
|
||||
|
@ -63,6 +62,8 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
@ -2007,8 +2008,8 @@ namespace MWGui
|
|||
// Turn off all rendering except for the GUI
|
||||
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
|
||||
int oldCullMask = mViewer->getCamera()->getCullMask();
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(SceneUtil::Mask_GUI);
|
||||
mViewer->getCamera()->setCullMask(SceneUtil::Mask_GUI);
|
||||
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI);
|
||||
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI);
|
||||
|
||||
MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
sizeVideo(screenSize.width, screenSize.height);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <components/esm/esmwriter.hpp>
|
||||
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
@ -44,6 +43,8 @@
|
|||
|
||||
#include "../mwmechanics/aibreathe.hpp"
|
||||
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "spellcasting.hpp"
|
||||
#include "steering.hpp"
|
||||
#include "npcstats.hpp"
|
||||
|
@ -1543,11 +1544,11 @@ namespace MWMechanics
|
|||
const float dist = (player.getRefData().getPosition().asVec3() - ptr.getRefData().getPosition().asVec3()).length();
|
||||
if (dist > mActorsProcessingRange)
|
||||
{
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Actor);
|
||||
|
||||
// Fade away actors on large distance (>90% of actor's processing distance)
|
||||
float visibilityRatio = 1.0;
|
||||
|
@ -1925,12 +1926,12 @@ namespace MWMechanics
|
|||
|
||||
if (!inRange)
|
||||
{
|
||||
iter->first.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
iter->first.getRefData().getBaseNode()->setNodeMask(0);
|
||||
world->setActorCollisionMode(iter->first, false, false);
|
||||
continue;
|
||||
}
|
||||
else if (!isPlayer)
|
||||
iter->first.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
|
||||
iter->first.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Actor);
|
||||
|
||||
const bool isDead = iter->first.getClass().getCreatureStats(iter->first).isDead();
|
||||
if (!isDead && iter->first.getClass().getCreatureStats(iter->first).isParalyzed())
|
||||
|
|
|
@ -632,7 +632,9 @@ void CharacterController::refreshMovementAnims(const std::string& weapShortGroup
|
|||
// The first person anims don't have any velocity to calculate a speed multiplier from.
|
||||
// We use the third person velocities instead.
|
||||
// FIXME: should be pulled from the actual animation, but it is not presently loaded.
|
||||
mMovementAnimSpeed = (isSneaking() ? 33.5452f : (isRunning() ? 222.857f : 154.064f));
|
||||
bool sneaking = mMovementState == CharState_SneakForward || mMovementState == CharState_SneakBack
|
||||
|| mMovementState == CharState_SneakLeft || mMovementState == CharState_SneakRight;
|
||||
mMovementAnimSpeed = (sneaking ? 33.5452f : (isRunning() ? 222.857f : 154.064f));
|
||||
mMovementAnimationControlled = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ namespace MWMechanics
|
|||
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());
|
||||
osg::Vec3f pos2 (actor2.getRefData().getPosition().asVec3());
|
||||
|
||||
float d = getAggroDistance(actor2, pos1, pos2);
|
||||
float d = getAggroDistance(actor1, pos1, pos2);
|
||||
|
||||
static const int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
||||
"iFightDistanceBase")->mValue.getInteger();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/lightutil.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
|
@ -32,6 +31,8 @@
|
|||
#include "../mwmechanics/actorutil.hpp"
|
||||
#include "../mwmechanics/weapontype.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
|
@ -366,7 +367,7 @@ void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
|||
// Otherwise add the enchanted glow to it.
|
||||
if (!showHolsteredWeapons)
|
||||
{
|
||||
weaponNode->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
weaponNode->setNodeMask(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -540,7 +541,7 @@ void ActorAnimation::addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM
|
|||
bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior();
|
||||
|
||||
osg::Vec4f ambient(1,1,1,1);
|
||||
osg::ref_ptr<SceneUtil::LightSource> lightSource = SceneUtil::createLightSource(esmLight, exterior, ambient);
|
||||
osg::ref_ptr<SceneUtil::LightSource> lightSource = SceneUtil::createLightSource(esmLight, Mask_Lighting, exterior, ambient);
|
||||
|
||||
mInsert->addChild(lightSource);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "actorspaths.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
#include <components/sceneutil/agentpath.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace MWRender
|
|||
const auto newGroup = SceneUtil::createAgentPathGroup(path, halfExtents, start, end, settings);
|
||||
if (newGroup)
|
||||
{
|
||||
newGroup->setNodeMask(SceneUtil::Mask_Debug);
|
||||
newGroup->setNodeMask(Mask_Debug);
|
||||
mRootNode->addChild(newGroup);
|
||||
mGroups[actor] = newGroup;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <components/sceneutil/actorutil.hpp>
|
||||
#include <components/sceneutil/statesetupdater.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/lightutil.hpp>
|
||||
#include <components/sceneutil/skeleton.hpp>
|
||||
|
@ -45,6 +44,7 @@
|
|||
|
||||
#include "../mwmechanics/character.hpp" // FIXME: for MWMechanics::Priority
|
||||
|
||||
#include "vismask.hpp"
|
||||
#include "util.hpp"
|
||||
#include "rotatecontroller.hpp"
|
||||
|
||||
|
@ -578,7 +578,7 @@ namespace MWRender
|
|||
else
|
||||
{
|
||||
// Hide effect immediately
|
||||
node->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
node->setNodeMask(0);
|
||||
mFinished = true;
|
||||
}
|
||||
}
|
||||
|
@ -1595,7 +1595,7 @@ namespace MWRender
|
|||
{
|
||||
bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior();
|
||||
|
||||
SceneUtil::addLight(parent, esmLight, exterior);
|
||||
SceneUtil::addLight(parent, esmLight, Mask_ParticleSystem, Mask_Lighting, exterior);
|
||||
}
|
||||
|
||||
void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture)
|
||||
|
@ -1647,7 +1647,7 @@ namespace MWRender
|
|||
// FreezeOnCull doesn't work so well with effect particles, that tend to have moving emitters
|
||||
SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor;
|
||||
node->accept(disableFreezeOnCullVisitor);
|
||||
node->setNodeMask(SceneUtil::Mask_Effect);
|
||||
node->setNodeMask(Mask_Effect);
|
||||
|
||||
params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength();
|
||||
params.mLoop = loop;
|
||||
|
@ -1806,7 +1806,7 @@ namespace MWRender
|
|||
SceneUtil::configureLight(light, radius, isExterior);
|
||||
|
||||
mGlowLight = new SceneUtil::LightSource;
|
||||
mGlowLight->setNodeMask(SceneUtil::Mask_Lighting);
|
||||
mGlowLight->setNodeMask(Mask_Lighting);
|
||||
mInsert->addChild(mGlowLight);
|
||||
mGlowLight->setLight(light);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ void DebugDrawer::createGeometry()
|
|||
if (!mGeometry)
|
||||
{
|
||||
mGeometry = new osg::Geometry;
|
||||
mGeometry->setNodeMask(SceneUtil::Mask_Debug);
|
||||
mGeometry->setNodeMask(Mask_Debug);
|
||||
|
||||
mVertices = new osg::Vec3Array;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/shadow.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -28,6 +27,7 @@
|
|||
#include "../mwmechanics/weapontype.hpp"
|
||||
|
||||
#include "npcanimation.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace MWRender
|
|||
}
|
||||
else
|
||||
{
|
||||
node->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
node->setNodeMask(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,9 @@ namespace MWRender
|
|||
mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture);
|
||||
mCamera->setName("CharacterPreview");
|
||||
mCamera->setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
|
||||
mCamera->setCullMask(~(SceneUtil::Mask_UpdateVisitor));
|
||||
mCamera->setCullMask(~(Mask_UpdateVisitor));
|
||||
|
||||
mCamera->setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
mCamera->setNodeMask(Mask_RenderToTexture);
|
||||
|
||||
osg::ref_ptr<SceneUtil::LightManager> lightManager = new SceneUtil::LightManager;
|
||||
lightManager->setStartLight(1);
|
||||
|
@ -255,7 +255,7 @@ namespace MWRender
|
|||
|
||||
void CharacterPreview::redraw()
|
||||
{
|
||||
mCamera->setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
mCamera->setNodeMask(Mask_RenderToTexture);
|
||||
mDrawOnceCallback->redrawNextFrame();
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ namespace MWRender
|
|||
visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame());
|
||||
|
||||
osg::Node::NodeMask nodeMask = mCamera->getNodeMask();
|
||||
mCamera->setNodeMask(SceneUtil::Mask_Default);
|
||||
mCamera->setNodeMask(~0);
|
||||
mCamera->accept(visitor);
|
||||
mCamera->setNodeMask(nodeMask);
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <components/resource/scenemanager.hpp>
|
||||
|
||||
#include <components/sceneutil/controller.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "animation.hpp"
|
||||
#include "vismask.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace MWRender
|
||||
|
@ -29,7 +29,7 @@ void EffectManager::addEffect(const std::string &model, const std::string& textu
|
|||
{
|
||||
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(model);
|
||||
|
||||
node->setNodeMask(SceneUtil::Mask_Effect);
|
||||
node->setNodeMask(Mask_Effect);
|
||||
|
||||
Effect effect;
|
||||
effect.mAnimTime.reset(new EffectAnimationTime);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/sceneutil/workqueue.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <components/esm/globalmap.hpp>
|
||||
|
||||
|
@ -38,6 +37,8 @@
|
|||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -88,7 +89,7 @@ namespace
|
|||
{
|
||||
if (mParent->copyResult(static_cast<osg::Camera*>(node), nv->getTraversalNumber()))
|
||||
{
|
||||
node->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
node->setNodeMask(0);
|
||||
mParent->markForRemoval(static_cast<osg::Camera*>(node));
|
||||
}
|
||||
return;
|
||||
|
@ -323,7 +324,7 @@ namespace MWRender
|
|||
float srcLeft, float srcTop, float srcRight, float srcBottom)
|
||||
{
|
||||
osg::ref_ptr<osg::Camera> camera (new osg::Camera);
|
||||
camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
camera->setNodeMask(Mask_RenderToTexture);
|
||||
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
|
||||
camera->setViewMatrix(osg::Matrix::identity());
|
||||
camera->setProjectionMatrix(osg::Matrix::identity());
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <components/settings/settings.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/shadow.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/files/memorystream.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -26,6 +25,8 @@
|
|||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -41,7 +42,7 @@ namespace
|
|||
virtual void operator()(osg::Node* node, osg::NodeVisitor*)
|
||||
{
|
||||
if (mRendered)
|
||||
node->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
node->setNodeMask(0);
|
||||
|
||||
if (!mRendered)
|
||||
{
|
||||
|
@ -177,8 +178,8 @@ osg::ref_ptr<osg::Camera> LocalMap::createOrthographicCamera(float x, float y, f
|
|||
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
camera->setRenderOrder(osg::Camera::PRE_RENDER);
|
||||
|
||||
camera->setCullMask(SceneUtil::Mask_Scene | SceneUtil::Mask_SimpleWater | SceneUtil::Mask_Terrain | SceneUtil::Mask_Object | SceneUtil::Mask_Static);
|
||||
camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
camera->setCullMask(Mask_Scene | Mask_SimpleWater | Mask_Terrain | Mask_Object | Mask_Static);
|
||||
camera->setNodeMask(Mask_RenderToTexture);
|
||||
|
||||
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
|
||||
stateset->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL), osg::StateAttribute::OVERRIDE);
|
||||
|
@ -375,7 +376,7 @@ void LocalMap::requestExteriorMap(const MWWorld::CellStore* cell)
|
|||
void LocalMap::requestInteriorMap(const MWWorld::CellStore* cell)
|
||||
{
|
||||
osg::ComputeBoundsVisitor computeBoundsVisitor;
|
||||
computeBoundsVisitor.setTraversalMask(SceneUtil::Mask_Scene | SceneUtil::Mask_Terrain | SceneUtil::Mask_Object | SceneUtil::Mask_Static);
|
||||
computeBoundsVisitor.setTraversalMask(Mask_Scene | Mask_Terrain | Mask_Object | Mask_Static);
|
||||
mSceneRoot->accept(computeBoundsVisitor);
|
||||
|
||||
osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "navmesh.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
#include <components/sceneutil/navmesh.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace MWRender
|
|||
mGroup = SceneUtil::createNavMeshGroup(navMesh, settings);
|
||||
if (mGroup)
|
||||
{
|
||||
mGroup->setNodeMask(SceneUtil::Mask_Debug);
|
||||
mGroup->setNodeMask(Mask_Debug);
|
||||
mRootNode->addChild(mGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <components/sceneutil/actorutil.hpp>
|
||||
#include <components/sceneutil/attach.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/skeleton.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
@ -44,6 +43,7 @@
|
|||
#include "camera.hpp"
|
||||
#include "rotatecontroller.hpp"
|
||||
#include "renderbin.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ void NpcAnimation::updateNpcBase()
|
|||
|
||||
addAnimSource(smodel, smodel);
|
||||
|
||||
mObjectRoot->setNodeMask(SceneUtil::Mask_FirstPerson);
|
||||
mObjectRoot->setNodeMask(Mask_FirstPerson);
|
||||
mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/unrefqueue.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
@ -13,6 +12,8 @@
|
|||
#include "animation.hpp"
|
||||
#include "npcanimation.hpp"
|
||||
#include "creatureanimation.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ void Objects::insertBegin(const MWWorld::Ptr& ptr)
|
|||
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool animated, bool allowLight)
|
||||
{
|
||||
insertBegin(ptr);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Object);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Object);
|
||||
|
||||
osg::ref_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight));
|
||||
|
||||
|
@ -80,7 +81,7 @@ void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool
|
|||
void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, bool weaponsShields)
|
||||
{
|
||||
insertBegin(ptr);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
|
||||
|
||||
// CreatureAnimation
|
||||
osg::ref_ptr<Animation> anim;
|
||||
|
@ -97,7 +98,7 @@ void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, b
|
|||
void Objects::insertNPC(const MWWorld::Ptr &ptr)
|
||||
{
|
||||
insertBegin(ptr);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
|
||||
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
|
||||
|
||||
osg::ref_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem));
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <components/esm/loadpgrd.hpp>
|
||||
#include <components/sceneutil/pathgridutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -18,6 +17,8 @@
|
|||
#include "../mwmechanics/pathfinding.hpp"
|
||||
#include "../mwmechanics/coordinateconverter.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
|
@ -72,7 +73,7 @@ void Pathgrid::togglePathgrid()
|
|||
{
|
||||
// add path grid meshes to already loaded cells
|
||||
mPathGridRoot = new osg::Group;
|
||||
mPathGridRoot->setNodeMask(SceneUtil::Mask_Pathgrid);
|
||||
mPathGridRoot->setNodeMask(Mask_Debug);
|
||||
mRootNode->addChild(mPathGridRoot);
|
||||
|
||||
for(const MWWorld::CellStore* cell : mActiveCells)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "recastmesh.hpp"
|
||||
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/recastmesh.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
RecastMesh::RecastMesh(const osg::ref_ptr<osg::Group>& root, bool enabled)
|
||||
|
@ -49,7 +50,7 @@ namespace MWRender
|
|||
|| it->second.mRevision != tile->second->getRevision())
|
||||
{
|
||||
const auto group = SceneUtil::createRecastMeshGroup(*tile->second, settings);
|
||||
group->setNodeMask(SceneUtil::Mask_Debug);
|
||||
group->setNodeMask(Mask_Debug);
|
||||
mRootNode->removeChild(it->second.mValue);
|
||||
mRootNode->addChild(group);
|
||||
it->second.mValue = group;
|
||||
|
@ -66,7 +67,7 @@ namespace MWRender
|
|||
if (mGroups.count(tile.first))
|
||||
continue;
|
||||
const auto group = SceneUtil::createRecastMeshGroup(*tile.second, settings);
|
||||
group->setNodeMask(SceneUtil::Mask_Debug);
|
||||
group->setNodeMask(Mask_Debug);
|
||||
mGroups.emplace(tile.first, Group {tile.second->getGeneration(), tile.second->getRevision(), group});
|
||||
mRootNode->addChild(group);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <components/nifosg/nifloader.hpp>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
@ -40,7 +42,6 @@
|
|||
#include <components/sceneutil/unrefqueue.hpp>
|
||||
#include <components/sceneutil/writescene.hpp>
|
||||
#include <components/sceneutil/shadow.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <components/terrain/terraingrid.hpp>
|
||||
#include <components/terrain/quadtreeworld.hpp>
|
||||
|
@ -59,6 +60,7 @@
|
|||
#include "sky.hpp"
|
||||
#include "effectmanager.hpp"
|
||||
#include "npcanimation.hpp"
|
||||
#include "vismask.hpp"
|
||||
#include "pathgrid.hpp"
|
||||
#include "camera.hpp"
|
||||
#include "water.hpp"
|
||||
|
@ -216,7 +218,7 @@ namespace MWRender
|
|||
, mFieldOfViewOverride(0.f)
|
||||
, mBorders(false)
|
||||
{
|
||||
resourceSystem->getSceneManager()->setParticleSystemMask(SceneUtil::Mask_ParticleSystem);
|
||||
resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem);
|
||||
resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders");
|
||||
// Shadows and radial fog have problems with fixed-function mode
|
||||
bool forceShaders = Settings::Manager::getBool("radial fog", "Shaders") || Settings::Manager::getBool("force shaders", "Shaders") || Settings::Manager::getBool("enable shadows", "Shadows");
|
||||
|
@ -230,21 +232,21 @@ namespace MWRender
|
|||
resourceSystem->getSceneManager()->setSpecularMapPattern(Settings::Manager::getString("specular map pattern", "Shaders"));
|
||||
|
||||
osg::ref_ptr<SceneUtil::LightManager> sceneRoot = new SceneUtil::LightManager;
|
||||
sceneRoot->setLightingMask(SceneUtil::Mask_Lighting);
|
||||
sceneRoot->setLightingMask(Mask_Lighting);
|
||||
mSceneRoot = sceneRoot;
|
||||
sceneRoot->setStartLight(1);
|
||||
|
||||
int shadowCastingTraversalMask = SceneUtil::Mask_Scene;
|
||||
int shadowCastingTraversalMask = Mask_Scene;
|
||||
if (Settings::Manager::getBool("actor shadows", "Shadows"))
|
||||
shadowCastingTraversalMask |= SceneUtil::Mask_Actor;
|
||||
shadowCastingTraversalMask |= Mask_Actor;
|
||||
if (Settings::Manager::getBool("player shadows", "Shadows"))
|
||||
shadowCastingTraversalMask |= SceneUtil::Mask_Player;
|
||||
shadowCastingTraversalMask |= Mask_Player;
|
||||
if (Settings::Manager::getBool("terrain shadows", "Shadows"))
|
||||
shadowCastingTraversalMask |= SceneUtil::Mask_Terrain;
|
||||
shadowCastingTraversalMask |= Mask_Terrain;
|
||||
|
||||
int indoorShadowCastingTraversalMask = shadowCastingTraversalMask;
|
||||
if (Settings::Manager::getBool("object shadows", "Shadows"))
|
||||
shadowCastingTraversalMask |= (SceneUtil::Mask_Object|SceneUtil::Mask_Static);
|
||||
shadowCastingTraversalMask |= (Mask_Object|Mask_Static);
|
||||
|
||||
mShadowManager.reset(new SceneUtil::ShadowManager(sceneRoot, mRootNode, shadowCastingTraversalMask, indoorShadowCastingTraversalMask, mResourceSystem->getSceneManager()->getShaderManager()));
|
||||
|
||||
|
@ -280,8 +282,6 @@ namespace MWRender
|
|||
|
||||
mEffectManager.reset(new EffectManager(sceneRoot, mResourceSystem));
|
||||
|
||||
mWater.reset(new Water(mRootNode, sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), resourcePath));
|
||||
|
||||
DLLandFogStart = Settings::Manager::getFloat("distant land fog start", "Fog");
|
||||
DLLandFogEnd = Settings::Manager::getFloat("distant land fog end", "Fog");
|
||||
DLUnderwaterFogStart = Settings::Manager::getFloat("distant underwater fog start", "Fog");
|
||||
|
@ -311,20 +311,24 @@ namespace MWRender
|
|||
float maxCompGeometrySize = Settings::Manager::getFloat("max composite geometry size", "Terrain");
|
||||
maxCompGeometrySize = std::max(maxCompGeometrySize, 1.f);
|
||||
mTerrain.reset(new Terrain::QuadTreeWorld(
|
||||
sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, compMapResolution, compMapLevel, lodFactor, vertexLodMod, maxCompGeometrySize));
|
||||
sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile, Mask_Debug,
|
||||
compMapResolution, compMapLevel, lodFactor, vertexLodMod, maxCompGeometrySize));
|
||||
}
|
||||
else
|
||||
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage));
|
||||
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile, Mask_Debug));
|
||||
|
||||
mTerrain->setTargetFrameRate(Settings::Manager::getFloat("target framerate", "Cells"));
|
||||
mTerrain->setWorkQueue(mWorkQueue.get());
|
||||
|
||||
// water goes after terrain for correct waterculling order
|
||||
mWater.reset(new Water(mRootNode, sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), resourcePath));
|
||||
|
||||
mCamera.reset(new Camera(mViewer->getCamera()));
|
||||
|
||||
mViewer->setLightingMode(osgViewer::View::NO_LIGHT);
|
||||
|
||||
osg::ref_ptr<osg::LightSource> source = new osg::LightSource;
|
||||
source->setNodeMask(SceneUtil::Mask_Lighting);
|
||||
source->setNodeMask(Mask_Lighting);
|
||||
mSunLight = new osg::Light;
|
||||
source->setLight(mSunLight);
|
||||
mSunLight->setDiffuse(osg::Vec4f(0,0,0,1));
|
||||
|
@ -343,7 +347,7 @@ namespace MWRender
|
|||
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
|
||||
|
||||
sceneRoot->setNodeMask(SceneUtil::Mask_Scene);
|
||||
sceneRoot->setNodeMask(Mask_Scene);
|
||||
sceneRoot->setName("Scene Root");
|
||||
|
||||
mSky.reset(new SkyManager(sceneRoot, resourceSystem->getSceneManager()));
|
||||
|
@ -371,7 +375,8 @@ namespace MWRender
|
|||
mViewer->getCamera()->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
|
||||
mViewer->getCamera()->setCullingMode(cullingMode);
|
||||
|
||||
mViewer->getCamera()->setCullMask(~(SceneUtil::Mask_UpdateVisitor|SceneUtil::Mask_SimpleWater));
|
||||
mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater));
|
||||
NifOsg::Loader::setHiddenNodeMask(Mask_UpdateVisitor);
|
||||
|
||||
mNearClip = Settings::Manager::getFloat("near clip", "Camera");
|
||||
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
|
||||
|
@ -537,6 +542,8 @@ namespace MWRender
|
|||
|
||||
void RenderingManager::enableTerrain(bool enable)
|
||||
{
|
||||
if (!enable)
|
||||
mWater->setCullCallback(nullptr);
|
||||
mTerrain->enable(enable);
|
||||
}
|
||||
|
||||
|
@ -573,12 +580,12 @@ namespace MWRender
|
|||
else if (mode == Render_Scene)
|
||||
{
|
||||
int mask = mViewer->getCamera()->getCullMask();
|
||||
bool enabled = mask & SceneUtil::Mask_Scene;
|
||||
bool enabled = mask&Mask_Scene;
|
||||
enabled = !enabled;
|
||||
if (enabled)
|
||||
mask |= SceneUtil::Mask_Scene;
|
||||
mask |= Mask_Scene;
|
||||
else
|
||||
mask &= ~SceneUtil::Mask_Scene;
|
||||
mask &= ~Mask_Scene;
|
||||
mViewer->getCamera()->setCullMask(mask);
|
||||
return enabled;
|
||||
}
|
||||
|
@ -736,6 +743,7 @@ namespace MWRender
|
|||
|
||||
void RenderingManager::setWaterHeight(float height)
|
||||
{
|
||||
mWater->setCullCallback(mTerrain->getHeightCullCallback(height, Mask_Water));
|
||||
mWater->setHeight(height);
|
||||
mSky->setWaterHeight(height);
|
||||
}
|
||||
|
@ -743,18 +751,20 @@ namespace MWRender
|
|||
class NotifyDrawCompletedCallback : public osg::Camera::DrawCallback
|
||||
{
|
||||
public:
|
||||
NotifyDrawCompletedCallback()
|
||||
: mDone(false)
|
||||
NotifyDrawCompletedCallback(unsigned int frame)
|
||||
: mDone(false), mFrame(frame)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
mMutex.lock();
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mMutex);
|
||||
if (renderInfo.getState()->getFrameStamp()->getFrameNumber() >= mFrame)
|
||||
{
|
||||
mDone = true;
|
||||
mMutex.unlock();
|
||||
mCondition.signal();
|
||||
}
|
||||
}
|
||||
|
||||
void waitTillDone()
|
||||
{
|
||||
|
@ -768,6 +778,7 @@ namespace MWRender
|
|||
mutable OpenThreads::Condition mCondition;
|
||||
mutable OpenThreads::Mutex mMutex;
|
||||
mutable bool mDone;
|
||||
unsigned int mFrame;
|
||||
};
|
||||
|
||||
bool RenderingManager::screenshot360(osg::Image* image, std::string settingStr)
|
||||
|
@ -851,7 +862,7 @@ namespace MWRender
|
|||
int maskBackup = mPlayerAnimation->getObjectRoot()->getNodeMask();
|
||||
|
||||
if (mCamera->isFirstPerson())
|
||||
mPlayerAnimation->getObjectRoot()->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
mPlayerAnimation->getObjectRoot()->setNodeMask(0);
|
||||
|
||||
for (int i = 0; i < 6; ++i) // for each cubemap side
|
||||
{
|
||||
|
@ -925,7 +936,7 @@ namespace MWRender
|
|||
|
||||
void RenderingManager::renderCameraToImage(osg::Camera *camera, osg::Image *image, int w, int h)
|
||||
{
|
||||
camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
camera->setNodeMask(Mask_RenderToTexture);
|
||||
camera->attach(osg::Camera::COLOR_BUFFER, image);
|
||||
camera->setRenderOrder(osg::Camera::PRE_RENDER);
|
||||
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
|
||||
|
@ -947,7 +958,7 @@ namespace MWRender
|
|||
mRootNode->addChild(camera);
|
||||
|
||||
// The draw needs to complete before we can copy back our image.
|
||||
osg::ref_ptr<NotifyDrawCompletedCallback> callback (new NotifyDrawCompletedCallback);
|
||||
osg::ref_ptr<NotifyDrawCompletedCallback> callback (new NotifyDrawCompletedCallback(0));
|
||||
camera->setFinalDrawCallback(callback);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->getLoadingScreen()->loadingOn(false);
|
||||
|
@ -966,6 +977,51 @@ namespace MWRender
|
|||
mRootNode->removeChild(camera);
|
||||
}
|
||||
|
||||
class ReadImageFromFramebufferCallback : public osg::Drawable::DrawCallback
|
||||
{
|
||||
public:
|
||||
ReadImageFromFramebufferCallback(osg::Image* image, int width, int height)
|
||||
: mWidth(width), mHeight(height), mImage(image)
|
||||
{
|
||||
}
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* /*drawable*/) const
|
||||
{
|
||||
int screenW = renderInfo.getCurrentCamera()->getViewport()->width();
|
||||
int screenH = renderInfo.getCurrentCamera()->getViewport()->height();
|
||||
double imageaspect = (double)mWidth/(double)mHeight;
|
||||
int leftPadding = std::max(0, static_cast<int>(screenW - screenH * imageaspect) / 2);
|
||||
int topPadding = std::max(0, static_cast<int>(screenH - screenW / imageaspect) / 2);
|
||||
int width = screenW - leftPadding*2;
|
||||
int height = screenH - topPadding*2;
|
||||
mImage->readPixels(leftPadding, topPadding, width, height, GL_RGB, GL_UNSIGNED_BYTE);
|
||||
mImage->scaleImage(mWidth, mHeight, 1);
|
||||
}
|
||||
private:
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
osg::ref_ptr<osg::Image> mImage;
|
||||
};
|
||||
|
||||
void RenderingManager::screenshotFramebuffer(osg::Image* image, int w, int h)
|
||||
{
|
||||
osg::Camera* camera = mViewer->getCamera();
|
||||
osg::ref_ptr<osg::Drawable> tempDrw = new osg::Drawable;
|
||||
tempDrw->setDrawCallback(new ReadImageFromFramebufferCallback(image, w, h));
|
||||
tempDrw->setCullingActive(false);
|
||||
tempDrw->getOrCreateStateSet()->setRenderBinDetails(100, "RenderBin", osg::StateSet::USE_RENDERBIN_DETAILS); // so its after all scene bins but before POST_RENDER gui camera
|
||||
camera->addChild(tempDrw);
|
||||
osg::ref_ptr<NotifyDrawCompletedCallback> callback (new NotifyDrawCompletedCallback(mViewer->getFrameStamp()->getFrameNumber()));
|
||||
camera->setFinalDrawCallback(callback);
|
||||
mViewer->eventTraversal();
|
||||
mViewer->updateTraversal();
|
||||
mViewer->renderingTraversals();
|
||||
callback->waitTillDone();
|
||||
// now that we've "used up" the current frame, get a fresh frame number for the next frame() following after the screenshot is completed
|
||||
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
|
||||
camera->removeChild(tempDrw);
|
||||
camera->setFinalDrawCallback(nullptr);
|
||||
}
|
||||
|
||||
void RenderingManager::screenshot(osg::Image *image, int w, int h, osg::Matrixd cameraTransform)
|
||||
{
|
||||
osg::ref_ptr<osg::Camera> rttCamera (new osg::Camera);
|
||||
|
@ -978,7 +1034,7 @@ namespace MWRender
|
|||
rttCamera->addChild(mWater->getReflectionCamera());
|
||||
rttCamera->addChild(mWater->getRefractionCamera());
|
||||
|
||||
rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~SceneUtil::Mask_GUI));
|
||||
rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~Mask_GUI));
|
||||
|
||||
rttCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
@ -991,7 +1047,7 @@ namespace MWRender
|
|||
return osg::Vec4f();
|
||||
|
||||
osg::ComputeBoundsVisitor computeBoundsVisitor;
|
||||
computeBoundsVisitor.setTraversalMask(~(SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Effect));
|
||||
computeBoundsVisitor.setTraversalMask(~(Mask_ParticleSystem|Mask_Effect));
|
||||
ptr.getRefData().getBaseNode()->accept(computeBoundsVisitor);
|
||||
|
||||
osg::Matrix viewProj = mViewer->getCamera()->getViewMatrix() * mViewer->getCamera()->getProjectionMatrix();
|
||||
|
@ -1063,11 +1119,12 @@ namespace MWRender
|
|||
mIntersectionVisitor->setTraversalNumber(mViewer->getFrameStamp()->getFrameNumber());
|
||||
mIntersectionVisitor->setIntersector(intersector);
|
||||
|
||||
int mask = ~(SceneUtil::Mask_RenderToTexture|SceneUtil::Mask_Sky|SceneUtil::Mask_Pathgrid|SceneUtil::Mask_Debug|SceneUtil::Mask_Effect|SceneUtil::Mask_Water|SceneUtil::Mask_SimpleWater);
|
||||
int mask = ~0;
|
||||
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water|Mask_SimpleWater);
|
||||
if (ignorePlayer)
|
||||
mask &= ~(SceneUtil::Mask_Player);
|
||||
mask &= ~(Mask_Player);
|
||||
if (ignoreActors)
|
||||
mask &= ~(SceneUtil::Mask_Actor|SceneUtil::Mask_Player);
|
||||
mask &= ~(Mask_Actor|Mask_Player);
|
||||
|
||||
mIntersectionVisitor->setTraversalMask(mask);
|
||||
return mIntersectionVisitor;
|
||||
|
@ -1148,7 +1205,7 @@ namespace MWRender
|
|||
if (!mPlayerNode)
|
||||
{
|
||||
mPlayerNode = new SceneUtil::PositionAttitudeTransform;
|
||||
mPlayerNode->setNodeMask(SceneUtil::Mask_Player);
|
||||
mPlayerNode->setNodeMask(Mask_Player);
|
||||
mPlayerNode->setName("Player Root");
|
||||
mSceneRoot->addChild(mPlayerNode);
|
||||
}
|
||||
|
@ -1392,7 +1449,7 @@ namespace MWRender
|
|||
|
||||
osg::ref_ptr<const osg::Node> node = mResourceSystem->getSceneManager()->getTemplate(modelName);
|
||||
osg::ComputeBoundsVisitor computeBoundsVisitor;
|
||||
computeBoundsVisitor.setTraversalMask(~(SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Effect));
|
||||
computeBoundsVisitor.setTraversalMask(~(MWRender::Mask_ParticleSystem|MWRender::Mask_Effect));
|
||||
const_cast<osg::Node*>(node.get())->accept(computeBoundsVisitor);
|
||||
osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox();
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ namespace MWRender
|
|||
void setWaterHeight(float level);
|
||||
|
||||
/// Take a screenshot of w*h onto the given image, not including the GUI.
|
||||
void screenshot(osg::Image* image, int w, int h, osg::Matrixd cameraTransform=osg::Matrixd());
|
||||
void screenshot(osg::Image* image, int w, int h, osg::Matrixd cameraTransform=osg::Matrixd()); // make a new render at given size
|
||||
void screenshotFramebuffer(osg::Image* image, int w, int h); // copy directly from framebuffer and scale to given size
|
||||
bool screenshot360(osg::Image* image, std::string settingStr);
|
||||
|
||||
struct RayResult
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "vismask.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -103,7 +104,7 @@ RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem*
|
|||
mParticleNode->setName("Ripple Root");
|
||||
mParticleNode->addChild(updater);
|
||||
mParticleNode->addChild(mParticleSystem);
|
||||
mParticleNode->setNodeMask(SceneUtil::Mask_Water);
|
||||
mParticleNode->setNodeMask(Mask_Water);
|
||||
|
||||
createWaterRippleStateSet(resourceSystem, mParticleNode);
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@
|
|||
#include <components/sceneutil/statesetupdater.hpp>
|
||||
#include <components/sceneutil/controller.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/shadow.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
#include "renderbin.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -454,7 +454,7 @@ public:
|
|||
|
||||
void setVisible(bool visible)
|
||||
{
|
||||
mTransform->setNodeMask(visible ? mVisibleMask : SceneUtil::Mask_Disabled);
|
||||
mTransform->setNodeMask(visible ? mVisibleMask : 0);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -470,7 +470,7 @@ class Sun : public CelestialBody
|
|||
{
|
||||
public:
|
||||
Sun(osg::Group* parentNode, Resource::ImageManager& imageManager)
|
||||
: CelestialBody(parentNode, 1.0f, 1, SceneUtil::Mask_Sun)
|
||||
: CelestialBody(parentNode, 1.0f, 1, Mask_Sun)
|
||||
, mUpdater(new Updater)
|
||||
{
|
||||
mTransform->addUpdateCallback(mUpdater);
|
||||
|
@ -655,7 +655,7 @@ private:
|
|||
camera->setProjectionMatrix(osg::Matrix::identity());
|
||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); // add to skyRoot instead?
|
||||
camera->setViewMatrix(osg::Matrix::identity());
|
||||
camera->setClearMask(SceneUtil::Mask_Disabled);
|
||||
camera->setClearMask(0);
|
||||
camera->setRenderOrder(osg::Camera::NESTED_RENDER);
|
||||
camera->setAllowEventFocus(false);
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana
|
|||
skyroot->getOrCreateStateSet()->setAttributeAndModes(new osg::Program(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::PROTECTED|osg::StateAttribute::ON);
|
||||
SceneUtil::ShadowManager::disableShadowsForStateSet(skyroot->getOrCreateStateSet());
|
||||
|
||||
skyroot->setNodeMask(SceneUtil::Mask_Sky);
|
||||
skyroot->setNodeMask(Mask_Sky);
|
||||
parentNode->addChild(skyroot);
|
||||
|
||||
mRootNode = skyroot;
|
||||
|
@ -1177,7 +1177,7 @@ void SkyManager::create()
|
|||
mAtmosphereDay->addUpdateCallback(mAtmosphereUpdater);
|
||||
|
||||
mAtmosphereNightNode = new osg::PositionAttitudeTransform;
|
||||
mAtmosphereNightNode->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
mAtmosphereNightNode->setNodeMask(0);
|
||||
mEarlyRenderBinRoot->addChild(mAtmosphereNightNode);
|
||||
|
||||
osg::ref_ptr<osg::Node> atmosphereNight;
|
||||
|
@ -1210,7 +1210,7 @@ void SkyManager::create()
|
|||
mCloudUpdater2 = new CloudUpdater;
|
||||
mCloudUpdater2->setOpacity(0.f);
|
||||
mCloudMesh2->addUpdateCallback(mCloudUpdater2);
|
||||
mCloudMesh2->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
mCloudMesh2->setNodeMask(0);
|
||||
|
||||
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
|
||||
depth->setWriteMask(false);
|
||||
|
@ -1533,7 +1533,7 @@ void SkyManager::createRain()
|
|||
mRainFader = new RainFader(&mWeatherAlpha);
|
||||
mRainNode->addUpdateCallback(mRainFader);
|
||||
mRainNode->addCullCallback(mUnderwaterSwitch);
|
||||
mRainNode->setNodeMask(SceneUtil::Mask_WeatherParticles);
|
||||
mRainNode->setNodeMask(Mask_WeatherParticles);
|
||||
|
||||
mRootNode->addChild(mRainNode);
|
||||
}
|
||||
|
@ -1636,7 +1636,7 @@ void SkyManager::setEnabled(bool enabled)
|
|||
if (enabled && !mCreated)
|
||||
create();
|
||||
|
||||
mRootNode->setNodeMask(enabled ? SceneUtil::Mask_Sky : SceneUtil::Mask_Disabled);
|
||||
mRootNode->setNodeMask(enabled ? Mask_Sky : 0);
|
||||
|
||||
mEnabled = enabled;
|
||||
}
|
||||
|
@ -1729,7 +1729,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
|
|||
{
|
||||
mParticleNode = new osg::PositionAttitudeTransform;
|
||||
mParticleNode->addCullCallback(mUnderwaterSwitch);
|
||||
mParticleNode->setNodeMask(SceneUtil::Mask_WeatherParticles);
|
||||
mParticleNode->setNodeMask(Mask_WeatherParticles);
|
||||
mRootNode->addChild(mParticleNode);
|
||||
}
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
|
|||
|
||||
mCloudUpdater->setOpacity((1.f-mCloudBlendFactor));
|
||||
mCloudUpdater2->setOpacity(mCloudBlendFactor);
|
||||
mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
|
||||
mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? ~0 : 0);
|
||||
}
|
||||
|
||||
if (mCloudColour != weather.mFogColor)
|
||||
|
@ -1844,7 +1844,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
|
|||
mAtmosphereNightUpdater->setFade(mStarsOpacity);
|
||||
}
|
||||
|
||||
mAtmosphereNightNode->setNodeMask(weather.mNight ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
|
||||
mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0 : 0);
|
||||
|
||||
if (mRainFader)
|
||||
mRainFader->setAlpha(weather.mEffectFade * 0.6); // * Rain_Threshold?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef OPENMW_COMPONENTS_SCENEUTIL_VISMASK_H
|
||||
#define OPENMW_COMPONENTS_SCENEUTIL_VISMASK_H
|
||||
#ifndef OPENMW_MWRENDER_VISMASK_H
|
||||
#define OPENMW_MWRENDER_VISMASK_H
|
||||
|
||||
namespace SceneUtil
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
/// Node masks used for controlling visibility of game objects.
|
||||
|
@ -21,8 +21,6 @@ namespace SceneUtil
|
|||
/// compatibility if the enumeration values were to be changed. Feel free to change them when it makes sense.
|
||||
enum VisMask
|
||||
{
|
||||
Mask_Disabled = 0, // For hidden nodes
|
||||
|
||||
Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors
|
||||
|
||||
// child of Scene
|
||||
|
@ -55,19 +53,7 @@ namespace SceneUtil
|
|||
Mask_PreCompile = (1<<18),
|
||||
|
||||
// Set on a camera's cull mask to enable the LightManager
|
||||
Mask_Lighting = (1<<19),
|
||||
|
||||
// For pathgrid nodes debugging
|
||||
Mask_Pathgrid = (1<<20),
|
||||
|
||||
// Editor control elements
|
||||
Mask_EditorCellMarker = (1<<21),
|
||||
Mask_EditorCellArrow = (1<<22),
|
||||
Mask_EditorCellBorder = (1<<23),
|
||||
Mask_EditorReference = (1<<24),
|
||||
|
||||
// Default mask for OSG nodes
|
||||
Mask_Default = 0xffffffff
|
||||
Mask_Lighting = (1<<19)
|
||||
};
|
||||
|
||||
}
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include <components/sceneutil/shadow.hpp>
|
||||
#include <components/sceneutil/waterutil.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <components/misc/constants.hpp>
|
||||
|
||||
|
@ -41,6 +40,7 @@
|
|||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "vismask.hpp"
|
||||
#include "ripplesimulation.hpp"
|
||||
#include "renderbin.hpp"
|
||||
#include "util.hpp"
|
||||
|
@ -243,8 +243,8 @@ public:
|
|||
setName("RefractionCamera");
|
||||
setCullCallback(new InheritViewPointCallback);
|
||||
|
||||
setCullMask(SceneUtil::Mask_Effect|SceneUtil::Mask_Scene|SceneUtil::Mask_Object|SceneUtil::Mask_Static|SceneUtil::Mask_Terrain|SceneUtil::Mask_Actor|SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Sky|SceneUtil::Mask_Sun|SceneUtil::Mask_Player|SceneUtil::Mask_Lighting);
|
||||
setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
setCullMask(Mask_Effect|Mask_Scene|Mask_Object|Mask_Static|Mask_Terrain|Mask_Actor|Mask_ParticleSystem|Mask_Sky|Mask_Sun|Mask_Player|Mask_Lighting);
|
||||
setNodeMask(Mask_RenderToTexture);
|
||||
setViewport(0, 0, rttSize, rttSize);
|
||||
|
||||
// No need for Update traversal since the scene is already updated as part of the main scene graph
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
setCullCallback(new InheritViewPointCallback);
|
||||
|
||||
setInterior(isInterior);
|
||||
setNodeMask(SceneUtil::Mask_RenderToTexture);
|
||||
setNodeMask(Mask_RenderToTexture);
|
||||
|
||||
unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water");
|
||||
setViewport(0, 0, rttSize, rttSize);
|
||||
|
@ -372,11 +372,11 @@ public:
|
|||
int reflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
|
||||
reflectionDetail = std::min(4, std::max(isInterior ? 2 : 0, reflectionDetail));
|
||||
unsigned int extraMask = 0;
|
||||
if(reflectionDetail >= 1) extraMask |= SceneUtil::Mask_Terrain;
|
||||
if(reflectionDetail >= 2) extraMask |= SceneUtil::Mask_Static;
|
||||
if(reflectionDetail >= 3) extraMask |= SceneUtil::Mask_Effect|SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Object;
|
||||
if(reflectionDetail >= 4) extraMask |= SceneUtil::Mask_Player|SceneUtil::Mask_Actor;
|
||||
setCullMask(SceneUtil::Mask_Scene|SceneUtil::Mask_Sky|SceneUtil::Mask_Lighting|extraMask);
|
||||
if(reflectionDetail >= 1) extraMask |= Mask_Terrain;
|
||||
if(reflectionDetail >= 2) extraMask |= Mask_Static;
|
||||
if(reflectionDetail >= 3) extraMask |= Mask_Effect|Mask_ParticleSystem|Mask_Object;
|
||||
if(reflectionDetail >= 4) extraMask |= Mask_Player|Mask_Actor;
|
||||
setCullMask(Mask_Scene|Mask_Sky|Mask_Lighting|extraMask);
|
||||
}
|
||||
|
||||
void setWaterLevel(float waterLevel)
|
||||
|
@ -436,12 +436,13 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
|||
, mToggled(true)
|
||||
, mTop(0)
|
||||
, mInterior(false)
|
||||
, mCullCallback(nullptr)
|
||||
{
|
||||
mSimulation.reset(new RippleSimulation(mSceneRoot, resourceSystem));
|
||||
|
||||
mWaterGeom = SceneUtil::createWaterGeometry(Constants::CellSizeInUnits*150, 40, 900);
|
||||
mWaterGeom->setDrawCallback(new DepthClampCallback);
|
||||
mWaterGeom->setNodeMask(SceneUtil::Mask_Water);
|
||||
mWaterGeom->setNodeMask(Mask_Water);
|
||||
|
||||
mWaterNode = new osg::PositionAttitudeTransform;
|
||||
mWaterNode->setName("Water Root");
|
||||
|
@ -451,7 +452,7 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
|||
// simple water fallback for the local map
|
||||
osg::ref_ptr<osg::Geometry> geom2 (osg::clone(mWaterGeom.get(), osg::CopyOp::DEEP_COPY_NODES));
|
||||
createSimpleWaterStateSet(geom2, Fallback::Map::getFloat("Water_Map_Alpha"));
|
||||
geom2->setNodeMask(SceneUtil::Mask_SimpleWater);
|
||||
geom2->setNodeMask(Mask_SimpleWater);
|
||||
mWaterNode->addChild(geom2);
|
||||
|
||||
mSceneRoot->addChild(mWaterNode);
|
||||
|
@ -466,6 +467,29 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
|||
ico->add(mWaterNode);
|
||||
}
|
||||
|
||||
void Water::setCullCallback(osg::Callback* callback)
|
||||
{
|
||||
if (mCullCallback)
|
||||
{
|
||||
mWaterNode->removeCullCallback(mCullCallback);
|
||||
if (mReflection)
|
||||
mReflection->removeCullCallback(mCullCallback);
|
||||
if (mRefraction)
|
||||
mRefraction->removeCullCallback(mCullCallback);
|
||||
}
|
||||
|
||||
mCullCallback = callback;
|
||||
|
||||
if (callback)
|
||||
{
|
||||
mWaterNode->addCullCallback(callback);
|
||||
if (mReflection)
|
||||
mReflection->addCullCallback(callback);
|
||||
if (mRefraction)
|
||||
mRefraction->addCullCallback(callback);
|
||||
}
|
||||
}
|
||||
|
||||
osg::Uniform *Water::getRainIntensityUniform()
|
||||
{
|
||||
return mRainIntensityUniform.get();
|
||||
|
@ -491,6 +515,8 @@ void Water::updateWaterMaterial()
|
|||
mReflection = new Reflection(mInterior);
|
||||
mReflection->setWaterLevel(mTop);
|
||||
mReflection->setScene(mSceneRoot);
|
||||
if (mCullCallback)
|
||||
mReflection->addCullCallback(mCullCallback);
|
||||
mParent->addChild(mReflection);
|
||||
|
||||
if (Settings::Manager::getBool("refraction", "Water"))
|
||||
|
@ -498,6 +524,8 @@ void Water::updateWaterMaterial()
|
|||
mRefraction = new Refraction;
|
||||
mRefraction->setWaterLevel(mTop);
|
||||
mRefraction->setScene(mSceneRoot);
|
||||
if (mCullCallback)
|
||||
mRefraction->addCullCallback(mCullCallback);
|
||||
mParent->addChild(mRefraction);
|
||||
}
|
||||
|
||||
|
@ -706,11 +734,11 @@ void Water::update(float dt)
|
|||
void Water::updateVisible()
|
||||
{
|
||||
bool visible = mEnabled && mToggled;
|
||||
mWaterNode->setNodeMask(visible ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
|
||||
mWaterNode->setNodeMask(visible ? ~0 : 0);
|
||||
if (mRefraction)
|
||||
mRefraction->setNodeMask(visible ? SceneUtil::Mask_RenderToTexture : SceneUtil::Mask_Disabled);
|
||||
mRefraction->setNodeMask(visible ? Mask_RenderToTexture : 0);
|
||||
if (mReflection)
|
||||
mReflection->setNodeMask(visible ? SceneUtil::Mask_RenderToTexture : SceneUtil::Mask_Disabled);
|
||||
mReflection->setNodeMask(visible ? Mask_RenderToTexture : 0);
|
||||
}
|
||||
|
||||
bool Water::toggle()
|
||||
|
|
|
@ -71,6 +71,8 @@ namespace MWRender
|
|||
float mTop;
|
||||
bool mInterior;
|
||||
|
||||
osg::Callback* mCullCallback;
|
||||
|
||||
osg::Vec3f getSceneNodeCoordinates(int gridX, int gridY);
|
||||
void updateVisible();
|
||||
|
||||
|
@ -88,6 +90,8 @@ namespace MWRender
|
|||
const std::string& resourcePath);
|
||||
~Water();
|
||||
|
||||
void setCullCallback(osg::Callback* callback);
|
||||
|
||||
void listAssetsToPreload(std::vector<std::string>& textures);
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
|
|
|
@ -45,7 +45,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||
const std::vector<ESM::Header::MasterData> &masters = esm.getGameFiles();
|
||||
std::vector<ESM::ESMReader> *allPlugins = esm.getGlobalReaderList();
|
||||
for (size_t j = 0; j < masters.size(); j++) {
|
||||
ESM::Header::MasterData &mast = const_cast<ESM::Header::MasterData&>(masters[j]);
|
||||
const ESM::Header::MasterData &mast = masters[j];
|
||||
std::string fname = mast.name;
|
||||
int index = ~0;
|
||||
for (int i = 0; i < esm.getIndex(); i++) {
|
||||
|
@ -63,7 +63,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||
+ ", but it has not been loaded yet. Please check your load order.";
|
||||
esm.fail(fstring);
|
||||
}
|
||||
mast.index = index;
|
||||
esm.addParentFileIndex(index);
|
||||
}
|
||||
|
||||
// Loop through all records
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <components/sceneutil/controller.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
@ -36,6 +35,7 @@
|
|||
#include "../mwmechanics/weapontype.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
#include "../mwrender/util.hpp"
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace MWWorld
|
|||
bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, std::string texture)
|
||||
{
|
||||
state.mNode = new osg::PositionAttitudeTransform;
|
||||
state.mNode->setNodeMask(SceneUtil::Mask_Effect);
|
||||
state.mNode->setNodeMask(MWRender::Mask_Effect);
|
||||
state.mNode->setPosition(pos);
|
||||
state.mNode->setAttitude(orient);
|
||||
|
||||
|
@ -228,7 +228,7 @@ namespace MWWorld
|
|||
projectileLight->setPosition(osg::Vec4(pos, 1.0));
|
||||
|
||||
SceneUtil::LightSource* projectileLightSource = new SceneUtil::LightSource;
|
||||
projectileLightSource->setNodeMask(SceneUtil::Mask_Lighting);
|
||||
projectileLightSource->setNodeMask(MWRender::Mask_Lighting);
|
||||
projectileLightSource->setRadius(66.f);
|
||||
|
||||
state.mNode->addChild(projectileLightSource);
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <components/resource/resourcesystem.hpp>
|
||||
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/detournavigator/navigatorimpl.hpp>
|
||||
|
@ -69,6 +68,7 @@
|
|||
#include "../mwrender/npcanimation.hpp"
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
#include "../mwrender/camera.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "../mwscript/globalscripts.hpp"
|
||||
|
||||
|
@ -2566,7 +2566,7 @@ namespace MWWorld
|
|||
{
|
||||
// Adjust position so the location we wanted ends up in the middle of the object bounding box
|
||||
osg::ComputeBoundsVisitor computeBounds;
|
||||
computeBounds.setTraversalMask(~SceneUtil::Mask_ParticleSystem);
|
||||
computeBounds.setTraversalMask(~MWRender::Mask_ParticleSystem);
|
||||
dropped.getRefData().getBaseNode()->accept(computeBounds);
|
||||
osg::BoundingBox bounds = computeBounds.getBoundingBox();
|
||||
if (bounds.valid())
|
||||
|
@ -2847,7 +2847,7 @@ namespace MWWorld
|
|||
|
||||
void World::screenshot(osg::Image* image, int w, int h)
|
||||
{
|
||||
mRendering->screenshot(image, w, h);
|
||||
mRendering->screenshotFramebuffer(image, w, h);
|
||||
}
|
||||
|
||||
bool World::screenshot360(osg::Image* image, std::string settingStr)
|
||||
|
|
|
@ -11,10 +11,16 @@
|
|||
#include <boost/optional/optional_io.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <deque>
|
||||
|
||||
MATCHER_P3(Vec3fEq, x, y, z, "")
|
||||
{
|
||||
return std::abs(arg.x() - x) < 1e-4 && std::abs(arg.y() - y) < 1e-4 && std::abs(arg.z() - z) < 1e-4;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace testing;
|
||||
|
@ -113,31 +119,31 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
osg::Vec3f(215, -215, 1.87718021869659423828125),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.85963428020477294921875),
|
||||
Vec3fEq(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
Vec3fEq(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
Vec3fEq(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
Vec3fEq(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
Vec3fEq(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
Vec3fEq(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
Vec3fEq(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
Vec3fEq(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
Vec3fEq(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
Vec3fEq(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
Vec3fEq(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
Vec3fEq(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
Vec3fEq(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
Vec3fEq(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
Vec3fEq(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
Vec3fEq(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
Vec3fEq(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
Vec3fEq(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
Vec3fEq(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
Vec3fEq(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
Vec3fEq(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
Vec3fEq(215, -215, 1.87718021869659423828125)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, add_object_should_change_navmesh)
|
||||
|
@ -163,31 +169,31 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
osg::Vec3f(215, -215, 1.87718021869659423828125),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.85963428020477294921875),
|
||||
Vec3fEq(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
Vec3fEq(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
Vec3fEq(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
Vec3fEq(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
Vec3fEq(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
Vec3fEq(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
Vec3fEq(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
Vec3fEq(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
Vec3fEq(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
Vec3fEq(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
Vec3fEq(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
Vec3fEq(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
Vec3fEq(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
Vec3fEq(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
Vec3fEq(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
Vec3fEq(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
Vec3fEq(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
Vec3fEq(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
Vec3fEq(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
Vec3fEq(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
Vec3fEq(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
Vec3fEq(215, -215, 1.87718021869659423828125)
|
||||
));
|
||||
|
||||
mNavigator->addObject(ObjectId(&compoundShape), compoundShape, btTransform::getIdentity());
|
||||
mNavigator->update(mPlayerPosition);
|
||||
|
@ -197,31 +203,31 @@ namespace
|
|||
mOut = std::back_inserter(mPath);
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.87826788425445556640625),
|
||||
osg::Vec3f(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
|
||||
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
|
||||
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
|
||||
osg::Vec3f(-154.1872711181640625, 119.36397552490234375, -19.837890625),
|
||||
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
|
||||
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
|
||||
osg::Vec3f(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
|
||||
osg::Vec3f(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
|
||||
osg::Vec3f(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
|
||||
osg::Vec3f(-62.968158721923828125, -24.0900936126708984375, -33.50289154052734375),
|
||||
osg::Vec3f(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
|
||||
osg::Vec3f(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
|
||||
osg::Vec3f(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
|
||||
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
|
||||
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
|
||||
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
|
||||
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
|
||||
osg::Vec3f(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
|
||||
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
|
||||
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
|
||||
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
|
||||
osg::Vec3f(215, -215, 1.87826788425445556640625),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.87826788425445556640625),
|
||||
Vec3fEq(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
|
||||
Vec3fEq(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
|
||||
Vec3fEq(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
|
||||
Vec3fEq(-154.1872711181640625, 119.36397552490234375, -19.837890625),
|
||||
Vec3fEq(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
|
||||
Vec3fEq(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
|
||||
Vec3fEq(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
|
||||
Vec3fEq(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
|
||||
Vec3fEq(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
|
||||
Vec3fEq(-62.968158721923828125, -24.0900936126708984375, -33.50289154052734375),
|
||||
Vec3fEq(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
|
||||
Vec3fEq(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
|
||||
Vec3fEq(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
|
||||
Vec3fEq(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
|
||||
Vec3fEq(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
|
||||
Vec3fEq(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
|
||||
Vec3fEq(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
|
||||
Vec3fEq(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
|
||||
Vec3fEq(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
|
||||
Vec3fEq(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
|
||||
Vec3fEq(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
|
||||
Vec3fEq(215, -215, 1.87826788425445556640625)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, update_changed_object_should_change_navmesh)
|
||||
|
@ -248,31 +254,31 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.87826788425445556640625),
|
||||
osg::Vec3f(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
|
||||
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
|
||||
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
|
||||
osg::Vec3f(-154.1872711181640625, 119.36397552490234375, -19.837890625),
|
||||
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
|
||||
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
|
||||
osg::Vec3f(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
|
||||
osg::Vec3f(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
|
||||
osg::Vec3f(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
|
||||
osg::Vec3f(-62.968158721923828125, -24.0900936126708984375, -33.50289154052734375),
|
||||
osg::Vec3f(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
|
||||
osg::Vec3f(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
|
||||
osg::Vec3f(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
|
||||
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
|
||||
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
|
||||
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
|
||||
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
|
||||
osg::Vec3f(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
|
||||
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
|
||||
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
|
||||
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
|
||||
osg::Vec3f(215, -215, 1.87826788425445556640625),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.87826788425445556640625),
|
||||
Vec3fEq(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
|
||||
Vec3fEq(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
|
||||
Vec3fEq(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
|
||||
Vec3fEq(-154.1872711181640625, 119.36397552490234375, -19.837890625),
|
||||
Vec3fEq(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
|
||||
Vec3fEq(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
|
||||
Vec3fEq(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
|
||||
Vec3fEq(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
|
||||
Vec3fEq(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
|
||||
Vec3fEq(-62.968158721923828125, -24.0900936126708984375, -33.50289154052734375),
|
||||
Vec3fEq(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
|
||||
Vec3fEq(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
|
||||
Vec3fEq(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
|
||||
Vec3fEq(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
|
||||
Vec3fEq(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
|
||||
Vec3fEq(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
|
||||
Vec3fEq(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
|
||||
Vec3fEq(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
|
||||
Vec3fEq(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
|
||||
Vec3fEq(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
|
||||
Vec3fEq(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
|
||||
Vec3fEq(215, -215, 1.87826788425445556640625)
|
||||
));
|
||||
|
||||
compoundShape.updateChildTransform(0, btTransform(btMatrix3x3::getIdentity(), btVector3(1000, 0, 0)));
|
||||
|
||||
|
@ -284,31 +290,31 @@ namespace
|
|||
mOut = std::back_inserter(mPath);
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
osg::Vec3f(215, -215, 1.87718021869659423828125),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.85963428020477294921875),
|
||||
Vec3fEq(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
Vec3fEq(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
Vec3fEq(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
Vec3fEq(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
Vec3fEq(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
Vec3fEq(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
Vec3fEq(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
Vec3fEq(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
Vec3fEq(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
Vec3fEq(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
Vec3fEq(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
Vec3fEq(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
Vec3fEq(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
Vec3fEq(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
Vec3fEq(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
Vec3fEq(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
Vec3fEq(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
Vec3fEq(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
Vec3fEq(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
Vec3fEq(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
Vec3fEq(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
Vec3fEq(215, -215, 1.87718021869659423828125)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, for_overlapping_heightfields_should_use_higher)
|
||||
|
@ -341,31 +347,31 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.96328866481781005859375),
|
||||
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -0.242215454578399658203125),
|
||||
osg::Vec3f(-174.930633544921875, 174.930633544921875, -2.447719097137451171875),
|
||||
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -4.65322399139404296875),
|
||||
osg::Vec3f(-134.86126708984375, 134.86126708984375, -6.858726978302001953125),
|
||||
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -9.06423282623291015625),
|
||||
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -11.26973628997802734375),
|
||||
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -13.26497173309326171875),
|
||||
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -15.24860477447509765625),
|
||||
osg::Vec3f(-34.68780517578125, 34.68780517578125, -17.23223876953125),
|
||||
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -19.215869903564453125),
|
||||
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -20.1338443756103515625),
|
||||
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -18.1502132415771484375),
|
||||
osg::Vec3f(45.450958251953125, -45.450958251953125, -16.1665802001953125),
|
||||
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -14.18294620513916015625),
|
||||
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -12.199314117431640625),
|
||||
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -10.08488368988037109375),
|
||||
osg::Vec3f(125.5897216796875, -125.5897216796875, -7.87938022613525390625),
|
||||
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -5.673875331878662109375),
|
||||
osg::Vec3f(165.659088134765625, -165.659088134765625, -3.468370914459228515625),
|
||||
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -1.26286637783050537109375),
|
||||
osg::Vec3f(205.7284698486328125, -205.7284698486328125, 0.942641556262969970703125),
|
||||
osg::Vec3f(215, -215, 1.96328866481781005859375),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.96328866481781005859375),
|
||||
Vec3fEq(-194.9653167724609375, 194.9653167724609375, -0.242215454578399658203125),
|
||||
Vec3fEq(-174.930633544921875, 174.930633544921875, -2.447719097137451171875),
|
||||
Vec3fEq(-154.8959503173828125, 154.8959503173828125, -4.65322399139404296875),
|
||||
Vec3fEq(-134.86126708984375, 134.86126708984375, -6.858726978302001953125),
|
||||
Vec3fEq(-114.82657623291015625, 114.82657623291015625, -9.06423282623291015625),
|
||||
Vec3fEq(-94.7918853759765625, 94.7918853759765625, -11.26973628997802734375),
|
||||
Vec3fEq(-74.75719451904296875, 74.75719451904296875, -13.26497173309326171875),
|
||||
Vec3fEq(-54.722499847412109375, 54.722499847412109375, -15.24860477447509765625),
|
||||
Vec3fEq(-34.68780517578125, 34.68780517578125, -17.23223876953125),
|
||||
Vec3fEq(-14.6531162261962890625, 14.6531162261962890625, -19.215869903564453125),
|
||||
Vec3fEq(5.3815765380859375, -5.3815765380859375, -20.1338443756103515625),
|
||||
Vec3fEq(25.41626739501953125, -25.41626739501953125, -18.1502132415771484375),
|
||||
Vec3fEq(45.450958251953125, -45.450958251953125, -16.1665802001953125),
|
||||
Vec3fEq(65.48564910888671875, -65.48564910888671875, -14.18294620513916015625),
|
||||
Vec3fEq(85.5203399658203125, -85.5203399658203125, -12.199314117431640625),
|
||||
Vec3fEq(105.55503082275390625, -105.55503082275390625, -10.08488368988037109375),
|
||||
Vec3fEq(125.5897216796875, -125.5897216796875, -7.87938022613525390625),
|
||||
Vec3fEq(145.6244049072265625, -145.6244049072265625, -5.673875331878662109375),
|
||||
Vec3fEq(165.659088134765625, -165.659088134765625, -3.468370914459228515625),
|
||||
Vec3fEq(185.6937713623046875, -185.6937713623046875, -1.26286637783050537109375),
|
||||
Vec3fEq(205.7284698486328125, -205.7284698486328125, 0.942641556262969970703125),
|
||||
Vec3fEq(215, -215, 1.96328866481781005859375)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, path_should_be_around_avoid_shape)
|
||||
|
@ -397,32 +403,32 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.9393787384033203125),
|
||||
osg::Vec3f(-200.8159637451171875, 190.47265625, -0.639537751674652099609375),
|
||||
osg::Vec3f(-186.6319427490234375, 165.9453125, -3.2184507846832275390625),
|
||||
osg::Vec3f(-172.447906494140625, 141.41796875, -5.797363758087158203125),
|
||||
osg::Vec3f(-158.263885498046875, 116.8906097412109375, -8.37627696990966796875),
|
||||
osg::Vec3f(-144.079864501953125, 92.3632659912109375, -10.9551906585693359375),
|
||||
osg::Vec3f(-129.89581298828125, 67.83591461181640625, -13.53410625457763671875),
|
||||
osg::Vec3f(-115.7117919921875, 43.308563232421875, -16.1130199432373046875),
|
||||
osg::Vec3f(-101.5277557373046875, 18.7812137603759765625, -18.6919345855712890625),
|
||||
osg::Vec3f(-87.34372711181640625, -5.7461376190185546875, -20.4680538177490234375),
|
||||
osg::Vec3f(-67.02922821044921875, -25.4970550537109375, -20.514247894287109375),
|
||||
osg::Vec3f(-46.714717864990234375, -45.2479705810546875, -20.560443878173828125),
|
||||
osg::Vec3f(-26.40021514892578125, -64.99889373779296875, -20.6066417694091796875),
|
||||
osg::Vec3f(-6.085712432861328125, -84.74980926513671875, -20.652835845947265625),
|
||||
osg::Vec3f(14.22879505157470703125, -104.50072479248046875, -18.151397705078125),
|
||||
osg::Vec3f(39.05098724365234375, -118.16222381591796875, -15.66748714447021484375),
|
||||
osg::Vec3f(63.87317657470703125, -131.82373046875, -13.18358135223388671875),
|
||||
osg::Vec3f(88.69537353515625, -145.4852142333984375, -10.699672698974609375),
|
||||
osg::Vec3f(113.51757049560546875, -159.146697998046875, -8.21576786041259765625),
|
||||
osg::Vec3f(138.3397674560546875, -172.808197021484375, -5.731859683990478515625),
|
||||
osg::Vec3f(163.1619720458984375, -186.469696044921875, -3.2479507923126220703125),
|
||||
osg::Vec3f(187.984161376953125, -200.1311798095703125, -0.764044821262359619140625),
|
||||
osg::Vec3f(212.8063507080078125, -213.7926788330078125, 1.719865322113037109375),
|
||||
osg::Vec3f(215, -215, 1.9393787384033203125),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.9393787384033203125),
|
||||
Vec3fEq(-200.8159637451171875, 190.47265625, -0.639537751674652099609375),
|
||||
Vec3fEq(-186.6319427490234375, 165.9453125, -3.2184507846832275390625),
|
||||
Vec3fEq(-172.447906494140625, 141.41796875, -5.797363758087158203125),
|
||||
Vec3fEq(-158.263885498046875, 116.8906097412109375, -8.37627696990966796875),
|
||||
Vec3fEq(-144.079864501953125, 92.3632659912109375, -10.9551906585693359375),
|
||||
Vec3fEq(-129.89581298828125, 67.83591461181640625, -13.53410625457763671875),
|
||||
Vec3fEq(-115.7117919921875, 43.308563232421875, -16.1130199432373046875),
|
||||
Vec3fEq(-101.5277557373046875, 18.7812137603759765625, -18.6919345855712890625),
|
||||
Vec3fEq(-87.34372711181640625, -5.7461376190185546875, -20.4680538177490234375),
|
||||
Vec3fEq(-67.02922821044921875, -25.4970550537109375, -20.514247894287109375),
|
||||
Vec3fEq(-46.714717864990234375, -45.2479705810546875, -20.560443878173828125),
|
||||
Vec3fEq(-26.40021514892578125, -64.99889373779296875, -20.6066417694091796875),
|
||||
Vec3fEq(-6.085712432861328125, -84.74980926513671875, -20.652835845947265625),
|
||||
Vec3fEq(14.22879505157470703125, -104.50072479248046875, -18.151397705078125),
|
||||
Vec3fEq(39.05098724365234375, -118.16222381591796875, -15.66748714447021484375),
|
||||
Vec3fEq(63.87317657470703125, -131.82373046875, -13.18358135223388671875),
|
||||
Vec3fEq(88.69537353515625, -145.4852142333984375, -10.699672698974609375),
|
||||
Vec3fEq(113.51757049560546875, -159.146697998046875, -8.21576786041259765625),
|
||||
Vec3fEq(138.3397674560546875, -172.808197021484375, -5.731859683990478515625),
|
||||
Vec3fEq(163.1619720458984375, -186.469696044921875, -3.2479507923126220703125),
|
||||
Vec3fEq(187.984161376953125, -200.1311798095703125, -0.764044821262359619140625),
|
||||
Vec3fEq(212.8063507080078125, -213.7926788330078125, 1.719865322113037109375),
|
||||
Vec3fEq(215, -215, 1.9393787384033203125)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_ground_lower_than_water_with_only_swim_flag)
|
||||
|
@ -590,26 +596,26 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(0, 215, -94.75363922119140625),
|
||||
osg::Vec3f(9.8083515167236328125, 188.4185333251953125, -105.199951171875),
|
||||
osg::Vec3f(19.6167049407958984375, 161.837066650390625, -114.25495147705078125),
|
||||
osg::Vec3f(29.42505645751953125, 135.255615234375, -123.309967041015625),
|
||||
osg::Vec3f(39.23340606689453125, 108.674163818359375, -132.3649749755859375),
|
||||
osg::Vec3f(49.04175567626953125, 82.09270477294921875, -137.2874755859375),
|
||||
osg::Vec3f(58.8501129150390625, 55.5112457275390625, -139.2451171875),
|
||||
osg::Vec3f(68.6584625244140625, 28.9297885894775390625, -141.2027740478515625),
|
||||
osg::Vec3f(78.4668121337890625, 2.3483295440673828125, -143.1604156494140625),
|
||||
osg::Vec3f(88.27516937255859375, -24.233127593994140625, -141.3894805908203125),
|
||||
osg::Vec3f(83.73651885986328125, -52.2005767822265625, -142.3761444091796875),
|
||||
osg::Vec3f(79.19786834716796875, -80.16802978515625, -143.114837646484375),
|
||||
osg::Vec3f(64.8477935791015625, -104.598602294921875, -137.840911865234375),
|
||||
osg::Vec3f(50.497714996337890625, -129.0291748046875, -131.45831298828125),
|
||||
osg::Vec3f(36.147632598876953125, -153.459747314453125, -121.42321014404296875),
|
||||
osg::Vec3f(21.7975559234619140625, -177.8903350830078125, -111.38811492919921875),
|
||||
osg::Vec3f(7.44747829437255859375, -202.3209075927734375, -101.19382476806640625),
|
||||
osg::Vec3f(0, -215, -94.75363922119140625),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(0, 215, -94.75363922119140625),
|
||||
Vec3fEq(9.8083515167236328125, 188.4185333251953125, -105.199951171875),
|
||||
Vec3fEq(19.6167049407958984375, 161.837066650390625, -114.25495147705078125),
|
||||
Vec3fEq(29.42505645751953125, 135.255615234375, -123.309967041015625),
|
||||
Vec3fEq(39.23340606689453125, 108.674163818359375, -132.3649749755859375),
|
||||
Vec3fEq(49.04175567626953125, 82.09270477294921875, -137.2874755859375),
|
||||
Vec3fEq(58.8501129150390625, 55.5112457275390625, -139.2451171875),
|
||||
Vec3fEq(68.6584625244140625, 28.9297885894775390625, -141.2027740478515625),
|
||||
Vec3fEq(78.4668121337890625, 2.3483295440673828125, -143.1604156494140625),
|
||||
Vec3fEq(88.27516937255859375, -24.233127593994140625, -141.3894805908203125),
|
||||
Vec3fEq(83.73651885986328125, -52.2005767822265625, -142.3761444091796875),
|
||||
Vec3fEq(79.19786834716796875, -80.16802978515625, -143.114837646484375),
|
||||
Vec3fEq(64.8477935791015625, -104.598602294921875, -137.840911865234375),
|
||||
Vec3fEq(50.497714996337890625, -129.0291748046875, -131.45831298828125),
|
||||
Vec3fEq(36.147632598876953125, -153.459747314453125, -121.42321014404296875),
|
||||
Vec3fEq(21.7975559234619140625, -177.8903350830078125, -111.38811492919921875),
|
||||
Vec3fEq(7.44747829437255859375, -202.3209075927734375, -101.19382476806640625),
|
||||
Vec3fEq(0, -215, -94.75363922119140625)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, update_remove_and_update_then_find_path_should_return_path)
|
||||
|
@ -639,31 +645,31 @@ namespace
|
|||
|
||||
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
||||
|
||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
osg::Vec3f(215, -215, 1.87718021869659423828125),
|
||||
})) << mPath;
|
||||
EXPECT_THAT(mPath, ElementsAre(
|
||||
Vec3fEq(-215, 215, 1.85963428020477294921875),
|
||||
Vec3fEq(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
|
||||
Vec3fEq(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
|
||||
Vec3fEq(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
|
||||
Vec3fEq(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
|
||||
Vec3fEq(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
|
||||
Vec3fEq(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
|
||||
Vec3fEq(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
|
||||
Vec3fEq(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
|
||||
Vec3fEq(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
|
||||
Vec3fEq(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
|
||||
Vec3fEq(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
|
||||
Vec3fEq(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
|
||||
Vec3fEq(45.450958251953125, -45.450958251953125, -60.5882568359375),
|
||||
Vec3fEq(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
|
||||
Vec3fEq(85.5203399658203125, -85.5203399658203125, -45.8258514404296875),
|
||||
Vec3fEq(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
|
||||
Vec3fEq(125.5897216796875, -125.5897216796875, -31.063449859619140625),
|
||||
Vec3fEq(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
|
||||
Vec3fEq(165.659088134765625, -165.659088134765625, -16.3010501861572265625),
|
||||
Vec3fEq(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
|
||||
Vec3fEq(205.7284698486328125, -205.7284698486328125, -1.5386505126953125),
|
||||
Vec3fEq(215, -215, 1.87718021869659423828125)
|
||||
));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavigatorTest, update_then_find_random_point_around_circle_should_return_position)
|
||||
|
@ -687,10 +693,10 @@ namespace
|
|||
|
||||
const auto result = mNavigator->findRandomPointAroundCircle(mAgentHalfExtents, mStart, 100.0, Flag_walk);
|
||||
|
||||
ASSERT_EQ(result, boost::optional<osg::Vec3f>(osg::Vec3f(-209.95985412597656, 129.89768981933594, -0.26253718137741089)));
|
||||
ASSERT_THAT(result, Optional(Vec3fEq(-209.95985412597656, 129.89768981933594, -0.26253718137741089)));
|
||||
|
||||
const auto distance = (*result - mStart).length();
|
||||
|
||||
EXPECT_EQ(distance, 85.260780334472656) << distance;
|
||||
EXPECT_FLOAT_EQ(distance, 85.260780334472656);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
@ -312,11 +313,11 @@ namespace
|
|||
AreaType_ground
|
||||
);
|
||||
const auto recastMesh = builder.create(mGeneration, mRevision);
|
||||
EXPECT_EQ(recastMesh->getVertices(), std::vector<float>({
|
||||
EXPECT_THAT(recastMesh->getVertices(), Pointwise(FloatNear(1e-5), std::vector<float>({
|
||||
0, -0.70710659027099609375, -3.535533905029296875,
|
||||
0, 0.707107067108154296875, -3.535533905029296875,
|
||||
0, 2.384185791015625e-07, -4.24264049530029296875,
|
||||
}));
|
||||
})));
|
||||
EXPECT_EQ(recastMesh->getIndices(), std::vector<int>({0, 1, 2}));
|
||||
EXPECT_EQ(recastMesh->getAreaTypes(), std::vector<AreaType>({AreaType_ground}));
|
||||
}
|
||||
|
@ -337,11 +338,11 @@ namespace
|
|||
AreaType_ground
|
||||
);
|
||||
const auto recastMesh = builder.create(mGeneration, mRevision);
|
||||
EXPECT_EQ(recastMesh->getVertices(), std::vector<float>({
|
||||
EXPECT_THAT(recastMesh->getVertices(), Pointwise(FloatNear(1e-5), std::vector<float>({
|
||||
-3.535533905029296875, -0.70710659027099609375, 0,
|
||||
-3.535533905029296875, 0.707107067108154296875, 0,
|
||||
-4.24264049530029296875, 2.384185791015625e-07, 0,
|
||||
}));
|
||||
})));
|
||||
EXPECT_EQ(recastMesh->getIndices(), std::vector<int>({0, 1, 2}));
|
||||
EXPECT_EQ(recastMesh->getAreaTypes(), std::vector<AreaType>({AreaType_ground}));
|
||||
}
|
||||
|
|
|
@ -61,15 +61,15 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
EXPECT_TRUE(manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground));
|
||||
EXPECT_TRUE(manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_object_for_existing_object_should_return_false)
|
||||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_FALSE(manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground));
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_FALSE(manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, update_object_for_changed_object_should_return_changed_tiles)
|
||||
|
@ -77,9 +77,9 @@ namespace
|
|||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
const btTransform transform(btMatrix3x3::getIdentity(), btVector3(getTileSize(mSettings) / mSettings.mRecastScaleFactor, 0, 0));
|
||||
manager.addObject(ObjectId(1ul), boxShape, transform, AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, transform, AreaType::AreaType_ground);
|
||||
EXPECT_THAT(
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground),
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground),
|
||||
ElementsAre(TilePosition(-1, -1), TilePosition(-1, 0), TilePosition(0, -1), TilePosition(0, 0),
|
||||
TilePosition(1, -1), TilePosition(1, 0))
|
||||
);
|
||||
|
@ -89,9 +89,9 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground),
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground),
|
||||
std::vector<TilePosition>()
|
||||
);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
|
@ -111,7 +111,7 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(1, 0)), nullptr);
|
||||
}
|
||||
|
||||
|
@ -121,13 +121,13 @@ namespace
|
|||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
const btTransform transform(btMatrix3x3::getIdentity(), btVector3(getTileSize(mSettings) / mSettings.mRecastScaleFactor, 0, 0));
|
||||
|
||||
manager.addObject(ObjectId(1ul), boxShape, transform, AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, transform, AreaType::AreaType_ground);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(1, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(1, -1)), nullptr);
|
||||
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
|
@ -140,11 +140,11 @@ namespace
|
|||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
const btTransform transform(btMatrix3x3::getIdentity(), btVector3(getTileSize(mSettings) / mSettings.mRecastScaleFactor, 0, 0));
|
||||
|
||||
manager.addObject(ObjectId(1ul), boxShape, transform, AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, transform, AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(1, 0)), nullptr);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(1, -1)), nullptr);
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.removeObject(ObjectId(1ul));
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.removeObject(ObjectId(&boxShape));
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
EXPECT_EQ(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
|
@ -166,13 +166,13 @@ namespace
|
|||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, 0)), nullptr);
|
||||
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, -1)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(-1, 0)), nullptr);
|
||||
EXPECT_NE(manager.getMesh(TilePosition(0, -1)), nullptr);
|
||||
|
@ -184,7 +184,7 @@ namespace
|
|||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const auto initialRevision = manager.getRevision();
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getRevision(), initialRevision + 1);
|
||||
}
|
||||
|
||||
|
@ -192,9 +192,9 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
const auto beforeAddRevision = manager.getRevision();
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getRevision(), beforeAddRevision);
|
||||
}
|
||||
|
||||
|
@ -203,9 +203,9 @@ namespace
|
|||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
const btTransform transform(btMatrix3x3::getIdentity(), btVector3(getTileSize(mSettings) / mSettings.mRecastScaleFactor, 0, 0));
|
||||
manager.addObject(ObjectId(1ul), boxShape, transform, AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, transform, AreaType::AreaType_ground);
|
||||
const auto beforeUpdateRevision = manager.getRevision();
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getRevision(), beforeUpdateRevision + 1);
|
||||
}
|
||||
|
||||
|
@ -213,9 +213,9 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
const auto beforeUpdateRevision = manager.getRevision();
|
||||
manager.updateObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.updateObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
EXPECT_EQ(manager.getRevision(), beforeUpdateRevision);
|
||||
}
|
||||
|
||||
|
@ -223,9 +223,9 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const btBoxShape boxShape(btVector3(20, 20, 100));
|
||||
manager.addObject(ObjectId(1ul), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground);
|
||||
const auto beforeRemoveRevision = manager.getRevision();
|
||||
manager.removeObject(ObjectId(1ul));
|
||||
manager.removeObject(ObjectId(&boxShape));
|
||||
EXPECT_EQ(manager.getRevision(), beforeRemoveRevision + 1);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ namespace
|
|||
{
|
||||
TileCachedRecastMeshManager manager(mSettings);
|
||||
const auto beforeRemoveRevision = manager.getRevision();
|
||||
manager.removeObject(ObjectId(1ul));
|
||||
manager.removeObject(ObjectId(&manager));
|
||||
EXPECT_EQ(manager.getRevision(), beforeRemoveRevision);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void Wizard::ConclusionPage::initializePage()
|
|||
} else {
|
||||
textLabel->setText(tr("<html><head/><body><p>The OpenMW Wizard failed to install Morrowind on your computer.</p> \
|
||||
<p>Please report any bugs you might have encountered to our \
|
||||
<a href=\"https://bugs.openmw.org\">bug tracker</a>.<br/>Make sure to include the installation log.</p><br/></body></html>"));
|
||||
<a href=\"https://gitlab.com/OpenMW/openmw/issues\">bug tracker</a>.<br/>Make sure to include the installation log.</p><br/></body></html>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ add_component_dir (shader
|
|||
add_component_dir (sceneutil
|
||||
clone attach visitor util statesetupdater controller skeleton riggeometry morphgeometry lightcontroller
|
||||
lightmanager lightutil positionattitudetransform workqueue unrefqueue pathgridutil waterutil writescene serialize optimizer
|
||||
actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique vismask recastmesh
|
||||
actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique recastmesh
|
||||
)
|
||||
|
||||
add_component_dir (nif
|
||||
|
@ -274,6 +274,10 @@ if (USE_QT)
|
|||
processinvoker
|
||||
)
|
||||
|
||||
add_component_dir (misc
|
||||
helpviewer
|
||||
)
|
||||
|
||||
if (DESIRED_QT_VERSION MATCHES 4)
|
||||
include(${QT_USE_FILE})
|
||||
QT4_WRAP_UI(ESM_UI_HDR ${ESM_UI})
|
||||
|
|
|
@ -412,7 +412,7 @@ static void crash_handler(const char *logfile)
|
|||
|
||||
if(logfile)
|
||||
{
|
||||
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile) + "'.\n Please report this to https://bugs.openmw.org !";
|
||||
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile) + "'.\n Please report this to https://gitlab.com/OpenMW/openmw/issues !";
|
||||
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace DetourNavigator
|
|||
{
|
||||
public:
|
||||
template <class T>
|
||||
explicit ObjectId(const T value) throw()
|
||||
explicit ObjectId(T* value) throw()
|
||||
: mValue(reinterpret_cast<std::size_t>(value))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -130,7 +130,10 @@ void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted)
|
|||
}
|
||||
|
||||
if (mLockLevel == 0 && !mKey.empty())
|
||||
{
|
||||
mLockLevel = UnbreakableLock;
|
||||
mTrap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool isDeleted) const
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
@ -126,6 +127,7 @@ struct ESM_Context
|
|||
// actually contribute to a specific cell. Therefore, we need to store the index
|
||||
// of the file belonging to this contest. See CellStore::(list/load)refs for details.
|
||||
int index;
|
||||
std::vector<int> parentFileIndices;
|
||||
|
||||
// True if subName has been read but not used.
|
||||
bool subCached;
|
||||
|
|
|
@ -20,8 +20,7 @@ ESM_Context ESMReader::getContext()
|
|||
}
|
||||
|
||||
ESMReader::ESMReader()
|
||||
: mIdx(0)
|
||||
, mRecordFlags(0)
|
||||
: mRecordFlags(0)
|
||||
, mBuffer(50*1024)
|
||||
, mGlobalReaderList(nullptr)
|
||||
, mEncoder(nullptr)
|
||||
|
|
|
@ -79,13 +79,15 @@ public:
|
|||
// terrain palette, but ESMReader does not pass a reference to the correct plugin
|
||||
// to the individual load() methods. This hack allows to pass this reference
|
||||
// indirectly to the load() method.
|
||||
int mIdx;
|
||||
void setIndex(const int index) {mIdx = index; mCtx.index = index;}
|
||||
int getIndex() {return mIdx;}
|
||||
void setIndex(const int index) { mCtx.index = index;}
|
||||
int getIndex() {return mCtx.index;}
|
||||
|
||||
void setGlobalReaderList(std::vector<ESMReader> *list) {mGlobalReaderList = list;}
|
||||
std::vector<ESMReader> *getGlobalReaderList() {return mGlobalReaderList;}
|
||||
|
||||
void addParentFileIndex(int index) { mCtx.parentFileIndices.push_back(index); }
|
||||
const std::vector<int>& getParentFileIndices() const { return mCtx.parentFileIndices; }
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Medium-level reading shortcuts
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace
|
|||
|
||||
// If we have an index value that does not make sense, assume that it was an addition
|
||||
// by the present plugin (but a faulty one)
|
||||
if (local && local <= reader.getGameFiles().size())
|
||||
if (local && local <= reader.getParentFileIndices().size())
|
||||
{
|
||||
// If the most significant 8 bits are used, then this reference already exists.
|
||||
// In this case, do not spawn a new reference, but overwrite the old one.
|
||||
refNum.mIndex &= 0x00ffffff; // delete old plugin ID
|
||||
refNum.mContentFile = reader.getGameFiles()[local-1].index;
|
||||
refNum.mContentFile = reader.getParentFileIndices()[local-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
12
components/misc/helpviewer.cpp
Normal file
12
components/misc/helpviewer.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "helpviewer.hpp"
|
||||
|
||||
#include <QString>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
void Misc::HelpViewer::openHelp(const char* url)
|
||||
{
|
||||
QString link {OPENMW_DOC_BASEURL};
|
||||
link.append(url);
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
7
components/misc/helpviewer.hpp
Normal file
7
components/misc/helpviewer.hpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
namespace Misc {
|
||||
namespace HelpViewer {
|
||||
void openHelp(const char* url);
|
||||
}
|
||||
}
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include <components/nif/data.hpp>
|
||||
#include <components/sceneutil/morphgeometry.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
#include "userdata.hpp"
|
||||
|
||||
|
@ -270,12 +269,14 @@ void UVController::apply(osg::StateSet* stateset, osg::NodeVisitor* nv)
|
|||
}
|
||||
}
|
||||
|
||||
VisController::VisController(const Nif::NiVisData *data)
|
||||
VisController::VisController(const Nif::NiVisData *data, unsigned int mask)
|
||||
: mData(data->mVis)
|
||||
, mMask(mask)
|
||||
{
|
||||
}
|
||||
|
||||
VisController::VisController()
|
||||
: mMask(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -283,6 +284,7 @@ VisController::VisController(const VisController ©, const osg::CopyOp ©o
|
|||
: osg::NodeCallback(copy, copyop)
|
||||
, Controller(copy)
|
||||
, mData(copy.mData)
|
||||
, mMask(copy.mMask)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -304,8 +306,7 @@ void VisController::operator() (osg::Node* node, osg::NodeVisitor* nv)
|
|||
if (hasInput())
|
||||
{
|
||||
bool vis = calculate(getInputValue(nv));
|
||||
// Leave 0x1 enabled for UpdateVisitor, so we can make ourselves visible again in the future from this update callback
|
||||
node->setNodeMask(vis ? SceneUtil::Mask_Default : SceneUtil::Mask_UpdateVisitor);
|
||||
node->setNodeMask(vis ? ~0 : mMask);
|
||||
}
|
||||
traverse(node, nv);
|
||||
}
|
||||
|
|
|
@ -234,11 +234,12 @@ namespace NifOsg
|
|||
{
|
||||
private:
|
||||
std::vector<Nif::NiVisData::VisData> mData;
|
||||
unsigned int mMask;
|
||||
|
||||
bool calculate(float time) const;
|
||||
|
||||
public:
|
||||
VisController(const Nif::NiVisData *data);
|
||||
VisController(const Nif::NiVisData *data, unsigned int mask);
|
||||
VisController();
|
||||
VisController(const VisController& copy, const osg::CopyOp& copyop);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <components/misc/resourcehelpers.hpp>
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
#include <components/sceneutil/util.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
// particle
|
||||
#include <osgParticle/ParticleSystem>
|
||||
|
@ -178,7 +177,7 @@ namespace NifOsg
|
|||
|
||||
void setEnabled(bool enabled)
|
||||
{
|
||||
setNodeMask(enabled ? SceneUtil::Mask_Default : SceneUtil::Mask_Effect);
|
||||
setNodeMask(enabled ? ~0 : 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -194,6 +193,17 @@ namespace NifOsg
|
|||
return sShowMarkers;
|
||||
}
|
||||
|
||||
unsigned int Loader::sHiddenNodeMask = 0;
|
||||
|
||||
void Loader::setHiddenNodeMask(unsigned int mask)
|
||||
{
|
||||
sHiddenNodeMask = mask;
|
||||
}
|
||||
unsigned int Loader::getHiddenNodeMask()
|
||||
{
|
||||
return sHiddenNodeMask;
|
||||
}
|
||||
|
||||
class LoaderImpl
|
||||
{
|
||||
public:
|
||||
|
@ -572,8 +582,7 @@ namespace NifOsg
|
|||
if (nifNode->recType == Nif::RC_RootCollisionNode)
|
||||
{
|
||||
skipMeshes = true;
|
||||
// Leave mask for UpdateVisitor enabled
|
||||
node->setNodeMask(SceneUtil::Mask_UpdateVisitor);
|
||||
node->setNodeMask(Loader::getHiddenNodeMask());
|
||||
}
|
||||
|
||||
// We can skip creating meshes for hidden nodes if they don't have a VisController that
|
||||
|
@ -587,8 +596,7 @@ namespace NifOsg
|
|||
if (!hasVisController)
|
||||
skipMeshes = true; // skip child meshes, but still create the child node hierarchy for animating collision shapes
|
||||
|
||||
// now hide this node, but leave the mask for UpdateVisitor enabled so that KeyframeController works
|
||||
node->setNodeMask(SceneUtil::Mask_UpdateVisitor);
|
||||
node->setNodeMask(Loader::getHiddenNodeMask());
|
||||
}
|
||||
|
||||
if ((skipMeshes || hasMarkers) && isAnimated) // make sure the empty node is not optimized away so the physicssystem can find it.
|
||||
|
@ -754,7 +762,7 @@ namespace NifOsg
|
|||
{
|
||||
if (visctrl->data.empty())
|
||||
return;
|
||||
osg::ref_ptr<VisController> callback(new VisController(visctrl->data.getPtr()));
|
||||
osg::ref_ptr<VisController> callback(new VisController(visctrl->data.getPtr(), Loader::getHiddenNodeMask()));
|
||||
setupController(visctrl, callback, animflags);
|
||||
node->addUpdateCallback(callback);
|
||||
}
|
||||
|
@ -1078,6 +1086,8 @@ namespace NifOsg
|
|||
trans->addChild(toAttach);
|
||||
parentNode->addChild(trans);
|
||||
}
|
||||
// create partsys stateset in order to pass in ShaderVisitor like all other Drawables
|
||||
partsys->getOrCreateStateSet();
|
||||
}
|
||||
|
||||
void triCommonToGeometry(osg::Geometry *geometry, const std::vector<osg::Vec3f>& vertices, const std::vector<osg::Vec3f>& normals, const std::vector<std::vector<osg::Vec2f>>& uvlist, const std::vector<osg::Vec4f>& colors, const std::vector<unsigned int>& boundTextures, const std::string& name)
|
||||
|
@ -1705,7 +1715,8 @@ namespace NifOsg
|
|||
{
|
||||
osg::StateSet* stateset = node->getOrCreateStateSet();
|
||||
|
||||
int specFlags = 0; // Specular is disabled by default, even if there's a specular color in the NiMaterialProperty
|
||||
// Specular lighting is enabled by default, but there's a quirk...
|
||||
int specFlags = 1;
|
||||
osg::ref_ptr<osg::Material> mat (new osg::Material);
|
||||
mat->setColorMode(hasVertexColors ? osg::Material::AMBIENT_AND_DIFFUSE : osg::Material::OFF);
|
||||
|
||||
|
@ -1723,6 +1734,7 @@ namespace NifOsg
|
|||
{
|
||||
case Nif::RC_NiSpecularProperty:
|
||||
{
|
||||
// Specular property can turn specular lighting off.
|
||||
specFlags = property->flags;
|
||||
break;
|
||||
}
|
||||
|
@ -1806,17 +1818,10 @@ namespace NifOsg
|
|||
}
|
||||
}
|
||||
|
||||
if (specFlags == 0)
|
||||
// While NetImmerse and Gamebryo support specular lighting, Morrowind has its support disabled.
|
||||
if (mVersion <= Nif::NIFFile::NIFVersion::VER_MW || specFlags == 0)
|
||||
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f,0.f,0.f,0.f));
|
||||
|
||||
// Particles don't have normals, so can't be diffuse lit.
|
||||
if (particleMaterial)
|
||||
{
|
||||
// NB ignoring diffuse.a()
|
||||
mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0,0,0,1));
|
||||
mat->setColorMode(osg::Material::AMBIENT);
|
||||
}
|
||||
|
||||
if (lightmode == 0)
|
||||
{
|
||||
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);
|
||||
|
|
|
@ -74,8 +74,13 @@ namespace NifOsg
|
|||
|
||||
static bool getShowMarkers();
|
||||
|
||||
private:
|
||||
/// Set the mask to use for hidden nodes. The default is 0, i.e. updates to those nodes can no longer happen.
|
||||
/// If you need to run animations or physics for hidden nodes, you may want to set this to a non-zero mask and remove exactly that mask from the camera's cull mask.
|
||||
static void setHiddenNodeMask(unsigned int mask);
|
||||
static unsigned int getHiddenNodeMask();
|
||||
|
||||
private:
|
||||
static unsigned int sHiddenNodeMask;
|
||||
static bool sShowMarkers;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <limits>
|
||||
|
||||
#include <osg/Version>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Geometry>
|
||||
|
||||
|
@ -19,12 +20,19 @@ ParticleSystem::ParticleSystem()
|
|||
: osgParticle::ParticleSystem()
|
||||
, mQuota(std::numeric_limits<int>::max())
|
||||
{
|
||||
mNormalArray = new osg::Vec3Array(1);
|
||||
mNormalArray->setBinding(osg::Array::BIND_OVERALL);
|
||||
(*mNormalArray.get())[0] = osg::Vec3(0.3, 0.3, 0.3);
|
||||
}
|
||||
|
||||
ParticleSystem::ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op)
|
||||
: osgParticle::ParticleSystem(copy, copyop)
|
||||
, mQuota(copy.mQuota)
|
||||
{
|
||||
mNormalArray = new osg::Vec3Array(1);
|
||||
mNormalArray->setBinding(osg::Array::BIND_OVERALL);
|
||||
(*mNormalArray.get())[0] = osg::Vec3(0.3, 0.3, 0.3);
|
||||
|
||||
// For some reason the osgParticle constructor doesn't copy the particles
|
||||
for (int i=0;i<copy.numParticles()-copy.numDeadParticles();++i)
|
||||
ParticleSystem::createParticle(copy.getParticle(i));
|
||||
|
@ -42,6 +50,25 @@ osgParticle::Particle* ParticleSystem::createParticle(const osgParticle::Particl
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
osg::State & state = *renderInfo.getState();
|
||||
#if OSG_MIN_VERSION_REQUIRED(3, 5, 6)
|
||||
if(state.useVertexArrayObject(getUseVertexArrayObject()))
|
||||
{
|
||||
state.getCurrentVertexArrayState()->assignNormalArrayDispatcher();
|
||||
state.getCurrentVertexArrayState()->setNormalArray(state, mNormalArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
state.getAttributeDispatchers().activateNormalArray(mNormalArray);
|
||||
}
|
||||
#else
|
||||
state.Normal(0.3, 0.3, 0.3);
|
||||
#endif
|
||||
osgParticle::ParticleSystem::drawImplementation(renderInfo);
|
||||
}
|
||||
|
||||
void InverseWorldMatrix::operator()(osg::Node *node, osg::NodeVisitor *nv)
|
||||
{
|
||||
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
|
||||
|
@ -159,8 +186,11 @@ void ParticleColorAffector::operate(osgParticle::Particle* particle, double /* d
|
|||
{
|
||||
float time = static_cast<float>(particle->getAge()/particle->getLifeTime());
|
||||
osg::Vec4f color = mData.interpKey(time);
|
||||
float alpha = color.a();
|
||||
color.a() = 1.0f;
|
||||
|
||||
particle->setColorRange(osgParticle::rangev4(color, color));
|
||||
particle->setAlphaRange(osgParticle::rangef(alpha, alpha));
|
||||
}
|
||||
|
||||
GravityAffector::GravityAffector(const Nif::NiGravity *gravity)
|
||||
|
|
|
@ -36,8 +36,11 @@ namespace NifOsg
|
|||
|
||||
void setQuota(int quota);
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
private:
|
||||
int mQuota;
|
||||
osg::ref_ptr<osg::Vec3Array> mNormalArray;
|
||||
};
|
||||
|
||||
// HACK: Particle doesn't allow setting the initial age, but we need this for loading the particle system state
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <osgViewer/Renderer>
|
||||
|
||||
#include <components/myguiplatform/myguidatamanager.hpp>
|
||||
#include <components/sceneutil/vismask.hpp>
|
||||
|
||||
namespace Resource
|
||||
{
|
||||
|
@ -104,14 +103,14 @@ void StatsHandler::toggle(osgViewer::ViewerBase *viewer)
|
|||
|
||||
if (!_statsType)
|
||||
{
|
||||
_camera->setNodeMask(SceneUtil::Mask_Disabled);
|
||||
_camera->setNodeMask(0);
|
||||
_switch->setAllChildrenOff();
|
||||
|
||||
viewer->getViewerStats()->collectStats("resource", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_camera->setNodeMask(SceneUtil::Mask_Default);
|
||||
_camera->setNodeMask(0xffffffff);
|
||||
_switch->setSingleChildOn(_resourceStatsChildNum);
|
||||
|
||||
viewer->getViewerStats()->collectStats("resource", true);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "lightcontroller.hpp"
|
||||
#include "util.hpp"
|
||||
#include "visitor.hpp"
|
||||
#include "vismask.hpp"
|
||||
#include "positionattitudetransform.hpp"
|
||||
|
||||
namespace SceneUtil
|
||||
|
@ -59,7 +58,7 @@ namespace SceneUtil
|
|||
light->setQuadraticAttenuation(quadraticAttenuation);
|
||||
}
|
||||
|
||||
void addLight (osg::Group* node, const ESM::Light* esmLight, bool isExterior)
|
||||
void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior)
|
||||
{
|
||||
SceneUtil::FindByNameVisitor visitor("AttachLight");
|
||||
node->accept(visitor);
|
||||
|
@ -72,7 +71,7 @@ namespace SceneUtil
|
|||
else
|
||||
{
|
||||
osg::ComputeBoundsVisitor computeBound;
|
||||
computeBound.setTraversalMask(~SceneUtil::Mask_ParticleSystem);
|
||||
computeBound.setTraversalMask(~partsysMask);
|
||||
// We want the bounds of all children of the node, ignoring the node's local transformation
|
||||
// So do a traverse(), not accept()
|
||||
computeBound.traverse(*node);
|
||||
|
@ -86,15 +85,15 @@ namespace SceneUtil
|
|||
attachTo = trans;
|
||||
}
|
||||
|
||||
osg::ref_ptr<LightSource> lightSource = createLightSource(esmLight, isExterior);
|
||||
osg::ref_ptr<LightSource> lightSource = createLightSource(esmLight, lightMask, isExterior);
|
||||
attachTo->addChild(lightSource);
|
||||
}
|
||||
|
||||
osg::ref_ptr<LightSource> createLightSource(const ESM::Light* esmLight, bool isExterior, const osg::Vec4f& ambient)
|
||||
osg::ref_ptr<LightSource> createLightSource(const ESM::Light* esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient)
|
||||
{
|
||||
osg::ref_ptr<SceneUtil::LightSource> lightSource (new SceneUtil::LightSource);
|
||||
osg::ref_ptr<osg::Light> light (new osg::Light);
|
||||
lightSource->setNodeMask(SceneUtil::Mask_Lighting);
|
||||
lightSource->setNodeMask(lightMask);
|
||||
|
||||
float radius = esmLight->mData.mRadius;
|
||||
lightSource->setRadius(radius);
|
||||
|
|
|
@ -32,14 +32,14 @@ namespace SceneUtil
|
|||
/// @param partsysMask Node mask to ignore when computing the sub graph's bounding box.
|
||||
/// @param lightMask Mask to assign to the newly created LightSource.
|
||||
/// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
|
||||
void addLight (osg::Group* node, const ESM::Light* esmLight, bool isExterior);
|
||||
void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior);
|
||||
|
||||
/// @brief Convert an ESM::Light to a SceneUtil::LightSource, and return it.
|
||||
/// @param esmLight The light definition coming from the game files containing radius, color, flicker, etc.
|
||||
/// @param lightMask Mask to assign to the newly created LightSource.
|
||||
/// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
|
||||
/// @param ambient Ambient component of the light.
|
||||
osg::ref_ptr<LightSource> createLightSource (const ESM::Light* esmLight, bool isExterior, const osg::Vec4f& ambient=osg::Vec4f(0,0,0,1));
|
||||
osg::ref_ptr<LightSource> createLightSource (const ESM::Light* esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient=osg::Vec4f(0,0,0,1));
|
||||
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue