Move VisMask to components

pull/2700/head
Andrei Kortunov 5 years ago
parent 10fafabd7f
commit 84979fa8b7

@ -97,10 +97,6 @@ opencs_units_noqt (view/render
cellarrow cellmarker cellborder pathgrid cellarrow cellmarker cellborder pathgrid
) )
opencs_hdrs_noqt (view/render
mask
)
opencs_units (view/tools opencs_units (view/tools
reportsubview reporttable searchsubview searchbox merge reportsubview reporttable searchsubview searchbox merge

@ -9,6 +9,7 @@
#include <components/esm/loadcell.hpp> #include <components/esm/loadcell.hpp>
#include <components/esm/loadland.hpp> #include <components/esm/loadland.hpp>
#include <components/sceneutil/pathgridutil.hpp> #include <components/sceneutil/pathgridutil.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/terrain/terraingrid.hpp> #include <components/terrain/terraingrid.hpp>
#include "../../model/world/idtable.hpp" #include "../../model/world/idtable.hpp"
@ -21,7 +22,6 @@
#include "cellborder.hpp" #include "cellborder.hpp"
#include "cellarrow.hpp" #include "cellarrow.hpp"
#include "cellmarker.hpp" #include "cellmarker.hpp"
#include "mask.hpp"
#include "pathgrid.hpp" #include "pathgrid.hpp"
#include "terrainstorage.hpp" #include "terrainstorage.hpp"
#include "object.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)); std::unique_ptr<Object> object (new Object (mData, mCellNode, id, false));
if (mSubModeElementMask & Mask_Reference) if (mSubModeElementMask & SceneUtil::Mask_EditorReference)
object->setSubMode (mSubMode); object->setSubMode (mSubMode);
mObjects.insert (std::make_pair (id, object.release())); mObjects.insert (std::make_pair (id, object.release()));
@ -134,7 +134,7 @@ void CSVRender::Cell::updateLand()
else else
{ {
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode, mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode,
mData.getResourceSystem().get(), mTerrainStorage, Mask_Terrain)); mData.getResourceSystem().get(), mTerrainStorage));
} }
mTerrain->loadCell(esmLand.mX, esmLand.mY); mTerrain->loadCell(esmLand.mX, esmLand.mY);
@ -434,7 +434,7 @@ void CSVRender::Cell::reloadAssets()
void CSVRender::Cell::setSelection (int elementMask, Selection mode) void CSVRender::Cell::setSelection (int elementMask, Selection mode)
{ {
if (elementMask & Mask_Reference) if (elementMask & SceneUtil::Mask_EditorReference)
{ {
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin()); for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter) iter!=mObjects.end(); ++iter)
@ -451,7 +451,7 @@ void CSVRender::Cell::setSelection (int elementMask, Selection mode)
iter->second->setSelected (selected); iter->second->setSelected (selected);
} }
} }
if (mPathgrid && elementMask & Mask_Pathgrid) if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
{ {
// Only one pathgrid may be selected, so some operations will only have an effect // Only one pathgrid may be selected, so some operations will only have an effect
// if the pathgrid is already focused // 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; std::vector<osg::ref_ptr<TagBase> > result;
if (elementMask & Mask_Reference) if (elementMask & SceneUtil::Mask_EditorReference)
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin()); for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter) iter!=mObjects.end(); ++iter)
if (iter->second->getSelected()) if (iter->second->getSelected())
result.push_back (iter->second->getTag()); result.push_back (iter->second->getTag());
if (mPathgrid && elementMask & Mask_Pathgrid) if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
if (mPathgrid->isSelected()) if (mPathgrid->isSelected())
result.push_back(mPathgrid->getTag()); 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; std::vector<osg::ref_ptr<TagBase> > result;
if (elementMask & Mask_Reference) if (elementMask & SceneUtil::Mask_EditorReference)
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin()); for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter) iter!=mObjects.end(); ++iter)
if (iter->second->isEdited()) if (iter->second->isEdited())
@ -576,7 +576,7 @@ void CSVRender::Cell::setSubMode (int subMode, unsigned int elementMask)
mSubMode = subMode; mSubMode = subMode;
mSubModeElementMask = elementMask; mSubModeElementMask = elementMask;
if (elementMask & Mask_Reference) if (elementMask & SceneUtil::Mask_EditorReference)
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin()); for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter) iter!=mObjects.end(); ++iter)
iter->second->setSubMode (subMode); iter->second->setSubMode (subMode);
@ -584,10 +584,10 @@ void CSVRender::Cell::setSubMode (int subMode, unsigned int elementMask)
void CSVRender::Cell::reset (unsigned int elementMask) void CSVRender::Cell::reset (unsigned int elementMask)
{ {
if (elementMask & Mask_Reference) if (elementMask & SceneUtil::Mask_EditorReference)
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin()); for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter!=mObjects.end(); ++iter) iter!=mObjects.end(); ++iter)
iter->second->reset(); iter->second->reset();
if (mPathgrid && elementMask & Mask_Pathgrid) if (mPathgrid && elementMask & SceneUtil::Mask_Pathgrid)
mPathgrid->resetIndicators(); mPathgrid->resetIndicators();
} }

@ -11,11 +11,10 @@
#include "../../model/prefs/shortcutmanager.hpp" #include "../../model/prefs/shortcutmanager.hpp"
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
#include <components/sceneutil/vismask.hpp>
#include "mask.hpp"
CSVRender::CellArrowTag::CellArrowTag (CellArrow *arrow) CSVRender::CellArrowTag::CellArrowTag (CellArrow *arrow)
: TagBase (Mask_CellArrow), mArrow (arrow) : TagBase (SceneUtil::Mask_EditorCellArrow), mArrow (arrow)
{} {}
CSVRender::CellArrow *CSVRender::CellArrowTag::getCellArrow() const CSVRender::CellArrow *CSVRender::CellArrowTag::getCellArrow() const
@ -175,7 +174,7 @@ CSVRender::CellArrow::CellArrow (osg::Group *cellNode, Direction direction,
mParentNode->addChild (mBaseNode); mParentNode->addChild (mBaseNode);
mBaseNode->setNodeMask (Mask_CellArrow); mBaseNode->setNodeMask (SceneUtil::Mask_EditorCellArrow);
adjustTransform(); adjustTransform();
buildShape(); buildShape();

@ -7,8 +7,7 @@
#include <osg/PrimitiveSet> #include <osg/PrimitiveSet>
#include <components/esm/loadland.hpp> #include <components/esm/loadland.hpp>
#include <components/sceneutil/vismask.hpp>
#include "mask.hpp"
#include "../../model/world/cellcoordinates.hpp" #include "../../model/world/cellcoordinates.hpp"
@ -20,7 +19,7 @@ CSVRender::CellBorder::CellBorder(osg::Group* cellNode, const CSMWorld::CellCoor
: mParentNode(cellNode) : mParentNode(cellNode)
{ {
mBaseNode = new osg::PositionAttitudeTransform(); mBaseNode = new osg::PositionAttitudeTransform();
mBaseNode->setNodeMask(Mask_CellBorder); mBaseNode->setNodeMask(SceneUtil::Mask_EditorCellBorder);
mBaseNode->setPosition(osg::Vec3f(coords.getX() * CellSize, coords.getY() * CellSize, 10)); mBaseNode->setPosition(osg::Vec3f(coords.getX() * CellSize, coords.getY() * CellSize, 10));
mParentNode->addChild(mBaseNode); mParentNode->addChild(mBaseNode);

@ -8,7 +8,7 @@
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker) CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker)
: TagBase(Mask_CellMarker), mMarker(marker) : TagBase(SceneUtil::Mask_EditorCellMarker), mMarker(marker)
{} {}
CSVRender::CellMarker *CSVRender::CellMarkerTag::getCellMarker() const CSVRender::CellMarker *CSVRender::CellMarkerTag::getCellMarker() const
@ -79,7 +79,7 @@ CSVRender::CellMarker::CellMarker(
mMarkerNode->getOrCreateStateSet()->setAttribute(mat); mMarkerNode->getOrCreateStateSet()->setAttribute(mat);
mMarkerNode->setUserData(new CellMarkerTag(this)); mMarkerNode->setUserData(new CellMarkerTag(this));
mMarkerNode->setNodeMask(Mask_CellMarker); mMarkerNode->setNodeMask(SceneUtil::Mask_EditorCellMarker);
mCellNode->addChild(mMarkerNode); mCellNode->addChild(mMarkerNode);

@ -11,12 +11,12 @@
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/waterutil.hpp> #include <components/sceneutil/waterutil.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../../model/world/cell.hpp" #include "../../model/world/cell.hpp"
#include "../../model/world/cellcoordinates.hpp" #include "../../model/world/cellcoordinates.hpp"
#include "../../model/world/data.hpp" #include "../../model/world/data.hpp"
#include "mask.hpp"
namespace CSVRender namespace CSVRender
{ {
@ -38,7 +38,7 @@ namespace CSVRender
mWaterTransform->setPosition(osg::Vec3f(cellCoords.getX() * CellSize + CellSize / 2.f, mWaterTransform->setPosition(osg::Vec3f(cellCoords.getX() * CellSize + CellSize / 2.f,
cellCoords.getY() * CellSize + CellSize / 2.f, 0)); cellCoords.getY() * CellSize + CellSize / 2.f, 0));
mWaterTransform->setNodeMask(Mask_Water); mWaterTransform->setNodeMask(SceneUtil::Mask_Water);
mParentNode->addChild(mWaterTransform); mParentNode->addChild(mWaterTransform);
mWaterNode = new osg::Geode(); mWaterNode = new osg::Geode();

@ -14,7 +14,7 @@
#include "../widget/scenetoolbar.hpp" #include "../widget/scenetoolbar.hpp"
#include "../widget/scenetoolmode.hpp" #include "../widget/scenetoolmode.hpp"
#include "mask.hpp" #include <components/sceneutil/vismask.hpp>
#include "object.hpp" #include "object.hpp"
#include "worldspacewidget.hpp" #include "worldspacewidget.hpp"
@ -90,7 +90,7 @@ osg::Vec3f CSVRender::InstanceMode::getScreenCoords(const osg::Vec3f& pos)
} }
CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent) CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent)
: EditMode (worldspaceWidget, QIcon (":scenetoolbar/editing-instance"), Mask_Reference | Mask_Terrain, "Instance editing", : EditMode (worldspaceWidget, QIcon (":scenetoolbar/editing-instance"), SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain, "Instance editing",
parent), mSubMode (0), mSubModeId ("move"), mSelectionMode (0), mDragMode (DragMode_None), parent), mSubMode (0), mSubModeId ("move"), mSelectionMode (0), mDragMode (DragMode_None),
mDragAxis (-1), mLocked (false), mUnitScaleDist(1) mDragAxis (-1), mLocked (false), mUnitScaleDist(1)
{ {
@ -137,13 +137,13 @@ void CSVRender::InstanceMode::activate (CSVWidget::SceneToolbar *toolbar)
std::string subMode = mSubMode->getCurrentId(); std::string subMode = mSubMode->getCurrentId();
getWorldspaceWidget().setSubMode (getSubModeFromId (subMode), Mask_Reference); getWorldspaceWidget().setSubMode (getSubModeFromId (subMode), SceneUtil::Mask_EditorReference);
} }
void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar) void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar)
{ {
mDragMode = DragMode_None; mDragMode = DragMode_None;
getWorldspaceWidget().reset (Mask_Reference); getWorldspaceWidget().reset (SceneUtil::Mask_EditorReference);
if (mSelectionMode) if (mSelectionMode)
{ {
@ -196,7 +196,7 @@ void CSVRender::InstanceMode::secondaryEditPressed (const WorldspaceHitResult& h
void CSVRender::InstanceMode::primarySelectPressed (const WorldspaceHitResult& hit) void CSVRender::InstanceMode::primarySelectPressed (const WorldspaceHitResult& hit)
{ {
getWorldspaceWidget().clearSelection (Mask_Reference); getWorldspaceWidget().clearSelection (SceneUtil::Mask_EditorReference);
if (hit.tag) if (hit.tag)
{ {
@ -231,13 +231,13 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask());
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Reference); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
if (selection.empty()) if (selection.empty())
{ {
// Only change selection at the start of drag if no object is already selected // 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()) if (hit.tag && CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
{ {
getWorldspaceWidget().clearSelection (Mask_Reference); getWorldspaceWidget().clearSelection (SceneUtil::Mask_EditorReference);
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (hit.tag.get())) if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (hit.tag.get()))
{ {
CSVRender::Object* object = objectTag->mObject; CSVRender::Object* object = objectTag->mObject;
@ -245,7 +245,7 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
} }
} }
selection = getWorldspaceWidget().getSelection (Mask_Reference); selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_EditorReference);
if (selection.empty()) if (selection.empty())
return false; return false;
} }
@ -271,7 +271,7 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (const QPoint& pos)
mDragMode = DragMode_Scale; mDragMode = DragMode_Scale;
// Calculate scale factor // Calculate scale factor
std::vector<osg::ref_ptr<TagBase> > editedSelection = getWorldspaceWidget().getEdited (Mask_Reference); std::vector<osg::ref_ptr<TagBase> > editedSelection = getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
osg::Vec3f center = getScreenCoords(getSelectionCenter(editedSelection)); osg::Vec3f center = getScreenCoords(getSelectionCenter(editedSelection));
int widgetHeight = getWorldspaceWidget().height(); int widgetHeight = getWorldspaceWidget().height();
@ -307,7 +307,7 @@ void CSVRender::InstanceMode::drag (const QPoint& pos, int diffX, int diffY, dou
osg::Vec3f offset; osg::Vec3f offset;
osg::Quat rotation; osg::Quat rotation;
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getEdited (Mask_Reference); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
if (mDragMode == DragMode_Move) if (mDragMode == DragMode_Move)
{ {
@ -464,7 +464,7 @@ void CSVRender::InstanceMode::drag (const QPoint& pos, int diffX, int diffY, dou
void CSVRender::InstanceMode::dragCompleted(const QPoint& pos) void CSVRender::InstanceMode::dragCompleted(const QPoint& pos)
{ {
std::vector<osg::ref_ptr<TagBase> > selection = std::vector<osg::ref_ptr<TagBase> > selection =
getWorldspaceWidget().getEdited (Mask_Reference); getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack(); QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack();
@ -496,7 +496,7 @@ void CSVRender::InstanceMode::dragCompleted(const QPoint& pos)
void CSVRender::InstanceMode::dragAborted() void CSVRender::InstanceMode::dragAborted()
{ {
getWorldspaceWidget().reset (Mask_Reference); getWorldspaceWidget().reset (SceneUtil::Mask_EditorReference);
mDragMode = DragMode_None; mDragMode = DragMode_None;
} }
@ -515,7 +515,7 @@ void CSVRender::InstanceMode::dragWheel (int diff, double speedFactor)
offset *= diff * speedFactor; offset *= diff * speedFactor;
std::vector<osg::ref_ptr<TagBase> > selection = std::vector<osg::ref_ptr<TagBase> > selection =
getWorldspaceWidget().getEdited (Mask_Reference); getWorldspaceWidget().getEdited (SceneUtil::Mask_EditorReference);
for (std::vector<osg::ref_ptr<TagBase> >::iterator iter (selection.begin()); for (std::vector<osg::ref_ptr<TagBase> >::iterator iter (selection.begin());
iter!=selection.end(); ++iter) iter!=selection.end(); ++iter)
@ -657,5 +657,5 @@ void CSVRender::InstanceMode::subModeChanged (const std::string& id)
{ {
mSubModeId = id; mSubModeId = id;
getWorldspaceWidget().abortDrag(); getWorldspaceWidget().abortDrag();
getWorldspaceWidget().setSubMode (getSubModeFromId (id), Mask_Reference); getWorldspaceWidget().setSubMode (getSubModeFromId (id), SceneUtil::Mask_EditorReference);
} }

@ -6,13 +6,15 @@
#include "../../model/world/idtable.hpp" #include "../../model/world/idtable.hpp"
#include "../../model/world/commands.hpp" #include "../../model/world/commands.hpp"
#include <components/sceneutil/vismask.hpp>
#include "worldspacewidget.hpp" #include "worldspacewidget.hpp"
#include "object.hpp" #include "object.hpp"
namespace CSVRender namespace CSVRender
{ {
InstanceSelectionMode::InstanceSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget) InstanceSelectionMode::InstanceSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget)
: SelectionMode(parent, worldspaceWidget, Mask_Reference) : SelectionMode(parent, worldspaceWidget, SceneUtil::Mask_EditorReference)
{ {
mSelectSame = new QAction("Extend selection to instances with same object ID", this); mSelectSame = new QAction("Extend selection to instances with same object ID", this);
mDeleteSelection = new QAction("Delete selected instances", this); mDeleteSelection = new QAction("Delete selected instances", this);
@ -36,12 +38,12 @@ namespace CSVRender
void InstanceSelectionMode::selectSame() void InstanceSelectionMode::selectSame()
{ {
getWorldspaceWidget().selectAllWithSameParentId(Mask_Reference); getWorldspaceWidget().selectAllWithSameParentId(SceneUtil::Mask_EditorReference);
} }
void InstanceSelectionMode::deleteSelection() void InstanceSelectionMode::deleteSelection()
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(Mask_Reference); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(SceneUtil::Mask_EditorReference);
CSMWorld::IdTable& referencesTable = dynamic_cast<CSMWorld::IdTable&>( CSMWorld::IdTable& referencesTable = dynamic_cast<CSMWorld::IdTable&>(
*getWorldspaceWidget().getDocument().getData().getTableModel(CSMWorld::UniversalId::Type_References)); *getWorldspaceWidget().getDocument().getData().getTableModel(CSMWorld::UniversalId::Type_References));

@ -1,35 +0,0 @@
#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
{
// internal use within NifLoader, do not change
Mask_UpdateVisitor = 0x1,
// 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/resource/scenemanager.hpp>
#include <components/sceneutil/lightutil.hpp> #include <components/sceneutil/lightutil.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/vismask.hpp>
#include "actor.hpp" #include "actor.hpp"
#include "mask.hpp"
const float CSVRender::Object::MarkerShaftWidth = 30; const float CSVRender::Object::MarkerShaftWidth = 30;
@ -58,7 +58,7 @@ namespace
CSVRender::ObjectTag::ObjectTag (Object* object) CSVRender::ObjectTag::ObjectTag (Object* object)
: TagBase (Mask_Reference), mObject (object) : TagBase (SceneUtil::Mask_EditorReference), mObject (object)
{} {}
QString CSVRender::ObjectTag::getToolTip (bool hideBasics) const QString CSVRender::ObjectTag::getToolTip (bool hideBasics) const
@ -140,7 +140,7 @@ void CSVRender::Object::update()
if (light) if (light)
{ {
bool isExterior = false; // FIXME bool isExterior = false; // FIXME
SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, Mask_Lighting, isExterior); SceneUtil::addLight(mBaseNode, light, isExterior);
} }
} }
@ -429,7 +429,7 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
parentNode->addChild (mRootNode); parentNode->addChild (mRootNode);
mRootNode->setNodeMask(Mask_Reference); mRootNode->setNodeMask(SceneUtil::Mask_EditorReference);
if (referenceable) if (referenceable)
{ {

@ -21,7 +21,6 @@
#include "../widget/scenetooltoggle2.hpp" #include "../widget/scenetooltoggle2.hpp"
#include "editmode.hpp" #include "editmode.hpp"
#include "mask.hpp"
#include "cameracontroller.hpp" #include "cameracontroller.hpp"
#include "cellarrow.hpp" #include "cellarrow.hpp"
#include "terraintexturemode.hpp" #include "terraintexturemode.hpp"
@ -127,8 +126,8 @@ void CSVRender::PagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool) CSVWidget::SceneToolToggle2 *tool)
{ {
WorldspaceWidget::addVisibilitySelectorButtons (tool); WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain"); tool->addButton (Button_Terrain, SceneUtil::Mask_Terrain, "Terrain");
tool->addButton (Button_Fog, Mask_Fog, "Fog", "", true); //tool->addButton (Button_Fog, Mask_Fog, "Fog", "", true);
} }
void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons ( void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
@ -142,16 +141,16 @@ void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
tool->addButton ( tool->addButton (
new TerrainTextureMode (this, mRootNode, tool), "terrain-texture"); new TerrainTextureMode (this, mRootNode, tool), "terrain-texture");
tool->addButton ( tool->addButton (
new EditMode (this, QIcon (":placeholder"), Mask_Reference, "Terrain vertex paint editing"), new EditMode (this, QIcon (":placeholder"), SceneUtil::Mask_EditorReference, "Terrain vertex paint editing"),
"terrain-vertex"); "terrain-vertex");
tool->addButton ( tool->addButton (
new EditMode (this, QIcon (":placeholder"), Mask_Reference, "Terrain movement"), new EditMode (this, QIcon (":placeholder"), SceneUtil::Mask_EditorReference, "Terrain movement"),
"terrain-move"); "terrain-move");
} }
void CSVRender::PagedWorldspaceWidget::handleInteractionPress (const WorldspaceHitResult& hit, InteractionType type) void CSVRender::PagedWorldspaceWidget::handleInteractionPress (const WorldspaceHitResult& hit, InteractionType type)
{ {
if (hit.tag && hit.tag->getMask()==Mask_CellArrow) if (hit.tag && hit.tag->getMask()==SceneUtil::Mask_EditorCellArrow)
{ {
if (CellArrowTag *cellArrowTag = dynamic_cast<CSVRender::CellArrowTag *> (hit.tag.get())) if (CellArrowTag *cellArrowTag = dynamic_cast<CSVRender::CellArrowTag *> (hit.tag.get()))
{ {
@ -874,9 +873,9 @@ CSVWidget::SceneToolToggle2 *CSVRender::PagedWorldspaceWidget::makeControlVisibi
mControlElements = new CSVWidget::SceneToolToggle2 (parent, mControlElements = new CSVWidget::SceneToolToggle2 (parent,
"Controls & Guides Visibility", ":scenetoolbar/scene-view-marker-c", ":scenetoolbar/scene-view-marker-"); "Controls & Guides Visibility", ":scenetoolbar/scene-view-marker-c", ":scenetoolbar/scene-view-marker-");
mControlElements->addButton (1, Mask_CellMarker, "Cell Marker"); mControlElements->addButton (1, SceneUtil::Mask_EditorCellMarker, "Cell Marker");
mControlElements->addButton (2, Mask_CellArrow, "Cell Arrows"); mControlElements->addButton (2, SceneUtil::Mask_EditorCellArrow, "Cell Arrows");
mControlElements->addButton (4, Mask_CellBorder, "Cell Border"); mControlElements->addButton (4, SceneUtil::Mask_EditorCellBorder, "Cell Border");
mControlElements->setSelectionMask (0xffffffff); mControlElements->setSelectionMask (0xffffffff);

@ -10,6 +10,7 @@
#include <osg/Vec3> #include <osg/Vec3>
#include <components/sceneutil/pathgridutil.hpp> #include <components/sceneutil/pathgridutil.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../../model/world/cell.hpp" #include "../../model/world/cell.hpp"
#include "../../model/world/commands.hpp" #include "../../model/world/commands.hpp"
@ -31,7 +32,7 @@ namespace CSVRender
}; };
PathgridTag::PathgridTag(Pathgrid* pathgrid) PathgridTag::PathgridTag(Pathgrid* pathgrid)
: TagBase(Mask_Pathgrid), mPathgrid(pathgrid) : TagBase(SceneUtil::Mask_Pathgrid), mPathgrid(pathgrid)
{ {
} }
@ -70,7 +71,7 @@ namespace CSVRender
mBaseNode->setPosition(osg::Vec3f(mCoords.getX() * CoordScalar, mCoords.getY() * CoordScalar, 0.f)); mBaseNode->setPosition(osg::Vec3f(mCoords.getX() * CoordScalar, mCoords.getY() * CoordScalar, 0.f));
mBaseNode->setUserData(mTag); mBaseNode->setUserData(mTag);
mBaseNode->setUpdateCallback(new PathgridNodeCallback()); mBaseNode->setUpdateCallback(new PathgridNodeCallback());
mBaseNode->setNodeMask(Mask_Pathgrid); mBaseNode->setNodeMask(SceneUtil::Mask_Pathgrid);
mParent->addChild(mBaseNode); mParent->addChild(mBaseNode);
mPathgridGeode = new osg::Geode(); mPathgridGeode = new osg::Geode();

@ -4,6 +4,7 @@
#include <QPoint> #include <QPoint>
#include <components/sceneutil/pathgridutil.hpp> #include <components/sceneutil/pathgridutil.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../../model/prefs/state.hpp" #include "../../model/prefs/state.hpp"
@ -15,7 +16,6 @@
#include "../widget/scenetoolbar.hpp" #include "../widget/scenetoolbar.hpp"
#include "cell.hpp" #include "cell.hpp"
#include "mask.hpp"
#include "pathgrid.hpp" #include "pathgrid.hpp"
#include "pathgridselectionmode.hpp" #include "pathgridselectionmode.hpp"
#include "worldspacewidget.hpp" #include "worldspacewidget.hpp"
@ -23,7 +23,7 @@
namespace CSVRender namespace CSVRender
{ {
PathgridMode::PathgridMode(WorldspaceWidget* worldspaceWidget, QWidget* parent) PathgridMode::PathgridMode(WorldspaceWidget* worldspaceWidget, QWidget* parent)
: EditMode(worldspaceWidget, QIcon(":placeholder"), Mask_Pathgrid | Mask_Terrain | Mask_Reference, : EditMode(worldspaceWidget, QIcon(":placeholder"), SceneUtil::Mask_Pathgrid | SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference,
getTooltip(), parent) getTooltip(), parent)
, mDragMode(DragMode_None) , mDragMode(DragMode_None)
, mFromNode(0) , mFromNode(0)
@ -110,7 +110,7 @@ namespace CSVRender
void PathgridMode::primarySelectPressed(const WorldspaceHitResult& hit) void PathgridMode::primarySelectPressed(const WorldspaceHitResult& hit)
{ {
getWorldspaceWidget().clearSelection(Mask_Pathgrid); getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
if (hit.tag) if (hit.tag)
{ {
@ -131,7 +131,7 @@ namespace CSVRender
{ {
if (tag->getPathgrid()->getId() != mLastId) if (tag->getPathgrid()->getId() != mLastId)
{ {
getWorldspaceWidget().clearSelection(Mask_Pathgrid); getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
mLastId = tag->getPathgrid()->getId(); mLastId = tag->getPathgrid()->getId();
} }
@ -142,12 +142,12 @@ namespace CSVRender
} }
} }
getWorldspaceWidget().clearSelection(Mask_Pathgrid); getWorldspaceWidget().clearSelection(SceneUtil::Mask_Pathgrid);
} }
bool PathgridMode::primaryEditStartDrag(const QPoint& pos) bool PathgridMode::primaryEditStartDrag(const QPoint& pos)
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue()) if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
{ {
@ -156,7 +156,7 @@ namespace CSVRender
if (dynamic_cast<PathgridTag*>(hit.tag.get())) if (dynamic_cast<PathgridTag*>(hit.tag.get()))
{ {
primarySelectPressed(hit); primarySelectPressed(hit);
selection = getWorldspaceWidget().getSelection (Mask_Pathgrid); selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
} }
} }
@ -192,7 +192,7 @@ namespace CSVRender
{ {
if (mDragMode == DragMode_Move) if (mDragMode == DragMode_Move)
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(Mask_Pathgrid); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection(SceneUtil::Mask_Pathgrid);
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it) 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) if (mDragMode == DragMode_Move)
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it) for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
{ {
if (PathgridTag* tag = dynamic_cast<PathgridTag*>(it->get())) if (PathgridTag* tag = dynamic_cast<PathgridTag*>(it->get()))
@ -272,11 +272,11 @@ namespace CSVRender
} }
mDragMode = DragMode_None; mDragMode = DragMode_None;
getWorldspaceWidget().reset(Mask_Pathgrid); getWorldspaceWidget().reset(SceneUtil::Mask_Pathgrid);
} }
void PathgridMode::dragAborted() void PathgridMode::dragAborted()
{ {
getWorldspaceWidget().reset(Mask_Pathgrid); getWorldspaceWidget().reset(SceneUtil::Mask_Pathgrid);
} }
} }

@ -13,7 +13,7 @@
namespace CSVRender namespace CSVRender
{ {
PathgridSelectionMode::PathgridSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget) PathgridSelectionMode::PathgridSelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget)
: SelectionMode(parent, worldspaceWidget, Mask_Pathgrid) : SelectionMode(parent, worldspaceWidget, SceneUtil::Mask_Pathgrid)
{ {
mRemoveSelectedNodes = new QAction("Remove selected nodes", this); mRemoveSelectedNodes = new QAction("Remove selected nodes", this);
mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this); mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this);
@ -37,7 +37,7 @@ namespace CSVRender
void PathgridSelectionMode::removeSelectedNodes() void PathgridSelectionMode::removeSelectedNodes()
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it) for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
{ {
@ -54,7 +54,7 @@ namespace CSVRender
void PathgridSelectionMode::removeSelectedEdges() void PathgridSelectionMode::removeSelectedEdges()
{ {
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid); std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (SceneUtil::Mask_Pathgrid);
for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it) for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it != selection.end(); ++it)
{ {

@ -17,6 +17,7 @@
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../widget/scenetoolmode.hpp" #include "../widget/scenetoolmode.hpp"
@ -25,7 +26,6 @@
#include "../../model/prefs/shortcuteventhandler.hpp" #include "../../model/prefs/shortcuteventhandler.hpp"
#include "lighting.hpp" #include "lighting.hpp"
#include "mask.hpp"
#include "cameracontroller.hpp" #include "cameracontroller.hpp"
namespace CSVRender namespace CSVRender
@ -71,7 +71,7 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
SceneUtil::LightManager* lightMgr = new SceneUtil::LightManager; SceneUtil::LightManager* lightMgr = new SceneUtil::LightManager;
lightMgr->setStartLight(1); lightMgr->setStartLight(1);
lightMgr->setLightingMask(Mask_Lighting); lightMgr->setLightingMask(SceneUtil::Mask_Lighting);
mRootNode = lightMgr; mRootNode = lightMgr;
mView->getCamera()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); mView->getCamera()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
@ -88,7 +88,7 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
// Add ability to signal osg to show its statistics for debugging purposes // Add ability to signal osg to show its statistics for debugging purposes
mView->addEventHandler(new osgViewer::StatsHandler); mView->addEventHandler(new osgViewer::StatsHandler);
mView->getCamera()->setCullMask(~(Mask_UpdateVisitor)); mView->getCamera()->setCullMask(~(SceneUtil::Mask_UpdateVisitor));
viewer.addView(mView); viewer.addView(mView);
viewer.setDone(false); viewer.setDone(false);
@ -122,7 +122,7 @@ void RenderWidget::flagAsModified()
void RenderWidget::setVisibilityMask(int mask) void RenderWidget::setVisibilityMask(int mask)
{ {
mView->getCamera()->setCullMask(mask | Mask_ParticleSystem | Mask_Lighting); mView->getCamera()->setCullMask(mask | SceneUtil::Mask_ParticleSystem | SceneUtil::Mask_Lighting);
} }
osg::Camera *RenderWidget::getCamera() osg::Camera *RenderWidget::getCamera()
@ -212,7 +212,7 @@ SceneWidget::SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSyste
mOrbitCamControl = new OrbitCameraController(this); mOrbitCamControl = new OrbitCameraController(this);
mCurrentCamControl = mFreeCamControl; mCurrentCamControl = mFreeCamControl;
mOrbitCamControl->setPickingMask(Mask_Reference | Mask_Terrain); mOrbitCamControl->setPickingMask(SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain);
mOrbitCamControl->setConstRoll( CSMPrefs::get()["3D Scene Input"]["navi-orbit-const-roll"].isTrue() ); mOrbitCamControl->setConstRoll( CSMPrefs::get()["3D Scene Input"]["navi-orbit-const-roll"].isTrue() );
@ -221,7 +221,7 @@ SceneWidget::SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSyste
setLighting(&mLightingDay); setLighting(&mLightingDay);
mResourceSystem->getSceneManager()->setParticleSystemMask(Mask_ParticleSystem); mResourceSystem->getSceneManager()->setParticleSystemMask(SceneUtil::Mask_ParticleSystem);
// Recieve mouse move event even if mouse button is not pressed // Recieve mouse move event even if mouse button is not pressed
setMouseTracking(true); setMouseTracking(true);
@ -350,7 +350,7 @@ void SceneWidget::update(double dt)
} }
else else
{ {
mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp); mCurrentCamControl->setup(mRootNode, SceneUtil::Mask_EditorReference | SceneUtil::Mask_Terrain, CameraController::WorldUp);
mCamPositionSet = true; mCamPositionSet = true;
} }
} }

@ -3,8 +3,6 @@
#include "../widget/scenetoolmode.hpp" #include "../widget/scenetoolmode.hpp"
#include "mask.hpp"
class QAction; class QAction;
namespace CSVRender namespace CSVRender

@ -1,9 +1,9 @@
#include "tagbase.hpp" #include "tagbase.hpp"
CSVRender::TagBase::TagBase (Mask mask) : mMask (mask) {} CSVRender::TagBase::TagBase (SceneUtil::VisMask mask) : mMask (mask) {}
CSVRender::Mask CSVRender::TagBase::getMask() const SceneUtil::VisMask CSVRender::TagBase::getMask() const
{ {
return mMask; return mMask;
} }

@ -5,19 +5,19 @@
#include <QString> #include <QString>
#include "mask.hpp" #include <components/sceneutil/vismask.hpp>
namespace CSVRender namespace CSVRender
{ {
class TagBase : public osg::Referenced class TagBase : public osg::Referenced
{ {
Mask mMask; SceneUtil::VisMask mMask;
public: public:
TagBase (Mask mask); TagBase (SceneUtil::VisMask mask);
Mask getMask() const; SceneUtil::VisMask getMask() const;
virtual QString getToolTip (bool hideBasics) const; virtual QString getToolTip (bool hideBasics) const;

@ -17,6 +17,7 @@
#include <components/esm/loadland.hpp> #include <components/esm/loadland.hpp>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../widget/brushshapes.hpp" #include "../widget/brushshapes.hpp"
#include "../widget/modebutton.hpp" #include "../widget/modebutton.hpp"
@ -38,13 +39,12 @@
#include "editmode.hpp" #include "editmode.hpp"
#include "pagedworldspacewidget.hpp" #include "pagedworldspacewidget.hpp"
#include "mask.hpp"
#include "tagbase.hpp" #include "tagbase.hpp"
#include "terrainselection.hpp" #include "terrainselection.hpp"
#include "worldspacewidget.hpp" #include "worldspacewidget.hpp"
CSVRender::TerrainShapeMode::TerrainShapeMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent) CSVRender::TerrainShapeMode::TerrainShapeMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent)
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-shape"}, Mask_Terrain | Mask_Reference, "Terrain land editing", parent), : EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-shape"}, SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference, "Terrain land editing", parent),
mParentNode(parentNode) mParentNode(parentNode)
{ {
} }

@ -13,6 +13,7 @@
#include <osg/Group> #include <osg/Group>
#include <components/esm/loadland.hpp> #include <components/esm/loadland.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../widget/modebutton.hpp" #include "../widget/modebutton.hpp"
#include "../widget/scenetoolbar.hpp" #include "../widget/scenetoolbar.hpp"
@ -34,12 +35,11 @@
#include "editmode.hpp" #include "editmode.hpp"
#include "pagedworldspacewidget.hpp" #include "pagedworldspacewidget.hpp"
#include "mask.hpp"
#include "object.hpp" // Something small needed regarding pointers from here () #include "object.hpp" // Something small needed regarding pointers from here ()
#include "worldspacewidget.hpp" #include "worldspacewidget.hpp"
CSVRender::TerrainTextureMode::TerrainTextureMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent) CSVRender::TerrainTextureMode::TerrainTextureMode (WorldspaceWidget *worldspaceWidget, osg::Group* parentNode, QWidget *parent)
: EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-texture"}, Mask_Terrain | Mask_Reference, "Terrain texture editing", parent), : EditMode (worldspaceWidget, QIcon {":scenetoolbar/editing-terrain-texture"}, SceneUtil::Mask_Terrain | SceneUtil::Mask_EditorReference, "Terrain texture editing", parent),
mBrushTexture("L0#0"), mBrushTexture("L0#0"),
mBrushSize(1), mBrushSize(1),
mBrushShape(0), mBrushShape(0),

@ -16,7 +16,6 @@
#include "../widget/scenetooltoggle2.hpp" #include "../widget/scenetooltoggle2.hpp"
#include "cameracontroller.hpp" #include "cameracontroller.hpp"
#include "mask.hpp"
#include "tagbase.hpp" #include "tagbase.hpp"
void CSVRender::UnpagedWorldspaceWidget::update() void CSVRender::UnpagedWorldspaceWidget::update()
@ -304,8 +303,8 @@ void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool) CSVWidget::SceneToolToggle2 *tool)
{ {
WorldspaceWidget::addVisibilitySelectorButtons (tool); WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Button_Terrain, Mask_Terrain, "Terrain", "", true); tool->addButton (Button_Terrain, SceneUtil::Mask_Terrain, "Terrain", "", true);
tool->addButton (Button_Fog, Mask_Fog, "Fog"); //tool->addButton (Button_Fog, Mask_Fog, "Fog");
} }
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction() std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()

@ -26,8 +26,9 @@
#include "../widget/scenetooltoggle2.hpp" #include "../widget/scenetooltoggle2.hpp"
#include "../widget/scenetoolrun.hpp" #include "../widget/scenetoolrun.hpp"
#include <components/sceneutil/vismask.hpp>
#include "object.hpp" #include "object.hpp"
#include "mask.hpp"
#include "instancemode.hpp" #include "instancemode.hpp"
#include "pathgridmode.hpp" #include "pathgridmode.hpp"
#include "cameracontroller.hpp" #include "cameracontroller.hpp"
@ -138,7 +139,7 @@ void CSVRender::WorldspaceWidget::settingChanged (const CSMPrefs::Setting *setti
{ {
float alpha = setting->toDouble(); float alpha = setting->toDouble();
// getSelection is virtual, thus this can not be called from the constructor // getSelection is virtual, thus this can not be called from the constructor
auto selection = getSelection(Mask_Reference); auto selection = getSelection(SceneUtil::Mask_EditorReference);
for (osg::ref_ptr<TagBase> tag : selection) for (osg::ref_ptr<TagBase> tag : selection)
{ {
if (auto objTag = dynamic_cast<ObjectTag*>(tag.get())) if (auto objTag = dynamic_cast<ObjectTag*>(tag.get()))
@ -345,7 +346,7 @@ unsigned int CSVRender::WorldspaceWidget::getVisibilityMask() const
void CSVRender::WorldspaceWidget::setInteractionMask (unsigned int mask) void CSVRender::WorldspaceWidget::setInteractionMask (unsigned int mask)
{ {
mInteractionMask = mask | Mask_CellMarker | Mask_CellArrow; mInteractionMask = mask | SceneUtil::Mask_EditorCellMarker | SceneUtil::Mask_EditorCellArrow;
} }
unsigned int CSVRender::WorldspaceWidget::getInteractionMask() const unsigned int CSVRender::WorldspaceWidget::getInteractionMask() const
@ -361,9 +362,9 @@ void CSVRender::WorldspaceWidget::setEditLock (bool locked)
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons ( void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool) CSVWidget::SceneToolToggle2 *tool)
{ {
tool->addButton (Button_Reference, Mask_Reference, "Instances"); tool->addButton (Button_Reference, SceneUtil::Mask_EditorReference, "Instances");
tool->addButton (Button_Water, Mask_Water, "Water"); tool->addButton (Button_Water, SceneUtil::Mask_Water, "Water");
tool->addButton (Button_Pathgrid, Mask_Pathgrid, "Pathgrid"); tool->addButton (Button_Pathgrid, SceneUtil::Mask_Pathgrid, "Pathgrid");
} }
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool) void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)

@ -8,7 +8,6 @@
#include "../../model/world/tablemimedata.hpp" #include "../../model/world/tablemimedata.hpp"
#include "scenewidget.hpp" #include "scenewidget.hpp"
#include "mask.hpp"
namespace CSMPrefs namespace CSMPrefs
{ {

@ -18,7 +18,7 @@ set(GAME_HEADER
source_group(game FILES ${GAME} ${GAME_HEADER}) source_group(game FILES ${GAME} ${GAME_HEADER})
add_openmw_dir (mwrender add_openmw_dir (mwrender
actors objects renderingmanager animation rotatecontroller sky npcanimation vismask actors objects renderingmanager animation rotatecontroller sky npcanimation
creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation
bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation
renderbin actoranimation landmanager navmesh actorspaths renderbin actoranimation landmanager navmesh actorspaths

@ -26,6 +26,7 @@
#include <components/compiler/extensions0.hpp> #include <components/compiler/extensions0.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/workqueue.hpp> #include <components/sceneutil/workqueue.hpp>
#include <components/files/configurationmanager.hpp> #include <components/files/configurationmanager.hpp>
@ -47,8 +48,6 @@
#include "mwworld/player.hpp" #include "mwworld/player.hpp"
#include "mwworld/worldimp.hpp" #include "mwworld/worldimp.hpp"
#include "mwrender/vismask.hpp"
#include "mwclass/classes.hpp" #include "mwclass/classes.hpp"
#include "mwdialogue/dialoguemanagerimp.hpp" #include "mwdialogue/dialoguemanagerimp.hpp"
@ -544,7 +543,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
std::string myguiResources = (mResDir / "mygui").string(); std::string myguiResources = (mResDir / "mygui").string();
osg::ref_ptr<osg::Group> guiRoot = new osg::Group; osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
guiRoot->setName("GUI Root"); guiRoot->setName("GUI Root");
guiRoot->setNodeMask(MWRender::Mask_GUI); guiRoot->setNodeMask(SceneUtil::Mask_GUI);
rootNode->addChild(guiRoot); rootNode->addChild(guiRoot);
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(), MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(),
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources, mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,

@ -3,6 +3,7 @@
#include <components/esm/loadacti.hpp> #include <components/esm/loadacti.hpp>
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -19,7 +20,6 @@
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp" #include "../mwrender/renderinginterface.hpp"
#include "../mwrender/vismask.hpp"
#include "../mwgui/tooltips.hpp" #include "../mwgui/tooltips.hpp"
@ -34,7 +34,7 @@ namespace MWClass
if (!model.empty()) if (!model.empty())
{ {
renderingInterface.getObjects().insertModel(ptr, model, true); renderingInterface.getObjects().insertModel(ptr, model, true);
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
} }
} }

@ -3,6 +3,7 @@
#include <components/esm/loaddoor.hpp> #include <components/esm/loaddoor.hpp>
#include <components/esm/doorstate.hpp> #include <components/esm/doorstate.hpp>
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -25,7 +26,6 @@
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp" #include "../mwrender/renderinginterface.hpp"
#include "../mwrender/animation.hpp" #include "../mwrender/animation.hpp"
#include "../mwrender/vismask.hpp"
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
@ -58,7 +58,7 @@ namespace MWClass
if (!model.empty()) if (!model.empty())
{ {
renderingInterface.getObjects().insertModel(ptr, model, true); renderingInterface.getObjects().insertModel(ptr, model, true);
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
} }
} }

@ -2,6 +2,7 @@
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwphysics/physicssystem.hpp" #include "../mwphysics/physicssystem.hpp"
@ -9,7 +10,6 @@
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp" #include "../mwrender/renderinginterface.hpp"
#include "../mwrender/vismask.hpp"
namespace MWClass namespace MWClass
{ {
@ -19,7 +19,7 @@ namespace MWClass
if (!model.empty()) if (!model.empty())
{ {
renderingInterface.getObjects().insertModel(ptr, model); renderingInterface.getObjects().insertModel(ptr, model);
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Static);
} }
} }

@ -14,14 +14,13 @@
#include <components/myguiplatform/myguitexture.hpp> #include <components/myguiplatform/myguitexture.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/statemanager.hpp" #include "../mwbase/statemanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
#include "../mwrender/vismask.hpp"
#include "backgroundimage.hpp" #include "backgroundimage.hpp"
namespace MWGui namespace MWGui
@ -335,8 +334,8 @@ namespace MWGui
// Turn off rendering except the GUI // Turn off rendering except the GUI
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask(); int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
int oldCullMask = mViewer->getCamera()->getCullMask(); int oldCullMask = mViewer->getCamera()->getCullMask();
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile); mViewer->getUpdateVisitor()->setTraversalMask(SceneUtil::Mask_GUI|SceneUtil::Mask_PreCompile);
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI|MWRender::Mask_PreCompile); mViewer->getCamera()->setCullMask(SceneUtil::Mask_GUI|SceneUtil::Mask_PreCompile);
MWBase::Environment::get().getInputManager()->update(0, true, true); MWBase::Environment::get().getInputManager()->update(0, true, true);

@ -30,6 +30,7 @@
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/workqueue.hpp> #include <components/sceneutil/workqueue.hpp>
#include <components/translation/translation.hpp> #include <components/translation/translation.hpp>
@ -50,8 +51,6 @@
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwrender/vismask.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
@ -1883,8 +1882,8 @@ namespace MWGui
// Turn off all rendering except for the GUI // Turn off all rendering except for the GUI
int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask(); int oldUpdateMask = mViewer->getUpdateVisitor()->getTraversalMask();
int oldCullMask = mViewer->getCamera()->getCullMask(); int oldCullMask = mViewer->getCamera()->getCullMask();
mViewer->getUpdateVisitor()->setTraversalMask(MWRender::Mask_GUI); mViewer->getUpdateVisitor()->setTraversalMask(SceneUtil::Mask_GUI);
mViewer->getCamera()->setCullMask(MWRender::Mask_GUI); mViewer->getCamera()->setCullMask(SceneUtil::Mask_GUI);
MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize(); MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
sizeVideo(screenSize.width, screenSize.height); sizeVideo(screenSize.width, screenSize.height);

@ -4,6 +4,7 @@
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -24,8 +25,6 @@
#include "../mwmechanics/aibreathe.hpp" #include "../mwmechanics/aibreathe.hpp"
#include "../mwrender/vismask.hpp"
#include "spellcasting.hpp" #include "spellcasting.hpp"
#include "steering.hpp" #include "steering.hpp"
#include "npcstats.hpp" #include "npcstats.hpp"
@ -1414,11 +1413,11 @@ namespace MWMechanics
const float dist = (player.getRefData().getPosition().asVec3() - ptr.getRefData().getPosition().asVec3()).length(); const float dist = (player.getRefData().getPosition().asVec3() - ptr.getRefData().getPosition().asVec3()).length();
if (dist > mActorsProcessingRange) if (dist > mActorsProcessingRange)
{ {
ptr.getRefData().getBaseNode()->setNodeMask(0); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Disabled);
return; return;
} }
else else
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Actor); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
// Fade away actors on large distance (>90% of actor's processing distance) // Fade away actors on large distance (>90% of actor's processing distance)
float visibilityRatio = 1.0; float visibilityRatio = 1.0;
@ -1742,12 +1741,12 @@ namespace MWMechanics
if (!inRange) if (!inRange)
{ {
iter->first.getRefData().getBaseNode()->setNodeMask(0); iter->first.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Disabled);
world->setActorCollisionMode(iter->first, false, false); world->setActorCollisionMode(iter->first, false, false);
continue; continue;
} }
else if (!isPlayer) else if (!isPlayer)
iter->first.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Actor); iter->first.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
const bool isDead = iter->first.getClass().getCreatureStats(iter->first).isDead(); const bool isDead = iter->first.getClass().getCreatureStats(iter->first).isDead();
if (!isDead && iter->first.getClass().getCreatureStats(iter->first).isParalyzed()) if (!isDead && iter->first.getClass().getCreatureStats(iter->first).isParalyzed())

@ -15,6 +15,7 @@
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/lightutil.hpp> #include <components/sceneutil/lightutil.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
@ -31,8 +32,6 @@
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
#include "../mwmechanics/weapontype.hpp" #include "../mwmechanics/weapontype.hpp"
#include "vismask.hpp"
namespace MWRender namespace MWRender
{ {
@ -367,7 +366,7 @@ void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
// Otherwise add the enchanted glow to it. // Otherwise add the enchanted glow to it.
if (!showHolsteredWeapons) if (!showHolsteredWeapons)
{ {
weaponNode->setNodeMask(0); weaponNode->setNodeMask(SceneUtil::Mask_Disabled);
} }
else else
{ {
@ -541,7 +540,7 @@ void ActorAnimation::addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM
bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior(); bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior();
osg::Vec4f ambient(1,1,1,1); osg::Vec4f ambient(1,1,1,1);
osg::ref_ptr<SceneUtil::LightSource> lightSource = SceneUtil::createLightSource(esmLight, Mask_Lighting, exterior, ambient); osg::ref_ptr<SceneUtil::LightSource> lightSource = SceneUtil::createLightSource(esmLight, exterior, ambient);
mInsert->addChild(lightSource); mInsert->addChild(lightSource);

@ -1,7 +1,7 @@
#include "actorspaths.hpp" #include "actorspaths.hpp"
#include "vismask.hpp"
#include <components/sceneutil/agentpath.hpp> #include <components/sceneutil/agentpath.hpp>
#include <components/sceneutil/vismask.hpp>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
@ -43,7 +43,7 @@ namespace MWRender
const auto newGroup = SceneUtil::createAgentPathGroup(path, halfExtents, start, end, settings); const auto newGroup = SceneUtil::createAgentPathGroup(path, halfExtents, start, end, settings);
if (newGroup) if (newGroup)
{ {
newGroup->setNodeMask(Mask_Debug); newGroup->setNodeMask(SceneUtil::Mask_Debug);
mRootNode->addChild(newGroup); mRootNode->addChild(newGroup);
mGroups[actor] = newGroup; mGroups[actor] = newGroup;
} }

@ -28,6 +28,7 @@
#include <components/sceneutil/actorutil.hpp> #include <components/sceneutil/actorutil.hpp>
#include <components/sceneutil/statesetupdater.hpp> #include <components/sceneutil/statesetupdater.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/lightutil.hpp> #include <components/sceneutil/lightutil.hpp>
#include <components/sceneutil/skeleton.hpp> #include <components/sceneutil/skeleton.hpp>
@ -44,7 +45,6 @@
#include "../mwmechanics/character.hpp" // FIXME: for MWMechanics::Priority #include "../mwmechanics/character.hpp" // FIXME: for MWMechanics::Priority
#include "vismask.hpp"
#include "util.hpp" #include "util.hpp"
#include "rotatecontroller.hpp" #include "rotatecontroller.hpp"
@ -578,7 +578,7 @@ namespace MWRender
else else
{ {
// Hide effect immediately // Hide effect immediately
node->setNodeMask(0); node->setNodeMask(SceneUtil::Mask_Disabled);
mFinished = true; mFinished = true;
} }
} }
@ -1595,7 +1595,7 @@ namespace MWRender
{ {
bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior(); bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior();
SceneUtil::addLight(parent, esmLight, Mask_ParticleSystem, Mask_Lighting, exterior); SceneUtil::addLight(parent, esmLight, exterior);
} }
void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture) 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 // FreezeOnCull doesn't work so well with effect particles, that tend to have moving emitters
SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor; SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor;
node->accept(disableFreezeOnCullVisitor); node->accept(disableFreezeOnCullVisitor);
node->setNodeMask(Mask_Effect); node->setNodeMask(SceneUtil::Mask_Effect);
params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength(); params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength();
params.mLoop = loop; params.mLoop = loop;
@ -1806,7 +1806,7 @@ namespace MWRender
SceneUtil::configureLight(light, radius, isExterior); SceneUtil::configureLight(light, radius, isExterior);
mGlowLight = new SceneUtil::LightSource; mGlowLight = new SceneUtil::LightSource;
mGlowLight->setNodeMask(Mask_Lighting); mGlowLight->setNodeMask(SceneUtil::Mask_Lighting);
mInsert->addChild(mGlowLight); mInsert->addChild(mGlowLight);
mGlowLight->setLight(light); mGlowLight->setLight(light);
} }

@ -7,7 +7,7 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include "vismask.hpp" #include <components/sceneutil/vismask.hpp>
namespace namespace
{ {
@ -34,7 +34,7 @@ void DebugDrawer::createGeometry()
if (!mGeometry) if (!mGeometry)
{ {
mGeometry = new osg::Geometry; mGeometry = new osg::Geometry;
mGeometry->setNodeMask(Mask_Debug); mGeometry->setNodeMask(SceneUtil::Mask_Debug);
mVertices = new osg::Vec3Array; mVertices = new osg::Vec3Array;

@ -17,6 +17,7 @@
#include <components/fallback/fallback.hpp> #include <components/fallback/fallback.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -27,7 +28,6 @@
#include "../mwmechanics/weapontype.hpp" #include "../mwmechanics/weapontype.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "vismask.hpp"
namespace MWRender namespace MWRender
{ {
@ -61,7 +61,7 @@ namespace MWRender
} }
else else
{ {
node->setNodeMask(0); node->setNodeMask(SceneUtil::Mask_Disabled);
} }
} }
@ -138,9 +138,9 @@ namespace MWRender
mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture); mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture);
mCamera->setName("CharacterPreview"); mCamera->setName("CharacterPreview");
mCamera->setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); mCamera->setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
mCamera->setCullMask(~(Mask_UpdateVisitor)); mCamera->setCullMask(~(SceneUtil::Mask_UpdateVisitor));
mCamera->setNodeMask(Mask_RenderToTexture); mCamera->setNodeMask(SceneUtil::Mask_RenderToTexture);
osg::ref_ptr<SceneUtil::LightManager> lightManager = new SceneUtil::LightManager; osg::ref_ptr<SceneUtil::LightManager> lightManager = new SceneUtil::LightManager;
lightManager->setStartLight(1); lightManager->setStartLight(1);
@ -255,7 +255,7 @@ namespace MWRender
void CharacterPreview::redraw() void CharacterPreview::redraw()
{ {
mCamera->setNodeMask(Mask_RenderToTexture); mCamera->setNodeMask(SceneUtil::Mask_RenderToTexture);
mDrawOnceCallback->redrawNextFrame(); mDrawOnceCallback->redrawNextFrame();
} }
@ -364,7 +364,7 @@ namespace MWRender
visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame()); visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame());
osg::Node::NodeMask nodeMask = mCamera->getNodeMask(); osg::Node::NodeMask nodeMask = mCamera->getNodeMask();
mCamera->setNodeMask(~0); mCamera->setNodeMask(SceneUtil::Mask_Default);
mCamera->accept(visitor); mCamera->accept(visitor);
mCamera->setNodeMask(nodeMask); mCamera->setNodeMask(nodeMask);

@ -6,9 +6,9 @@
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/sceneutil/controller.hpp> #include <components/sceneutil/controller.hpp>
#include <components/sceneutil/vismask.hpp>
#include "animation.hpp" #include "animation.hpp"
#include "vismask.hpp"
#include "util.hpp" #include "util.hpp"
namespace MWRender 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); osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(model);
node->setNodeMask(Mask_Effect); node->setNodeMask(SceneUtil::Mask_Effect);
Effect effect; Effect effect;
effect.mAnimTime.reset(new EffectAnimationTime); effect.mAnimTime.reset(new EffectAnimationTime);

@ -16,6 +16,7 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/sceneutil/workqueue.hpp> #include <components/sceneutil/workqueue.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/esm/globalmap.hpp> #include <components/esm/globalmap.hpp>
@ -24,8 +25,6 @@
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "vismask.hpp"
namespace namespace
{ {
@ -76,7 +75,7 @@ namespace
{ {
if (mParent->copyResult(static_cast<osg::Camera*>(node), nv->getTraversalNumber())) if (mParent->copyResult(static_cast<osg::Camera*>(node), nv->getTraversalNumber()))
{ {
node->setNodeMask(0); node->setNodeMask(SceneUtil::Mask_Disabled);
mParent->markForRemoval(static_cast<osg::Camera*>(node)); mParent->markForRemoval(static_cast<osg::Camera*>(node));
} }
return; return;
@ -288,7 +287,7 @@ namespace MWRender
float srcLeft, float srcTop, float srcRight, float srcBottom) float srcLeft, float srcTop, float srcRight, float srcBottom)
{ {
osg::ref_ptr<osg::Camera> camera (new osg::Camera); osg::ref_ptr<osg::Camera> camera (new osg::Camera);
camera->setNodeMask(Mask_RenderToTexture); camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity()); camera->setViewMatrix(osg::Matrix::identity());
camera->setProjectionMatrix(osg::Matrix::identity()); camera->setProjectionMatrix(osg::Matrix::identity());

@ -18,6 +18,7 @@
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/files/memorystream.hpp> #include <components/files/memorystream.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -25,8 +26,6 @@
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "vismask.hpp"
namespace namespace
{ {
@ -42,7 +41,7 @@ namespace
virtual void operator()(osg::Node* node, osg::NodeVisitor*) virtual void operator()(osg::Node* node, osg::NodeVisitor*)
{ {
if (mRendered) if (mRendered)
node->setNodeMask(0); node->setNodeMask(SceneUtil::Mask_Disabled);
if (!mRendered) if (!mRendered)
{ {
@ -178,8 +177,8 @@ osg::ref_ptr<osg::Camera> LocalMap::createOrthographicCamera(float x, float y, f
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
camera->setRenderOrder(osg::Camera::PRE_RENDER); camera->setRenderOrder(osg::Camera::PRE_RENDER);
camera->setCullMask(Mask_Scene | Mask_SimpleWater | Mask_Terrain | Mask_Object | Mask_Static); camera->setCullMask(SceneUtil::Mask_Scene | SceneUtil::Mask_SimpleWater | SceneUtil::Mask_Terrain | SceneUtil::Mask_Object | SceneUtil::Mask_Static);
camera->setNodeMask(Mask_RenderToTexture); camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet; 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); stateset->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL), osg::StateAttribute::OVERRIDE);
@ -376,7 +375,7 @@ void LocalMap::requestExteriorMap(const MWWorld::CellStore* cell)
void LocalMap::requestInteriorMap(const MWWorld::CellStore* cell) void LocalMap::requestInteriorMap(const MWWorld::CellStore* cell)
{ {
osg::ComputeBoundsVisitor computeBoundsVisitor; osg::ComputeBoundsVisitor computeBoundsVisitor;
computeBoundsVisitor.setTraversalMask(Mask_Scene | Mask_Terrain | Mask_Object | Mask_Static); computeBoundsVisitor.setTraversalMask(SceneUtil::Mask_Scene | SceneUtil::Mask_Terrain | SceneUtil::Mask_Object | SceneUtil::Mask_Static);
mSceneRoot->accept(computeBoundsVisitor); mSceneRoot->accept(computeBoundsVisitor);
osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox(); osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox();

@ -1,7 +1,7 @@
#include "navmesh.hpp" #include "navmesh.hpp"
#include "vismask.hpp"
#include <components/sceneutil/navmesh.hpp> #include <components/sceneutil/navmesh.hpp>
#include <components/sceneutil/vismask.hpp>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
@ -45,7 +45,7 @@ namespace MWRender
mGroup = SceneUtil::createNavMeshGroup(navMesh, settings); mGroup = SceneUtil::createNavMeshGroup(navMesh, settings);
if (mGroup) if (mGroup)
{ {
mGroup->setNodeMask(Mask_Debug); mGroup->setNodeMask(SceneUtil::Mask_Debug);
mRootNode->addChild(mGroup); mRootNode->addChild(mGroup);
} }
} }

@ -18,6 +18,7 @@
#include <components/sceneutil/actorutil.hpp> #include <components/sceneutil/actorutil.hpp>
#include <components/sceneutil/attach.hpp> #include <components/sceneutil/attach.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/skeleton.hpp> #include <components/sceneutil/skeleton.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -43,7 +44,6 @@
#include "camera.hpp" #include "camera.hpp"
#include "rotatecontroller.hpp" #include "rotatecontroller.hpp"
#include "renderbin.hpp" #include "renderbin.hpp"
#include "vismask.hpp"
namespace namespace
{ {
@ -535,7 +535,7 @@ void NpcAnimation::updateNpcBase()
addAnimSource(smodel, smodel); addAnimSource(smodel, smodel);
mObjectRoot->setNodeMask(Mask_FirstPerson); mObjectRoot->setNodeMask(SceneUtil::Mask_FirstPerson);
mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView)); mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView));
} }

@ -5,6 +5,7 @@
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/unrefqueue.hpp> #include <components/sceneutil/unrefqueue.hpp>
#include <components/sceneutil/vismask.hpp>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -12,8 +13,6 @@
#include "animation.hpp" #include "animation.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "creatureanimation.hpp" #include "creatureanimation.hpp"
#include "vismask.hpp"
namespace MWRender namespace MWRender
{ {
@ -71,7 +70,7 @@ void Objects::insertBegin(const MWWorld::Ptr& ptr)
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool animated, bool allowLight) void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool animated, bool allowLight)
{ {
insertBegin(ptr); insertBegin(ptr);
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Object); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Object);
osg::ref_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight)); osg::ref_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight));
@ -81,7 +80,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) void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, bool weaponsShields)
{ {
insertBegin(ptr); insertBegin(ptr);
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
// CreatureAnimation // CreatureAnimation
osg::ref_ptr<Animation> anim; osg::ref_ptr<Animation> anim;
@ -98,7 +97,7 @@ void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, b
void Objects::insertNPC(const MWWorld::Ptr &ptr) void Objects::insertNPC(const MWWorld::Ptr &ptr)
{ {
insertBegin(ptr); insertBegin(ptr);
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor); ptr.getRefData().getBaseNode()->setNodeMask(SceneUtil::Mask_Actor);
osg::ref_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem)); osg::ref_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem));

@ -8,6 +8,7 @@
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
#include <components/sceneutil/pathgridutil.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/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -17,8 +18,6 @@
#include "../mwmechanics/pathfinding.hpp" #include "../mwmechanics/pathfinding.hpp"
#include "../mwmechanics/coordinateconverter.hpp" #include "../mwmechanics/coordinateconverter.hpp"
#include "vismask.hpp"
namespace MWRender namespace MWRender
{ {
@ -73,7 +72,7 @@ void Pathgrid::togglePathgrid()
{ {
// add path grid meshes to already loaded cells // add path grid meshes to already loaded cells
mPathGridRoot = new osg::Group; mPathGridRoot = new osg::Group;
mPathGridRoot->setNodeMask(Mask_Debug); mPathGridRoot->setNodeMask(SceneUtil::Mask_Pathgrid);
mRootNode->addChild(mPathGridRoot); mRootNode->addChild(mPathGridRoot);
for(const MWWorld::CellStore* cell : mActiveCells) for(const MWWorld::CellStore* cell : mActiveCells)

@ -40,6 +40,7 @@
#include <components/sceneutil/unrefqueue.hpp> #include <components/sceneutil/unrefqueue.hpp>
#include <components/sceneutil/writescene.hpp> #include <components/sceneutil/writescene.hpp>
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/terrain/terraingrid.hpp> #include <components/terrain/terraingrid.hpp>
#include <components/terrain/quadtreeworld.hpp> #include <components/terrain/quadtreeworld.hpp>
@ -58,7 +59,6 @@
#include "sky.hpp" #include "sky.hpp"
#include "effectmanager.hpp" #include "effectmanager.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "vismask.hpp"
#include "pathgrid.hpp" #include "pathgrid.hpp"
#include "camera.hpp" #include "camera.hpp"
#include "water.hpp" #include "water.hpp"
@ -215,7 +215,7 @@ namespace MWRender
, mFieldOfViewOverride(0.f) , mFieldOfViewOverride(0.f)
, mBorders(false) , mBorders(false)
{ {
resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem); resourceSystem->getSceneManager()->setParticleSystemMask(SceneUtil::Mask_ParticleSystem);
resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders"); resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders");
resourceSystem->getSceneManager()->setForceShaders(Settings::Manager::getBool("force shaders", "Shaders") || Settings::Manager::getBool("enable shadows", "Shadows")); // Shadows have problems with fixed-function mode resourceSystem->getSceneManager()->setForceShaders(Settings::Manager::getBool("force shaders", "Shaders") || Settings::Manager::getBool("enable shadows", "Shadows")); // Shadows have problems with fixed-function mode
// FIXME: calling dummy method because terrain needs to know whether lighting is clamped // FIXME: calling dummy method because terrain needs to know whether lighting is clamped
@ -227,21 +227,21 @@ namespace MWRender
resourceSystem->getSceneManager()->setSpecularMapPattern(Settings::Manager::getString("specular map pattern", "Shaders")); resourceSystem->getSceneManager()->setSpecularMapPattern(Settings::Manager::getString("specular map pattern", "Shaders"));
osg::ref_ptr<SceneUtil::LightManager> sceneRoot = new SceneUtil::LightManager; osg::ref_ptr<SceneUtil::LightManager> sceneRoot = new SceneUtil::LightManager;
sceneRoot->setLightingMask(Mask_Lighting); sceneRoot->setLightingMask(SceneUtil::Mask_Lighting);
mSceneRoot = sceneRoot; mSceneRoot = sceneRoot;
sceneRoot->setStartLight(1); sceneRoot->setStartLight(1);
int shadowCastingTraversalMask = Mask_Scene; int shadowCastingTraversalMask = SceneUtil::Mask_Scene;
if (Settings::Manager::getBool("actor shadows", "Shadows")) if (Settings::Manager::getBool("actor shadows", "Shadows"))
shadowCastingTraversalMask |= Mask_Actor; shadowCastingTraversalMask |= SceneUtil::Mask_Actor;
if (Settings::Manager::getBool("player shadows", "Shadows")) if (Settings::Manager::getBool("player shadows", "Shadows"))
shadowCastingTraversalMask |= Mask_Player; shadowCastingTraversalMask |= SceneUtil::Mask_Player;
if (Settings::Manager::getBool("terrain shadows", "Shadows")) if (Settings::Manager::getBool("terrain shadows", "Shadows"))
shadowCastingTraversalMask |= Mask_Terrain; shadowCastingTraversalMask |= SceneUtil::Mask_Terrain;
int indoorShadowCastingTraversalMask = shadowCastingTraversalMask; int indoorShadowCastingTraversalMask = shadowCastingTraversalMask;
if (Settings::Manager::getBool("object shadows", "Shadows")) if (Settings::Manager::getBool("object shadows", "Shadows"))
shadowCastingTraversalMask |= (Mask_Object|Mask_Static); shadowCastingTraversalMask |= (SceneUtil::Mask_Object|SceneUtil::Mask_Static);
mShadowManager.reset(new SceneUtil::ShadowManager(sceneRoot, mRootNode, shadowCastingTraversalMask, indoorShadowCastingTraversalMask, mResourceSystem->getSceneManager()->getShaderManager())); mShadowManager.reset(new SceneUtil::ShadowManager(sceneRoot, mRootNode, shadowCastingTraversalMask, indoorShadowCastingTraversalMask, mResourceSystem->getSceneManager()->getShaderManager()));
@ -305,11 +305,10 @@ namespace MWRender
float maxCompGeometrySize = Settings::Manager::getFloat("max composite geometry size", "Terrain"); float maxCompGeometrySize = Settings::Manager::getFloat("max composite geometry size", "Terrain");
maxCompGeometrySize = std::max(maxCompGeometrySize, 1.f); maxCompGeometrySize = std::max(maxCompGeometrySize, 1.f);
mTerrain.reset(new Terrain::QuadTreeWorld( mTerrain.reset(new Terrain::QuadTreeWorld(
sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile, Mask_Debug, sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, compMapResolution, compMapLevel, lodFactor, vertexLodMod, maxCompGeometrySize));
compMapResolution, compMapLevel, lodFactor, vertexLodMod, maxCompGeometrySize));
} }
else else
mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile, Mask_Debug)); mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage));
mTerrain->setTargetFrameRate(Settings::Manager::getFloat("target framerate", "Cells")); mTerrain->setTargetFrameRate(Settings::Manager::getFloat("target framerate", "Cells"));
mTerrain->setWorkQueue(mWorkQueue.get()); mTerrain->setWorkQueue(mWorkQueue.get());
@ -319,7 +318,7 @@ namespace MWRender
mViewer->setLightingMode(osgViewer::View::NO_LIGHT); mViewer->setLightingMode(osgViewer::View::NO_LIGHT);
osg::ref_ptr<osg::LightSource> source = new osg::LightSource; osg::ref_ptr<osg::LightSource> source = new osg::LightSource;
source->setNodeMask(Mask_Lighting); source->setNodeMask(SceneUtil::Mask_Lighting);
mSunLight = new osg::Light; mSunLight = new osg::Light;
source->setLight(mSunLight); source->setLight(mSunLight);
mSunLight->setDiffuse(osg::Vec4f(0,0,0,1)); mSunLight->setDiffuse(osg::Vec4f(0,0,0,1));
@ -338,7 +337,7 @@ namespace MWRender
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f)); defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat); sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
sceneRoot->setNodeMask(Mask_Scene); sceneRoot->setNodeMask(SceneUtil::Mask_Scene);
sceneRoot->setName("Scene Root"); sceneRoot->setName("Scene Root");
mSky.reset(new SkyManager(sceneRoot, resourceSystem->getSceneManager())); mSky.reset(new SkyManager(sceneRoot, resourceSystem->getSceneManager()));
@ -366,7 +365,7 @@ namespace MWRender
mViewer->getCamera()->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); mViewer->getCamera()->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
mViewer->getCamera()->setCullingMode(cullingMode); mViewer->getCamera()->setCullingMode(cullingMode);
mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater)); mViewer->getCamera()->setCullMask(~(SceneUtil::Mask_UpdateVisitor|SceneUtil::Mask_SimpleWater));
mNearClip = Settings::Manager::getFloat("near clip", "Camera"); mNearClip = Settings::Manager::getFloat("near clip", "Camera");
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera"); mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
@ -568,12 +567,12 @@ namespace MWRender
else if (mode == Render_Scene) else if (mode == Render_Scene)
{ {
int mask = mViewer->getCamera()->getCullMask(); int mask = mViewer->getCamera()->getCullMask();
bool enabled = mask&Mask_Scene; bool enabled = mask & SceneUtil::Mask_Scene;
enabled = !enabled; enabled = !enabled;
if (enabled) if (enabled)
mask |= Mask_Scene; mask |= SceneUtil::Mask_Scene;
else else
mask &= ~Mask_Scene; mask &= ~SceneUtil::Mask_Scene;
mViewer->getCamera()->setCullMask(mask); mViewer->getCamera()->setCullMask(mask);
return enabled; return enabled;
} }
@ -841,7 +840,7 @@ namespace MWRender
int maskBackup = mPlayerAnimation->getObjectRoot()->getNodeMask(); int maskBackup = mPlayerAnimation->getObjectRoot()->getNodeMask();
if (mCamera->isFirstPerson()) if (mCamera->isFirstPerson())
mPlayerAnimation->getObjectRoot()->setNodeMask(0); mPlayerAnimation->getObjectRoot()->setNodeMask(SceneUtil::Mask_Disabled);
for (int i = 0; i < 6; ++i) // for each cubemap side for (int i = 0; i < 6; ++i) // for each cubemap side
{ {
@ -915,7 +914,7 @@ namespace MWRender
void RenderingManager::renderCameraToImage(osg::Camera *camera, osg::Image *image, int w, int h) void RenderingManager::renderCameraToImage(osg::Camera *camera, osg::Image *image, int w, int h)
{ {
camera->setNodeMask(Mask_RenderToTexture); camera->setNodeMask(SceneUtil::Mask_RenderToTexture);
camera->attach(osg::Camera::COLOR_BUFFER, image); camera->attach(osg::Camera::COLOR_BUFFER, image);
camera->setRenderOrder(osg::Camera::PRE_RENDER); camera->setRenderOrder(osg::Camera::PRE_RENDER);
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
@ -968,7 +967,7 @@ namespace MWRender
rttCamera->addChild(mWater->getReflectionCamera()); rttCamera->addChild(mWater->getReflectionCamera());
rttCamera->addChild(mWater->getRefractionCamera()); rttCamera->addChild(mWater->getRefractionCamera());
rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~Mask_GUI)); rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~SceneUtil::Mask_GUI));
rttCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); rttCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -981,7 +980,7 @@ namespace MWRender
return osg::Vec4f(); return osg::Vec4f();
osg::ComputeBoundsVisitor computeBoundsVisitor; osg::ComputeBoundsVisitor computeBoundsVisitor;
computeBoundsVisitor.setTraversalMask(~(Mask_ParticleSystem|Mask_Effect)); computeBoundsVisitor.setTraversalMask(~(SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Effect));
ptr.getRefData().getBaseNode()->accept(computeBoundsVisitor); ptr.getRefData().getBaseNode()->accept(computeBoundsVisitor);
osg::Matrix viewProj = mViewer->getCamera()->getViewMatrix() * mViewer->getCamera()->getProjectionMatrix(); osg::Matrix viewProj = mViewer->getCamera()->getViewMatrix() * mViewer->getCamera()->getProjectionMatrix();
@ -1053,12 +1052,11 @@ namespace MWRender
mIntersectionVisitor->setTraversalNumber(mViewer->getFrameStamp()->getFrameNumber()); mIntersectionVisitor->setTraversalNumber(mViewer->getFrameStamp()->getFrameNumber());
mIntersectionVisitor->setIntersector(intersector); mIntersectionVisitor->setIntersector(intersector);
int mask = ~0; int mask = ~(SceneUtil::Mask_RenderToTexture|SceneUtil::Mask_Sky|SceneUtil::Mask_Pathgrid|SceneUtil::Mask_Debug|SceneUtil::Mask_Effect|SceneUtil::Mask_Water|SceneUtil::Mask_SimpleWater);
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water|Mask_SimpleWater);
if (ignorePlayer) if (ignorePlayer)
mask &= ~(Mask_Player); mask &= ~(SceneUtil::Mask_Player);
if (ignoreActors) if (ignoreActors)
mask &= ~(Mask_Actor|Mask_Player); mask &= ~(SceneUtil::Mask_Actor|SceneUtil::Mask_Player);
mIntersectionVisitor->setTraversalMask(mask); mIntersectionVisitor->setTraversalMask(mask);
return mIntersectionVisitor; return mIntersectionVisitor;
@ -1138,7 +1136,7 @@ namespace MWRender
if (!mPlayerNode) if (!mPlayerNode)
{ {
mPlayerNode = new SceneUtil::PositionAttitudeTransform; mPlayerNode = new SceneUtil::PositionAttitudeTransform;
mPlayerNode->setNodeMask(Mask_Player); mPlayerNode->setNodeMask(SceneUtil::Mask_Player);
mPlayerNode->setName("Player Root"); mPlayerNode->setName("Player Root");
mSceneRoot->addChild(mPlayerNode); mSceneRoot->addChild(mPlayerNode);
} }
@ -1382,7 +1380,7 @@ namespace MWRender
osg::ref_ptr<const osg::Node> node = mResourceSystem->getSceneManager()->getTemplate(modelName); osg::ref_ptr<const osg::Node> node = mResourceSystem->getSceneManager()->getTemplate(modelName);
osg::ComputeBoundsVisitor computeBoundsVisitor; osg::ComputeBoundsVisitor computeBoundsVisitor;
computeBoundsVisitor.setTraversalMask(~(MWRender::Mask_ParticleSystem|MWRender::Mask_Effect)); computeBoundsVisitor.setTraversalMask(~(SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Effect));
const_cast<osg::Node*>(node.get())->accept(computeBoundsVisitor); const_cast<osg::Node*>(node.get())->accept(computeBoundsVisitor);
osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox(); osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox();

@ -16,8 +16,7 @@
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/fallback/fallback.hpp> #include <components/fallback/fallback.hpp>
#include <components/sceneutil/vismask.hpp>
#include "vismask.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -104,7 +103,7 @@ RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem*
mParticleNode->setName("Ripple Root"); mParticleNode->setName("Ripple Root");
mParticleNode->addChild(updater); mParticleNode->addChild(updater);
mParticleNode->addChild(mParticleSystem); mParticleNode->addChild(mParticleSystem);
mParticleNode->setNodeMask(Mask_Water); mParticleNode->setNodeMask(SceneUtil::Mask_Water);
createWaterRippleStateSet(resourceSystem, mParticleNode); createWaterRippleStateSet(resourceSystem, mParticleNode);

@ -42,12 +42,12 @@
#include <components/sceneutil/statesetupdater.hpp> #include <components/sceneutil/statesetupdater.hpp>
#include <components/sceneutil/controller.hpp> #include <components/sceneutil/controller.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "vismask.hpp"
#include "renderbin.hpp" #include "renderbin.hpp"
namespace namespace
@ -453,7 +453,7 @@ public:
void setVisible(bool visible) void setVisible(bool visible)
{ {
mTransform->setNodeMask(visible ? mVisibleMask : 0); mTransform->setNodeMask(visible ? mVisibleMask : SceneUtil::Mask_Disabled);
} }
protected: protected:
@ -469,7 +469,7 @@ class Sun : public CelestialBody
{ {
public: public:
Sun(osg::Group* parentNode, Resource::ImageManager& imageManager) Sun(osg::Group* parentNode, Resource::ImageManager& imageManager)
: CelestialBody(parentNode, 1.0f, 1, Mask_Sun) : CelestialBody(parentNode, 1.0f, 1, SceneUtil::Mask_Sun)
, mUpdater(new Updater) , mUpdater(new Updater)
{ {
mTransform->addUpdateCallback(mUpdater); mTransform->addUpdateCallback(mUpdater);
@ -644,7 +644,7 @@ private:
camera->setProjectionMatrix(osg::Matrix::identity()); camera->setProjectionMatrix(osg::Matrix::identity());
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); // add to skyRoot instead? camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); // add to skyRoot instead?
camera->setViewMatrix(osg::Matrix::identity()); camera->setViewMatrix(osg::Matrix::identity());
camera->setClearMask(0); camera->setClearMask(SceneUtil::Mask_Disabled);
camera->setRenderOrder(osg::Camera::NESTED_RENDER); camera->setRenderOrder(osg::Camera::NESTED_RENDER);
camera->setAllowEventFocus(false); camera->setAllowEventFocus(false);
@ -1134,7 +1134,7 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana
skyroot->getOrCreateStateSet()->setAttributeAndModes(new osg::Program(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::PROTECTED|osg::StateAttribute::ON); skyroot->getOrCreateStateSet()->setAttributeAndModes(new osg::Program(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::PROTECTED|osg::StateAttribute::ON);
SceneUtil::ShadowManager::disableShadowsForStateSet(skyroot->getOrCreateStateSet()); SceneUtil::ShadowManager::disableShadowsForStateSet(skyroot->getOrCreateStateSet());
skyroot->setNodeMask(Mask_Sky); skyroot->setNodeMask(SceneUtil::Mask_Sky);
parentNode->addChild(skyroot); parentNode->addChild(skyroot);
mRootNode = skyroot; mRootNode = skyroot;
@ -1166,7 +1166,7 @@ void SkyManager::create()
mAtmosphereDay->addUpdateCallback(mAtmosphereUpdater); mAtmosphereDay->addUpdateCallback(mAtmosphereUpdater);
mAtmosphereNightNode = new osg::PositionAttitudeTransform; mAtmosphereNightNode = new osg::PositionAttitudeTransform;
mAtmosphereNightNode->setNodeMask(0); mAtmosphereNightNode->setNodeMask(SceneUtil::Mask_Disabled);
mEarlyRenderBinRoot->addChild(mAtmosphereNightNode); mEarlyRenderBinRoot->addChild(mAtmosphereNightNode);
osg::ref_ptr<osg::Node> atmosphereNight; osg::ref_ptr<osg::Node> atmosphereNight;
@ -1199,7 +1199,7 @@ void SkyManager::create()
mCloudUpdater2 = new CloudUpdater; mCloudUpdater2 = new CloudUpdater;
mCloudUpdater2->setOpacity(0.f); mCloudUpdater2->setOpacity(0.f);
mCloudMesh2->addUpdateCallback(mCloudUpdater2); mCloudMesh2->addUpdateCallback(mCloudUpdater2);
mCloudMesh2->setNodeMask(0); mCloudMesh2->setNodeMask(SceneUtil::Mask_Disabled);
osg::ref_ptr<osg::Depth> depth = new osg::Depth; osg::ref_ptr<osg::Depth> depth = new osg::Depth;
depth->setWriteMask(false); depth->setWriteMask(false);
@ -1522,7 +1522,7 @@ void SkyManager::createRain()
mRainFader = new RainFader(&mWeatherAlpha); mRainFader = new RainFader(&mWeatherAlpha);
mRainNode->addUpdateCallback(mRainFader); mRainNode->addUpdateCallback(mRainFader);
mRainNode->addCullCallback(mUnderwaterSwitch); mRainNode->addCullCallback(mUnderwaterSwitch);
mRainNode->setNodeMask(Mask_WeatherParticles); mRainNode->setNodeMask(SceneUtil::Mask_WeatherParticles);
mRootNode->addChild(mRainNode); mRootNode->addChild(mRainNode);
} }
@ -1625,7 +1625,7 @@ void SkyManager::setEnabled(bool enabled)
if (enabled && !mCreated) if (enabled && !mCreated)
create(); create();
mRootNode->setNodeMask(enabled ? Mask_Sky : 0); mRootNode->setNodeMask(enabled ? SceneUtil::Mask_Sky : SceneUtil::Mask_Disabled);
mEnabled = enabled; mEnabled = enabled;
} }
@ -1718,7 +1718,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
{ {
mParticleNode = new osg::PositionAttitudeTransform; mParticleNode = new osg::PositionAttitudeTransform;
mParticleNode->addCullCallback(mUnderwaterSwitch); mParticleNode->addCullCallback(mUnderwaterSwitch);
mParticleNode->setNodeMask(Mask_WeatherParticles); mParticleNode->setNodeMask(SceneUtil::Mask_WeatherParticles);
mRootNode->addChild(mParticleNode); mRootNode->addChild(mParticleNode);
} }
@ -1788,7 +1788,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
mCloudUpdater->setOpacity((1.f-mCloudBlendFactor)); mCloudUpdater->setOpacity((1.f-mCloudBlendFactor));
mCloudUpdater2->setOpacity(mCloudBlendFactor); mCloudUpdater2->setOpacity(mCloudBlendFactor);
mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? ~0 : 0); mCloudMesh2->setNodeMask(mCloudBlendFactor > 0.f ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
} }
if (mCloudColour != weather.mFogColor) if (mCloudColour != weather.mFogColor)
@ -1833,7 +1833,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
mAtmosphereNightUpdater->setFade(mStarsOpacity); mAtmosphereNightUpdater->setFade(mStarsOpacity);
} }
mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0 : 0); mAtmosphereNightNode->setNodeMask(weather.mNight ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
if (mRainFader) if (mRainFader)
mRainFader->setAlpha(weather.mEffectFade * 0.6); // * Rain_Threshold? mRainFader->setAlpha(weather.mEffectFade * 0.6); // * Rain_Threshold?

@ -27,6 +27,7 @@
#include <components/sceneutil/shadow.hpp> #include <components/sceneutil/shadow.hpp>
#include <components/sceneutil/waterutil.hpp> #include <components/sceneutil/waterutil.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
@ -40,7 +41,6 @@
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "vismask.hpp"
#include "ripplesimulation.hpp" #include "ripplesimulation.hpp"
#include "renderbin.hpp" #include "renderbin.hpp"
#include "util.hpp" #include "util.hpp"
@ -243,8 +243,8 @@ public:
setName("RefractionCamera"); setName("RefractionCamera");
setCullCallback(new InheritViewPointCallback); setCullCallback(new InheritViewPointCallback);
setCullMask(Mask_Effect|Mask_Scene|Mask_Object|Mask_Static|Mask_Terrain|Mask_Actor|Mask_ParticleSystem|Mask_Sky|Mask_Sun|Mask_Player|Mask_Lighting); 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(Mask_RenderToTexture); setNodeMask(SceneUtil::Mask_RenderToTexture);
setViewport(0, 0, rttSize, rttSize); setViewport(0, 0, rttSize, rttSize);
// No need for Update traversal since the scene is already updated as part of the main scene graph // 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); setCullCallback(new InheritViewPointCallback);
setInterior(isInterior); setInterior(isInterior);
setNodeMask(Mask_RenderToTexture); setNodeMask(SceneUtil::Mask_RenderToTexture);
unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water"); unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water");
setViewport(0, 0, rttSize, rttSize); setViewport(0, 0, rttSize, rttSize);
@ -372,11 +372,11 @@ public:
int reflectionDetail = Settings::Manager::getInt("reflection detail", "Water"); int reflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
reflectionDetail = std::min(4, std::max(isInterior ? 2 : 0, reflectionDetail)); reflectionDetail = std::min(4, std::max(isInterior ? 2 : 0, reflectionDetail));
unsigned int extraMask = 0; unsigned int extraMask = 0;
if(reflectionDetail >= 1) extraMask |= Mask_Terrain; if(reflectionDetail >= 1) extraMask |= SceneUtil::Mask_Terrain;
if(reflectionDetail >= 2) extraMask |= Mask_Static; if(reflectionDetail >= 2) extraMask |= SceneUtil::Mask_Static;
if(reflectionDetail >= 3) extraMask |= Mask_Effect|Mask_ParticleSystem|Mask_Object; if(reflectionDetail >= 3) extraMask |= SceneUtil::Mask_Effect|SceneUtil::Mask_ParticleSystem|SceneUtil::Mask_Object;
if(reflectionDetail >= 4) extraMask |= Mask_Player|Mask_Actor; if(reflectionDetail >= 4) extraMask |= SceneUtil::Mask_Player|SceneUtil::Mask_Actor;
setCullMask(Mask_Scene|Mask_Sky|Mask_Lighting|extraMask); setCullMask(SceneUtil::Mask_Scene|SceneUtil::Mask_Sky|SceneUtil::Mask_Lighting|extraMask);
} }
void setWaterLevel(float waterLevel) void setWaterLevel(float waterLevel)
@ -441,7 +441,7 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
mWaterGeom = SceneUtil::createWaterGeometry(Constants::CellSizeInUnits*150, 40, 900); mWaterGeom = SceneUtil::createWaterGeometry(Constants::CellSizeInUnits*150, 40, 900);
mWaterGeom->setDrawCallback(new DepthClampCallback); mWaterGeom->setDrawCallback(new DepthClampCallback);
mWaterGeom->setNodeMask(Mask_Water); mWaterGeom->setNodeMask(SceneUtil::Mask_Water);
mWaterNode = new osg::PositionAttitudeTransform; mWaterNode = new osg::PositionAttitudeTransform;
mWaterNode->setName("Water Root"); mWaterNode->setName("Water Root");
@ -451,7 +451,7 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
// simple water fallback for the local map // simple water fallback for the local map
osg::ref_ptr<osg::Geometry> geom2 (osg::clone(mWaterGeom.get(), osg::CopyOp::DEEP_COPY_NODES)); osg::ref_ptr<osg::Geometry> geom2 (osg::clone(mWaterGeom.get(), osg::CopyOp::DEEP_COPY_NODES));
createSimpleWaterStateSet(geom2, Fallback::Map::getFloat("Water_Map_Alpha")); createSimpleWaterStateSet(geom2, Fallback::Map::getFloat("Water_Map_Alpha"));
geom2->setNodeMask(Mask_SimpleWater); geom2->setNodeMask(SceneUtil::Mask_SimpleWater);
mWaterNode->addChild(geom2); mWaterNode->addChild(geom2);
mSceneRoot->addChild(mWaterNode); mSceneRoot->addChild(mWaterNode);
@ -706,11 +706,11 @@ void Water::update(float dt)
void Water::updateVisible() void Water::updateVisible()
{ {
bool visible = mEnabled && mToggled; bool visible = mEnabled && mToggled;
mWaterNode->setNodeMask(visible ? ~0 : 0); mWaterNode->setNodeMask(visible ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
if (mRefraction) if (mRefraction)
mRefraction->setNodeMask(visible ? Mask_RenderToTexture : 0); mRefraction->setNodeMask(visible ? SceneUtil::Mask_RenderToTexture : SceneUtil::Mask_Disabled);
if (mReflection) if (mReflection)
mReflection->setNodeMask(visible ? Mask_RenderToTexture : 0); mReflection->setNodeMask(visible ? SceneUtil::Mask_RenderToTexture : SceneUtil::Mask_Disabled);
} }
bool Water::toggle() bool Water::toggle()

@ -16,6 +16,7 @@
#include <components/sceneutil/controller.hpp> #include <components/sceneutil/controller.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
@ -35,7 +36,6 @@
#include "../mwmechanics/weapontype.hpp" #include "../mwmechanics/weapontype.hpp"
#include "../mwrender/animation.hpp" #include "../mwrender/animation.hpp"
#include "../mwrender/vismask.hpp"
#include "../mwrender/renderingmanager.hpp" #include "../mwrender/renderingmanager.hpp"
#include "../mwrender/util.hpp" #include "../mwrender/util.hpp"
@ -188,7 +188,7 @@ namespace MWWorld
bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, std::string texture) bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, std::string texture)
{ {
state.mNode = new osg::PositionAttitudeTransform; state.mNode = new osg::PositionAttitudeTransform;
state.mNode->setNodeMask(MWRender::Mask_Effect); state.mNode->setNodeMask(SceneUtil::Mask_Effect);
state.mNode->setPosition(pos); state.mNode->setPosition(pos);
state.mNode->setAttitude(orient); state.mNode->setAttitude(orient);
@ -228,7 +228,7 @@ namespace MWWorld
projectileLight->setPosition(osg::Vec4(pos, 1.0)); projectileLight->setPosition(osg::Vec4(pos, 1.0));
SceneUtil::LightSource* projectileLightSource = new SceneUtil::LightSource; SceneUtil::LightSource* projectileLightSource = new SceneUtil::LightSource;
projectileLightSource->setNodeMask(MWRender::Mask_Lighting); projectileLightSource->setNodeMask(SceneUtil::Mask_Lighting);
projectileLightSource->setRadius(66.f); projectileLightSource->setRadius(66.f);
state.mNode->addChild(projectileLightSource); state.mNode->addChild(projectileLightSource);

@ -23,6 +23,7 @@
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/sceneutil/vismask.hpp>
#include <components/detournavigator/debug.hpp> #include <components/detournavigator/debug.hpp>
#include <components/detournavigator/navigatorimpl.hpp> #include <components/detournavigator/navigatorimpl.hpp>
@ -46,7 +47,6 @@
#include "../mwrender/npcanimation.hpp" #include "../mwrender/npcanimation.hpp"
#include "../mwrender/renderingmanager.hpp" #include "../mwrender/renderingmanager.hpp"
#include "../mwrender/camera.hpp" #include "../mwrender/camera.hpp"
#include "../mwrender/vismask.hpp"
#include "../mwscript/globalscripts.hpp" #include "../mwscript/globalscripts.hpp"
@ -2265,7 +2265,7 @@ namespace MWWorld
{ {
// Adjust position so the location we wanted ends up in the middle of the object bounding box // Adjust position so the location we wanted ends up in the middle of the object bounding box
osg::ComputeBoundsVisitor computeBounds; osg::ComputeBoundsVisitor computeBounds;
computeBounds.setTraversalMask(~MWRender::Mask_ParticleSystem); computeBounds.setTraversalMask(~SceneUtil::Mask_ParticleSystem);
dropped.getRefData().getBaseNode()->accept(computeBounds); dropped.getRefData().getBaseNode()->accept(computeBounds);
osg::BoundingBox bounds = computeBounds.getBoundingBox(); osg::BoundingBox bounds = computeBounds.getBoundingBox();
if (bounds.valid()) if (bounds.valid())

@ -51,7 +51,7 @@ add_component_dir (shader
add_component_dir (sceneutil add_component_dir (sceneutil
clone attach visitor util statesetupdater controller skeleton riggeometry morphgeometry lightcontroller clone attach visitor util statesetupdater controller skeleton riggeometry morphgeometry lightcontroller
lightmanager lightutil positionattitudetransform workqueue unrefqueue pathgridutil waterutil writescene serialize optimizer lightmanager lightutil positionattitudetransform workqueue unrefqueue pathgridutil waterutil writescene serialize optimizer
actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique vismask
) )
add_component_dir (nif add_component_dir (nif

@ -10,6 +10,7 @@
#include <components/nif/data.hpp> #include <components/nif/data.hpp>
#include <components/sceneutil/morphgeometry.hpp> #include <components/sceneutil/morphgeometry.hpp>
#include <components/sceneutil/vismask.hpp>
#include "userdata.hpp" #include "userdata.hpp"
@ -304,7 +305,7 @@ void VisController::operator() (osg::Node* node, osg::NodeVisitor* nv)
{ {
bool vis = calculate(getInputValue(nv)); bool vis = calculate(getInputValue(nv));
// Leave 0x1 enabled for UpdateVisitor, so we can make ourselves visible again in the future from this update callback // Leave 0x1 enabled for UpdateVisitor, so we can make ourselves visible again in the future from this update callback
node->setNodeMask(vis ? ~0 : 0x1); node->setNodeMask(vis ? ~SceneUtil::Mask_Default : SceneUtil::Mask_UpdateVisitor);
} }
traverse(node, nv); traverse(node, nv);
} }

@ -16,6 +16,7 @@
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/sceneutil/util.hpp> #include <components/sceneutil/util.hpp>
#include <components/sceneutil/vismask.hpp>
// particle // particle
#include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystem>
@ -167,7 +168,6 @@ namespace
namespace NifOsg namespace NifOsg
{ {
bool Loader::sShowMarkers = false; bool Loader::sShowMarkers = false;
void Loader::setShowMarkers(bool show) void Loader::setShowMarkers(bool show)
@ -553,7 +553,7 @@ namespace NifOsg
{ {
skipMeshes = true; skipMeshes = true;
// Leave mask for UpdateVisitor enabled // Leave mask for UpdateVisitor enabled
node->setNodeMask(0x1); node->setNodeMask(SceneUtil::Mask_UpdateVisitor);
} }
// We can skip creating meshes for hidden nodes if they don't have a VisController that // We can skip creating meshes for hidden nodes if they don't have a VisController that
@ -568,7 +568,7 @@ namespace NifOsg
skipMeshes = true; // skip child meshes, but still create the child node hierarchy for animating collision shapes 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 // now hide this node, but leave the mask for UpdateVisitor enabled so that KeyframeController works
node->setNodeMask(0x1); node->setNodeMask(SceneUtil::Mask_UpdateVisitor);
} }
if ((skipMeshes || hasMarkers) && isAnimated) // make sure the empty node is not optimized away so the physicssystem can find it. if ((skipMeshes || hasMarkers) && isAnimated) // make sure the empty node is not optimized away so the physicssystem can find it.

@ -12,6 +12,7 @@
#include <osgViewer/Renderer> #include <osgViewer/Renderer>
#include <components/myguiplatform/myguidatamanager.hpp> #include <components/myguiplatform/myguidatamanager.hpp>
#include <components/sceneutil/vismask.hpp>
namespace Resource namespace Resource
{ {
@ -103,14 +104,14 @@ void StatsHandler::toggle(osgViewer::ViewerBase *viewer)
if (!_statsType) if (!_statsType)
{ {
_camera->setNodeMask(0); _camera->setNodeMask(SceneUtil::Mask_Disabled);
_switch->setAllChildrenOff(); _switch->setAllChildrenOff();
viewer->getViewerStats()->collectStats("resource", false); viewer->getViewerStats()->collectStats("resource", false);
} }
else else
{ {
_camera->setNodeMask(0xffffffff); _camera->setNodeMask(SceneUtil::Mask_Default);
_switch->setSingleChildOn(_resourceStatsChildNum); _switch->setSingleChildOn(_resourceStatsChildNum);
viewer->getViewerStats()->collectStats("resource", true); viewer->getViewerStats()->collectStats("resource", true);

@ -11,6 +11,7 @@
#include "lightcontroller.hpp" #include "lightcontroller.hpp"
#include "util.hpp" #include "util.hpp"
#include "visitor.hpp" #include "visitor.hpp"
#include "vismask.hpp"
#include "positionattitudetransform.hpp" #include "positionattitudetransform.hpp"
namespace SceneUtil namespace SceneUtil
@ -58,7 +59,7 @@ namespace SceneUtil
light->setQuadraticAttenuation(quadraticAttenuation); light->setQuadraticAttenuation(quadraticAttenuation);
} }
void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior) void addLight (osg::Group* node, const ESM::Light* esmLight, bool isExterior)
{ {
SceneUtil::FindByNameVisitor visitor("AttachLight"); SceneUtil::FindByNameVisitor visitor("AttachLight");
node->accept(visitor); node->accept(visitor);
@ -71,7 +72,7 @@ namespace SceneUtil
else else
{ {
osg::ComputeBoundsVisitor computeBound; osg::ComputeBoundsVisitor computeBound;
computeBound.setTraversalMask(~partsysMask); computeBound.setTraversalMask(~SceneUtil::Mask_ParticleSystem);
// We want the bounds of all children of the node, ignoring the node's local transformation // We want the bounds of all children of the node, ignoring the node's local transformation
// So do a traverse(), not accept() // So do a traverse(), not accept()
computeBound.traverse(*node); computeBound.traverse(*node);
@ -85,15 +86,15 @@ namespace SceneUtil
attachTo = trans; attachTo = trans;
} }
osg::ref_ptr<LightSource> lightSource = createLightSource(esmLight, lightMask, isExterior); osg::ref_ptr<LightSource> lightSource = createLightSource(esmLight, isExterior);
attachTo->addChild(lightSource); attachTo->addChild(lightSource);
} }
osg::ref_ptr<LightSource> createLightSource(const ESM::Light* esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient) osg::ref_ptr<LightSource> createLightSource(const ESM::Light* esmLight, bool isExterior, const osg::Vec4f& ambient)
{ {
osg::ref_ptr<SceneUtil::LightSource> lightSource (new SceneUtil::LightSource); osg::ref_ptr<SceneUtil::LightSource> lightSource (new SceneUtil::LightSource);
osg::ref_ptr<osg::Light> light (new osg::Light); osg::ref_ptr<osg::Light> light (new osg::Light);
lightSource->setNodeMask(lightMask); lightSource->setNodeMask(SceneUtil::Mask_Lighting);
float radius = esmLight->mData.mRadius; float radius = esmLight->mData.mRadius;
lightSource->setRadius(radius); lightSource->setRadius(radius);

@ -32,14 +32,14 @@ namespace SceneUtil
/// @param partsysMask Node mask to ignore when computing the sub graph's bounding box. /// @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 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 isExterior Is the light outside? May be used for deciding which attenuation settings to use.
void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior); void addLight (osg::Group* node, const ESM::Light* esmLight, bool isExterior);
/// @brief Convert an ESM::Light to a SceneUtil::LightSource, and return it. /// @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 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 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 isExterior Is the light outside? May be used for deciding which attenuation settings to use.
/// @param ambient Ambient component of the light. /// @param ambient Ambient component of the light.
osg::ref_ptr<LightSource> createLightSource (const ESM::Light* esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient=osg::Vec4f(0,0,0,1)); osg::ref_ptr<LightSource> createLightSource (const ESM::Light* esmLight, bool isExterior, const osg::Vec4f& ambient=osg::Vec4f(0,0,0,1));
} }

@ -22,6 +22,8 @@
#include <osg/Transform> #include <osg/Transform>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <components/sceneutil/vismask.hpp>
//#include <osgUtil/Export> //#include <osgUtil/Export>
#include <set> #include <set>
@ -42,7 +44,7 @@ class BaseOptimizerVisitor : public osg::NodeVisitor
_optimizer(optimizer), _optimizer(optimizer),
_operationType(operation) _operationType(operation)
{ {
setNodeMaskOverride(0xffffffff); setNodeMaskOverride(SceneUtil::Mask_Default);
} }
inline bool isOperationPermissibleForObject(const osg::StateSet* object) const; inline bool isOperationPermissibleForObject(const osg::StateSet* object) const;

@ -2,6 +2,7 @@
#include <osgShadow/ShadowedScene> #include <osgShadow/ShadowedScene>
#include <components/sceneutil/vismask.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
namespace SceneUtil namespace SceneUtil
@ -21,7 +22,7 @@ namespace SceneUtil
mShadowTechnique->enableShadows(); mShadowTechnique->enableShadows();
mShadowSettings->setLightNum(0); mShadowSettings->setLightNum(0);
mShadowSettings->setReceivesShadowTraversalMask(~0u); mShadowSettings->setReceivesShadowTraversalMask(SceneUtil::Mask_Default);
int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows"); int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows");
numberOfShadowMapsPerLight = std::max(1, std::min(numberOfShadowMapsPerLight, 8)); numberOfShadowMapsPerLight = std::max(1, std::min(numberOfShadowMapsPerLight, 8));

@ -1,7 +1,7 @@
#ifndef OPENMW_MWRENDER_VISMASK_H #ifndef OPENMW_COMPONENTS_SCENEUTIL_VISMASK_H
#define OPENMW_MWRENDER_VISMASK_H #define OPENMW_COMPONENTS_SCENEUTIL_VISMASK_H
namespace MWRender namespace SceneUtil
{ {
/// Node masks used for controlling visibility of game objects. /// Node masks used for controlling visibility of game objects.
@ -21,6 +21,8 @@ namespace MWRender
/// compatibility if the enumeration values were to be changed. Feel free to change them when it makes sense. /// compatibility if the enumeration values were to be changed. Feel free to change them when it makes sense.
enum VisMask enum VisMask
{ {
Mask_Disabled = 0, // For hidden nodes
Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors Mask_UpdateVisitor = 0x1, // reserved for separating UpdateVisitors from CullVisitors
// child of Scene // child of Scene
@ -53,7 +55,19 @@ namespace MWRender
Mask_PreCompile = (1<<18), Mask_PreCompile = (1<<18),
// Set on a camera's cull mask to enable the LightManager // Set on a camera's cull mask to enable the LightManager
Mask_Lighting = (1<<19) 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
}; };
} }

@ -4,16 +4,17 @@
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Geode> #include <osg/Geode>
#include <components/sceneutil/vismask.hpp>
#include "world.hpp" #include "world.hpp"
#include "../esm/loadland.hpp" #include "../esm/loadland.hpp"
namespace Terrain namespace Terrain
{ {
CellBorder::CellBorder(Terrain::World *world, osg::Group *root, int borderMask): CellBorder::CellBorder(Terrain::World *world, osg::Group *root):
mWorld(world), mWorld(world),
mRoot(root), mRoot(root)
mBorderMask(borderMask)
{ {
} }
@ -69,7 +70,7 @@ void CellBorder::createCellBorderGeometry(int x, int y)
polygonmode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE); polygonmode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
stateSet->setAttributeAndModes(polygonmode,osg::StateAttribute::ON); stateSet->setAttributeAndModes(polygonmode,osg::StateAttribute::ON);
borderGeode->setNodeMask(mBorderMask); borderGeode->setNodeMask(SceneUtil::Mask_Debug);
mRoot->addChild(borderGeode); mRoot->addChild(borderGeode);

@ -16,7 +16,7 @@ namespace Terrain
public: public:
typedef std::map<std::pair<int, int>, osg::ref_ptr<osg::Node> > CellGrid; typedef std::map<std::pair<int, int>, osg::ref_ptr<osg::Node> > CellGrid;
CellBorder(Terrain::World *world, osg::Group *root, int borderMask); CellBorder(Terrain::World *world, osg::Group *root);
void createCellBorderGeometry(int x, int y); void createCellBorderGeometry(int x, int y);
void destroyCellBorderGeometry(int x, int y); void destroyCellBorderGeometry(int x, int y);

@ -6,6 +6,7 @@
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
#include <components/sceneutil/mwshadowtechnique.hpp> #include <components/sceneutil/mwshadowtechnique.hpp>
#include <components/sceneutil/vismask.hpp>
#include "quadtreenode.hpp" #include "quadtreenode.hpp"
#include "storage.hpp" #include "storage.hpp"
@ -217,8 +218,8 @@ private:
osg::ref_ptr<LodCallback> mLodCallback; osg::ref_ptr<LodCallback> mLodCallback;
}; };
QuadTreeWorld::QuadTreeWorld(osg::Group *parent, osg::Group *compileRoot, Resource::ResourceSystem *resourceSystem, Storage *storage, int nodeMask, int preCompileMask, int borderMask, int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize) QuadTreeWorld::QuadTreeWorld(osg::Group *parent, osg::Group *compileRoot, Resource::ResourceSystem *resourceSystem, Storage *storage, int compMapResolution, float compMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize)
: TerrainGrid(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask) : TerrainGrid(parent, compileRoot, resourceSystem, storage)
, mViewDataMap(new ViewDataMap) , mViewDataMap(new ViewDataMap)
, mQuadTreeBuilt(false) , mQuadTreeBuilt(false)
, mLodFactor(lodFactor) , mLodFactor(lodFactor)
@ -425,7 +426,7 @@ void QuadTreeWorld::enable(bool enabled)
} }
if (mRootNode) if (mRootNode)
mRootNode->setNodeMask(enabled ? ~0 : 0); mRootNode->setNodeMask(enabled ? SceneUtil::Mask_Default : SceneUtil::Mask_Disabled);
} }
void QuadTreeWorld::cacheCell(View *view, int x, int y) void QuadTreeWorld::cacheCell(View *view, int x, int y)

@ -21,7 +21,7 @@ namespace Terrain
class QuadTreeWorld : public TerrainGrid // note: derived from TerrainGrid is only to render default cells (see loadCell) class QuadTreeWorld : public TerrainGrid // note: derived from TerrainGrid is only to render default cells (see loadCell)
{ {
public: public:
QuadTreeWorld(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask, int compMapResolution, float comMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize); QuadTreeWorld(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int compMapResolution, float comMapLevel, float lodFactor, int vertexLodMod, float maxCompGeometrySize);
~QuadTreeWorld(); ~QuadTreeWorld();

@ -18,8 +18,8 @@ public:
virtual void reset() {} virtual void reset() {}
}; };
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask) TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage)
: Terrain::World(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask) : Terrain::World(parent, compileRoot, resourceSystem, storage)
, mNumSplits(4) , mNumSplits(4)
{ {
} }

@ -14,7 +14,7 @@ namespace Terrain
class TerrainGrid : public Terrain::World class TerrainGrid : public Terrain::World
{ {
public: public:
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask=~0, int borderMask=0); TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage);
~TerrainGrid(); ~TerrainGrid();
virtual void cacheCell(View* view, int x, int y); virtual void cacheCell(View* view, int x, int y);

@ -5,6 +5,7 @@
#include <osg/Camera> #include <osg/Camera>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/vismask.hpp>
#include "storage.hpp" #include "storage.hpp"
#include "texturemanager.hpp" #include "texturemanager.hpp"
@ -14,14 +15,14 @@
namespace Terrain namespace Terrain
{ {
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask) World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage)
: mStorage(storage) : mStorage(storage)
, mParent(parent) , mParent(parent)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mBorderVisible(false) , mBorderVisible(false)
{ {
mTerrainRoot = new osg::Group; mTerrainRoot = new osg::Group;
mTerrainRoot->setNodeMask(nodeMask); mTerrainRoot->setNodeMask(SceneUtil::Mask_Terrain);
mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN); mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN);
osg::ref_ptr<osg::Material> material (new osg::Material); osg::ref_ptr<osg::Material> material (new osg::Material);
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
@ -34,8 +35,8 @@ World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSyst
compositeCam->setProjectionMatrix(osg::Matrix::identity()); compositeCam->setProjectionMatrix(osg::Matrix::identity());
compositeCam->setViewMatrix(osg::Matrix::identity()); compositeCam->setViewMatrix(osg::Matrix::identity());
compositeCam->setReferenceFrame(osg::Camera::ABSOLUTE_RF); compositeCam->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
compositeCam->setClearMask(0); compositeCam->setClearMask(SceneUtil::Mask_Disabled);
compositeCam->setNodeMask(preCompileMask); compositeCam->setNodeMask(SceneUtil::Mask_PreCompile);
mCompositeMapCamera = compositeCam; mCompositeMapCamera = compositeCam;
compileRoot->addChild(compositeCam); compileRoot->addChild(compositeCam);
@ -47,7 +48,7 @@ World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSyst
mTextureManager.reset(new TextureManager(mResourceSystem->getSceneManager())); mTextureManager.reset(new TextureManager(mResourceSystem->getSceneManager()));
mChunkManager.reset(new ChunkManager(mStorage, mResourceSystem->getSceneManager(), mTextureManager.get(), mCompositeMapRenderer)); mChunkManager.reset(new ChunkManager(mStorage, mResourceSystem->getSceneManager(), mTextureManager.get(), mCompositeMapRenderer));
mCellBorder.reset(new CellBorder(this,mTerrainRoot.get(),borderMask)); mCellBorder.reset(new CellBorder(this,mTerrainRoot.get()));
mResourceSystem->addResourceManager(mChunkManager.get()); mResourceSystem->addResourceManager(mChunkManager.get());
mResourceSystem->addResourceManager(mTextureManager.get()); mResourceSystem->addResourceManager(mTextureManager.get());

@ -63,7 +63,7 @@ namespace Terrain
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..) /// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
/// @param nodeMask mask for the terrain root /// @param nodeMask mask for the terrain root
/// @param preCompileMask mask for pre compiling textures /// @param preCompileMask mask for pre compiling textures
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask, int borderMask); World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage);
virtual ~World(); virtual ~World();
/// Set a WorkQueue to delete objects in the background thread. /// Set a WorkQueue to delete objects in the background thread.

Loading…
Cancel
Save