From 06dc94552ff262746246e7372d0f46a65e42c11c Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sat, 18 Mar 2017 15:42:24 +0100 Subject: [PATCH 1/2] Log a warning if size in SCHD (script header) does not match SCDT (bytecode) size instead of failing --- components/esm/loadscpt.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/components/esm/loadscpt.cpp b/components/esm/loadscpt.cpp index 1adebe45f..19246c4c4 100644 --- a/components/esm/loadscpt.cpp +++ b/components/esm/loadscpt.cpp @@ -83,10 +83,24 @@ namespace ESM loadSCVR(esm); break; case ESM::FourCC<'S','C','D','T'>::value: + { // compiled script - mScriptData.resize(mData.mScriptDataSize); - esm.getHExact(&mScriptData[0], mScriptData.size()); + esm.getSubHeader(); + uint32_t subSize = esm.getSubSize(); + + if (subSize != static_cast(mData.mScriptDataSize)) + { + std::stringstream ss; + ss << "ESM Warning: Script data size defined in SCHD subrecord does not match size of SCDT subrecord"; + ss << "\n File: " << esm.getName(); + ss << "\n Offset: 0x" << std::hex << esm.getFileOffset(); + std::cerr << ss.str() << std::endl; + } + + mScriptData.resize(subSize); + esm.getExact(&mScriptData[0], mScriptData.size()); break; + } case ESM::FourCC<'S','C','T','X'>::value: mScriptText = esm.getHString(); break; From c992cb6e820349939c648d34c9a901928566dce5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 19 Mar 2017 19:14:54 +0100 Subject: [PATCH 2/2] Fix texture not being applied on rendering the composite map (Fixes #3791) --- components/terrain/compositemaprenderer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/terrain/compositemaprenderer.cpp b/components/terrain/compositemaprenderer.cpp index 5300aac85..653ac53ec 100644 --- a/components/terrain/compositemaprenderer.cpp +++ b/components/terrain/compositemaprenderer.cpp @@ -88,6 +88,10 @@ void CompositeMapRenderer::compile(CompositeMap &compositeMap, osg::RenderInfo & return; } + // inform State that Texture attribute has changed due to compiling of FBO texture + // should OSG be doing this on its own? + state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), osg::StateAttribute::TEXTURE); + for (unsigned int i=compositeMap.mCompiled; i