1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00
Conflicts:
	apps/openmw/mwrender/sky.hpp
This commit is contained in:
scrawl 2014-06-26 04:29:03 +02:00
commit 7b1e1d03d8
18 changed files with 35 additions and 25 deletions

View file

@ -613,8 +613,10 @@ if (WIN32)
4127 # Conditional expression is constant 4127 # Conditional expression is constant
4242 # Storing value in a variable of a smaller type, possible loss of data 4242 # Storing value in a variable of a smaller type, possible loss of data
4244 # Storing value of one type in variable of another (size_t in int, for example) 4244 # Storing value of one type in variable of another (size_t in int, for example)
4267 # Conversion from 'size_t' to 'int', possible loss of data
4305 # Truncating value (double to float, for example) 4305 # Truncating value (double to float, for example)
4309 # Variable overflow, trying to store 128 in a signed char for example 4309 # Variable overflow, trying to store 128 in a signed char for example
4351 # New behavior: elements of array 'array' will be default initialized (desired behavior)
4355 # Using 'this' in member initialization list 4355 # Using 'this' in member initialization list
4505 # Unreferenced local function has been removed 4505 # Unreferenced local function has been removed
4701 # Potentially uninitialized local variable used 4701 # Potentially uninitialized local variable used
@ -633,7 +635,9 @@ if (WIN32)
set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101") set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101")
set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS}) set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS})
set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS})
set_target_properties(oics PROPERTIES COMPILE_FLAGS ${WARNINGS}) # oics uses tinyxml, which has an initialized but unused variable
set(OICS_WARNINGS "${WARNINGS} /wd4189")
set_target_properties(oics PROPERTIES COMPILE_FLAGS ${OICS_WARNINGS})
set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS})
if (BUILD_LAUNCHER) if (BUILD_LAUNCHER)
set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS}) set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS})

View file

@ -39,6 +39,7 @@ void CSMDoc::Loader::load()
Document *document = iter->first; Document *document = iter->first;
int size = static_cast<int> (document->getContentFiles().size()); int size = static_cast<int> (document->getContentFiles().size());
int editedIndex = size-1; // index of the file to be edited/created
if (document->isNew()) if (document->isNew())
--size; --size;
@ -77,7 +78,7 @@ void CSMDoc::Loader::load()
{ {
boost::filesystem::path path = document->getContentFiles()[iter->second.mFile]; boost::filesystem::path path = document->getContentFiles()[iter->second.mFile];
int steps = document->getData().startLoading (path, iter->second.mFile<size-1, false); int steps = document->getData().startLoading (path, iter->second.mFile!=editedIndex, false);
iter->second.mRecordsLeft = true; iter->second.mRecordsLeft = true;
emit nextStage (document, path.filename().string(), steps/batchingSize); emit nextStage (document, path.filename().string(), steps/batchingSize);

View file

@ -87,7 +87,7 @@ namespace CSVRender
std::stringstream windowHandle; std::stringstream windowHandle;
#ifdef WIN32 #ifdef WIN32
windowHandle << Ogre::StringConverter::toString((unsigned long)(this->winId())); windowHandle << Ogre::StringConverter::toString((uintptr_t)(this->winId()));
#else #else
windowHandle << this->winId(); windowHandle << this->winId();
#endif #endif

View file

@ -299,8 +299,10 @@ int main(int argc, char**argv)
std::streambuf* cout_rdbuf = std::cout.rdbuf (); std::streambuf* cout_rdbuf = std::cout.rdbuf ();
std::streambuf* cerr_rdbuf = std::cerr.rdbuf (); std::streambuf* cerr_rdbuf = std::cerr.rdbuf ();
#if !(defined(_WIN32) && defined(_DEBUG))
boost::iostreams::stream_buffer<Tee> coutsb; boost::iostreams::stream_buffer<Tee> coutsb;
boost::iostreams::stream_buffer<Tee> cerrsb; boost::iostreams::stream_buffer<Tee> cerrsb;
#endif
std::ostream oldcout(cout_rdbuf); std::ostream oldcout(cout_rdbuf);
std::ostream oldcerr(cerr_rdbuf); std::ostream oldcerr(cerr_rdbuf);

View file

@ -101,7 +101,7 @@ namespace MWGui
size_t viewRange = mScrollView->getCanvasSize().height; size_t viewRange = mScrollView->getCanvasSize().height;
if(viewPosition > viewRange) if(viewPosition > viewRange)
viewPosition = viewRange; viewPosition = viewRange;
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); mScrollView->setViewOffset(MyGUI::IntPoint(0, viewPosition * -1));
} }
void MWList::setPropertyOverride(const std::string &_key, const std::string &_value) void MWList::setPropertyOverride(const std::string &_key, const std::string &_value)

View file

@ -319,7 +319,7 @@ void LocalMap::createFogOfWar(const std::string& texturePrefix)
std::vector<uint32> buffer; std::vector<uint32> buffer;
// initialize to (0, 0, 0, 1) // initialize to (0, 0, 0, 1)
buffer.resize(sFogOfWarResolution*sFogOfWarResolution, (255 << 24)); buffer.resize(sFogOfWarResolution*sFogOfWarResolution, 0xFF000000);
// upload to the texture // upload to the texture
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4); memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);

View file

@ -35,7 +35,7 @@ namespace MWRender
vp->setShadowsEnabled(false); vp->setShadowsEnabled(false);
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky + RV_FirstPerson); vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky + RV_FirstPerson);
vp->setMaterialScheme("water_refraction"); vp->setMaterialScheme("water_refraction");
vp->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); vp->setBackgroundColour (Ogre::ColourValue(0.090195, 0.115685, 0.12745));
mRenderTarget->setAutoUpdated(true); mRenderTarget->setAutoUpdated(true);
mRenderTarget->addListener(this); mRenderTarget->addListener(this);
} }

View file

@ -531,9 +531,10 @@ void RenderingManager::applyFog (bool underwater)
} }
else else
{ {
mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(0.18039, 0.23137, 0.25490), 0, 0, 1000); Ogre::ColourValue clv(0.090195, 0.115685, 0.12745);
mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(clv), 0, 0, 1000);
mWater->setViewportBackground (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(clv));
mWater->setViewportBackground (Ogre::ColourValue(clv));
} }
} }
@ -640,12 +641,12 @@ void RenderingManager::sunDisable(bool real)
} }
} }
void RenderingManager::setSunDirection(const Ogre::Vector3& direction) void RenderingManager::setSunDirection(const Ogre::Vector3& direction, bool is_moon)
{ {
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera), // direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z)); if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z));
mSkyManager->setSunDirection(direction); mSkyManager->setSunDirection(direction, is_moon);
} }
void RenderingManager::setGlare(bool glare) void RenderingManager::setGlare(bool glare)

View file

@ -145,7 +145,7 @@ public:
void setAmbientColour(const Ogre::ColourValue& colour); void setAmbientColour(const Ogre::ColourValue& colour);
void setSunColour(const Ogre::ColourValue& colour); void setSunColour(const Ogre::ColourValue& colour);
void setSunDirection(const Ogre::Vector3& direction); void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0) void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0)
void sunDisable(bool real); void sunDisable(bool real);

View file

@ -666,14 +666,14 @@ void SkyManager::sunDisable()
mSunEnabled = false; mSunEnabled = false;
} }
void SkyManager::setSunDirection(const Vector3& direction) void SkyManager::setSunDirection(const Vector3& direction, bool is_moon)
{ {
if (!mCreated) return; if (!mCreated) return;
mSun->setPosition(direction); mSun->setPosition(direction);
mSunGlare->setPosition(direction); mSunGlare->setPosition(direction);
float height = direction.z; float height = direction.z;
float fade = ( height > 0.5) ? 1.0 : height * 2; float fade = is_moon ? 0.0 : (( height > 0.5) ? 1.0 : height * 2);
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(fade, height))); sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(fade, height)));
} }

View file

@ -150,7 +150,7 @@ namespace MWRender
void setRainSpeed(float speed); void setRainSpeed(float speed);
void setSunDirection(const Ogre::Vector3& direction); void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
void setMasserDirection(const Ogre::Vector3& direction); void setMasserDirection(const Ogre::Vector3& direction);

View file

@ -747,7 +747,7 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts)
* buffer. We use this to store the global_pts in * buffer. We use this to store the global_pts in
* a frame at the time it is allocated. * a frame at the time it is allocated.
*/ */
static uint64_t global_video_pkt_pts = AV_NOPTS_VALUE; static uint64_t global_video_pkt_pts = static_cast<uint64_t>(AV_NOPTS_VALUE);
static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic) static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic)
{ {
int ret = avcodec_default_get_buffer(c, pic); int ret = avcodec_default_get_buffer(c, pic);

View file

@ -386,7 +386,7 @@ namespace MWSound
sound = mOutput->playSound3D(file, initialPos, volume, basevol, pitch, min, max, mode|type, offset); sound = mOutput->playSound3D(file, initialPos, volume, basevol, pitch, min, max, mode|type, offset);
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId); mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
} }
catch(std::exception &e) catch(std::exception &)
{ {
//std::cout <<"Sound Error: "<<e.what()<< std::endl; //std::cout <<"Sound Error: "<<e.what()<< std::endl;
} }

View file

@ -413,11 +413,13 @@ void WeatherManager::update(float duration)
int facing = (mHour > 13.f) ? 1 : -1; int facing = (mHour > 13.f) ? 1 : -1;
bool sun_is_moon = mHour >= mNightStart || mHour <= mSunriseTime;
Vector3 final( Vector3 final(
(height - 1) * facing, (height - 1) * facing,
(height - 1) * facing, (height - 1) * facing,
height); height);
mRendering->setSunDirection(final); mRendering->setSunDirection(final, sun_is_moon);
/* /*
* TODO: import separated fadeInStart/Finish, fadeOutStart/Finish * TODO: import separated fadeInStart/Finish, fadeOutStart/Finish

View file

@ -118,7 +118,7 @@ namespace Terrain
// North // North
row = verts-1; row = verts-1;
outerStep = 1 << (lodDeltas[North] + lodLevel); outerStep = size_t(1) << (lodDeltas[North] + lodLevel);
for (size_t col = 0; col < verts-1; col += outerStep) for (size_t col = 0; col < verts-1; col += outerStep)
{ {
indices.push_back(verts*(col+outerStep)+row); indices.push_back(verts*(col+outerStep)+row);
@ -142,7 +142,7 @@ namespace Terrain
// West // West
size_t col = 0; size_t col = 0;
outerStep = 1 << (lodDeltas[West] + lodLevel); outerStep = size_t(1) << (lodDeltas[West] + lodLevel);
for (size_t row = 0; row < verts-1; row += outerStep) for (size_t row = 0; row < verts-1; row += outerStep)
{ {
indices.push_back(verts*col+row+outerStep); indices.push_back(verts*col+row+outerStep);
@ -166,7 +166,7 @@ namespace Terrain
// East // East
col = verts-1; col = verts-1;
outerStep = 1 << (lodDeltas[East] + lodLevel); outerStep = size_t(1) << (lodDeltas[East] + lodLevel);
for (size_t row = 0; row < verts-1; row += outerStep) for (size_t row = 0; row < verts-1; row += outerStep)
{ {
indices.push_back(verts*col+row); indices.push_back(verts*col+row);

View file

@ -32,7 +32,7 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
#ifdef WIN32 #ifdef WIN32
case SDL_SYSWM_WINDOWS: case SDL_SYSWM_WINDOWS:
// Windows code // Windows code
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window); winHandle = Ogre::StringConverter::toString((uintptr_t)wmInfo.info.win.window);
break; break;
#elif __MACOSX__ #elif __MACOSX__
case SDL_SYSWM_COCOA: case SDL_SYSWM_COCOA:

View file

@ -1,4 +1,4 @@
#define UNDERWATER_COLOUR float3(0.18039, 0.23137, 0.25490) #define UNDERWATER_COLOUR float3(0.090195, 0.115685, 0.12745)
#define VISIBILITY 1000.0 // how far you can look through water #define VISIBILITY 1000.0 // how far you can look through water

View file

@ -340,7 +340,7 @@
#if REFRACTION #if REFRACTION
float3 refraction = shSample(refractionMap, (screenCoords-(normal.xy*REFR_BUMP))*1.0).rgb; float3 refraction = shSample(refractionMap, (screenCoords-(normal.xy*REFR_BUMP))*1.0).rgb;
// brighten up the refraction underwater // brighten up the refraction underwater
refraction = (cameraPos.z < 0) ? shSaturate(refraction * 1.5) : refraction; refraction = (cameraPos.z < 0) ? shSaturate(refraction * 1.5) : refraction;
#endif #endif
@ -351,7 +351,7 @@
#if REFRACTION #if REFRACTION
shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz; shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz;
#else #else
shOutputColour(0).xyz = shLerp(reflection, float3(0.18039, 0.23137, 0.25490), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz; shOutputColour(0).xyz = shLerp(reflection, float3(0.090195, 0.115685, 0.12745), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz;
#endif #endif
// fog // fog
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w); float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);