2021-02-01 08:25:19 +00:00
|
|
|
/* Python-rgbcx Texture Compression Library
|
|
|
|
Copyright (C) 2021 Andrew Cassidy <drewcassidy@me.com>
|
2021-02-13 08:16:04 +00:00
|
|
|
Partially derived from rgbcx.h written by Richard Geldreich <richgel99@gmail.com>
|
2021-02-01 08:25:19 +00:00
|
|
|
and licenced under the public domain
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
2021-02-07 23:20:03 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
2021-02-01 08:25:19 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2021-02-07 23:20:03 +00:00
|
|
|
GNU Lesser General Public License for more details.
|
2021-02-01 08:25:19 +00:00
|
|
|
|
2021-02-07 23:20:03 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2021-02-01 08:25:19 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-02-10 03:43:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-15 01:52:13 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2021-03-28 09:36:47 +00:00
|
|
|
#include "../../Block.h"
|
|
|
|
#include "../../Decoder.h"
|
2021-03-13 12:14:04 +00:00
|
|
|
#include "../../ndebug.h"
|
|
|
|
#include "../bc1/BC1Decoder.h"
|
|
|
|
#include "../bc4/BC4Decoder.h"
|
2021-03-16 02:01:42 +00:00
|
|
|
#include "../interpolator/Interpolator.h"
|
2021-03-14 04:47:53 +00:00
|
|
|
#include "BC3Block.h"
|
2021-02-13 08:16:04 +00:00
|
|
|
|
2021-03-17 08:13:11 +00:00
|
|
|
namespace quicktex::s3tc {
|
2021-03-14 08:59:16 +00:00
|
|
|
|
2021-03-28 09:36:47 +00:00
|
|
|
class BC3Decoder : public BlockDecoder<BlockTexture<BC3Block>> {
|
2021-02-10 03:43:14 +00:00
|
|
|
public:
|
2021-02-15 01:52:13 +00:00
|
|
|
using BC1DecoderPtr = std::shared_ptr<BC1Decoder>;
|
|
|
|
using BC4DecoderPtr = std::shared_ptr<BC4Decoder>;
|
2021-03-16 02:01:42 +00:00
|
|
|
using InterpolatorPtr = std::shared_ptr<Interpolator>;
|
2021-02-15 01:52:13 +00:00
|
|
|
|
2021-03-18 09:34:31 +00:00
|
|
|
BC3Decoder(InterpolatorPtr interpolator) : _bc1_decoder(std::make_shared<BC1Decoder>(interpolator)), _bc4_decoder(std::make_shared<BC4Decoder>(3)) {}
|
2021-03-17 08:13:11 +00:00
|
|
|
|
2021-03-18 09:34:31 +00:00
|
|
|
BC3Decoder() : BC3Decoder(std::make_shared<Interpolator>()) {}
|
2021-02-10 21:34:11 +00:00
|
|
|
|
2021-03-28 09:36:47 +00:00
|
|
|
ColorBlock<4, 4> DecodeBlock(const BC3Block &block) const override;
|
2021-02-01 08:25:19 +00:00
|
|
|
|
2021-03-11 10:01:16 +00:00
|
|
|
BC1DecoderPtr GetBC1Decoder() const { return _bc1_decoder; }
|
|
|
|
BC4DecoderPtr GetBC4Decoder() const { return _bc4_decoder; }
|
|
|
|
|
2021-02-10 03:43:14 +00:00
|
|
|
private:
|
2021-02-15 01:52:13 +00:00
|
|
|
const BC1DecoderPtr _bc1_decoder;
|
|
|
|
const BC4DecoderPtr _bc4_decoder;
|
2021-02-10 03:43:14 +00:00
|
|
|
};
|
2021-03-14 08:59:16 +00:00
|
|
|
} // namespace quicktex::s3tc
|