Last active
April 1, 2021 02:58
-
-
Save Journeyman1337/51e076f962ba28e76175c1b980761d27 to your computer and use it in GitHub Desktop.
wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2020 Daniel Valcour | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | |
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | |
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | |
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
*/ | |
#pragma once | |
#include "types.h" | |
#include <vector> | |
#include <string> | |
namespace jtk | |
{ | |
enum class TextureResizeFilterMode | |
{ | |
Situational, | |
Point, | |
// TODO | |
}; | |
class Texture | |
{ | |
private: | |
std::unique_ptr<uint8_t[]> data_ptr; | |
std::vector<tex_sptr_t> mips; | |
size_t width; | |
size_t height; | |
size_t layers; | |
size_t channels; | |
size_t channel_size; | |
size_t pixel_size; | |
size_t size; | |
public: | |
Texture(); | |
~Texture(); | |
static tex_sptr_t MakeShared(); | |
void Build(size_t width, size_t height, size_t layers, size_t channels, size_t channel_size, size_t pixel_size, bool initialize); | |
void Clear(); | |
void* Data(); | |
void* GetDataPointer(size_t pixel_x, size_t pixel_y, size_t pixel_z, size_t channel); | |
bool IsBuilt(); | |
size_t GetWidth(); | |
size_t GetHeight(); | |
size_t GetLayers(); | |
size_t GetChannels(); | |
size_t GetChannelSize(); | |
size_t GetPixelSize(); | |
size_t GetSize(); | |
size_t GetMipmapCount(); | |
tex_sptr_t GetMipmap(size_t level); | |
void DestroyMipmaps(); | |
void GenerateMipmaps(int levels, float progression, TextureResizeFilterMode filterMode); | |
tex_sptr_t Copy(); | |
tex_sptr_t CopyRezised(size_t new_width, size_t new_height, TextureResizeFilterMode filterMode); | |
void Insert(tex_sptr_t to_insert, size_t left_x, size_t bottom_y, size_t bottom_z); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment