mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
75aeb561bd
This utility class is used to quickly render and retrieve a Texture from a source. It should be used in place of manual rendering since it can be updated quickly, fixing outstanding issue in all places of the plugin instead of just one.
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
// Modern effects for a modern Streamer
|
|
// Copyright (C) 2017 Michael Fabian Dirks
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 2 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 General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
#pragma once
|
|
#include <string>
|
|
#include <obs.h>
|
|
#include <memory>
|
|
#include "gs-texture.h"
|
|
#include "gs-rendertarget.h"
|
|
|
|
namespace util {
|
|
class SourceTexture {
|
|
obs_source_t* m_source;
|
|
std::shared_ptr<GS::RenderTarget> m_rt;
|
|
|
|
SourceTexture();
|
|
public:
|
|
~SourceTexture();
|
|
SourceTexture(const char* name);
|
|
SourceTexture(std::string name);
|
|
SourceTexture(obs_source_t* src);
|
|
|
|
std::shared_ptr<GS::Texture> Render(size_t width, size_t height);
|
|
};
|
|
}
|