/* Python-rgbcx Texture Compression Library Copyright (C) 2021 Andrew Cassidy Partially derived from rgbcx.h written by Richard Geldreich and licenced under the public domain This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by 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 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include "../../BlockDecoder.h" #include "../../BlockEncoder.h" #include "../interpolator/Interpolator.h" #include "BC3Decoder.h" #include "BC3Encoder.h" namespace py = pybind11; namespace quicktex::bindings { using namespace quicktex::s3tc; using namespace pybind11::literals; using InterpolatorPtr = std::shared_ptr; using BC1EncoderPtr = std::shared_ptr; using BC1DecoderPtr = std::shared_ptr; void InitBC3(py::module_ &s3tc) { auto bc3 = s3tc.def_submodule("_bc3", "BC3 encoding/decoding module"); auto block_encoder = py::type::of(); auto block_decoder = py::type::of(); // BC3Encoder py::class_ bc3_encoder(bc3, "BC3Encoder", block_encoder); bc3_encoder.def(py::init(), "bc1_encoder"_a); bc3_encoder.def(py::init(), "level"_a = 5, "use_3color"_a = true, "use_3color_black"_a = true); bc3_encoder.def(py::init(), "level"_a, "use_3color"_a, "use_3color_black"_a, "interpolator"_a); bc3_encoder.def_property_readonly("bc1_encoder", &BC3Encoder::GetBC1Encoder); bc3_encoder.def_property_readonly("bc4_encoder", &BC3Encoder::GetBC4Encoder); // BC3Decoder py::class_ bc3_decoder(bc3, "BC3Decoder", block_decoder); bc3_decoder.def(py::init<>()); bc3_decoder.def(py::init(), "bc1_decoder"_a); bc3_decoder.def(py::init(), "interpolator"_a); bc3_decoder.def_property_readonly("bc1_decoder", &BC3Decoder::GetBC1Decoder); bc3_decoder.def_property_readonly("bc4_decoder", &BC3Decoder::GetBC4Decoder); }; } // namespace quicktex::bindings