Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DVDTexture.h
Go to the documentation of this file.
1/***********************************************************************
2 created: Sun Jan 11 2009
3 author: Paul D Turner
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#pragma once
28#ifndef DVD_CEGUIDVDTexture_h_
29#define DVD_CEGUIDVDTexture_h_
30
31#include "CEGUI/Base.h"
32#include "CEGUI/Renderer.h"
33#include "CEGUI/Texture.h"
34#include "CEGUIRenderer.h"
36
37#if defined(_MSC_VER)
38# pragma warning(push)
39# pragma warning(disable : 4251)
40#endif
41
42namespace CEGUI
43{
44
45class DVDTexture final : public Texture
46{
47public:
48#pragma region Texture Interface
49 [[nodiscard]] const String& getName() const override;
50 [[nodiscard]] const Sizef& getSize() const override;
51 [[nodiscard]] const Sizef& getOriginalDataSize() const override;
52 [[nodiscard]] const Vector2f& getTexelScaling() const override;
53 [[nodiscard]] bool isPixelFormatSupported(PixelFormat fmt) const override;
54
55 void loadFromFile(const String& filename, const String& resourceGroup) override;
56 void loadFromMemory(const void* buffer, const Sizef& buffer_size, PixelFormat pixel_format) override;
57 void blitFromMemory(const void* sourceData, const Rectf& area) override;
58 void blitToMemory(void* targetData) override;
59#pragma endregion
60
65 void setDVDTexture(Divide::Handle<Divide::Texture> tex, const Sizef& size);
66
75
96 void setTextureSize(const Sizef& sz);
97
98private:
99 // Friends (to allow construction and destruction)
100 friend Texture& CEGUIRenderer::createTexture(const String&);
101 friend Texture& CEGUIRenderer::createTexture(const String&, const String&, const String&);
102 friend Texture& CEGUIRenderer::createTexture(const String&, const Sizef&);
103 friend Texture& CEGUIRenderer::createTexture(const String&, const Divide::Handle<Divide::Texture>, const Sizef&);
104 friend void CEGUIRenderer::destroyTexture(Texture&);
105 friend void CEGUIRenderer::destroyTexture(const String&);
106
108 DVDTexture( CEGUIRenderer& owner, const String& name);
110 DVDTexture( CEGUIRenderer& owner, const String& name, const String& filename, const String& resourceGroup);
112 DVDTexture( CEGUIRenderer& owner, const String& name, const Sizef& size);
114 DVDTexture( CEGUIRenderer& owner, const String& name, const Divide::Handle<Divide::Texture> tex, const Sizef& size);
115 ~DVDTexture();
116
118 void generateDVDTexture();
122 void setTextureSize_impl(const Sizef& sz, PixelFormat format);
123
124 [[nodiscard]] size_t getBufferSize();
125
126private:
128 Sizef _size{1.f,1.f};
130 Sizef _dataSize{0, 0};
132 Vector2f _texelScaling{0.f, 0.f};
136 const String _name;
138 PixelFormat _format;
140 bool _isCompressed{false};
142 Divide::Handle<Divide::Texture> _texture{Divide::INVALID_HANDLE<Divide::Texture>};
145};
146
147} // End of CEGUI namespace section
148
149#if defined(_MSC_VER)
150# pragma warning(pop)
151#endif
152
153#endif // DVD_CEGUIDVDTexture_h_
154
155#include "DVDTexture.inl"
Texture & createTexture(const String &name) override
void destroyTexture(Texture &texture) override
size_t getBufferSize()
bool isPixelFormatSupported(PixelFormat fmt) const override
Definition: DVDTexture.cpp:316
bool _isCompressed
Whether Texture format is a compressed format.
Definition: DVDTexture.h:140
void updateCachedScaleValues()
updates cached scale value used to map pixels to texture co-ords.
Definition: DVDTexture.inl:54
Divide::Handle< Divide::Texture > _texture
The Divide texture used for storing this DVDTexture's data.
Definition: DVDTexture.h:142
void blitFromMemory(const void *sourceData, const Rectf &area) override
Definition: DVDTexture.cpp:170
void setTextureSize(const Sizef &sz)
set the size of the internal texture.
Definition: DVDTexture.cpp:118
Divide::SamplerDescriptor _sampler
A Divide sampler hash used for sampling from this texture in shaders.
Definition: DVDTexture.h:144
const Sizef & getSize() const override
Definition: DVDTexture.inl:39
void setDVDTexture(Divide::Handle< Divide::Texture > tex, const Sizef &size)
set the Divide::Texture that this Texture is based on to the specified texture, with the specified si...
Definition: DVDTexture.cpp:307
const String & getName() const override
Definition: DVDTexture.inl:34
const String _name
The name given for this texture.
Definition: DVDTexture.h:136
Vector2f _texelScaling
cached pixel to texel mapping scale values.
Definition: DVDTexture.h:132
void loadFromMemory(const void *buffer, const Sizef &buffer_size, PixelFormat pixel_format) override
Definition: DVDTexture.cpp:105
Sizef _dataSize
original size of pixel data loaded into texture
Definition: DVDTexture.h:130
const Sizef & getOriginalDataSize() const override
Definition: DVDTexture.inl:44
CEGUIRenderer & _owner
CEGUIRenderer that created and owns this DVDTexture.
Definition: DVDTexture.h:134
void generateDVDTexture()
generate the DVD texture and set some initial options.
Definition: DVDTexture.cpp:233
Divide::Handle< Divide::Texture > getDVDTexture() const
Return the internal Divide::Texture pointer used by this Texture object.
Definition: DVDTexture.inl:60
void setTextureSize_impl(const Sizef &sz, PixelFormat format)
internal texture resize function (does not reset format or other fields)
Definition: DVDTexture.cpp:126
void blitToMemory(void *targetData) override
Definition: DVDTexture.cpp:224
void loadFromFile(const String &filename, const String &resourceGroup) override
Definition: DVDTexture.cpp:81
const Vector2f & getTexelScaling() const override
Definition: DVDTexture.inl:49
PixelFormat _format
Texture format.
Definition: DVDTexture.h:138
Sizef _size
Size of the texture.
Definition: DVDTexture.h:128