diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index e4bd8522f..9e57b38e2 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -474,13 +474,12 @@ undersampling (Undersampling) int 1 1 8 # 3D support. # Currently supported: -# - none: no 3d output. -# - anaglyph: cyan/magenta color 3d. -# - interlaced: odd/even line based polarization screen support. -# - topbottom: split screen top/bottom. -# - sidebyside: split screen side by side. -# - crossview: Cross-eyed 3d -3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview +# - none: no 3D output +# - anaglyph: cyan/magenta color 3D +# - topbottom: split screen top/bottom +# - sidebyside: split screen side-by-side +# - crossview: cross-eyed 3D +3d_mode (3D mode) enum none none,anaglyph,topbottom,sidebyside,crossview # Strength of 3D mode parallax. 3d_paralax_strength (3D mode parallax strength) float 0.025 -0.087 0.087 diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index a09a0fb3f..ac98d4bd8 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -32,7 +32,6 @@ set(client_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/render/anaglyph.cpp ${CMAKE_CURRENT_SOURCE_DIR}/render/core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/render/factory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/render/interlaced.cpp ${CMAKE_CURRENT_SOURCE_DIR}/render/plain.cpp ${CMAKE_CURRENT_SOURCE_DIR}/render/sidebyside.cpp ${CMAKE_CURRENT_SOURCE_DIR}/render/stereo.cpp diff --git a/src/client/render/factory.cpp b/src/client/render/factory.cpp index 060e22670..99fe95507 100644 --- a/src/client/render/factory.cpp +++ b/src/client/render/factory.cpp @@ -8,7 +8,6 @@ #include "log.h" #include "plain.h" #include "anaglyph.h" -#include "interlaced.h" #include "sidebyside.h" #include "secondstage.h" #include "client/shadows/dynamicshadowsrender.h" @@ -52,10 +51,6 @@ void createPipeline(const std::string &stereo_mode, IrrlichtDevice *device, Clie populateAnaglyphPipeline(result.pipeline.get(), client); return; } - if (stereo_mode == "interlaced") { - populateInterlacedPipeline(result.pipeline.get(), client); - return; - } if (stereo_mode == "sidebyside") { populateSideBySidePipeline(result.pipeline.get(), client, false, false, result.virtual_size_scale); return; diff --git a/src/client/render/interlaced.cpp b/src/client/render/interlaced.cpp deleted file mode 100644 index c4014a74d..000000000 --- a/src/client/render/interlaced.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Luanti -// SPDX-License-Identifier: LGPL-2.1-or-later -// Copyright (C) 2010-2013 celeron55, Perttu Ahola -// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy - -#include "interlaced.h" -#include "secondstage.h" -#include "client/client.h" -#include "client/shader.h" -#include "client/camera.h" - -InitInterlacedMaskStep::InitInterlacedMaskStep(TextureBuffer *_buffer, u8 _index) : - buffer(_buffer), index(_index) -{ -} - -void InitInterlacedMaskStep::run(PipelineContext &context) -{ - video::ITexture *mask = buffer->getTexture(index); - if (!mask) - return; - if (mask == last_mask) - return; - last_mask = mask; - - auto size = mask->getSize(); - u8 *data = reinterpret_cast(mask->lock(video::ETLM_WRITE_ONLY)); - for (u32 j = 0; j < size.Height; j++) { - u8 val = j % 2 ? 0xff : 0x00; - memset(data, val, 4 * size.Width); - data += 4 * size.Width; - } - mask->unlock(); -} - -void populateInterlacedPipeline(RenderPipeline *pipeline, Client *client) -{ - // FIXME: "3d_mode = interlaced" is currently broken. Two options: - // 1. Remove it - // 2. Fix it - // If you fix it, make sure to test it with "enable_post_processing = false". - // You'll probably have to add a depth texture to make that combination work. - // Also, this code should probably use selectColorFormat/selectDepthFormat. - - static const u8 TEXTURE_LEFT = 0; - static const u8 TEXTURE_RIGHT = 1; - static const u8 TEXTURE_MASK = 2; - - TextureBuffer *buffer = pipeline->createOwned(); - buffer->setTexture(TEXTURE_LEFT, v2f(1.0f, 0.5f), "3d_render_left", video::ECF_A8R8G8B8); - buffer->setTexture(TEXTURE_RIGHT, v2f(1.0f, 0.5f), "3d_render_right", video::ECF_A8R8G8B8); - buffer->setTexture(TEXTURE_MASK, v2f(1.0f, 1.0f), "3d_render_mask", video::ECF_A8R8G8B8); - - pipeline->addStep(buffer, TEXTURE_MASK); - - auto step3D = pipeline->own(create3DStage(client, v2f(1.0f, 0.5f))); - - // eyes - for (bool right : { false, true }) { - pipeline->addStep(right); - auto output = pipeline->createOwned(buffer, right ? TEXTURE_RIGHT : TEXTURE_LEFT); - pipeline->addStep(step3D, output); - pipeline->addStep(step3D); - pipeline->addStep(); - pipeline->addStep(); - } - - pipeline->addStep(0.0f); - - IShaderSource *s = client->getShaderSource(); - auto shader = s->getShaderRaw("3d_interlaced_merge"); - video::E_MATERIAL_TYPE material = s->getShaderInfo(shader).material; - auto texture_map = { TEXTURE_LEFT, TEXTURE_RIGHT, TEXTURE_MASK }; - - auto merge = pipeline->addStep(material, texture_map); - merge->setRenderSource(buffer); - merge->setRenderTarget(pipeline->createOwned()); - pipeline->addStep(); -} diff --git a/src/client/render/interlaced.h b/src/client/render/interlaced.h deleted file mode 100644 index 24992f110..000000000 --- a/src/client/render/interlaced.h +++ /dev/null @@ -1,20 +0,0 @@ -// Luanti -// SPDX-License-Identifier: LGPL-2.1-or-later -// Copyright (C) 2010-2013 celeron55, Perttu Ahola -// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy - -#pragma once -#include "pipeline.h" - -class InitInterlacedMaskStep : public TrivialRenderStep -{ -public: - InitInterlacedMaskStep(TextureBuffer *buffer, u8 index); - void run(PipelineContext &context) override; -private: - TextureBuffer *buffer; - video::ITexture *last_mask { nullptr }; - u8 index; -}; - -void populateInterlacedPipeline(RenderPipeline *pipeline, Client *client);