forked from mirror/openmw-tes3mp
Merged branch master into master
This commit is contained in:
commit
a840d84b39
63 changed files with 572 additions and 659 deletions
|
@ -428,11 +428,7 @@ printf "MyGUI 3.2.2... "
|
||||||
mv MyGUI-3.2.2-win$BITS MyGUI
|
mv MyGUI-3.2.2-win$BITS MyGUI
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MYGUI_SDK="`real_pwd`/MyGUI"
|
export MYGUI_HOME="`real_pwd`/MyGUI"
|
||||||
|
|
||||||
add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \
|
|
||||||
-DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \
|
|
||||||
-DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h"
|
|
||||||
|
|
||||||
if [ $CONFIGURATION == "Debug" ]; then
|
if [ $CONFIGURATION == "Debug" ]; then
|
||||||
SUFFIX="_d"
|
SUFFIX="_d"
|
||||||
|
|
|
@ -227,6 +227,7 @@ IF(BOOST_STATIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(BUILD_OPENMW OR BUILD_OPENCS)
|
IF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||||
|
|
||||||
find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgUtil osgFX)
|
find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgUtil osgFX)
|
||||||
|
|
||||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
|
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
|
||||||
|
@ -289,14 +290,11 @@ IF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(MyGUI REQUIRED)
|
find_package(MyGUI 3.2.1 REQUIRED)
|
||||||
if (${MYGUI_VERSION} VERSION_LESS "3.2.1")
|
|
||||||
message(FATAL_ERROR "OpenMW requires MyGUI 3.2.1 or later, please install the latest version from http://mygui.info")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
find_package(Bullet 283 REQUIRED COMPONENTS BulletCollision LinearMath)
|
find_package(Bullet 283 REQUIRED COMPONENTS BulletCollision LinearMath)
|
||||||
|
|
||||||
ENDIF(BUILD_OPENMW OR BUILD_OPENCS)
|
ENDIF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
@ -305,12 +303,12 @@ include_directories("."
|
||||||
SYSTEM
|
SYSTEM
|
||||||
${SDL2_INCLUDE_DIR}
|
${SDL2_INCLUDE_DIR}
|
||||||
${Boost_INCLUDE_DIR}
|
${Boost_INCLUDE_DIR}
|
||||||
${MYGUI_INCLUDE_DIRS}
|
${MyGUI_INCLUDE_DIRS}
|
||||||
${OPENAL_INCLUDE_DIR}
|
${OPENAL_INCLUDE_DIR}
|
||||||
${Bullet_INCLUDE_DIRS}
|
${Bullet_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${MYGUI_LIB_DIR})
|
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
|
||||||
|
|
||||||
if(MYGUI_STATIC)
|
if(MYGUI_STATIC)
|
||||||
add_definitions(-DMYGUI_STATIC)
|
add_definitions(-DMYGUI_STATIC)
|
||||||
|
|
|
@ -66,7 +66,7 @@ opencs_hdrs_noqt (view/doc
|
||||||
|
|
||||||
|
|
||||||
opencs_units (view/world
|
opencs_units (view/world
|
||||||
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator globalcreator
|
||||||
cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview
|
cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview
|
||||||
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
|
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
|
||||||
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator
|
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator
|
||||||
|
|
|
@ -370,8 +370,6 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event)
|
||||||
selection.add (CSMWorld::CellCoordinates::fromId (cellId).first);
|
selection.add (CSMWorld::CellCoordinates::fromId (cellId).first);
|
||||||
paged->setCellSelection (selection);
|
paged->setCellSelection (selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
noCell = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CSVRender::PagedWorldspaceWidget *paged =
|
else if (CSVRender::PagedWorldspaceWidget *paged =
|
||||||
|
|
|
@ -15,9 +15,9 @@ namespace CSVRender
|
||||||
, mWorldspaceWidget(worldspaceWidget)
|
, mWorldspaceWidget(worldspaceWidget)
|
||||||
, mCenterOnSelection(0)
|
, mCenterOnSelection(0)
|
||||||
{
|
{
|
||||||
mCenterShortcut.reset(new CSMPrefs::Shortcut("orbit-center-selection", worldspaceWidget));
|
mCenterShortcut = new CSMPrefs::Shortcut("orbit-center-selection", worldspaceWidget);
|
||||||
mCenterShortcut->enable(false);
|
mCenterShortcut->enable(false);
|
||||||
connect(mCenterShortcut.get(), SIGNAL(activated()), this, SLOT(centerSelection()));
|
connect(mCenterShortcut, SIGNAL(activated()), this, SLOT(centerSelection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
OrbitCameraMode::~OrbitCameraMode()
|
OrbitCameraMode::~OrbitCameraMode()
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace CSVRender
|
||||||
|
|
||||||
WorldspaceWidget* mWorldspaceWidget;
|
WorldspaceWidget* mWorldspaceWidget;
|
||||||
QAction* mCenterOnSelection;
|
QAction* mCenterOnSelection;
|
||||||
std::auto_ptr<CSMPrefs::Shortcut> mCenterShortcut;
|
CSMPrefs::Shortcut* mCenterShortcut;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
26
apps/opencs/view/world/globalcreator.cpp
Normal file
26
apps/opencs/view/world/globalcreator.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "globalcreator.hpp"
|
||||||
|
|
||||||
|
#include <components/esm/variant.hpp>
|
||||||
|
|
||||||
|
#include "../../model/world/data.hpp"
|
||||||
|
#include "../../model/world/commands.hpp"
|
||||||
|
#include "../../model/world/columns.hpp"
|
||||||
|
#include "../../model/world/idtable.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
void GlobalCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const
|
||||||
|
{
|
||||||
|
CSMWorld::IdTable* table = static_cast<CSMWorld::IdTable*>(getData().getTableModel(getCollectionId()));
|
||||||
|
|
||||||
|
int index = table->findColumnIndex(CSMWorld::Columns::ColumnId_ValueType);
|
||||||
|
int type = (int)ESM::VT_Float;
|
||||||
|
|
||||||
|
command.addValue(index, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalCreator::GlobalCreator(CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id)
|
||||||
|
: GenericCreator (data, undoStack, id, true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
22
apps/opencs/view/world/globalcreator.hpp
Normal file
22
apps/opencs/view/world/globalcreator.hpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef CSV_WORLD_GLOBALCREATOR_H
|
||||||
|
#define CSV_WORLD_GLOBALCREATOR_H
|
||||||
|
|
||||||
|
#include "genericcreator.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
class GlobalCreator : public GenericCreator
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GlobalCreator(CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void configureCreateCommand(CSMWorld::CreateCommand& command) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,6 +7,7 @@
|
||||||
#include "scriptsubview.hpp"
|
#include "scriptsubview.hpp"
|
||||||
#include "regionmapsubview.hpp"
|
#include "regionmapsubview.hpp"
|
||||||
#include "genericcreator.hpp"
|
#include "genericcreator.hpp"
|
||||||
|
#include "globalcreator.hpp"
|
||||||
#include "cellcreator.hpp"
|
#include "cellcreator.hpp"
|
||||||
#include "referenceablecreator.hpp"
|
#include "referenceablecreator.hpp"
|
||||||
#include "referencecreator.hpp"
|
#include "referencecreator.hpp"
|
||||||
|
@ -32,7 +33,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
|
|
||||||
static const CSMWorld::UniversalId::Type sTableTypes[] =
|
static const CSMWorld::UniversalId::Type sTableTypes[] =
|
||||||
{
|
{
|
||||||
CSMWorld::UniversalId::Type_Globals,
|
|
||||||
CSMWorld::UniversalId::Type_Classes,
|
CSMWorld::UniversalId::Type_Classes,
|
||||||
CSMWorld::UniversalId::Type_Factions,
|
CSMWorld::UniversalId::Type_Factions,
|
||||||
CSMWorld::UniversalId::Type_Races,
|
CSMWorld::UniversalId::Type_Races,
|
||||||
|
@ -78,6 +78,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
manager.add (CSMWorld::UniversalId::Type_Pathgrids,
|
manager.add (CSMWorld::UniversalId::Type_Pathgrids,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >);
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >);
|
||||||
|
|
||||||
|
manager.add (CSMWorld::UniversalId::Type_Globals,
|
||||||
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<GlobalCreator> >);
|
||||||
|
|
||||||
// Subviews for resources tables
|
// Subviews for resources tables
|
||||||
manager.add (CSMWorld::UniversalId::Type_Meshes,
|
manager.add (CSMWorld::UniversalId::Type_Meshes,
|
||||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
||||||
|
|
|
@ -134,7 +134,7 @@ target_link_libraries(openmw
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
${OPENAL_LIBRARY}
|
${OPENAL_LIBRARY}
|
||||||
${FFmpeg_LIBRARIES}
|
${FFmpeg_LIBRARIES}
|
||||||
${MYGUI_LIBRARIES}
|
${MyGUI_LIBRARIES}
|
||||||
${SDL2_LIBRARY}
|
${SDL2_LIBRARY}
|
||||||
"osg-ffmpeg-videoplayer"
|
"osg-ffmpeg-videoplayer"
|
||||||
"oics"
|
"oics"
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -226,8 +226,10 @@ namespace MWClass
|
||||||
typeText = "#{sLight}";
|
typeText = "#{sLight}";
|
||||||
else if (armorType == ESM::Skill::MediumArmor)
|
else if (armorType == ESM::Skill::MediumArmor)
|
||||||
typeText = "#{sMedium}";
|
typeText = "#{sMedium}";
|
||||||
else
|
else if (armorType == ESM::Skill::HeavyArmor)
|
||||||
typeText = "#{sHeavy}";
|
typeText = "#{sHeavy}";
|
||||||
|
else // if (armorType == ESM::Skill::Unarmored)
|
||||||
|
typeText = "";
|
||||||
|
|
||||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
|
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
|
||||||
MWMechanics::getPlayer()));
|
MWMechanics::getPlayer()));
|
||||||
|
@ -236,7 +238,9 @@ namespace MWClass
|
||||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||||
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||||
|
|
||||||
|
if (typeText != "")
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight) + " (" + typeText + ")";
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight) + " (" + typeText + ")";
|
||||||
|
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction(std::string(), ptr));
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
#include "../mwrender/animation.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
|
@ -112,6 +113,20 @@ namespace MWClass
|
||||||
bool hasKey = false;
|
bool hasKey = false;
|
||||||
std::string keyName;
|
std::string keyName;
|
||||||
|
|
||||||
|
// make door glow if player activates it with telekinesis
|
||||||
|
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||||
|
MWBase::Environment::get().getWorld()->getDistanceToFacedObject() >
|
||||||
|
MWBase::Environment::get().getWorld()->getMaxActivationDistance())
|
||||||
|
{
|
||||||
|
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
||||||
|
|
||||||
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
int index = ESM::MagicEffect::effectStringToId("sEffectTelekinesis");
|
||||||
|
const ESM::MagicEffect *effect = store.get<ESM::MagicEffect>().find(index);
|
||||||
|
|
||||||
|
animation->addSpellCastGlow(effect); // TODO: Telekinesis glow should only be as long as the door animation
|
||||||
|
}
|
||||||
|
|
||||||
// make key id lowercase
|
// make key id lowercase
|
||||||
std::string keyId = ptr.getCellRef().getKey();
|
std::string keyId = ptr.getCellRef().getKey();
|
||||||
Misc::StringUtils::lowerCaseInPlace(keyId);
|
Misc::StringUtils::lowerCaseInPlace(keyId);
|
||||||
|
@ -205,7 +220,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// locked, and we can't open.
|
// locked, and we can't open.
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction(std::string(), ptr));
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -159,11 +159,9 @@ namespace MWClass
|
||||||
|
|
||||||
if (Settings::Manager::getBool("show effect duration","Game"))
|
if (Settings::Manager::getBool("show effect duration","Game"))
|
||||||
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(ptr.getClass().getRemainingUsageTime(ptr));
|
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(ptr.getClass().getRemainingUsageTime(ptr));
|
||||||
if (ref->mBase->mData.mWeight != 0)
|
|
||||||
{
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
}
|
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MWClass
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -159,11 +159,9 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
if (!gold && !ref->mBase->mData.mIsKey)
|
if (!gold && !ref->mBase->mData.mIsKey)
|
||||||
{
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
|
||||||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||||
}
|
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
||||||
|
|
|
@ -1203,6 +1203,7 @@ namespace MWClass
|
||||||
|
|
||||||
switch(boots->getClass().getEquipmentSkill(*boots))
|
switch(boots->getClass().getEquipmentSkill(*boots))
|
||||||
{
|
{
|
||||||
|
case ESM::Skill::Unarmored:
|
||||||
case ESM::Skill::LightArmor:
|
case ESM::Skill::LightArmor:
|
||||||
return (name == "left") ? "FootLightLeft" : "FootLightRight";
|
return (name == "left") ? "FootLightLeft" : "FootLightRight";
|
||||||
case ESM::Skill::MediumArmor:
|
case ESM::Skill::MediumArmor:
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MWClass
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ namespace MWClass
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -318,7 +318,7 @@ namespace MWClass
|
||||||
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||||
}
|
}
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
info.enchant = ref->mBase->mEnchant;
|
info.enchant = ref->mBase->mEnchant;
|
||||||
|
|
|
@ -135,27 +135,6 @@ namespace MWGui
|
||||||
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats(player);
|
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats(player);
|
||||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
||||||
|
|
||||||
const ESM::NPC *playerData = player.get<ESM::NPC>()->mBase;
|
|
||||||
|
|
||||||
// set class image
|
|
||||||
const ESM::Class *cls =
|
|
||||||
world->getStore().get<ESM::Class>().find(playerData->mClass);
|
|
||||||
|
|
||||||
if(world->getStore().get<ESM::Class>().isDynamic(cls->mId))
|
|
||||||
{
|
|
||||||
// Choosing Stealth specialization and Speed/Agility as attributes, if possible. Otherwise fall back to first class found.
|
|
||||||
MWWorld::SharedIterator<ESM::Class> it = world->getStore().get<ESM::Class>().begin();
|
|
||||||
for(; it != world->getStore().get<ESM::Class>().end(); ++it)
|
|
||||||
{
|
|
||||||
if(it->mData.mIsPlayable && it->mData.mSpecialization == 2 && it->mData.mAttribute[0] == 4 && it->mData.mAttribute[1] == 3)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (it == world->getStore().get<ESM::Class>().end())
|
|
||||||
it = world->getStore().get<ESM::Class>().begin();
|
|
||||||
if (it != world->getStore().get<ESM::Class>().end())
|
|
||||||
cls = &*it;
|
|
||||||
}
|
|
||||||
|
|
||||||
setClassImage(mClassImage, getLevelupClassImage(pcStats.getSkillIncreasesForSpecialization(0),
|
setClassImage(mClassImage, getLevelupClassImage(pcStats.getSkillIncreasesForSpecialization(0),
|
||||||
pcStats.getSkillIncreasesForSpecialization(1),
|
pcStats.getSkillIncreasesForSpecialization(1),
|
||||||
pcStats.getSkillIncreasesForSpecialization(2)));
|
pcStats.getSkillIncreasesForSpecialization(2)));
|
||||||
|
|
|
@ -163,7 +163,6 @@ namespace MWGui
|
||||||
, mInterior(false)
|
, mInterior(false)
|
||||||
, mLocalMap(NULL)
|
, mLocalMap(NULL)
|
||||||
, mCompass(NULL)
|
, mCompass(NULL)
|
||||||
, mPrefix()
|
|
||||||
, mChanged(true)
|
, mChanged(true)
|
||||||
, mFogOfWarToggled(true)
|
, mFogOfWarToggled(true)
|
||||||
, mFogOfWarEnabled(fogOfWarEnabled)
|
, mFogOfWarEnabled(fogOfWarEnabled)
|
||||||
|
@ -174,6 +173,7 @@ namespace MWGui
|
||||||
, mMarkerUpdateTimer(0.0f)
|
, mMarkerUpdateTimer(0.0f)
|
||||||
, mLastDirectionX(0.0f)
|
, mLastDirectionX(0.0f)
|
||||||
, mLastDirectionY(0.0f)
|
, mLastDirectionY(0.0f)
|
||||||
|
, mNeedDoorMarkersUpdate(false)
|
||||||
{
|
{
|
||||||
mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
||||||
}
|
}
|
||||||
|
@ -368,12 +368,6 @@ namespace MWGui
|
||||||
|
|
||||||
applyFogOfWar();
|
applyFogOfWar();
|
||||||
|
|
||||||
|
|
||||||
// clear all previous door markers
|
|
||||||
for (std::vector<MyGUI::Widget*>::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it)
|
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
|
||||||
mDoorMarkerWidgets.clear();
|
|
||||||
|
|
||||||
// Update the map textures
|
// Update the map textures
|
||||||
TextureVector textures;
|
TextureVector textures;
|
||||||
for (int mx=0; mx<mNumCells; ++mx)
|
for (int mx=0; mx<mNumCells; ++mx)
|
||||||
|
@ -399,60 +393,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
mMapTextures.swap(textures);
|
mMapTextures.swap(textures);
|
||||||
|
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
// Delay the door markers update until scripts have been given a chance to run.
|
||||||
|
// If we don't do this, door markers that should be disabled will still appear on the map.
|
||||||
// Retrieve the door markers we want to show
|
mNeedDoorMarkersUpdate = true;
|
||||||
std::vector<MWBase::World::DoorMarker> doors;
|
|
||||||
if (interior)
|
|
||||||
{
|
|
||||||
MWWorld::CellStore* cell = world->getInterior (mPrefix);
|
|
||||||
world->getDoorMarkers(cell, doors);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int dX=-mCellDistance; dX<=mCellDistance; ++dX)
|
|
||||||
{
|
|
||||||
for (int dY=-mCellDistance; dY<=mCellDistance; ++dY)
|
|
||||||
{
|
|
||||||
MWWorld::CellStore* cell = world->getExterior (mCurX+dX, mCurY+dY);
|
|
||||||
world->getDoorMarkers(cell, doors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a widget for each marker
|
|
||||||
int counter = 0;
|
|
||||||
for (std::vector<MWBase::World::DoorMarker>::iterator it = doors.begin(); it != doors.end(); ++it)
|
|
||||||
{
|
|
||||||
MWBase::World::DoorMarker marker = *it;
|
|
||||||
|
|
||||||
std::vector<std::string> destNotes;
|
|
||||||
CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(marker.dest);
|
|
||||||
for (CustomMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; ++it)
|
|
||||||
destNotes.push_back(it->second.mNote);
|
|
||||||
|
|
||||||
MarkerUserData data (mLocalMapRender);
|
|
||||||
data.notes = destNotes;
|
|
||||||
data.caption = marker.name;
|
|
||||||
MyGUI::IntPoint widgetPos = getMarkerPosition(marker.x, marker.y, data);
|
|
||||||
MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
|
|
||||||
widgetPos.top - 4,
|
|
||||||
8, 8);
|
|
||||||
++counter;
|
|
||||||
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
|
||||||
widgetCoord, MyGUI::Align::Default);
|
|
||||||
markerWidget->setNormalColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
|
||||||
markerWidget->setHoverColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal_over}")));
|
|
||||||
markerWidget->setDepth(Local_MarkerLayer);
|
|
||||||
markerWidget->setNeedMouseFocus(true);
|
|
||||||
// Used by tooltips to not show the tooltip if marker is hidden by fog of war
|
|
||||||
markerWidget->setUserString("ToolTipType", "MapMarker");
|
|
||||||
|
|
||||||
markerWidget->setUserData(data);
|
|
||||||
doorMarkerCreated(markerWidget);
|
|
||||||
|
|
||||||
mDoorMarkerWidgets.push_back(markerWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMagicMarkers();
|
updateMagicMarkers();
|
||||||
updateCustomMarkers();
|
updateCustomMarkers();
|
||||||
|
@ -565,6 +508,12 @@ namespace MWGui
|
||||||
|
|
||||||
void LocalMapBase::onFrame(float dt)
|
void LocalMapBase::onFrame(float dt)
|
||||||
{
|
{
|
||||||
|
if (mNeedDoorMarkersUpdate)
|
||||||
|
{
|
||||||
|
updateDoorMarkers();
|
||||||
|
mNeedDoorMarkersUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
mMarkerUpdateTimer += dt;
|
mMarkerUpdateTimer += dt;
|
||||||
|
|
||||||
if (mMarkerUpdateTimer >= 0.25)
|
if (mMarkerUpdateTimer >= 0.25)
|
||||||
|
@ -574,6 +523,69 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalMapBase::updateDoorMarkers()
|
||||||
|
{
|
||||||
|
// clear all previous door markers
|
||||||
|
for (std::vector<MyGUI::Widget*>::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it)
|
||||||
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
|
mDoorMarkerWidgets.clear();
|
||||||
|
|
||||||
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
// Retrieve the door markers we want to show
|
||||||
|
std::vector<MWBase::World::DoorMarker> doors;
|
||||||
|
if (mInterior)
|
||||||
|
{
|
||||||
|
MWWorld::CellStore* cell = world->getInterior (mPrefix);
|
||||||
|
world->getDoorMarkers(cell, doors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int dX=-mCellDistance; dX<=mCellDistance; ++dX)
|
||||||
|
{
|
||||||
|
for (int dY=-mCellDistance; dY<=mCellDistance; ++dY)
|
||||||
|
{
|
||||||
|
MWWorld::CellStore* cell = world->getExterior (mCurX+dX, mCurY+dY);
|
||||||
|
world->getDoorMarkers(cell, doors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a widget for each marker
|
||||||
|
int counter = 0;
|
||||||
|
for (std::vector<MWBase::World::DoorMarker>::iterator it = doors.begin(); it != doors.end(); ++it)
|
||||||
|
{
|
||||||
|
MWBase::World::DoorMarker marker = *it;
|
||||||
|
|
||||||
|
std::vector<std::string> destNotes;
|
||||||
|
CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(marker.dest);
|
||||||
|
for (CustomMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; ++it)
|
||||||
|
destNotes.push_back(it->second.mNote);
|
||||||
|
|
||||||
|
MarkerUserData data (mLocalMapRender);
|
||||||
|
data.notes = destNotes;
|
||||||
|
data.caption = marker.name;
|
||||||
|
MyGUI::IntPoint widgetPos = getMarkerPosition(marker.x, marker.y, data);
|
||||||
|
MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
|
||||||
|
widgetPos.top - 4,
|
||||||
|
8, 8);
|
||||||
|
++counter;
|
||||||
|
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
||||||
|
widgetCoord, MyGUI::Align::Default);
|
||||||
|
markerWidget->setNormalColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
||||||
|
markerWidget->setHoverColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal_over}")));
|
||||||
|
markerWidget->setDepth(Local_MarkerLayer);
|
||||||
|
markerWidget->setNeedMouseFocus(true);
|
||||||
|
// Used by tooltips to not show the tooltip if marker is hidden by fog of war
|
||||||
|
markerWidget->setUserString("ToolTipType", "MapMarker");
|
||||||
|
|
||||||
|
markerWidget->setUserData(data);
|
||||||
|
doorMarkerCreated(markerWidget);
|
||||||
|
|
||||||
|
mDoorMarkerWidgets.push_back(markerWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LocalMapBase::updateMagicMarkers()
|
void LocalMapBase::updateMagicMarkers()
|
||||||
{
|
{
|
||||||
// clear all previous markers
|
// clear all previous markers
|
||||||
|
|
|
@ -155,6 +155,10 @@ namespace MWGui
|
||||||
|
|
||||||
float mLastDirectionX;
|
float mLastDirectionX;
|
||||||
float mLastDirectionY;
|
float mLastDirectionY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateDoorMarkers();
|
||||||
|
bool mNeedDoorMarkersUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditNoteDialog : public MWGui::WindowModal
|
class EditNoteDialog : public MWGui::WindowModal
|
||||||
|
|
|
@ -586,6 +586,14 @@ namespace MWGui
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ToolTips::getWeightString(const float weight, const std::string& prefix)
|
||||||
|
{
|
||||||
|
if (weight == 0)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
return "\n" + prefix + ": " + toString(weight);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ToolTips::getValueString(const int value, const std::string& prefix)
|
std::string ToolTips::getValueString(const int value, const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace MWGui
|
||||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||||
///< set the screen-space position of the tooltip for focused object
|
///< set the screen-space position of the tooltip for focused object
|
||||||
|
|
||||||
|
static std::string getWeightString(const float weight, const std::string& prefix);
|
||||||
static std::string getValueString(const int value, const std::string& prefix);
|
static std::string getValueString(const int value, const std::string& prefix);
|
||||||
///< @return "prefix: value" or "" if value is 0
|
///< @return "prefix: value" or "" if value is 0
|
||||||
|
|
||||||
|
|
|
@ -79,12 +79,13 @@ void WindowModal::close()
|
||||||
NoDrop::NoDrop(DragAndDrop *drag, MyGUI::Widget *widget)
|
NoDrop::NoDrop(DragAndDrop *drag, MyGUI::Widget *widget)
|
||||||
: mWidget(widget), mDrag(drag), mTransparent(false)
|
: mWidget(widget), mDrag(drag), mTransparent(false)
|
||||||
{
|
{
|
||||||
if (!mWidget)
|
|
||||||
throw std::runtime_error("NoDrop needs a non-NULL widget!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoDrop::onFrame(float dt)
|
void NoDrop::onFrame(float dt)
|
||||||
{
|
{
|
||||||
|
if (!mWidget)
|
||||||
|
return;
|
||||||
|
|
||||||
MyGUI::IntPoint mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
MyGUI::IntPoint mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
|
|
||||||
if (mDrag->mIsOnDragAndDrop)
|
if (mDrag->mIsOnDragAndDrop)
|
||||||
|
@ -113,5 +114,6 @@ void NoDrop::onFrame(float dt)
|
||||||
|
|
||||||
void NoDrop::setAlpha(float alpha)
|
void NoDrop::setAlpha(float alpha)
|
||||||
{
|
{
|
||||||
|
if (mWidget)
|
||||||
mWidget->setAlpha(alpha);
|
mWidget->setAlpha(alpha);
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,9 +812,6 @@ namespace MWMechanics
|
||||||
MWBase::Environment::get().getWorld()->moveObject(actor, static_cast<float>(dest.mX),
|
MWBase::Environment::get().getWorld()->moveObject(actor, static_cast<float>(dest.mX),
|
||||||
static_cast<float>(dest.mY), static_cast<float>(dest.mZ));
|
static_cast<float>(dest.mY), static_cast<float>(dest.mZ));
|
||||||
actor.getClass().adjustPosition(actor, false);
|
actor.getClass().adjustPosition(actor, false);
|
||||||
|
|
||||||
// may have changed cell
|
|
||||||
storage.mPopulateAvailableNodes = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AiWander::OffsetToPreventOvercrowding()
|
int AiWander::OffsetToPreventOvercrowding()
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
#include "security.hpp"
|
#include "security.hpp"
|
||||||
#include "actorutil.hpp"
|
#include "actorutil.hpp"
|
||||||
|
#include "spellcasting.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -961,34 +962,6 @@ void CharacterController::updateIdleStormState(bool inwater)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::castSpell(const std::string &spellid)
|
|
||||||
{
|
|
||||||
static const std::string schools[] = {
|
|
||||||
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
|
||||||
};
|
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
|
||||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
|
||||||
const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0);
|
|
||||||
|
|
||||||
const ESM::MagicEffect *effect;
|
|
||||||
effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID);
|
|
||||||
|
|
||||||
const ESM::Static* castStatic;
|
|
||||||
if (!effect->mCasting.empty())
|
|
||||||
castStatic = store.get<ESM::Static>().find (effect->mCasting);
|
|
||||||
else
|
|
||||||
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
|
|
||||||
|
|
||||||
mAnimation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex);
|
|
||||||
|
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
|
||||||
if(!effect->mCastSound.empty())
|
|
||||||
sndMgr->playSound3D(mPtr, effect->mCastSound, 1.0f, 1.0f);
|
|
||||||
else
|
|
||||||
sndMgr->playSound3D(mPtr, schools[effect->mData.mSchool]+" cast", 1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CharacterController::updateCreatureState()
|
bool CharacterController::updateCreatureState()
|
||||||
{
|
{
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
|
@ -1020,7 +993,8 @@ bool CharacterController::updateCreatureState()
|
||||||
const std::string spellid = stats.getSpells().getSelectedSpell();
|
const std::string spellid = stats.getSpells().getSelectedSpell();
|
||||||
if (!spellid.empty() && MWBase::Environment::get().getWorld()->startSpellCast(mPtr))
|
if (!spellid.empty() && MWBase::Environment::get().getWorld()->startSpellCast(mPtr))
|
||||||
{
|
{
|
||||||
castSpell(spellid);
|
MWMechanics::CastSpell cast(mPtr, NULL);
|
||||||
|
cast.playSpellCastingEffects(spellid);
|
||||||
|
|
||||||
if (!mAnimation->hasAnimation("spellcast"))
|
if (!mAnimation->hasAnimation("spellcast"))
|
||||||
MWBase::Environment::get().getWorld()->castSpell(mPtr); // No "release" text key to use, so cast immediately
|
MWBase::Environment::get().getWorld()->castSpell(mPtr); // No "release" text key to use, so cast immediately
|
||||||
|
@ -1248,7 +1222,8 @@ bool CharacterController::updateWeaponState()
|
||||||
|
|
||||||
if(!spellid.empty() && MWBase::Environment::get().getWorld()->startSpellCast(mPtr))
|
if(!spellid.empty() && MWBase::Environment::get().getWorld()->startSpellCast(mPtr))
|
||||||
{
|
{
|
||||||
castSpell(spellid);
|
MWMechanics::CastSpell cast(mPtr, NULL);
|
||||||
|
cast.playSpellCastingEffects(spellid);
|
||||||
|
|
||||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
||||||
const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0);
|
const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0);
|
||||||
|
|
|
@ -214,8 +214,6 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
|
|
||||||
void updateHeadTracking(float duration);
|
void updateHeadTracking(float duration);
|
||||||
|
|
||||||
void castSpell(const std::string& spellid);
|
|
||||||
|
|
||||||
void updateMagicEffects();
|
void updateMagicEffects();
|
||||||
|
|
||||||
void playDeath(float startpoint, CharacterState death);
|
void playDeath(float startpoint, CharacterState death);
|
||||||
|
|
|
@ -358,6 +358,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool castByPlayer = (!caster.isEmpty() && caster == getPlayer());
|
bool castByPlayer = (!caster.isEmpty() && caster == getPlayer());
|
||||||
|
|
||||||
|
ActiveSpells targetSpells;
|
||||||
|
if (target.getClass().isActor())
|
||||||
|
targetSpells = target.getClass().getCreatureStats(target).getActiveSpells();
|
||||||
|
|
||||||
|
bool canCastAnEffect = false; // For bound equipment.If this remains false
|
||||||
|
// throughout the iteration of this spell's
|
||||||
|
// effects, we display a "can't re-cast" message
|
||||||
|
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (effects.mList.begin());
|
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (effects.mList.begin());
|
||||||
effectIt!=effects.mList.end(); ++effectIt)
|
effectIt!=effects.mList.end(); ++effectIt)
|
||||||
{
|
{
|
||||||
|
@ -368,6 +376,16 @@ namespace MWMechanics
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
effectIt->mEffectID);
|
effectIt->mEffectID);
|
||||||
|
|
||||||
|
// Re-casting a bound equipment effect has no effect if the spell is still active
|
||||||
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::NonRecastable && targetSpells.isSpellActive(mId))
|
||||||
|
{
|
||||||
|
if (effectIt == (effects.mList.end() - 1) && !canCastAnEffect && castByPlayer)
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCannotRecast}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
canCastAnEffect = true;
|
||||||
|
|
||||||
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -576,6 +594,10 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if (effectId == ESM::MagicEffect::Lock)
|
if (effectId == ESM::MagicEffect::Lock)
|
||||||
{
|
{
|
||||||
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||||
|
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||||
|
animation->addSpellCastGlow(magiceffect);
|
||||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||||
{
|
{
|
||||||
if (caster == getPlayer())
|
if (caster == getPlayer())
|
||||||
|
@ -586,6 +608,10 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
else if (effectId == ESM::MagicEffect::Open)
|
else if (effectId == ESM::MagicEffect::Open)
|
||||||
{
|
{
|
||||||
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||||
|
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||||
|
animation->addSpellCastGlow(magiceffect);
|
||||||
if (target.getCellRef().getLockLevel() <= magnitude)
|
if (target.getCellRef().getLockLevel() <= magnitude)
|
||||||
{
|
{
|
||||||
if (target.getCellRef().getLockLevel() > 0)
|
if (target.getCellRef().getLockLevel() > 0)
|
||||||
|
@ -864,6 +890,10 @@ namespace MWMechanics
|
||||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||||
spellSchoolToSkill(school), 0);
|
spellSchoolToSkill(school), 0);
|
||||||
|
|
||||||
|
// A non-actor doesn't play its spell cast effects from a character controller, so play them here
|
||||||
|
if (!mCaster.getClass().isActor())
|
||||||
|
playSpellCastingEffects(mId);
|
||||||
|
|
||||||
inflict(mCaster, mCaster, spell->mEffects, ESM::RT_Self);
|
inflict(mCaster, mCaster, spell->mEffects, ESM::RT_Self);
|
||||||
|
|
||||||
if (!mTarget.isEmpty())
|
if (!mTarget.isEmpty())
|
||||||
|
@ -957,6 +987,42 @@ namespace MWMechanics
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CastSpell::playSpellCastingEffects(const std::string &spellid){
|
||||||
|
|
||||||
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
||||||
|
const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0);
|
||||||
|
|
||||||
|
const ESM::MagicEffect *effect;
|
||||||
|
effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID);
|
||||||
|
|
||||||
|
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster);
|
||||||
|
|
||||||
|
if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a spell cast vfx
|
||||||
|
{
|
||||||
|
const ESM::Static* castStatic;
|
||||||
|
if (!effect->mCasting.empty())
|
||||||
|
castStatic = store.get<ESM::Static>().find (effect->mCasting);
|
||||||
|
else
|
||||||
|
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
|
||||||
|
|
||||||
|
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mCaster.getClass().isActor())
|
||||||
|
animation->addSpellCastGlow(effect);
|
||||||
|
|
||||||
|
static const std::string schools[] = {
|
||||||
|
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
||||||
|
};
|
||||||
|
|
||||||
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
|
if(!effect->mCastSound.empty())
|
||||||
|
sndMgr->playSound3D(mCaster, effect->mCastSound, 1.0f, 1.0f);
|
||||||
|
else
|
||||||
|
sndMgr->playSound3D(mCaster, schools[effect->mData.mSchool]+" cast", 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
int getEffectiveEnchantmentCastCost(float castCost, const MWWorld::Ptr &actor)
|
int getEffectiveEnchantmentCastCost(float castCost, const MWWorld::Ptr &actor)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -92,6 +92,8 @@ namespace MWMechanics
|
||||||
/// @note Auto detects if spell, ingredient or potion
|
/// @note Auto detects if spell, ingredient or potion
|
||||||
bool cast (const std::string& id);
|
bool cast (const std::string& id);
|
||||||
|
|
||||||
|
void playSpellCastingEffects(const std::string &spellid);
|
||||||
|
|
||||||
/// @note \a target can be any type of object, not just actors.
|
/// @note \a target can be any type of object, not just actors.
|
||||||
/// @note \a caster can be any type of object, or even an empty object.
|
/// @note \a caster can be any type of object, or even an empty object.
|
||||||
void inflict (const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
void inflict (const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
||||||
|
|
|
@ -86,48 +86,6 @@ namespace
|
||||||
std::vector<osg::ref_ptr<osg::Node> > mToRemove;
|
std::vector<osg::ref_ptr<osg::Node> > mToRemove;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlowUpdater : public SceneUtil::StateSetUpdater
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GlowUpdater(int texUnit, osg::Vec4f color, const std::vector<osg::ref_ptr<osg::Texture2D> >& textures)
|
|
||||||
: mTexUnit(texUnit)
|
|
||||||
, mColor(color)
|
|
||||||
, mTextures(textures)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void setDefaults(osg::StateSet *stateset)
|
|
||||||
{
|
|
||||||
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
|
||||||
|
|
||||||
osg::TexGen* texGen = new osg::TexGen;
|
|
||||||
texGen->setMode(osg::TexGen::SPHERE_MAP);
|
|
||||||
|
|
||||||
stateset->setTextureAttributeAndModes(mTexUnit, texGen, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
|
||||||
|
|
||||||
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
|
|
||||||
texEnv->setSource0_RGB(osg::TexEnvCombine::CONSTANT);
|
|
||||||
texEnv->setConstantColor(mColor);
|
|
||||||
texEnv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
|
|
||||||
texEnv->setSource2_RGB(osg::TexEnvCombine::TEXTURE);
|
|
||||||
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
|
|
||||||
|
|
||||||
stateset->setTextureAttributeAndModes(mTexUnit, texEnv, osg::StateAttribute::ON);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
|
||||||
{
|
|
||||||
float time = nv->getFrameStamp()->getSimulationTime();
|
|
||||||
int index = (int)(time*16) % mTextures.size();
|
|
||||||
stateset->setTextureAttribute(mTexUnit, mTextures[index], osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int mTexUnit;
|
|
||||||
osg::Vec4f mColor;
|
|
||||||
std::vector<osg::ref_ptr<osg::Texture2D> > mTextures;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NodeMapVisitor : public osg::NodeVisitor
|
class NodeMapVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -289,6 +247,134 @@ namespace
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
class GlowUpdater : public SceneUtil::StateSetUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GlowUpdater(int texUnit, osg::Vec4f color, const std::vector<osg::ref_ptr<osg::Texture2D> >& textures,
|
||||||
|
osg::Node* node, float duration, Resource::ResourceSystem* resourcesystem)
|
||||||
|
: mTexUnit(texUnit)
|
||||||
|
, mColor(color)
|
||||||
|
, mOriginalColor(color)
|
||||||
|
, mTextures(textures)
|
||||||
|
, mNode(node)
|
||||||
|
, mDuration(duration)
|
||||||
|
, mOriginalDuration(duration)
|
||||||
|
, mStartingTime(0)
|
||||||
|
, mResourceSystem(resourcesystem)
|
||||||
|
, mColorChanged(false)
|
||||||
|
, mDone(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void setDefaults(osg::StateSet *stateset)
|
||||||
|
{
|
||||||
|
if (mDone)
|
||||||
|
removeTexture(stateset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
||||||
|
osg::TexGen* texGen = new osg::TexGen;
|
||||||
|
texGen->setMode(osg::TexGen::SPHERE_MAP);
|
||||||
|
|
||||||
|
stateset->setTextureAttributeAndModes(mTexUnit, texGen, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||||
|
|
||||||
|
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
|
||||||
|
texEnv->setSource0_RGB(osg::TexEnvCombine::CONSTANT);
|
||||||
|
texEnv->setConstantColor(mColor);
|
||||||
|
texEnv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
|
||||||
|
texEnv->setSource2_RGB(osg::TexEnvCombine::TEXTURE);
|
||||||
|
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
|
||||||
|
|
||||||
|
stateset->setTextureAttributeAndModes(mTexUnit, texEnv, osg::StateAttribute::ON);
|
||||||
|
stateset->addUniform(new osg::Uniform("envMapColor", mColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeTexture(osg::StateSet* stateset)
|
||||||
|
{
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXGEN);
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXENV);
|
||||||
|
stateset->removeTextureMode(mTexUnit, GL_TEXTURE_2D);
|
||||||
|
stateset->removeUniform("envMapColor");
|
||||||
|
|
||||||
|
osg::StateSet::TextureAttributeList& list = stateset->getTextureAttributeList();
|
||||||
|
while (list.size() && list.rbegin()->empty())
|
||||||
|
list.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
||||||
|
{
|
||||||
|
if (mColorChanged){
|
||||||
|
this->reset();
|
||||||
|
setDefaults(stateset);
|
||||||
|
mColorChanged = false;
|
||||||
|
}
|
||||||
|
if (mDone)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Set the starting time to measure glow duration from if this is a temporary glow
|
||||||
|
if ((mDuration >= 0) && mStartingTime == 0)
|
||||||
|
mStartingTime = nv->getFrameStamp()->getSimulationTime();
|
||||||
|
|
||||||
|
float time = nv->getFrameStamp()->getSimulationTime();
|
||||||
|
int index = (int)(time*16) % mTextures.size();
|
||||||
|
stateset->setTextureAttribute(mTexUnit, mTextures[index], osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||||
|
|
||||||
|
if ((mDuration >= 0) && (time - mStartingTime > mDuration)) // If this is a temporary glow and it has finished its duration
|
||||||
|
{
|
||||||
|
if (mOriginalDuration >= 0) // if this glowupdater was a temporary glow since its creation
|
||||||
|
{
|
||||||
|
removeTexture(stateset);
|
||||||
|
this->reset();
|
||||||
|
mDone = true;
|
||||||
|
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||||
|
}
|
||||||
|
if (mOriginalDuration < 0) // if this glowupdater was originally a permanent glow
|
||||||
|
{
|
||||||
|
mDuration = mOriginalDuration;
|
||||||
|
mStartingTime = 0;
|
||||||
|
mColor = mOriginalColor;
|
||||||
|
this->reset();
|
||||||
|
setDefaults(stateset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isPermanentGlowUpdater()
|
||||||
|
{
|
||||||
|
return (mDuration < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isDone()
|
||||||
|
{
|
||||||
|
return mDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColor(osg::Vec4f color)
|
||||||
|
{
|
||||||
|
mColor = color;
|
||||||
|
mColorChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDuration(float duration)
|
||||||
|
{
|
||||||
|
mDuration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int mTexUnit;
|
||||||
|
osg::Vec4f mColor;
|
||||||
|
osg::Vec4f mOriginalColor; // for restoring the color of a permanent glow after a temporary glow on the object finishes
|
||||||
|
std::vector<osg::ref_ptr<osg::Texture2D> > mTextures;
|
||||||
|
osg::Node* mNode;
|
||||||
|
float mDuration;
|
||||||
|
float mOriginalDuration; // for recording that this is originally a permanent glow if it is changed to a temporary one
|
||||||
|
float mStartingTime;
|
||||||
|
Resource::ResourceSystem* mResourceSystem;
|
||||||
|
bool mColorChanged;
|
||||||
|
bool mDone;
|
||||||
|
};
|
||||||
|
|
||||||
struct Animation::AnimSource
|
struct Animation::AnimSource
|
||||||
{
|
{
|
||||||
|
@ -1106,7 +1192,29 @@ namespace MWRender
|
||||||
int mLowestUnusedTexUnit;
|
int mLowestUnusedTexUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Animation::addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor)
|
void Animation::addSpellCastGlow(const ESM::MagicEffect *effect)
|
||||||
|
{
|
||||||
|
osg::Vec4f glowColor(1,1,1,1);
|
||||||
|
glowColor.x() = effect->mData.mRed / 255.f;
|
||||||
|
glowColor.y() = effect->mData.mGreen / 255.f;
|
||||||
|
glowColor.z() = effect->mData.mBlue / 255.f;
|
||||||
|
|
||||||
|
if (!mGlowUpdater || (mGlowUpdater->isDone() || (mGlowUpdater->isPermanentGlowUpdater() == true)))
|
||||||
|
{
|
||||||
|
if (mGlowUpdater && mGlowUpdater->isDone())
|
||||||
|
mObjectRoot->removeUpdateCallback(mGlowUpdater);
|
||||||
|
|
||||||
|
if (mGlowUpdater && mGlowUpdater->isPermanentGlowUpdater())
|
||||||
|
{
|
||||||
|
mGlowUpdater->setColor(glowColor);
|
||||||
|
mGlowUpdater->setDuration(1.5); // Glow length measured from original engine as about 1.5 seconds
|
||||||
|
}
|
||||||
|
else
|
||||||
|
addGlow(mObjectRoot, glowColor, 1.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animation::addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor, float glowDuration)
|
||||||
{
|
{
|
||||||
std::vector<osg::ref_ptr<osg::Texture2D> > textures;
|
std::vector<osg::ref_ptr<osg::Texture2D> > textures;
|
||||||
for (int i=0; i<32; ++i)
|
for (int i=0; i<32; ++i)
|
||||||
|
@ -1130,18 +1238,22 @@ namespace MWRender
|
||||||
FindLowestUnusedTexUnitVisitor findLowestUnusedTexUnitVisitor;
|
FindLowestUnusedTexUnitVisitor findLowestUnusedTexUnitVisitor;
|
||||||
node->accept(findLowestUnusedTexUnitVisitor);
|
node->accept(findLowestUnusedTexUnitVisitor);
|
||||||
int texUnit = findLowestUnusedTexUnitVisitor.mLowestUnusedTexUnit;
|
int texUnit = findLowestUnusedTexUnitVisitor.mLowestUnusedTexUnit;
|
||||||
osg::ref_ptr<GlowUpdater> glowupdater (new GlowUpdater(texUnit, glowColor, textures));
|
|
||||||
node->addUpdateCallback(glowupdater);
|
osg::ref_ptr<GlowUpdater> glowUpdater = new GlowUpdater(texUnit, glowColor, textures, node, glowDuration, mResourceSystem);
|
||||||
|
mGlowUpdater = glowUpdater;
|
||||||
|
node->addUpdateCallback(glowUpdater);
|
||||||
|
|
||||||
// set a texture now so that the ShaderVisitor can find it
|
// set a texture now so that the ShaderVisitor can find it
|
||||||
osg::ref_ptr<osg::StateSet> writableStateSet = NULL;
|
osg::ref_ptr<osg::StateSet> writableStateSet = NULL;
|
||||||
if (!node->getStateSet())
|
if (!node->getStateSet())
|
||||||
writableStateSet = node->getOrCreateStateSet();
|
writableStateSet = node->getOrCreateStateSet();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
writableStateSet = osg::clone(node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
writableStateSet = osg::clone(node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||||
|
node->setStateSet(writableStateSet);
|
||||||
|
}
|
||||||
writableStateSet->setTextureAttributeAndModes(texUnit, textures.front(), osg::StateAttribute::ON);
|
writableStateSet->setTextureAttributeAndModes(texUnit, textures.front(), osg::StateAttribute::ON);
|
||||||
writableStateSet->addUniform(new osg::Uniform("envMapColor", glowColor));
|
writableStateSet->addUniform(new osg::Uniform("envMapColor", glowColor));
|
||||||
|
|
||||||
mResourceSystem->getSceneManager()->recreateShaders(node);
|
mResourceSystem->getSceneManager()->recreateShaders(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
struct Light;
|
struct Light;
|
||||||
|
struct MagicEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Resource
|
namespace Resource
|
||||||
|
@ -32,6 +33,7 @@ namespace MWRender
|
||||||
|
|
||||||
class ResetAccumRootCallback;
|
class ResetAccumRootCallback;
|
||||||
class RotateController;
|
class RotateController;
|
||||||
|
class GlowUpdater;
|
||||||
|
|
||||||
class EffectAnimationTime : public SceneUtil::ControllerSource
|
class EffectAnimationTime : public SceneUtil::ControllerSource
|
||||||
{
|
{
|
||||||
|
@ -261,6 +263,7 @@ protected:
|
||||||
float mHeadPitchRadians;
|
float mHeadPitchRadians;
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::LightSource> mGlowLight;
|
osg::ref_ptr<SceneUtil::LightSource> mGlowLight;
|
||||||
|
osg::ref_ptr<GlowUpdater> mGlowUpdater;
|
||||||
|
|
||||||
float mAlpha;
|
float mAlpha;
|
||||||
|
|
||||||
|
@ -317,7 +320,7 @@ protected:
|
||||||
|
|
||||||
osg::Vec4f getEnchantmentColor(const MWWorld::ConstPtr& item) const;
|
osg::Vec4f getEnchantmentColor(const MWWorld::ConstPtr& item) const;
|
||||||
|
|
||||||
void addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor);
|
void addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor, float glowDuration = -1);
|
||||||
|
|
||||||
/// Set the render bin for this animation's object root. May be customized by subclasses.
|
/// Set the render bin for this animation's object root. May be customized by subclasses.
|
||||||
virtual void setRenderBin();
|
virtual void setRenderBin();
|
||||||
|
@ -351,6 +354,8 @@ public:
|
||||||
void removeEffect (int effectId);
|
void removeEffect (int effectId);
|
||||||
void getLoopingEffects (std::vector<int>& out) const;
|
void getLoopingEffects (std::vector<int>& out) const;
|
||||||
|
|
||||||
|
void addSpellCastGlow(const ESM::MagicEffect *effect);
|
||||||
|
|
||||||
virtual void updatePtr(const MWWorld::Ptr &ptr);
|
virtual void updatePtr(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
bool hasAnimation(const std::string &anim) const;
|
bool hasAnimation(const std::string &anim) const;
|
||||||
|
|
|
@ -147,6 +147,7 @@ namespace MWRender
|
||||||
|
|
||||||
CharacterPreview::~CharacterPreview ()
|
CharacterPreview::~CharacterPreview ()
|
||||||
{
|
{
|
||||||
|
mCamera->removeChildren(0, mCamera->getNumChildren());
|
||||||
mViewer->getSceneData()->asGroup()->removeChild(mCamera);
|
mViewer->getSceneData()->asGroup()->removeChild(mCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,10 @@ namespace MWRender
|
||||||
|
|
||||||
GlobalMap::~GlobalMap()
|
GlobalMap::~GlobalMap()
|
||||||
{
|
{
|
||||||
|
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
||||||
|
removeCamera(*it);
|
||||||
|
for (CameraVector::iterator it = mActiveCameras.begin(); it != mActiveCameras.end(); ++it)
|
||||||
|
removeCamera(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::render (Loading::Listener* loadingListener)
|
void GlobalMap::render (Loading::Listener* loadingListener)
|
||||||
|
@ -507,7 +511,8 @@ namespace MWRender
|
||||||
void GlobalMap::cleanupCameras()
|
void GlobalMap::cleanupCameras()
|
||||||
{
|
{
|
||||||
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
||||||
mRoot->removeChild(*it);
|
removeCamera(*it);
|
||||||
|
|
||||||
mCamerasPendingRemoval.clear();
|
mCamerasPendingRemoval.clear();
|
||||||
|
|
||||||
for (ImageDestVector::iterator it = mPendingImageDest.begin(); it != mPendingImageDest.end();)
|
for (ImageDestVector::iterator it = mPendingImageDest.begin(); it != mPendingImageDest.end();)
|
||||||
|
@ -524,4 +529,10 @@ namespace MWRender
|
||||||
it = mPendingImageDest.erase(it);
|
it = mPendingImageDest.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlobalMap::removeCamera(osg::Camera *cam)
|
||||||
|
{
|
||||||
|
cam->removeChildren(0, cam->getNumChildren());
|
||||||
|
mRoot->removeChild(cam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ namespace MWRender
|
||||||
*/
|
*/
|
||||||
void cleanupCameras();
|
void cleanupCameras();
|
||||||
|
|
||||||
|
void removeCamera(osg::Camera* cam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark a camera for cleanup in the next update. For internal use only.
|
* Mark a camera for cleanup in the next update. For internal use only.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,9 +88,9 @@ LocalMap::LocalMap(osgViewer::Viewer* viewer)
|
||||||
LocalMap::~LocalMap()
|
LocalMap::~LocalMap()
|
||||||
{
|
{
|
||||||
for (CameraVector::iterator it = mActiveCameras.begin(); it != mActiveCameras.end(); ++it)
|
for (CameraVector::iterator it = mActiveCameras.begin(); it != mActiveCameras.end(); ++it)
|
||||||
mRoot->removeChild(*it);
|
removeCamera(*it);
|
||||||
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
||||||
mRoot->removeChild(*it);
|
removeCamera(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
const osg::Vec2f LocalMap::rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle)
|
const osg::Vec2f LocalMap::rotatePoint(const osg::Vec2f& point, const osg::Vec2f& center, const float angle)
|
||||||
|
@ -275,6 +275,12 @@ osg::ref_ptr<osg::Texture2D> LocalMap::getFogOfWarTexture(int x, int y)
|
||||||
return found->second.mFogOfWarTexture;
|
return found->second.mFogOfWarTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalMap::removeCamera(osg::Camera *cam)
|
||||||
|
{
|
||||||
|
cam->removeChildren(0, cam->getNumChildren());
|
||||||
|
mRoot->removeChild(cam);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalMap::markForRemoval(osg::Camera *cam)
|
void LocalMap::markForRemoval(osg::Camera *cam)
|
||||||
{
|
{
|
||||||
CameraVector::iterator found = std::find(mActiveCameras.begin(), mActiveCameras.end(), cam);
|
CameraVector::iterator found = std::find(mActiveCameras.begin(), mActiveCameras.end(), cam);
|
||||||
|
@ -293,11 +299,7 @@ void LocalMap::cleanupCameras()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
for (CameraVector::iterator it = mCamerasPendingRemoval.begin(); it != mCamerasPendingRemoval.end(); ++it)
|
||||||
{
|
removeCamera(*it);
|
||||||
(*it)->removeChildren(0, (*it)->getNumChildren());
|
|
||||||
(*it)->setGraphicsContext(NULL);
|
|
||||||
mRoot->removeChild(*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
mCamerasPendingRemoval.clear();
|
mCamerasPendingRemoval.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace MWRender
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> getFogOfWarTexture (int x, int y);
|
osg::ref_ptr<osg::Texture2D> getFogOfWarTexture (int x, int y);
|
||||||
|
|
||||||
|
void removeCamera(osg::Camera* cam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates a camera has been queued for rendering and can be cleaned up in the next frame. For internal use only.
|
* Indicates a camera has been queued for rendering and can be cleaned up in the next frame. For internal use only.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -258,6 +258,8 @@ namespace MWRender
|
||||||
|
|
||||||
RenderingManager::~RenderingManager()
|
RenderingManager::~RenderingManager()
|
||||||
{
|
{
|
||||||
|
// let background loading thread finish before we delete anything else
|
||||||
|
mWorkQueue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWRender::Objects& RenderingManager::getObjects()
|
MWRender::Objects& RenderingManager::getObjects()
|
||||||
|
|
|
@ -22,7 +22,7 @@ void overrideTexture(const std::string &texture, Resource::ResourceSystem *resou
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> stateset;
|
osg::ref_ptr<osg::StateSet> stateset;
|
||||||
if (node->getStateSet())
|
if (node->getStateSet())
|
||||||
stateset = static_cast<osg::StateSet*>(node->getStateSet()->clone(osg::CopyOp::SHALLOW_COPY));
|
stateset = osg::clone(node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||||
else
|
else
|
||||||
stateset = new osg::StateSet;
|
stateset = new osg::StateSet;
|
||||||
|
|
||||||
|
|
|
@ -443,11 +443,13 @@ void Water::updateWaterMaterial()
|
||||||
{
|
{
|
||||||
if (mReflection)
|
if (mReflection)
|
||||||
{
|
{
|
||||||
|
mReflection->removeChildren(0, mReflection->getNumChildren());
|
||||||
mParent->removeChild(mReflection);
|
mParent->removeChild(mReflection);
|
||||||
mReflection = NULL;
|
mReflection = NULL;
|
||||||
}
|
}
|
||||||
if (mRefraction)
|
if (mRefraction)
|
||||||
{
|
{
|
||||||
|
mRefraction->removeChildren(0, mRefraction->getNumChildren());
|
||||||
mParent->removeChild(mRefraction);
|
mParent->removeChild(mRefraction);
|
||||||
mRefraction = NULL;
|
mRefraction = NULL;
|
||||||
}
|
}
|
||||||
|
@ -572,11 +574,13 @@ Water::~Water()
|
||||||
|
|
||||||
if (mReflection)
|
if (mReflection)
|
||||||
{
|
{
|
||||||
|
mReflection->removeChildren(0, mReflection->getNumChildren());
|
||||||
mParent->removeChild(mReflection);
|
mParent->removeChild(mReflection);
|
||||||
mReflection = NULL;
|
mReflection = NULL;
|
||||||
}
|
}
|
||||||
if (mRefraction)
|
if (mRefraction)
|
||||||
{
|
{
|
||||||
|
mRefraction->removeChildren(0, mRefraction->getNumChildren());
|
||||||
mParent->removeChild(mRefraction);
|
mParent->removeChild(mRefraction);
|
||||||
mRefraction = NULL;
|
mRefraction = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace MWScript
|
||||||
throw std::runtime_error ("animation mode out of range");
|
throw std::runtime_error ("animation mode out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, loops, true);
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, loops + 1, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
FailedAction::FailedAction(const std::string &msg)
|
FailedAction::FailedAction(const std::string &msg, const Ptr& target)
|
||||||
: Action(false), mMessage(msg)
|
: Action(false, target), mMessage(msg)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void FailedAction::executeImp(const Ptr &actor)
|
void FailedAction::executeImp(const Ptr &actor)
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWWorld
|
||||||
virtual void executeImp(const Ptr &actor);
|
virtual void executeImp(const Ptr &actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FailedAction(const std::string &message = std::string());
|
FailedAction(const std::string &message = std::string(), const Ptr& target = Ptr());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ T TimeOfDayInterpolator<T>::getValue(const float gameHour, const TimeOfDaySettin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template class TimeOfDayInterpolator<float>;
|
template class MWWorld::TimeOfDayInterpolator<float>;
|
||||||
template class TimeOfDayInterpolator<osg::Vec4f>;
|
template class MWWorld::TimeOfDayInterpolator<osg::Vec4f>;
|
||||||
|
|
||||||
Weather::Weather(const std::string& name,
|
Weather::Weather(const std::string& name,
|
||||||
const Fallback::Map& fallback,
|
const Fallback::Map& fallback,
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
# ======================================
|
# ======================================
|
||||||
|
|
||||||
include(LibFindMacros)
|
include(LibFindMacros)
|
||||||
include(PreprocessorUtils)
|
|
||||||
|
|
||||||
set(_REGULAR_INSTALL_PATHS
|
set(_REGULAR_INSTALL_PATHS
|
||||||
/usr/X11R6
|
/usr/X11R6
|
||||||
|
@ -78,21 +77,13 @@ find_path(Freetype_OLD_INCLUDE_DIR
|
||||||
PATH_SUFFIXES freetype2
|
PATH_SUFFIXES freetype2
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
libfind_version_n_header(Freetype
|
||||||
# get version from freetype.h
|
NAMES freetype/freetype.h freetype.h
|
||||||
find_file(Freetype_HEADER
|
PATHS Freetype_OLD_INCLUDE_DIR
|
||||||
NAMES freetype.h
|
DEFINES FREETYPE_MAJOR FREETYPE_MINOR FREETYPE_PATCH
|
||||||
PATH_SUFFIXES freetype
|
|
||||||
PATHS ${Freetype_OLD_INCLUDE_DIR}
|
|
||||||
)
|
)
|
||||||
if (Freetype_HEADER)
|
|
||||||
get_version_from_n_defines(Freetype_VERSION
|
|
||||||
${Freetype_HEADER}
|
|
||||||
FREETYPE_MAJOR FREETYPE_MINOR FREETYPE_PATCH
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(Freetype_PROCESS_INCLUDES Freetype_INCLUDE_DIR Freetype_OLD_INCLUDE_DIR)
|
set(Freetype_PROCESS_INCLUDES Freetype_OLD_INCLUDE_DIR)
|
||||||
libfind_process(Freetype)
|
libfind_process(Freetype)
|
||||||
|
|
||||||
if (Freetype_INCLUDE_DIRS)
|
if (Freetype_INCLUDE_DIRS)
|
||||||
|
|
|
@ -1,158 +1,53 @@
|
||||||
# - Find MyGUI includes and library
|
# - Find MyGUI includes and library
|
||||||
#
|
#
|
||||||
|
# This module accepts the following env variables
|
||||||
|
# MYGUI_HOME - Can be set to MyGUI install path or Windows build path
|
||||||
|
#
|
||||||
# This module defines
|
# This module defines
|
||||||
# MYGUI_INCLUDE_DIRS
|
# MyGUI_INCLUDE_DIRS
|
||||||
# MYGUI_LIBRARIES, the libraries to link against to use MYGUI.
|
# MyGUI_LIBRARIES, the libraries to link against to use MyGUI.
|
||||||
# MYGUI_LIB_DIR, the location of the libraries
|
# MyGUI_FOUND, If false, do not try to use MyGUI
|
||||||
# MYGUI_FOUND, If false, do not try to use MYGUI
|
|
||||||
#
|
#
|
||||||
# Copyright © 2007, Matt Williams
|
# Copyright © 2007, Matt Williams
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
CMAKE_POLICY(PUSH)
|
|
||||||
include(FindPkgMacros)
|
|
||||||
include(PreprocessorUtils)
|
|
||||||
|
|
||||||
# IF (MYGUI_LIBRARIES AND MYGUI_INCLUDE_DIRS)
|
include(LibFindMacros)
|
||||||
# SET(MYGUI_FIND_QUIETLY TRUE)
|
|
||||||
# ENDIF (MYGUI_LIBRARIES AND MYGUI_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
IF (WIN32) #Windows
|
|
||||||
|
|
||||||
MESSAGE(STATUS "Looking for MyGUI")
|
|
||||||
|
|
||||||
IF(MINGW)
|
|
||||||
|
|
||||||
FIND_PATH ( MYGUI_INCLUDE_DIRS MyGUI.h PATH_SUFFIXES MYGUI)
|
|
||||||
FIND_LIBRARY ( MYGUI_LIBRARIES_REL NAMES
|
|
||||||
libMyGUIEngine${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
HINTS
|
|
||||||
${MYGUI_LIB_DIR}
|
|
||||||
PATH_SUFFIXES "" release relwithdebinfo minsizerel )
|
|
||||||
|
|
||||||
FIND_LIBRARY ( MYGUI_LIBRARIES_DBG NAMES
|
|
||||||
libMyGUIEngine_d${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
HINTS
|
|
||||||
${MYGUI_LIB_DIR}
|
|
||||||
PATH_SUFFIXES "" debug )
|
|
||||||
|
|
||||||
make_library_set ( MYGUI_LIBRARIES )
|
|
||||||
|
|
||||||
MESSAGE ("${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF(MINGW)
|
|
||||||
|
|
||||||
SET(MYGUISDK $ENV{MYGUI_HOME})
|
|
||||||
IF (MYGUISDK)
|
|
||||||
findpkg_begin ( "MYGUI" )
|
|
||||||
MESSAGE(STATUS "Using MyGUI in MyGUI SDK")
|
|
||||||
STRING(REGEX REPLACE "[\\]" "/" MYGUISDK "${MYGUISDK}" )
|
|
||||||
|
|
||||||
find_path ( MYGUI_INCLUDE_DIRS MyGUI.h "${MYGUISDK}/MyGUIEngine/include" NO_DEFAULT_PATH )
|
|
||||||
|
|
||||||
SET ( MYGUI_LIB_DIR ${MYGUISDK}/lib ${MYGUISDK}/*/lib )
|
|
||||||
|
|
||||||
if (MYGUI_STATIC)
|
if (MYGUI_STATIC)
|
||||||
set(LIB_SUFFIX "Static")
|
set(MYGUI_STATIC_SUFFIX "Static")
|
||||||
find_package(Freetype)
|
else()
|
||||||
endif ( MYGUI_STATIC )
|
set(MYGUI_STATIC_SUFFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_library ( MYGUI_LIBRARIES_REL NAMES MyGUIEngine${LIB_SUFFIX}.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" release relwithdebinfo minsizerel )
|
libfind_pkg_detect(MyGUI_Debug MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
|
||||||
find_library ( MYGUI_LIBRARIES_DBG NAMES MyGUIEngine${LIB_SUFFIX}_d.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" debug )
|
FIND_LIBRARY MyGUIEngine_d${MYGUI_STATIC_SUFFIX}
|
||||||
|
HINTS $ENV{MYGUI_HOME}/lib
|
||||||
|
PATH_SUFFIXES "" debug
|
||||||
|
)
|
||||||
|
set(MyGUI_Debug_FIND_QUIETLY TRUE)
|
||||||
|
libfind_process(MyGUI_Debug)
|
||||||
|
|
||||||
make_library_set ( MYGUI_LIBRARIES )
|
libfind_pkg_detect(MyGUI MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
|
||||||
|
FIND_PATH MyGUI.h
|
||||||
|
HINTS $ENV{MYGUI_HOME}/include
|
||||||
|
PATH_SUFFIXES MYGUI MyGUI
|
||||||
|
FIND_LIBRARY MyGUIEngine${MYGUI_STATIC_SUFFIX}
|
||||||
|
HINTS $ENV{MYGUI_HOME}/lib
|
||||||
|
PATH_SUFFIXES "" release relwithdebinfo minsizerel
|
||||||
|
)
|
||||||
|
if (MYGUI_STATIC AND (APPLE OR ANDROID))
|
||||||
|
# we need explicit Freetype libs only on OS X and ANDROID for static build
|
||||||
|
libfind_package(MyGUI Freetype)
|
||||||
|
endif()
|
||||||
|
|
||||||
MESSAGE ("${MYGUI_LIBRARIES}")
|
libfind_version_n_header(MyGUI
|
||||||
|
NAMES MyGUI_Prerequest.h
|
||||||
|
DEFINES MYGUI_VERSION_MAJOR MYGUI_VERSION_MINOR MYGUI_VERSION_PATCH
|
||||||
|
)
|
||||||
|
libfind_process(MyGUI)
|
||||||
|
|
||||||
#findpkg_finish ( "MYGUI" )
|
if (MyGUI_Debug_FOUND)
|
||||||
ENDIF (MYGUISDK)
|
set(MyGUI_LIBRARIES optimized ${MyGUI_LIBRARIES} debug ${MyGUI_Debug_LIBRARIES})
|
||||||
ELSE (WIN32) #Unix
|
endif()
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
|
|
||||||
FIND_PACKAGE(PkgConfig)
|
|
||||||
IF(MYGUI_STATIC)
|
|
||||||
# don't use pkgconfig on OS X, find freetype & append it's libs to resulting MYGUI_LIBRARIES
|
|
||||||
IF (NOT APPLE AND NOT ANDROID)
|
|
||||||
PKG_SEARCH_MODULE(MYGUI MYGUIStatic MyGUIStatic)
|
|
||||||
IF (MYGUI_INCLUDE_DIRS)
|
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS})
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBDIR})
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
|
||||||
ELSE (MYGUI_INCLUDE_DIRS)
|
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES myguistatic PATHS /usr/lib /usr/local/lib)
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS)
|
|
||||||
ELSE (NOT APPLE AND NOT ANDROID)
|
|
||||||
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${MYGUI_DEPENDENCIES_DIR})
|
|
||||||
FIND_PACKAGE(Freetype REQUIRED)
|
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES MyGUIEngineStatic PATHS /usr/lib /usr/local/lib ${OPENMW_DEPENDENCIES_DIR})
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF (NOT APPLE AND NOT ANDROID)
|
|
||||||
ELSE(MYGUI_STATIC)
|
|
||||||
PKG_SEARCH_MODULE(MYGUI MYGUI MyGUI)
|
|
||||||
IF (MYGUI_INCLUDE_DIRS)
|
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS})
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBDIR})
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
|
||||||
ELSE (MYGUI_INCLUDE_DIRS)
|
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES MyGUIEngine PATHS /usr/local/lib /usr/lib)
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS)
|
|
||||||
ENDIF(MYGUI_STATIC)
|
|
||||||
ENDIF (WIN32)
|
|
||||||
|
|
||||||
|
|
||||||
#Do some preparation
|
|
||||||
IF (NOT WIN32) # This does not work on Windows for paths with spaces in them
|
|
||||||
SEPARATE_ARGUMENTS(MYGUI_INCLUDE_DIRS)
|
|
||||||
SEPARATE_ARGUMENTS(MYGUI_LIBRARIES)
|
|
||||||
ENDIF (NOT WIN32)
|
|
||||||
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} ${Freetype_LIBRARIES})
|
|
||||||
|
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS} CACHE PATH "")
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIB_DIR} CACHE PATH "")
|
|
||||||
|
|
||||||
IF (NOT APPLE OR NOT MYGUI_STATIC) # we need explicit freetype libs only on OS X for static build, for other cases just make it TRUE
|
|
||||||
SET(Freetype_LIBRARIES TRUE)
|
|
||||||
ENDIF (NOT APPLE OR NOT MYGUI_STATIC)
|
|
||||||
|
|
||||||
IF (MYGUI_INCLUDE_DIRS AND MYGUI_LIBRARIES AND Freetype_LIBRARIES)
|
|
||||||
SET(MYGUI_FOUND TRUE)
|
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS AND MYGUI_LIBRARIES AND Freetype_LIBRARIES)
|
|
||||||
|
|
||||||
IF (MYGUI_FOUND)
|
|
||||||
MARK_AS_ADVANCED(MYGUI_LIB_DIR)
|
|
||||||
IF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS " libraries : ${MYGUI_LIBRARIES} from ${MYGUI_LIB_DIR}")
|
|
||||||
MESSAGE(STATUS " includes : ${MYGUI_INCLUDE_DIRS}")
|
|
||||||
ENDIF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
|
|
||||||
find_file(MYGUI_PREQUEST_FILE NAMES MyGUI_Prerequest.h PATHS ${MYGUI_INCLUDE_DIRS})
|
|
||||||
file(READ ${MYGUI_PREQUEST_FILE} MYGUI_TEMP_VERSION_CONTENT)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_MAJOR MYGUI_VERSION_MAJOR)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_MINOR MYGUI_VERSION_MINOR)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_PATCH MYGUI_VERSION_PATCH)
|
|
||||||
set(MYGUI_VERSION "${MYGUI_VERSION_MAJOR}.${MYGUI_VERSION_MINOR}.${MYGUI_VERSION_PATCH}")
|
|
||||||
|
|
||||||
IF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS "MyGUI version: ${MYGUI_VERSION}")
|
|
||||||
ENDIF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
ENDIF (MYGUI_FOUND)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MyGUI DEFAULT_MSG
|
|
||||||
MYGUI_INCLUDE_DIRS
|
|
||||||
Freetype_LIBRARIES
|
|
||||||
MYGUI_LIBRARIES)
|
|
||||||
|
|
||||||
CMAKE_POLICY(POP)
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
include(LibFindMacros)
|
include(LibFindMacros)
|
||||||
include(PreprocessorUtils)
|
|
||||||
|
|
||||||
libfind_pkg_detect(TinyXML tinyxml
|
libfind_pkg_detect(TinyXML tinyxml
|
||||||
FIND_PATH tinyxml.h
|
FIND_PATH tinyxml.h
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# This file is part of the CMake build system for OGRE
|
|
||||||
# (Object-oriented Graphics Rendering Engine)
|
|
||||||
# For the latest info, see http://www.ogre3d.org/
|
|
||||||
#
|
|
||||||
# The contents of this file are placed in the public domain. Feel
|
|
||||||
# free to make use of it in any way you like.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE)
|
|
||||||
string(REGEX MATCH
|
|
||||||
"# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))"
|
|
||||||
PREPROC_TEMP_VAR
|
|
||||||
${${CONTENTS}}
|
|
||||||
)
|
|
||||||
if (CMAKE_MATCH_3)
|
|
||||||
set(${VARIABLE} ${CMAKE_MATCH_3})
|
|
||||||
else ()
|
|
||||||
set(${VARIABLE} ${CMAKE_MATCH_4})
|
|
||||||
endif ()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE)
|
|
||||||
string(REGEX MATCH
|
|
||||||
"\n *# *define +(${KEYWORD})"
|
|
||||||
PREPROC_TEMP_VAR
|
|
||||||
${${CONTENTS}}
|
|
||||||
)
|
|
||||||
if (CMAKE_MATCH_1)
|
|
||||||
set(${VARIABLE} TRUE)
|
|
||||||
else ()
|
|
||||||
set(${VARIABLE} FALSE)
|
|
||||||
endif ()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE)
|
|
||||||
string(REGEX REPLACE
|
|
||||||
"(// *)?# *define +${KEYWORD} +[^ \n]*"
|
|
||||||
"#define ${KEYWORD} ${NEW_VALUE}"
|
|
||||||
${VARIABLE}_TEMP
|
|
||||||
${${VARIABLE}}
|
|
||||||
)
|
|
||||||
set(${VARIABLE} ${${VARIABLE}_TEMP})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE)
|
|
||||||
if (${ENABLE})
|
|
||||||
set(TMP_REPLACE_STR "#define ${KEYWORD}")
|
|
||||||
else ()
|
|
||||||
set(TMP_REPLACE_STR "// #define ${KEYWORD}")
|
|
||||||
endif ()
|
|
||||||
string(REGEX REPLACE
|
|
||||||
"(// *)?# *define +${KEYWORD} *\n"
|
|
||||||
${TMP_REPLACE_STR}
|
|
||||||
${VARIABLE}_TEMP
|
|
||||||
${${VARIABLE}}
|
|
||||||
)
|
|
||||||
set(${VARIABLE} ${${VARIABLE}_TEMP})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
|
|
||||||
# get_version_from_n_defines(result_version_name header_path [list of defines...])
|
|
||||||
#
|
|
||||||
# get_version_from_n_defines(MyPackage_VERSION /Header/Path/HeaderName.h
|
|
||||||
# MYPACKAGE_VERSION_MAJOR
|
|
||||||
# MYPACKAGE_VERSION_MINOR
|
|
||||||
# )
|
|
||||||
# Function call will get the values of defines MYPACKAGE_VERSION_MAJOR & MYPACKAGE_VERSION_MINOR
|
|
||||||
# from header and set "${MYPACKAGE_VERSION_MAJOR}.${MYPACKAGE_VERSION_MINOR}" into MyPackage_VERSION
|
|
||||||
#
|
|
||||||
|
|
||||||
function(get_version_from_n_defines OUT_VAR HEADER_PATH)
|
|
||||||
if (NOT EXISTS ${HEADER_PATH})
|
|
||||||
message(FATAL_ERROR "Unable to find '${HEADER_PATH}'")
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
file(READ ${HEADER_PATH} _CONTENT)
|
|
||||||
unset(_DEFINES_LIST)
|
|
||||||
foreach (_DEFINE_NAME ${ARGN})
|
|
||||||
get_preprocessor_entry(_CONTENT ${_DEFINE_NAME} _DEFINE_VALUE)
|
|
||||||
list(APPEND _DEFINES_LIST ${_DEFINE_VALUE})
|
|
||||||
endforeach()
|
|
||||||
string(REPLACE ";" "." _VERSION "${_DEFINES_LIST}")
|
|
||||||
set(${OUT_VAR} "${_VERSION}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
|
@ -222,7 +222,7 @@ target_link_libraries(components
|
||||||
${SDL2_LIBRARY}
|
${SDL2_LIBRARY}
|
||||||
# For MyGUI platform
|
# For MyGUI platform
|
||||||
${GL_LIB}
|
${GL_LIB}
|
||||||
${MYGUI_LIBRARIES}
|
${MyGUI_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
|
@ -412,6 +412,8 @@ void RenderManager::initialise()
|
||||||
|
|
||||||
void RenderManager::shutdown()
|
void RenderManager::shutdown()
|
||||||
{
|
{
|
||||||
|
mGuiRoot->removeChildren(0, mGuiRoot->getNumChildren());
|
||||||
|
mSceneRoot->removeChild(mGuiRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::IVertexBuffer* RenderManager::createVertexBuffer()
|
MyGUI::IVertexBuffer* RenderManager::createVertexBuffer()
|
||||||
|
|
|
@ -239,7 +239,7 @@ UVController::UVController(const UVController& copy, const osg::CopyOp& copyop)
|
||||||
|
|
||||||
void UVController::setDefaults(osg::StateSet *stateset)
|
void UVController::setDefaults(osg::StateSet *stateset)
|
||||||
{
|
{
|
||||||
osg::TexMat* texMat = new osg::TexMat;
|
osg::ref_ptr<osg::TexMat> texMat (new osg::TexMat);
|
||||||
for (std::set<int>::const_iterator it = mTextureUnits.begin(); it != mTextureUnits.end(); ++it)
|
for (std::set<int>::const_iterator it = mTextureUnits.begin(); it != mTextureUnits.end(); ++it)
|
||||||
stateset->setTextureAttributeAndModes(*it, texMat, osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(*it, texMat, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1110,7 +1110,7 @@ namespace NifOsg
|
||||||
geometry->setDataVariance(osg::Object::STATIC);
|
geometry->setDataVariance(osg::Object::STATIC);
|
||||||
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
|
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> geom2 = static_cast<osg::Geometry*>(osg::clone(geometry.get(), osg::CopyOp::DEEP_COPY_NODES|osg::CopyOp::DEEP_COPY_DRAWABLES));
|
osg::ref_ptr<osg::Geometry> geom2 = osg::clone(geometry.get(), osg::CopyOp::DEEP_COPY_NODES|osg::CopyOp::DEEP_COPY_DRAWABLES);
|
||||||
frameswitch->addChild(geometry);
|
frameswitch->addChild(geometry);
|
||||||
frameswitch->addChild(geom2);
|
frameswitch->addChild(geom2);
|
||||||
|
|
||||||
|
@ -1224,8 +1224,7 @@ namespace NifOsg
|
||||||
|
|
||||||
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
|
osg::ref_ptr<FrameSwitch> frameswitch = new FrameSwitch;
|
||||||
|
|
||||||
SceneUtil::RigGeometry* rig2 = static_cast<SceneUtil::RigGeometry*>(osg::clone(rig.get(), osg::CopyOp::DEEP_COPY_NODES|
|
SceneUtil::RigGeometry* rig2 = osg::clone(rig.get(), osg::CopyOp::DEEP_COPY_NODES|osg::CopyOp::DEEP_COPY_DRAWABLES);
|
||||||
osg::CopyOp::DEEP_COPY_DRAWABLES));
|
|
||||||
frameswitch->addChild(rig);
|
frameswitch->addChild(rig);
|
||||||
frameswitch->addChild(rig2);
|
frameswitch->addChild(rig2);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace SceneUtil
|
||||||
for (int i=0; i<2; ++i) // Using SHALLOW_COPY for StateAttributes, if users want to modify it is their responsibility to set a non-shared one first
|
for (int i=0; i<2; ++i) // Using SHALLOW_COPY for StateAttributes, if users want to modify it is their responsibility to set a non-shared one first
|
||||||
// This can be done conveniently in user implementations of the setDefaults() method
|
// This can be done conveniently in user implementations of the setDefaults() method
|
||||||
{
|
{
|
||||||
mStateSets[i] = static_cast<osg::StateSet*>(osg::clone(src, osg::CopyOp::SHALLOW_COPY));
|
mStateSets[i] = osg::clone(src, osg::CopyOp::SHALLOW_COPY);
|
||||||
setDefaults(mStateSets[i]);
|
setDefaults(mStateSets[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ namespace SceneUtil
|
||||||
: StateSetUpdater(copy, copyop)
|
: StateSetUpdater(copy, copyop)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<copy.mCtrls.size(); ++i)
|
for (unsigned int i=0; i<copy.mCtrls.size(); ++i)
|
||||||
mCtrls.push_back(static_cast<StateSetUpdater*>(osg::clone(copy.mCtrls[i].get(), copyop)));
|
mCtrls.push_back(osg::clone(copy.mCtrls[i].get(), copyop));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CompositeStateSetUpdater::getNumControllers()
|
unsigned int CompositeStateSetUpdater::getNumControllers()
|
||||||
|
|
10
extern/osgQt/GraphicsWindowQt
vendored
10
extern/osgQt/GraphicsWindowQt
vendored
|
@ -37,16 +37,6 @@ namespace osgQt
|
||||||
// forward declarations
|
// forward declarations
|
||||||
class GraphicsWindowQt;
|
class GraphicsWindowQt;
|
||||||
|
|
||||||
/** The function sets the viewer that will be used after entering
|
|
||||||
* the Qt main loop (QCoreApplication::exec()).
|
|
||||||
*
|
|
||||||
* The function also initializes internal structures required for proper
|
|
||||||
* scene rendering.
|
|
||||||
*
|
|
||||||
* The method must be called from main thread. */
|
|
||||||
void setViewer( osgViewer::ViewerBase *viewer );
|
|
||||||
|
|
||||||
|
|
||||||
class GLWidget : public QGLWidget
|
class GLWidget : public QGLWidget
|
||||||
{
|
{
|
||||||
typedef QGLWidget inherited;
|
typedef QGLWidget inherited;
|
||||||
|
|
123
extern/osgQt/GraphicsWindowQt.cpp
vendored
123
extern/osgQt/GraphicsWindowQt.cpp
vendored
|
@ -26,28 +26,6 @@
|
||||||
|
|
||||||
using namespace osgQt;
|
using namespace osgQt;
|
||||||
|
|
||||||
/// The object responsible for the scene re-rendering.
|
|
||||||
class HeartBeat : public QObject {
|
|
||||||
public:
|
|
||||||
int _timerId;
|
|
||||||
osg::Timer _lastFrameStartTime;
|
|
||||||
osg::observer_ptr< osgViewer::ViewerBase > _viewer;
|
|
||||||
|
|
||||||
virtual ~HeartBeat();
|
|
||||||
|
|
||||||
void init( osgViewer::ViewerBase *viewer );
|
|
||||||
void stopTimer();
|
|
||||||
void timerEvent( QTimerEvent *event );
|
|
||||||
|
|
||||||
static HeartBeat* instance();
|
|
||||||
private:
|
|
||||||
HeartBeat();
|
|
||||||
|
|
||||||
static QPointer<HeartBeat> heartBeat;
|
|
||||||
};
|
|
||||||
|
|
||||||
QPointer<HeartBeat> HeartBeat::heartBeat;
|
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
|
||||||
#define GETDEVICEPIXELRATIO() 1.0
|
#define GETDEVICEPIXELRATIO() 1.0
|
||||||
#else
|
#else
|
||||||
|
@ -637,104 +615,3 @@ private:
|
||||||
QtWindowingSystem& operator=( const QtWindowingSystem& );
|
QtWindowingSystem& operator=( const QtWindowingSystem& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void osgQt::setViewer( osgViewer::ViewerBase *viewer )
|
|
||||||
{
|
|
||||||
HeartBeat::instance()->init( viewer );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Constructor. Must be called from main thread.
|
|
||||||
HeartBeat::HeartBeat() : _timerId( 0 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Destructor. Must be called from main thread.
|
|
||||||
HeartBeat::~HeartBeat()
|
|
||||||
{
|
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
HeartBeat* HeartBeat::instance()
|
|
||||||
{
|
|
||||||
if (!heartBeat)
|
|
||||||
{
|
|
||||||
heartBeat = new HeartBeat();
|
|
||||||
}
|
|
||||||
return heartBeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HeartBeat::stopTimer()
|
|
||||||
{
|
|
||||||
if ( _timerId != 0 )
|
|
||||||
{
|
|
||||||
killTimer( _timerId );
|
|
||||||
_timerId = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Initializes the loop for viewer. Must be called from main thread.
|
|
||||||
void HeartBeat::init( osgViewer::ViewerBase *viewer )
|
|
||||||
{
|
|
||||||
if( _viewer == viewer )
|
|
||||||
return;
|
|
||||||
|
|
||||||
stopTimer();
|
|
||||||
|
|
||||||
_viewer = viewer;
|
|
||||||
|
|
||||||
if( viewer )
|
|
||||||
{
|
|
||||||
_timerId = startTimer( 0 );
|
|
||||||
_lastFrameStartTime.setStartTick( 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void HeartBeat::timerEvent( QTimerEvent * /*event*/ )
|
|
||||||
{
|
|
||||||
osg::ref_ptr< osgViewer::ViewerBase > viewer;
|
|
||||||
if( !_viewer.lock( viewer ) )
|
|
||||||
{
|
|
||||||
// viewer has been deleted -> stop timer
|
|
||||||
stopTimer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// limit the frame rate
|
|
||||||
if( viewer->getRunMaxFrameRate() > 0.0)
|
|
||||||
{
|
|
||||||
double dt = _lastFrameStartTime.time_s();
|
|
||||||
double minFrameTime = 1.0 / viewer->getRunMaxFrameRate();
|
|
||||||
if (dt < minFrameTime)
|
|
||||||
OpenThreads::Thread::microSleep(static_cast<unsigned int>(1000000.0*(minFrameTime-dt)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// avoid excessive CPU loading when no frame is required in ON_DEMAND mode
|
|
||||||
if( viewer->getRunFrameScheme() == osgViewer::ViewerBase::ON_DEMAND )
|
|
||||||
{
|
|
||||||
double dt = _lastFrameStartTime.time_s();
|
|
||||||
if (dt < 0.01)
|
|
||||||
OpenThreads::Thread::microSleep(static_cast<unsigned int>(1000000.0*(0.01-dt)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// record start frame time
|
|
||||||
_lastFrameStartTime.setStartTick();
|
|
||||||
|
|
||||||
// make frame
|
|
||||||
if( viewer->getRunFrameScheme() == osgViewer::ViewerBase::ON_DEMAND )
|
|
||||||
{
|
|
||||||
if( viewer->checkNeedToDoFrame() )
|
|
||||||
{
|
|
||||||
viewer->frame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewer->frame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -59,7 +59,9 @@ varying vec3 passNormal;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
#if @diffuseMap
|
||||||
vec2 adjustedDiffuseUV = diffuseMapUV;
|
vec2 adjustedDiffuseUV = diffuseMapUV;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if @normalMap
|
#if @normalMap
|
||||||
vec4 normalTex = texture2D(normalMap, normalMapUV);
|
vec4 normalTex = texture2D(normalMap, normalMapUV);
|
||||||
|
|
|
@ -27,6 +27,5 @@ set_target_properties(${MYGUI_RESOURCE_PLUGIN_LIBRARY} PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(${MYGUI_RESOURCE_PLUGIN_LIBRARY}
|
target_link_libraries(${MYGUI_RESOURCE_PLUGIN_LIBRARY}
|
||||||
${OGRE_LIBRARIES}
|
${OGRE_LIBRARIES}
|
||||||
${MYGUI_LIBRARIES}
|
|
||||||
components
|
components
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue