mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-03 17:54:06 +00:00
cleanup default shaders and remove confusing main shader
This commit is contained in:
parent
bc1a6bfd72
commit
ac4b29be08
@ -17,28 +17,6 @@
|
|||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
void saveChain()
|
|
||||||
{
|
|
||||||
auto* processor = MWBase::Environment::get().getWorld()->getPostProcessor();
|
|
||||||
|
|
||||||
std::vector<std::string> chain;
|
|
||||||
|
|
||||||
for (size_t i = 1; i < processor->getTechniques().size(); ++i)
|
|
||||||
{
|
|
||||||
auto technique = processor->getTechniques()[i];
|
|
||||||
|
|
||||||
if (!technique || technique->getDynamic())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
chain.push_back(technique->getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings::Manager::setStringArray("chain", "Post Processing", chain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
void PostProcessorHud::ListWrapper::onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char ch)
|
void PostProcessorHud::ListWrapper::onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char ch)
|
||||||
@ -145,7 +123,7 @@ namespace MWGui
|
|||||||
processor->enableTechnique(technique);
|
processor->enableTechnique(technique);
|
||||||
else
|
else
|
||||||
processor->disableTechnique(technique);
|
processor->disableTechnique(technique);
|
||||||
saveChain();
|
processor->saveChain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +156,7 @@ namespace MWGui
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (processor->enableTechnique(technique, index) != MWRender::PostProcessor::Status_Error)
|
if (processor->enableTechnique(technique, index) != MWRender::PostProcessor::Status_Error)
|
||||||
saveChain();
|
processor->saveChain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +355,7 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
Gui::AutoSizedTextBox* divider = mConfigArea->createWidget<Gui::AutoSizedTextBox>("MW_UniformGroup", {0,0,0,34}, MyGUI::Align::Default);
|
Gui::AutoSizedTextBox* divider = mConfigArea->createWidget<Gui::AutoSizedTextBox>("MW_UniformGroup", {0,0,0,34}, MyGUI::Align::Default);
|
||||||
divider->setNeedMouseFocus(false);
|
divider->setNeedMouseFocus(false);
|
||||||
divider->setCaption(uniform->mHeader);
|
divider->setCaptionWithReplacing(uniform->mHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
fx::Widgets::UniformBase* uwidget = mConfigArea->createWidget<fx::Widgets::UniformBase>("MW_UniformEdit", {0,0,0,22}, MyGUI::Align::Default);
|
fx::Widgets::UniformBase* uwidget = mConfigArea->createWidget<fx::Widgets::UniformBase>("MW_UniformEdit", {0,0,0,22}, MyGUI::Align::Default);
|
||||||
|
@ -100,21 +100,10 @@ namespace MWRender
|
|||||||
|
|
||||||
if (filtered.empty() || !bufferData.postprocessing)
|
if (filtered.empty() || !bufferData.postprocessing)
|
||||||
{
|
{
|
||||||
if (bufferData.postprocessing)
|
|
||||||
{
|
|
||||||
if (!mLoggedLastError)
|
|
||||||
{
|
|
||||||
Log(Debug::Error) << "Critical error, postprocess shaders failed to compile. Using default shader.";
|
|
||||||
mLoggedLastError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mLoggedLastError = false;
|
|
||||||
|
|
||||||
state.pushStateSet(mFallbackStateSet);
|
state.pushStateSet(mFallbackStateSet);
|
||||||
state.apply();
|
state.apply();
|
||||||
|
|
||||||
if (Stereo::getMultiview() && mMultiviewResolveProgram)
|
if (Stereo::getMultiview())
|
||||||
{
|
{
|
||||||
state.pushStateSet(mMultiviewResolveStateSet);
|
state.pushStateSet(mMultiviewResolveStateSet);
|
||||||
state.apply();
|
state.apply();
|
||||||
@ -126,7 +115,7 @@ namespace MWRender
|
|||||||
drawGeometry(renderInfo);
|
drawGeometry(renderInfo);
|
||||||
state.popStateSet();
|
state.popStateSet();
|
||||||
|
|
||||||
if (Stereo::getMultiview() && mMultiviewResolveProgram)
|
if (Stereo::getMultiview())
|
||||||
{
|
{
|
||||||
state.popStateSet();
|
state.popStateSet();
|
||||||
}
|
}
|
||||||
@ -298,7 +287,7 @@ namespace MWRender
|
|||||||
state.popStateSet();
|
state.popStateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Stereo::getMultiview() && mMultiviewResolveProgram)
|
if (Stereo::getMultiview())
|
||||||
{
|
{
|
||||||
ext->glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0);
|
ext->glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0);
|
||||||
lastApplied = 0;
|
lastApplied = 0;
|
||||||
|
@ -83,8 +83,6 @@ namespace MWRender
|
|||||||
mutable std::array<BufferData, 2> mBufferData;
|
mutable std::array<BufferData, 2> mBufferData;
|
||||||
mutable std::array<osg::ref_ptr<osg::FrameBufferObject>, 3> mFbos;
|
mutable std::array<osg::ref_ptr<osg::FrameBufferObject>, 3> mFbos;
|
||||||
mutable osg::ref_ptr<osg::Viewport> mRenderViewport;
|
mutable osg::ref_ptr<osg::Viewport> mRenderViewport;
|
||||||
|
|
||||||
mutable bool mLoggedLastError = false;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,6 @@ namespace MWRender
|
|||||||
, mNormalsSupported(false)
|
, mNormalsSupported(false)
|
||||||
, mPassLights(false)
|
, mPassLights(false)
|
||||||
, mPrevPassLights(false)
|
, mPrevPassLights(false)
|
||||||
, mMainTemplate(new osg::Texture2D)
|
|
||||||
{
|
{
|
||||||
mSoftParticles = Settings::Manager::getBool("soft particles", "Shaders");
|
mSoftParticles = Settings::Manager::getBool("soft particles", "Shaders");
|
||||||
mUsePostProcessing = Settings::Manager::getBool("enabled", "Post Processing");
|
mUsePostProcessing = Settings::Manager::getBool("enabled", "Post Processing");
|
||||||
@ -247,14 +246,6 @@ namespace MWRender
|
|||||||
populateTechniqueFiles();
|
populateTechniqueFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
mMainTemplate->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
|
|
||||||
mMainTemplate->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
|
||||||
mMainTemplate->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
|
||||||
mMainTemplate->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
|
||||||
mMainTemplate->setInternalFormat(GL_RGBA);
|
|
||||||
mMainTemplate->setSourceType(GL_UNSIGNED_BYTE);
|
|
||||||
mMainTemplate->setSourceFormat(GL_RGBA);
|
|
||||||
|
|
||||||
createTexturesAndCamera(frame() % 2);
|
createTexturesAndCamera(frame() % 2);
|
||||||
|
|
||||||
removeChild(mHUDCamera);
|
removeChild(mHUDCamera);
|
||||||
@ -399,13 +390,8 @@ namespace MWRender
|
|||||||
|
|
||||||
mReload = false;
|
mReload = false;
|
||||||
|
|
||||||
if (!mTechniques.empty())
|
loadChain();
|
||||||
reloadMainPass(*mTechniques[0]);
|
resize();
|
||||||
|
|
||||||
reloadTechniques();
|
|
||||||
|
|
||||||
if (!mUsePostProcessing)
|
|
||||||
resize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::update(size_t frameId)
|
void PostProcessor::update(size_t frameId)
|
||||||
@ -483,9 +469,6 @@ namespace MWRender
|
|||||||
auto fpDepthRb = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples);
|
auto fpDepthRb = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples);
|
||||||
fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::PACKED_DEPTH_STENCIL_BUFFER, osg::FrameBufferAttachment(fpDepthRb));
|
fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::PACKED_DEPTH_STENCIL_BUFFER, osg::FrameBufferAttachment(fpDepthRb));
|
||||||
|
|
||||||
// When MSAA is enabled we must first render to a render buffer, then
|
|
||||||
// blit the result to the FBO which is either passed to the main frame
|
|
||||||
// buffer for display or used as the entry point for a post process chain.
|
|
||||||
if (mSamples > 1)
|
if (mSamples > 1)
|
||||||
{
|
{
|
||||||
fbos[FBO_Multisample] = new osg::FrameBufferObject;
|
fbos[FBO_Multisample] = new osg::FrameBufferObject;
|
||||||
@ -494,7 +477,6 @@ namespace MWRender
|
|||||||
{
|
{
|
||||||
auto normalRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Normal], mSamples);
|
auto normalRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Normal], mSamples);
|
||||||
fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB);
|
fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB);
|
||||||
fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB);
|
|
||||||
}
|
}
|
||||||
auto depthRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples);
|
auto depthRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples);
|
||||||
fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, colorRB);
|
fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, colorRB);
|
||||||
@ -667,7 +649,7 @@ namespace MWRender
|
|||||||
return Status_Error;
|
return Status_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!technique || technique->getLocked() || (location.has_value() && location.value() <= 0))
|
if (!technique || technique->getLocked() || (location.has_value() && location.value() < 0))
|
||||||
return Status_Error;
|
return Status_Error;
|
||||||
|
|
||||||
disableTechnique(technique, false);
|
disableTechnique(technique, false);
|
||||||
@ -734,17 +716,6 @@ namespace MWRender
|
|||||||
textures[Tex_Normal]->setSourceFormat(GL_RGB);
|
textures[Tex_Normal]->setSourceFormat(GL_RGB);
|
||||||
textures[Tex_Normal]->setInternalFormat(GL_RGB);
|
textures[Tex_Normal]->setInternalFormat(GL_RGB);
|
||||||
|
|
||||||
if (mMainTemplate)
|
|
||||||
{
|
|
||||||
textures[Tex_Scene]->setSourceFormat(mMainTemplate->getSourceFormat());
|
|
||||||
textures[Tex_Scene]->setSourceType(mMainTemplate->getSourceType());
|
|
||||||
textures[Tex_Scene]->setInternalFormat(mMainTemplate->getInternalFormat());
|
|
||||||
textures[Tex_Scene]->setFilter(osg::Texture2D::MIN_FILTER, mMainTemplate->getFilter(osg::Texture2D::MIN_FILTER));
|
|
||||||
textures[Tex_Scene]->setFilter(osg::Texture2D::MAG_FILTER, mMainTemplate->getFilter(osg::Texture2D::MAG_FILTER));
|
|
||||||
textures[Tex_Scene]->setWrap(osg::Texture::WRAP_S, mMainTemplate->getWrap(osg::Texture2D::WRAP_S));
|
|
||||||
textures[Tex_Scene]->setWrap(osg::Texture::WRAP_T, mMainTemplate->getWrap(osg::Texture2D::WRAP_T));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto setupDepth = [] (osg::Texture* tex) {
|
auto setupDepth = [] (osg::Texture* tex) {
|
||||||
tex->setSourceFormat(GL_DEPTH_STENCIL_EXT);
|
tex->setSourceFormat(GL_DEPTH_STENCIL_EXT);
|
||||||
tex->setSourceType(SceneUtil::AutoDepth::depthSourceType());
|
tex->setSourceType(SceneUtil::AutoDepth::depthSourceType());
|
||||||
@ -816,14 +787,12 @@ namespace MWRender
|
|||||||
return technique;
|
return technique;
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadMainPass(*technique);
|
|
||||||
|
|
||||||
mTemplates.push_back(std::move(technique));
|
mTemplates.push_back(std::move(technique));
|
||||||
|
|
||||||
return mTemplates.back();
|
return mTemplates.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::reloadTechniques()
|
void PostProcessor::loadChain()
|
||||||
{
|
{
|
||||||
if (!isEnabled())
|
if (!isEnabled())
|
||||||
return;
|
return;
|
||||||
@ -832,18 +801,9 @@ namespace MWRender
|
|||||||
|
|
||||||
std::vector<std::string> techniqueStrings = Settings::Manager::getStringArray("chain", "Post Processing");
|
std::vector<std::string> techniqueStrings = Settings::Manager::getStringArray("chain", "Post Processing");
|
||||||
|
|
||||||
const std::string mainIdentifier = "main";
|
|
||||||
|
|
||||||
auto main = loadTechnique(mainIdentifier);
|
|
||||||
|
|
||||||
if (main)
|
|
||||||
main->setLocked(true);
|
|
||||||
|
|
||||||
mTechniques.push_back(std::move(main));
|
|
||||||
|
|
||||||
for (auto& techniqueName : techniqueStrings)
|
for (auto& techniqueName : techniqueStrings)
|
||||||
{
|
{
|
||||||
if (techniqueName.empty() || Misc::StringUtils::ciEqual(techniqueName, mainIdentifier))
|
if (techniqueName.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mTechniques.push_back(loadTechnique(techniqueName));
|
mTechniques.push_back(loadTechnique(techniqueName));
|
||||||
@ -852,14 +812,17 @@ namespace MWRender
|
|||||||
dirtyTechniques();
|
dirtyTechniques();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::reloadMainPass(fx::Technique& technique)
|
void PostProcessor::saveChain()
|
||||||
{
|
{
|
||||||
if (!technique.getMainTemplate())
|
std::vector<std::string> chain;
|
||||||
return;
|
|
||||||
|
|
||||||
mMainTemplate = technique.getMainTemplate();
|
for (const auto& technique : mTechniques) {
|
||||||
|
if (!technique || technique->getDynamic())
|
||||||
|
continue;
|
||||||
|
chain.push_back(technique->getName());
|
||||||
|
}
|
||||||
|
|
||||||
resize();
|
Settings::Manager::setStringArray("chain", "Post Processing", chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::toggleMode()
|
void PostProcessor::toggleMode()
|
||||||
|
@ -86,6 +86,13 @@ namespace MWRender
|
|||||||
Unit_NextFree
|
Unit_NextFree
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Status
|
||||||
|
{
|
||||||
|
Status_Error,
|
||||||
|
Status_Toggled,
|
||||||
|
Status_Unchanged
|
||||||
|
};
|
||||||
|
|
||||||
PostProcessor(RenderingManager& rendering, osgViewer::Viewer* viewer, osg::Group* rootNode, const VFS::Manager* vfs);
|
PostProcessor(RenderingManager& rendering, osgViewer::Viewer* viewer, osg::Group* rootNode, const VFS::Manager* vfs);
|
||||||
|
|
||||||
~PostProcessor();
|
~PostProcessor();
|
||||||
@ -110,13 +117,6 @@ namespace MWRender
|
|||||||
|
|
||||||
void resize();
|
void resize();
|
||||||
|
|
||||||
enum Status
|
|
||||||
{
|
|
||||||
Status_Error,
|
|
||||||
Status_Toggled,
|
|
||||||
Status_Unchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
Status enableTechnique(std::shared_ptr<fx::Technique> technique, std::optional<int> location = std::nullopt);
|
Status enableTechnique(std::shared_ptr<fx::Technique> technique, std::optional<int> location = std::nullopt);
|
||||||
|
|
||||||
Status disableTechnique(std::shared_ptr<fx::Technique> technique, bool dirty = true);
|
Status disableTechnique(std::shared_ptr<fx::Technique> technique, bool dirty = true);
|
||||||
@ -180,6 +180,9 @@ namespace MWRender
|
|||||||
int renderWidth() const;
|
int renderWidth() const;
|
||||||
int renderHeight() const;
|
int renderHeight() const;
|
||||||
|
|
||||||
|
void loadChain();
|
||||||
|
void saveChain();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void populateTechniqueFiles();
|
void populateTechniqueFiles();
|
||||||
@ -190,8 +193,6 @@ namespace MWRender
|
|||||||
|
|
||||||
void createTexturesAndCamera(size_t frameId);
|
void createTexturesAndCamera(size_t frameId);
|
||||||
|
|
||||||
void reloadTechniques();
|
|
||||||
|
|
||||||
void reloadMainPass(fx::Technique& technique);
|
void reloadMainPass(fx::Technique& technique);
|
||||||
|
|
||||||
void dirtyTechniques();
|
void dirtyTechniques();
|
||||||
@ -245,8 +246,6 @@ namespace MWRender
|
|||||||
bool mUBO;
|
bool mUBO;
|
||||||
int mGLSLVersion;
|
int mGLSLVersion;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture> mMainTemplate;
|
|
||||||
|
|
||||||
osg::ref_ptr<fx::StateUpdater> mStateUpdater;
|
osg::ref_ptr<fx::StateUpdater> mStateUpdater;
|
||||||
osg::ref_ptr<PingPongCull> mPingPongCull;
|
osg::ref_ptr<PingPongCull> mPingPongCull;
|
||||||
osg::ref_ptr<PingPongCanvas> mPingPongCanvas;
|
osg::ref_ptr<PingPongCanvas> mPingPongCanvas;
|
||||||
|
@ -23,7 +23,6 @@ namespace
|
|||||||
|
|
||||||
TEST_F(LexerSingleTokenTest, single_token_shared) { test<Shared>(); }
|
TEST_F(LexerSingleTokenTest, single_token_shared) { test<Shared>(); }
|
||||||
TEST_F(LexerSingleTokenTest, single_token_technique) { test<Technique>(); }
|
TEST_F(LexerSingleTokenTest, single_token_technique) { test<Technique>(); }
|
||||||
TEST_F(LexerSingleTokenTest, single_token_main_pass) { test<Main_Pass>(); }
|
|
||||||
TEST_F(LexerSingleTokenTest, single_token_render_target) { test<Render_Target>(); }
|
TEST_F(LexerSingleTokenTest, single_token_render_target) { test<Render_Target>(); }
|
||||||
TEST_F(LexerSingleTokenTest, single_token_vertex) { test<Vertex>(); }
|
TEST_F(LexerSingleTokenTest, single_token_vertex) { test<Vertex>(); }
|
||||||
TEST_F(LexerSingleTokenTest, single_token_fragment) { test<Fragment>(); }
|
TEST_F(LexerSingleTokenTest, single_token_fragment) { test<Fragment>(); }
|
||||||
|
@ -230,7 +230,6 @@ namespace fx
|
|||||||
|
|
||||||
if (value == "shared") return Shared{};
|
if (value == "shared") return Shared{};
|
||||||
if (value == "technique") return Technique{};
|
if (value == "technique") return Technique{};
|
||||||
if (value == "main_pass") return Main_Pass{};
|
|
||||||
if (value == "render_target") return Render_Target{};
|
if (value == "render_target") return Render_Target{};
|
||||||
if (value == "vertex") return Vertex{};
|
if (value == "vertex") return Vertex{};
|
||||||
if (value == "fragment") return Fragment{};
|
if (value == "fragment") return Fragment{};
|
||||||
|
@ -18,7 +18,6 @@ namespace fx
|
|||||||
struct Fragment { inline static constexpr std::string_view repr = "fragment"; };
|
struct Fragment { inline static constexpr std::string_view repr = "fragment"; };
|
||||||
struct Compute { inline static constexpr std::string_view repr = "compute"; };
|
struct Compute { inline static constexpr std::string_view repr = "compute"; };
|
||||||
struct Technique { inline static constexpr std::string_view repr = "technique"; };
|
struct Technique { inline static constexpr std::string_view repr = "technique"; };
|
||||||
struct Main_Pass { inline static constexpr std::string_view repr = "main_pass"; };
|
|
||||||
struct Render_Target { inline static constexpr std::string_view repr = "render_target"; };
|
struct Render_Target { inline static constexpr std::string_view repr = "render_target"; };
|
||||||
struct Sampler_1D { inline static constexpr std::string_view repr = "sampler_1d"; };
|
struct Sampler_1D { inline static constexpr std::string_view repr = "sampler_1d"; };
|
||||||
struct Sampler_2D { inline static constexpr std::string_view repr = "sampler_2d"; };
|
struct Sampler_2D { inline static constexpr std::string_view repr = "sampler_2d"; };
|
||||||
@ -49,7 +48,7 @@ namespace fx
|
|||||||
using Token = std::variant<Float, Integer, Boolean, String, Literal, Equal, Open_bracket, Close_bracket, Open_Parenthesis,
|
using Token = std::variant<Float, Integer, Boolean, String, Literal, Equal, Open_bracket, Close_bracket, Open_Parenthesis,
|
||||||
Close_Parenthesis, Quote, SemiColon, Comma, VBar, Colon, Shared, Technique, Render_Target, Vertex, Fragment,
|
Close_Parenthesis, Quote, SemiColon, Comma, VBar, Colon, Shared, Technique, Render_Target, Vertex, Fragment,
|
||||||
Compute, Sampler_1D, Sampler_2D, Sampler_3D, Uniform_Bool, Uniform_Float, Uniform_Int, Uniform_Vec2, Uniform_Vec3, Uniform_Vec4,
|
Compute, Sampler_1D, Sampler_2D, Sampler_3D, Uniform_Bool, Uniform_Float, Uniform_Int, Uniform_Vec2, Uniform_Vec3, Uniform_Vec4,
|
||||||
True, False, Vec2, Vec3, Vec4, Main_Pass, Eof>;
|
True, False, Vec2, Vec3, Vec4, Eof>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ namespace fx
|
|||||||
mPassKeys.clear();
|
mPassKeys.clear();
|
||||||
mDefinedUniforms.clear();
|
mDefinedUniforms.clear();
|
||||||
mRenderTargets.clear();
|
mRenderTargets.clear();
|
||||||
mMainTemplate = nullptr;
|
|
||||||
mLastAppliedType = Pass::Type::None;
|
mLastAppliedType = Pass::Type::None;
|
||||||
mFlags = 0;
|
mFlags = 0;
|
||||||
mShared.clear();
|
mShared.clear();
|
||||||
@ -262,47 +261,6 @@ namespace fx
|
|||||||
error("pass list in 'technique' block cannot be empty.");
|
error("pass list in 'technique' block cannot be empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
void Technique::parseBlockImp<Lexer::Main_Pass>()
|
|
||||||
{
|
|
||||||
if (mMainTemplate)
|
|
||||||
error("duplicate 'main_pass' block");
|
|
||||||
|
|
||||||
if (mName != "main")
|
|
||||||
error("'main_pass' block can only be defined in the 'main.omwfx' technique file");
|
|
||||||
|
|
||||||
mMainTemplate = new osg::Texture2D;
|
|
||||||
|
|
||||||
mMainTemplate->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
|
|
||||||
mMainTemplate->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
|
||||||
|
|
||||||
while (!isNext<Lexer::Close_bracket>() && !isNext<Lexer::Eof>())
|
|
||||||
{
|
|
||||||
expect<Lexer::Literal>();
|
|
||||||
|
|
||||||
auto key = std::get<Lexer::Literal>(mToken).value;
|
|
||||||
|
|
||||||
expect<Lexer::Equal>();
|
|
||||||
|
|
||||||
if (key == "wrap_s")
|
|
||||||
mMainTemplate->setWrap(osg::Texture::WRAP_S, parseWrapMode());
|
|
||||||
else if (key == "wrap_t")
|
|
||||||
mMainTemplate->setWrap(osg::Texture::WRAP_T, parseWrapMode());
|
|
||||||
// Skip depth attachments for main scene, as some engine settings rely on specific depth formats.
|
|
||||||
// Allowing this to be overriden will cause confusion.
|
|
||||||
else if (key == "internal_format")
|
|
||||||
mMainTemplate->setInternalFormat(parseInternalFormat());
|
|
||||||
else if (key == "source_type")
|
|
||||||
mMainTemplate->setSourceType(parseSourceType());
|
|
||||||
else if (key == "source_format")
|
|
||||||
mMainTemplate->setSourceFormat(parseSourceFormat());
|
|
||||||
else
|
|
||||||
error(Misc::StringUtils::format("unexpected key '%s'", std::string(key)));
|
|
||||||
|
|
||||||
expect<Lexer::SemiColon>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Technique::parseBlockImp<Lexer::Render_Target>()
|
void Technique::parseBlockImp<Lexer::Render_Target>()
|
||||||
{
|
{
|
||||||
@ -738,8 +696,6 @@ namespace fx
|
|||||||
parseBlock<Lexer::Shared>(false);
|
parseBlock<Lexer::Shared>(false);
|
||||||
else if constexpr (std::is_same_v<Lexer::Technique, T>)
|
else if constexpr (std::is_same_v<Lexer::Technique, T>)
|
||||||
parseBlock<Lexer::Technique>(false);
|
parseBlock<Lexer::Technique>(false);
|
||||||
else if constexpr (std::is_same_v<Lexer::Main_Pass, T>)
|
|
||||||
parseBlock<Lexer::Main_Pass>(false);
|
|
||||||
else if constexpr (std::is_same_v<Lexer::Render_Target, T>)
|
else if constexpr (std::is_same_v<Lexer::Render_Target, T>)
|
||||||
parseBlock<Lexer::Render_Target>();
|
parseBlock<Lexer::Render_Target>();
|
||||||
else if constexpr (std::is_same_v<Lexer::Vertex, T>)
|
else if constexpr (std::is_same_v<Lexer::Vertex, T>)
|
||||||
|
@ -159,8 +159,6 @@ namespace fx
|
|||||||
|
|
||||||
const std::unordered_set<std::string>& getGLSLExtensions() const { return mGLSLExtensions; }
|
const std::unordered_set<std::string>& getGLSLExtensions() const { return mGLSLExtensions; }
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> getMainTemplate() const { return mMainTemplate; }
|
|
||||||
|
|
||||||
FlagsType getFlags() const { return mFlags; }
|
FlagsType getFlags() const { return mFlags; }
|
||||||
|
|
||||||
bool getHidden() const { return mFlags & Flag_Hidden; }
|
bool getHidden() const { return mFlags & Flag_Hidden; }
|
||||||
@ -273,7 +271,6 @@ namespace fx
|
|||||||
int mWidth;
|
int mWidth;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> mMainTemplate;
|
|
||||||
RenderTargetMap mRenderTargets;
|
RenderTargetMap mRenderTargets;
|
||||||
|
|
||||||
TexList mTextures;
|
TexList mTextures;
|
||||||
@ -301,7 +298,6 @@ namespace fx
|
|||||||
|
|
||||||
template<> void Technique::parseBlockImp<Lexer::Shared>();
|
template<> void Technique::parseBlockImp<Lexer::Shared>();
|
||||||
template<> void Technique::parseBlockImp<Lexer::Technique>();
|
template<> void Technique::parseBlockImp<Lexer::Technique>();
|
||||||
template<> void Technique::parseBlockImp<Lexer::Main_Pass>();
|
|
||||||
template<> void Technique::parseBlockImp<Lexer::Render_Target>();
|
template<> void Technique::parseBlockImp<Lexer::Render_Target>();
|
||||||
template<> void Technique::parseBlockImp<Lexer::Vertex>();
|
template<> void Technique::parseBlockImp<Lexer::Vertex>();
|
||||||
template<> void Technique::parseBlockImp<Lexer::Fragment>();
|
template<> void Technique::parseBlockImp<Lexer::Fragment>();
|
||||||
|
@ -87,8 +87,8 @@ set(BUILTIN_DATA_FILES
|
|||||||
scripts/omw/mwui/space.lua
|
scripts/omw/mwui/space.lua
|
||||||
scripts/omw/mwui/init.lua
|
scripts/omw/mwui/init.lua
|
||||||
|
|
||||||
shaders/main.omwfx
|
shaders/adjustments.omwfx
|
||||||
shaders/displaydepth.omwfx
|
shaders/debug.omwfx
|
||||||
|
|
||||||
mygui/core.skin
|
mygui/core.skin
|
||||||
mygui/core.xml
|
mygui/core.xml
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
DisplayDepthDescription: "Visualisiert den Tiefenpuffer."
|
DisplayDepthName: "Visualisiert den Tiefenpuffer."
|
||||||
DisplayDepthFactorDescription: "Bestimmt die Korrelation zwischen dem Pixeltiefenwert und seiner Ausgabefarbe. Hohe Werte führen zu einem helleren Bild."
|
DisplayDepthFactorDescription: "Bestimmt die Korrelation zwischen dem Pixeltiefenwert und seiner Ausgabefarbe. Hohe Werte führen zu einem helleren Bild."
|
||||||
DisplayDepthFactorName: "Farbfaktor"
|
DisplayDepthFactorName: "Farbfaktor"
|
||||||
|
ContrastLevelDescription: "Kontraststufe"
|
||||||
|
ContrastLevelName: "Kontrast"
|
||||||
|
GammaLevelDescription: "Gamma-Level"
|
||||||
|
GammaLevelName: "Gamma"
|
@ -1,3 +1,12 @@
|
|||||||
DisplayDepthDescription: "Visualizes the depth buffer."
|
AdjustmentsDescription: "Colour adjustments."
|
||||||
DisplayDepthFactorDescription: "Determines correlation between pixel depth value and its output color. High values lead to brighter image."
|
DebugDescription: "Debug shader."
|
||||||
DisplayDepthFactorName: "Color factor"
|
DebugHeaderDepth: "Depth Buffer"
|
||||||
|
DebugHeaderNormals: "Normals"
|
||||||
|
DisplayDepthFactorName: "Depth colour factor"
|
||||||
|
DisplayDepthFactorDescription: "Determines correlation between pixel depth value and its output colour. High values lead to brighter image."
|
||||||
|
DisplayDepthName: "Visualize depth buffer"
|
||||||
|
DisplayNormalsName: "Visualize pass normals"
|
||||||
|
ContrastLevelDescription: "Constrast level"
|
||||||
|
ContrastLevelName: "Constrast"
|
||||||
|
GammaLevelDescription: "Gamma level"
|
||||||
|
GammaLevelName: "Gamma"
|
@ -1,3 +1,12 @@
|
|||||||
DisplayDepthDescription: "Визуализирует буфер глубины."
|
AdjustmentsDescription: "Коррекция цвета."
|
||||||
|
DebugDescription: "Отладочный шейдер."
|
||||||
|
DebugHeaderDepth: "Буфер глубины"
|
||||||
|
DebugHeaderNormals: "Нормали"
|
||||||
|
DisplayDepthName: "Визуализация буфера глубины"
|
||||||
DisplayDepthFactorDescription: "Определяет соотношение между значением глубины пикселя и его цветом. Чем выше значение, тем ярче будет изображение."
|
DisplayDepthFactorDescription: "Определяет соотношение между значением глубины пикселя и его цветом. Чем выше значение, тем ярче будет изображение."
|
||||||
DisplayDepthFactorName: "Соотношение цвета"
|
DisplayDepthFactorName: "Соотношение цвета"
|
||||||
|
DisplayNormalsName: "Визуализация нормалей"
|
||||||
|
ContrastLevelDescription: "Контрастность изображения"
|
||||||
|
ContrastLevelName: "Контрастность"
|
||||||
|
GammaLevelDescription: "Яркость изображения"
|
||||||
|
GammaLevelName: "Яркость"
|
@ -1,3 +1,7 @@
|
|||||||
DisplayDepthDescription: "Visualiserar djupbufferten."
|
DisplayDepthName: "Visualiserar djupbufferten."
|
||||||
DisplayDepthFactorDescription: "Avgör korrelation mellan djupvärdet på pixeln och dess producerade färg. Högre värden ger ljusare bild."
|
DisplayDepthFactorDescription: "Avgör korrelation mellan djupvärdet på pixeln och dess producerade färg. Högre värden ger ljusare bild."
|
||||||
DisplayDepthFactorName: "Färgfaktor"
|
DisplayDepthFactorName: "Färgfaktor"
|
||||||
|
ContrastLevelDescription: "Kontrastnivå"
|
||||||
|
ContrastLevelName: "Kontrast"
|
||||||
|
GammaLevelDescription: "Gammanivå"
|
||||||
|
# GammaLevelName: "Gamma" samma som en
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
Abovewater: "Überwasser"
|
Abovewater: "Überwasser"
|
||||||
Author: "Autor"
|
Author: "Autor"
|
||||||
Configuration: "Konfiguration"
|
Configuration: "Konfiguration"
|
||||||
ContrastLevelDescription: "Kontraststufe"
|
|
||||||
ContrastLevelName: "Kontrast"
|
|
||||||
Description: "Beschreibung"
|
Description: "Beschreibung"
|
||||||
GammaLevelDescription: "Gamma-Level"
|
|
||||||
GammaLevelName: "Gamma"
|
|
||||||
InExteriors: "Außenbereich"
|
InExteriors: "Außenbereich"
|
||||||
InInteriors: "Innenbereich"
|
InInteriors: "Innenbereich"
|
||||||
KeyboardControls: |
|
KeyboardControls: |
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
Abovewater: "Abovewater"
|
Abovewater: "Abovewater"
|
||||||
Author: "Author"
|
Author: "Author"
|
||||||
Configuration: "Configuration"
|
Configuration: "Configuration"
|
||||||
ContrastLevelDescription: "Constrast level"
|
|
||||||
ContrastLevelName: "Constrast"
|
|
||||||
Description: "Description"
|
Description: "Description"
|
||||||
GammaLevelDescription: "Gamma level"
|
|
||||||
GammaLevelName: "Gamma"
|
|
||||||
InExteriors: "Exteriors"
|
InExteriors: "Exteriors"
|
||||||
InInteriors: "Interiors"
|
InInteriors: "Interiors"
|
||||||
KeyboardControls: |
|
KeyboardControls: |
|
||||||
@ -15,7 +11,6 @@ KeyboardControls: |
|
|||||||
Shift+Left-Arrow > Deactive shader
|
Shift+Left-Arrow > Deactive shader
|
||||||
Shift+Up-Arrow > Move shader up
|
Shift+Up-Arrow > Move shader up
|
||||||
Shift+Down-Arrow > Move shader down
|
Shift+Down-Arrow > Move shader down
|
||||||
MainPassDescription: "Passes scene data to post processing shaders. Can not be toggled or moved."
|
|
||||||
PostProcessHUD: "Postprocess HUD"
|
PostProcessHUD: "Postprocess HUD"
|
||||||
ResetShader: "Reset shader to default state"
|
ResetShader: "Reset shader to default state"
|
||||||
ShaderLocked: "Locked"
|
ShaderLocked: "Locked"
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
Abovewater: "Над водой"
|
Abovewater: "Над водой"
|
||||||
Author: "Автор"
|
Author: "Автор"
|
||||||
Configuration: "Настройки"
|
Configuration: "Настройки"
|
||||||
ContrastLevelDescription: "Контрастность изображения"
|
|
||||||
ContrastLevelName: "Контрастность"
|
|
||||||
Description: "Описание"
|
Description: "Описание"
|
||||||
GammaLevelDescription: "Яркость изображения"
|
|
||||||
GammaLevelName: "Яркость"
|
|
||||||
InExteriors: "Вне помещений"
|
InExteriors: "Вне помещений"
|
||||||
InInteriors: "В помещениях"
|
InInteriors: "В помещениях"
|
||||||
KeyboardControls: |
|
KeyboardControls: |
|
||||||
@ -15,7 +11,6 @@ KeyboardControls: |
|
|||||||
Shift+Left-Arrow > Выключить шейдер
|
Shift+Left-Arrow > Выключить шейдер
|
||||||
Shift+Up-Arrow > Передвинуть шейдер выше
|
Shift+Up-Arrow > Передвинуть шейдер выше
|
||||||
Shift+Down-Arrow > Передвинуть шейдер ниже
|
Shift+Down-Arrow > Передвинуть шейдер ниже
|
||||||
MainPassDescription: "Передает данные сцены в шейдеры постобработки. Не может быть выключен или передвинут."
|
|
||||||
PostProcessHUD: "Настройки постобработки"
|
PostProcessHUD: "Настройки постобработки"
|
||||||
ResetShader: "Обнулить настройки этого шейдера"
|
ResetShader: "Обнулить настройки этого шейдера"
|
||||||
ShaderLocked: "Заблокирован"
|
ShaderLocked: "Заблокирован"
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
Abovewater: "Ovan vatten"
|
Abovewater: "Ovan vatten"
|
||||||
Author: "Skapare" # Author = Författare, but författare sounds very book-author-ish. Skapare, meaning "creator", sounds better in Swedish in this case. Ok?
|
Author: "Skapare" # Author = Författare, but författare sounds very book-author-ish. Skapare, meaning "creator", sounds better in Swedish in this case. Ok?
|
||||||
Configuration: "Konfiguration"
|
Configuration: "Konfiguration"
|
||||||
ContrastLevelDescription: "Kontrastnivå"
|
|
||||||
ContrastLevelName: "Kontrast"
|
|
||||||
Description: "Beskrivning"
|
Description: "Beskrivning"
|
||||||
GammaLevelDescription: "Gammanivå"
|
|
||||||
# GammaLevelName: "Gamma" samma som en
|
|
||||||
InExteriors: "Exteriörer"
|
InExteriors: "Exteriörer"
|
||||||
InInteriors: "Interiörer"
|
InInteriors: "Interiörer"
|
||||||
KeyboardControls: |
|
KeyboardControls: |
|
||||||
@ -15,7 +11,6 @@ KeyboardControls: |
|
|||||||
Shift+Vänsterpil > Avaktivera shader
|
Shift+Vänsterpil > Avaktivera shader
|
||||||
Shift+Pil upp > Flytta shader upp
|
Shift+Pil upp > Flytta shader upp
|
||||||
Shift+Pil ner > Flytta shader ner
|
Shift+Pil ner > Flytta shader ner
|
||||||
MainPassDescription: "Flyttar scendata till postprocess-shaders. Kan ej slås på/av eller flyttas."
|
|
||||||
PostProcessHUD: "Postprocess HUD"
|
PostProcessHUD: "Postprocess HUD"
|
||||||
ResetShader: "Återställ shader to ursprungligt läge"
|
ResetShader: "Återställ shader to ursprungligt läge"
|
||||||
ShaderLocked: "Låst"
|
ShaderLocked: "Låst"
|
||||||
|
@ -1,18 +1,10 @@
|
|||||||
main_pass {
|
|
||||||
wrap_s = clamp_to_edge;
|
|
||||||
wrap_t = clamp_to_edge;
|
|
||||||
internal_format = rgba;
|
|
||||||
source_type = unsigned_int;
|
|
||||||
source_format = rgba;
|
|
||||||
}
|
|
||||||
|
|
||||||
uniform_float uGamma {
|
uniform_float uGamma {
|
||||||
default = 1.0;
|
default = 1.0;
|
||||||
step = 0.01;
|
step = 0.01;
|
||||||
min = 0.0;
|
min = 0.0;
|
||||||
max = 5.0;
|
max = 5.0;
|
||||||
display_name = "#{PostProcessing:GammaLevelName}";
|
display_name = "#{BuiltInShaders:GammaLevelName}";
|
||||||
description = "#{PostProcessing:GammaLevelDescription}";
|
description = "#{BuiltInShaders:GammaLevelDescription}";
|
||||||
}
|
}
|
||||||
|
|
||||||
uniform_float uContrast {
|
uniform_float uContrast {
|
||||||
@ -20,8 +12,8 @@ uniform_float uContrast {
|
|||||||
step = 0.01;
|
step = 0.01;
|
||||||
min = 0.0;
|
min = 0.0;
|
||||||
max = 5.0;
|
max = 5.0;
|
||||||
display_name = "#{PostProcessing:ContrastLevelName}";
|
display_name = "#{BuiltInShaders:ContrastLevelName}";
|
||||||
description = "#{PostProcessing:ContrastLevelDescription}";
|
description = "#{BuiltInShaders:ContrastLevelDescription}";
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment main {
|
fragment main {
|
||||||
@ -39,9 +31,8 @@ fragment main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
technique {
|
technique {
|
||||||
description = "#{PostProcessing:MainPassDescription}";
|
description = "#{BuiltInShaders:AdjustmentsDescription}";
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
author = "OpenMW";
|
author = "OpenMW";
|
||||||
passes = main;
|
passes = main;
|
||||||
hdr = false;
|
|
||||||
}
|
}
|
45
files/data/shaders/debug.omwfx
Normal file
45
files/data/shaders/debug.omwfx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
uniform_bool uDisplayDepth {
|
||||||
|
header = "#{BuiltInShaders:DebugHeaderDepth}";
|
||||||
|
default = true;
|
||||||
|
display_name = "#{BuiltInShaders:DisplayDepthName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
uniform_float uDepthFactor {
|
||||||
|
step = 0.1;
|
||||||
|
min = 0.01;
|
||||||
|
max = 20.0;
|
||||||
|
default = 1.0;
|
||||||
|
display_name = "#{BuiltInShaders:DisplayDepthFactorName}";
|
||||||
|
description = "#{BuiltInShaders:DisplayDepthFactorDescription}";
|
||||||
|
}
|
||||||
|
|
||||||
|
uniform_bool uDisplayNormals {
|
||||||
|
header = "#{BuiltInShaders:DebugHeaderNormals}";
|
||||||
|
default = true;
|
||||||
|
display_name = "#{BuiltInShaders:DisplayNormalsName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment main {
|
||||||
|
|
||||||
|
omw_In vec2 omw_TexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
omw_FragColor = omw_GetLastShader(omw_TexCoord);
|
||||||
|
|
||||||
|
if (uDisplayDepth)
|
||||||
|
omw_FragColor = vec4(vec3(omw_GetLinearDepth(omw_TexCoord) / omw.far * uDepthFactor), 1.0);
|
||||||
|
#if OMW_NORMALS
|
||||||
|
if (uDisplayNormals && (!uDisplayDepth || omw_TexCoord.x < 0.5))
|
||||||
|
omw_FragColor.rgb = omw_GetNormals(omw_TexCoord);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
technique {
|
||||||
|
passes = main;
|
||||||
|
description = "#{BuiltInShaders:DebugDescription}";
|
||||||
|
author = "OpenMW";
|
||||||
|
version = "1.0";
|
||||||
|
pass_normals = true;
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
uniform_float uFactor {
|
|
||||||
step = 0.1;
|
|
||||||
min = 0.01;
|
|
||||||
max = 20.0;
|
|
||||||
default = 1.0;
|
|
||||||
display_name = "#{BuiltInShaders:DisplayDepthFactorName}";
|
|
||||||
description = "#{BuiltInShaders:DisplayDepthFactorDescription}";
|
|
||||||
}
|
|
||||||
|
|
||||||
fragment main {
|
|
||||||
|
|
||||||
omw_In vec2 omw_TexCoord;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
omw_FragColor = vec4(vec3(omw_GetLinearDepth(omw_TexCoord) / omw.far * uFactor), 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
technique {
|
|
||||||
passes = main;
|
|
||||||
description = "#{BuiltInShaders:DisplayDepthDescription}";
|
|
||||||
author = "OpenMW";
|
|
||||||
version = "1.0";
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user