Merge pull request #399 from TES3MP/0.6.3 while resolving conflicts

Conflicts:
	apps/openmw/mwmp/WorldEvent.cpp
	apps/openmw/mwmp/WorldEvent.hpp
	apps/openmw/mwmp/processors/world/ProcessorContainer.hpp
pull/416/head
David Cernat 7 years ago
commit 5bb09d3bed

@ -613,8 +613,7 @@ fi
SUFFIX=""
fi
add_runtime_dlls "$(pwd)/bin/lib"{EGL,GLESv2}${SUFFIX}.dll \
"$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll
add_runtime_dlls "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll
add_qt_platform_dlls "$(pwd)/plugins/platforms/qwindows${SUFFIX}.dll"
echo Done.

@ -151,6 +151,8 @@ if (BUILD_MASTER)
endif()
# Dependencies
find_package(OpenGL REQUIRED)
if (USE_QT)
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
@ -200,12 +202,6 @@ if (NOT WIN32 AND BUILD_WIZARD) # windows users can just run the morrowind insta
set(OPENMW_USE_UNSHIELD TRUE)
endif()
option(OPENGL_ES "enable opengl es support" FALSE )
if (OPENGL_ES)
add_definitions(-DOPENGL_ES)
endif(OPENGL_ES)
# Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE)
find_package (Threads)

@ -35,28 +35,11 @@ int Java_org_libsdl_app_SDLActivity_isMouseShown(JNIEnv *env, jclass cls, jobjec
return SDL_ShowCursor(SDL_QUERY);
}
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls,
jobject obj) {
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj) {
setenv("OPENMW_DECOMPRESS_TEXTURES", "1", 1);
SDL_Android_Init(env, cls);
SDL_SetMainReady();
// On Android, we use a virtual controller with guid="Virtual"
SDL_GameControllerAddMapping("5669727475616c000000000000000000,Virtual,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4");
/* Run the application code! */
int status;
status = main(argcData+1, argvData);
releaseArgv();
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
/* exit(status); */
return status;
return 0;
}

@ -36,6 +36,16 @@ namespace MWClass
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
///< Return container store
/*
Start of tes3mp addition
Make it possible to check whether a class has a container store
*/
virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; }
/*
End of tes3mp addition
*/
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr

@ -73,6 +73,16 @@ namespace MWClass
virtual bool hasInventoryStore (const MWWorld::Ptr &ptr) const;
/*
Start of tes3mp addition
Make it possible to check whether a class has a container store
*/
virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; }
/*
End of tes3mp addition
*/
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr

@ -71,6 +71,16 @@ namespace MWClass
virtual bool hasInventoryStore(const MWWorld::Ptr &ptr) const { return true; }
/*
Start of tes3mp addition
Make it possible to check whether a class has a container store
*/
virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; }
/*
End of tes3mp addition
*/
virtual void hit(const MWWorld::Ptr& ptr, float attackStrength, int type) const;
virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const;

@ -11,6 +11,7 @@
#include <components/openmw-mp/Log.hpp>
#include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/WorldEvent.hpp"
#include "../mwmp/CellController.hpp"
/*
@ -218,7 +219,7 @@ namespace MWGui
Mark this container as open for multiplayer logic purposes
*/
mwmp::Main::get().getCellController()->openContainer(container);
mwmp::Main::get().getLocalPlayer()->storeCurrentContainer(container);
/*
End of tes3mp addition
*/
@ -270,7 +271,8 @@ namespace MWGui
Mark this container as closed for multiplayer logic purposes
*/
mwmp::Main::get().getCellController()->closeContainer(mPtr);
mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
mwmp::Main::get().getLocalPlayer()->updateInventory();
/*
End of tes3mp addition
*/

@ -345,48 +345,6 @@ bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCel
return false;
}
void CellController::openContainer(const MWWorld::Ptr &container)
{
// Record this as the player's current open container
Main::get().getLocalPlayer()->storeCurrentContainer(container);
const auto &cellRef = container.getCellRef();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened",
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex);
for (const auto &ptr : container.getClass().getContainerStore(container))
{
int count = ptr.getRefData().getCount();
const std::string &name = ptr.getCellRef().getRefId();
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", name.c_str(), count);
/*if (::Misc::StringUtils::ciEqual(name, "gold_001"))
cont.remove("gold_001", count, container);*/
}
}
void CellController::closeContainer(const MWWorld::Ptr &container)
{
Main::get().getLocalPlayer()->clearCurrentContainer();
// If the player died while in a container, the container's Ptr could be invalid now
if (!container.isEmpty())
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.", container.getCellRef().getRefId().c_str(),
container.getCellRef().getRefNum().mIndex);
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
for (const auto &ptr : cont)
{
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", ptr.getCellRef().getRefId().c_str(),
ptr.getRefData().getCount());
}
}
Main::get().getLocalPlayer()->updateInventory();
}
int CellController::getCellSize() const
{
return 8192;

@ -60,9 +60,6 @@ namespace mwmp
bool isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell);
void openContainer(const MWWorld::Ptr& container);
void closeContainer(const MWWorld::Ptr& container);
int getCellSize() const;
private:

@ -57,6 +57,43 @@ void WorldEvent::reset()
containerSubAction = BaseEvent::ContainerSubAction::None;
}
WorldObject WorldEvent::getWorldObject(const MWWorld::Ptr& ptr)
{
mwmp::WorldObject worldObject;
worldObject.refId = ptr.getCellRef().getRefId();
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldObject.mpNum = ptr.getCellRef().getMpNum();
return worldObject;
}
void WorldEvent::addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount)
{
mwmp::ContainerItem containerItem;
containerItem.refId = itemPtr.getCellRef().getRefId();
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge();
containerItem.actionCount = actionCount;
LOG_APPEND(Log::LOG_INFO, "- Adding container item %s", containerItem.refId.c_str());
worldObject.containerItems.push_back(containerItem);
}
void WorldEvent::addEntireContainer(const MWWorld::Ptr& ptr)
{
MWWorld::ContainerStore& containerStore = ptr.getClass().getContainerStore(ptr);
mwmp::WorldObject worldObject = getWorldObject(ptr);
for (const auto itemPtr : containerStore)
{
addContainerItem(worldObject, itemPtr, itemPtr.getRefData().getCount());
}
worldObjects.push_back(move(worldObject));
}
void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
{
bool isLocalEvent = guid == Main::get().getLocalPlayer()->guid;
@ -75,6 +112,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
// ptrFound.getCellRef().getRefNum().mIndex, ptrFound.getCellRef().getMpNum());
bool isCurrentContainer = false;
bool hasActorEquipment = ptrFound.getClass().isActor() && ptrFound.getClass().hasInventoryStore(ptrFound);
// If we are in a container, and it happens to be this container, keep track of that
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container))
@ -125,6 +163,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
containerStore.add(newPtr, containerItem.count, ownerPtr, true);
}
else if (action == BaseEvent::Action::Remove && containerItem.actionCount > 0)
{
// We have to find the right item ourselves because ContainerStore has no method
@ -141,7 +180,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
takeAllSound = itemPtr.getClass().getUpSoundId(itemPtr);
// Is this an actor's container? If so, unequip this item if it was equipped
if (ptrFound.getClass().isActor())
if (hasActorEquipment)
{
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);
@ -160,7 +199,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
isResolved = containerWindow->dragItemByPtr(itemPtr, containerItem.actionCount);
}
}
if (!isResolved)
{
containerStore.remove(itemPtr, containerItem.actionCount, ownerPtr);
@ -180,8 +219,8 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
// Was this a SET or ADD action on an actor's container, and are we the authority
// over the actor? If so, autoequip the actor
if ((action == BaseEvent::Action::Add || action == BaseEvent::Action::Set) && ptrFound.getClass().isActor()
&& mwmp::Main::get().getCellController()->isLocalActor(ptrFound))
if ((action == BaseEvent::Action::Add || action == BaseEvent::Action::Set) && hasActorEquipment &&
mwmp::Main::get().getCellController()->isLocalActor(ptrFound))
{
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);
invStore.autoEquip(ptrFound);
@ -667,39 +706,45 @@ void WorldEvent::playVideo()
}
}
WorldObject WorldEvent::getWorldObject(const MWWorld::Ptr& ptr)
void WorldEvent::addAllContainers(MWWorld::CellStore* cellStore)
{
mwmp::WorldObject worldObject;
worldObject.refId = ptr.getCellRef().getRefId();
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldObject.mpNum = ptr.getCellRef().getMpNum();
return worldObject;
}
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
void WorldEvent::addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount)
{
mwmp::ContainerItem containerItem;
containerItem.refId = itemPtr.getCellRef().getRefId();
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge();
containerItem.actionCount = actionCount;
for (auto &container : containerList->mList)
{
mwmp::WorldObject worldObject;
worldObject.refId = container.mRef.getRefId();
worldObject.refNumIndex = container.mRef.getRefNum().mIndex;
worldObject.mpNum = container.mRef.getMpNum();
MWWorld::ContainerStore& containerStore = container.mClass->getContainerStore(MWWorld::Ptr(&container, 0));
worldObject.containerItems.push_back(move(containerItem));
for (const auto itemPtr : containerStore)
{
addContainerItem(worldObject, itemPtr, 0);
}
worldObjects.push_back(move(worldObject));
}
}
void WorldEvent::addEntireContainer(const MWWorld::Ptr& ptr)
void WorldEvent::addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector<WorldObject>& requestObjects)
{
MWWorld::ContainerStore& containerStore = ptr.getClass().getContainerStore(ptr);
for (const auto &worldObject : requestObjects)
{
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(),
worldObject.refNumIndex, worldObject.mpNum);
mwmp::WorldObject worldObject = getWorldObject(ptr);
MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum);
for (const auto itemPtr : containerStore)
{
addContainerItem(worldObject, itemPtr, itemPtr.getRefData().getCount());
if (ptrFound)
{
if (ptrFound.getClass().hasContainerStore(ptrFound))
addEntireContainer(ptrFound);
else
LOG_APPEND(Log::LOG_VERBOSE, "-- Object lacks container store", ptrFound.getCellRef().getRefId().c_str());
}
}
worldObjects.push_back(move(worldObject));
}
void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer)
@ -1072,30 +1117,9 @@ void WorldEvent::sendScriptGlobalShort()
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send();
}
void WorldEvent::sendCellContainers(MWWorld::CellStore* cellStore)
void WorldEvent::sendContainer()
{
reset();
cell = *cellStore->getCell();
action = BaseEvent::Action::Set;
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
for (auto &container : containerList->mList)
{
mwmp::WorldObject worldObject;
worldObject.refId = container.mRef.getRefId();
worldObject.refNumIndex = container.mRef.getRefNum().mIndex;
worldObject.mpNum = container.mRef.getMpNum();
MWWorld::ContainerStore& containerStore = container.mClass->getContainerStore(MWWorld::Ptr(&container, nullptr));
for (const auto &itemPtr : containerStore)
{
addContainerItem(worldObject, itemPtr, 0);
}
worldObjects.push_back(move(worldObject));
}
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_CONTAINER");
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(this);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();

@ -17,6 +17,10 @@ namespace mwmp
void reset();
WorldObject getWorldObject(const MWWorld::Ptr& ptr);
void addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount);
void addEntireContainer(const MWWorld::Ptr& ptr);
void editContainers(MWWorld::CellStore* cellStore);
void placeObjects(MWWorld::CellStore* cellStore);
@ -40,9 +44,8 @@ namespace mwmp
void playMusic();
void playVideo();
WorldObject getWorldObject(const MWWorld::Ptr& ptr);
void addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount);
void addEntireContainer(const MWWorld::Ptr& ptr);
void addAllContainers(MWWorld::CellStore* cellStore);
void addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector<WorldObject>& requestObjects);
void addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer = false);
void addObjectSpawn(const MWWorld::Ptr& ptr);
@ -77,8 +80,7 @@ namespace mwmp
void sendScriptLocalFloat();
void sendScriptMemberShort();
void sendScriptGlobalShort();
void sendCellContainers(MWWorld::CellStore* cellStore);
void sendContainer();
private:
Networking *getNetworking();

@ -21,10 +21,36 @@ namespace mwmp
// If we've received a request for information, comply with it
if (event.action == mwmp::BaseEvent::Action::Request)
event.sendCellContainers(ptrCellStore);
{
if (event.worldObjects.size() == 0)
{
LOG_APPEND(Log::LOG_VERBOSE, "- Request had no objects attached, so we are sending all containers in the cell %s",
event.cell.getDescription().c_str());
event.reset();
event.cell = *ptrCellStore->getCell();
event.action = BaseEvent::Action::Set;
event.addAllContainers(ptrCellStore);
event.sendContainer();
}
else
{
LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", event.worldObjects.size(), event.worldObjects.size() == 1 ? "object" : "objects");
std::vector<WorldObject> requestObjects = event.worldObjects;
event.reset();
event.cell = *ptrCellStore->getCell();
event.action = mwmp::BaseEvent::Action::Set;
event.addRequestedContainers(ptrCellStore, requestObjects);
if (event.worldObjects.size() > 0)
event.sendContainer();
}
}
// Otherwise, edit containers based on the information received
else
{
LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet");
event.editContainers(ptrCellStore);
}
}
};

@ -503,13 +503,11 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
// use a shader to render the simple water, ensuring that fog is applied per pixel as required.
// this could be removed if a more detailed water mesh, using some sort of paging solution, is implemented.
#if !defined(OPENGL_ES) && !defined(ANDROID)
Resource::SceneManager* sceneManager = mResourceSystem->getSceneManager();
bool oldValue = sceneManager->getForceShaders();
sceneManager->setForceShaders(true);
sceneManager->recreateShaders(node);
sceneManager->setForceShaders(oldValue);
#endif
}
void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, Refraction* refraction)

@ -128,6 +128,19 @@ namespace MWWorld
throw std::runtime_error ("class does not have an inventory store");
}
/*
Start of tes3mp addition
Make it possible to check whether a class has a container store
*/
bool Class::hasContainerStore(const Ptr &ptr) const
{
return false;
}
/*
End of tes3mp addition
*/
bool Class::hasInventoryStore(const Ptr &ptr) const
{
return false;

@ -154,6 +154,17 @@ namespace MWWorld
///< Return inventory store or throw an exception, if class does not have a
/// inventory store (default implementation: throw an exception)
/*
Start of tes3mp addition
Make it possible to check whether a class has a container store
*/
virtual bool hasContainerStore(const Ptr& ptr) const;
///< Does this object have a container store? (default implementation: false)
/*
End of tes3mp addition
*/
virtual bool hasInventoryStore (const Ptr& ptr) const;
///< Does this object have an inventory store, i.e. equipment slots? (default implementation: false)

@ -1,94 +0,0 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see https://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.
#-------------------------------------------------------------------
# - Try to find OpenGLES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGLES
# OPENGLES_INCLUDE_DIR - the GL include directory
# OPENGLES_LIBRARIES - Link these to use OpenGLES
IF (WIN32)
IF (CYGWIN)
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h )
FIND_LIBRARY(OPENGLES_gl_LIBRARY libgles_cm )
ELSE (CYGWIN)
IF(BORLAND)
SET (OPENGLES_gl_LIBRARY import32 CACHE STRING "OpenGL ES 1.x library for win32")
ELSE(BORLAND)
#MS compiler - todo - fix the following line:
SET (OPENGLES_gl_LIBRARY ${OGRE_SOURCE_DIR}/Dependencies/lib/release/libgles_cm.lib CACHE STRING "OpenGL ES 1.x library for win32")
ENDIF(BORLAND)
ENDIF (CYGWIN)
ELSE (WIN32)
IF (APPLE)
#create_search_paths(/Developer/Platforms)
#findpkg_framework(OpenGLES)
#set(OPENGLES_gl_LIBRARY "-framework OpenGLES")
ELSE(APPLE)
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h
/opt/vc/include
/opt/graphics/OpenGL/include
/usr/openwin/share/include
/usr/X11R6/include
/usr/include
)
FIND_LIBRARY(OPENGLES_gl_LIBRARY
NAMES GLES_CM GLESv1_CM
PATHS /opt/vc/lib
/opt/graphics/OpenGL/lib
/usr/openwin/lib
/usr/shlib /usr/X11R6/lib
/usr/lib
)
# On Unix OpenGL most certainly always requires X11.
# Feel free to tighten up these conditions if you don't
# think this is always true.
#IF (OPENGLES_gl_LIBRARY)
# IF(NOT X11_FOUND)
# INCLUDE(FindX11)
# ENDIF(NOT X11_FOUND)
# IF (X11_FOUND)
# SET (OPENGLES_LIBRARIES ${X11_LIBRARIES})
# ENDIF (X11_FOUND)
#ENDIF (OPENGLES_gl_LIBRARY)
ENDIF(APPLE)
ENDIF (WIN32)
SET( OPENGLES_FOUND "NO" )
IF(OPENGLES_gl_LIBRARY)
SET( OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_LIBRARIES})
SET( OPENGLES_FOUND "YES" )
ENDIF(OPENGLES_gl_LIBRARY)
MARK_AS_ADVANCED(
OPENGLES_INCLUDE_DIR
OPENGLES_gl_LIBRARY
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENGLES REQUIRED_VARS OPENGLES_LIBRARIES OPENGLES_INCLUDE_DIR)

@ -26,14 +26,6 @@ else (GIT_CHECKOUT)
configure_resource_file(${VERSION_IN_FILE} ${VERSION_FILE_PATH_BASE} ${VERSION_FILE_PATH_RELATIVE})
endif (GIT_CHECKOUT)
if(BUILD_OPENMW OR BUILD_OPENCS)
if (OPENGL_ES)
find_package(OpenGLES REQUIRED)
else()
find_package(OpenGL REQUIRED)
endif()
endif(BUILD_OPENMW OR BUILD_OPENCS)
# source files
add_component_dir (settings
@ -252,14 +244,6 @@ include_directories(${Bullet_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
if(BUILD_OPENMW OR BUILD_OPENCS)
if (OPENGL_ES)
set(GL_LIB ${OPENGLES_gl_LIBRARY})
else()
set(GL_LIB ${OPENGL_gl_LIBRARY})
endif()
endif(BUILD_OPENMW OR BUILD_OPENCS)
target_link_libraries(components
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
@ -276,8 +260,7 @@ target_link_libraries(components
${OSGANIMATION_LIBRARIES}
${Bullet_LIBRARIES}
${SDL2_LIBRARIES}
# For MyGUI platform
${GL_LIB}
${OPENGL_gl_LIBRARY}
${MyGUI_LIBRARIES}
)

@ -91,7 +91,7 @@ void GraphicsWindowSDL2::init()
SDL_Window *oldWin = SDL_GL_GetCurrentWindow();
SDL_GLContext oldCtx = SDL_GL_GetCurrentContext();
#if defined(OPENGL_ES) || defined(ANDROID)
#if defined(ANDROID)
int major = 1;
int minor = 1;
char *ver = getenv("OPENMW_GLES_VERSION");

@ -47,8 +47,8 @@ vec3 getSpecular(vec3 viewNormal, vec3 viewDirection, float shininess, vec3 matS
{
vec3 lightDir = normalize(gl_LightSource[0].position.xyz);
float NdotL = max(dot(viewNormal, lightDir), 0.0);
if (NdotL < 0)
return vec3(0,0,0);
if (NdotL < 0.0)
return vec3(0.,0.,0.);
vec3 halfVec = normalize(lightDir - viewDirection);
return pow(max(dot(viewNormal, halfVec), 0.0), 128) * gl_LightSource[0].specular.xyz * matSpec;
return pow(max(dot(viewNormal, halfVec), 0.0), 128.) * gl_LightSource[0].specular.xyz * matSpec;
}

Loading…
Cancel
Save