libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Texture.h
Go to the documentation of this file.
1#pragma once
2
4#include <memory>
5#include <vector>
6
7#define TEX_FLAG_LOAD_AS_RAW (1 << 0)
8#define TEX_FLAG_LOAD_AS_IMG (1 << 1)
9
10namespace Fast {
11enum class TextureType {
12 Error = 0,
13 RGBA32bpp = 1,
14 RGBA16bpp = 2,
15 Palette4bpp = 3,
16 Palette8bpp = 4,
17 Grayscale4bpp = 5,
18 Grayscale8bpp = 6,
22};
23
24class Texture final : public Ship::Resource<uint8_t> {
25 public:
26 using Resource::Resource;
27
29
30 uint8_t* GetPointer() override;
31 size_t GetPointerSize() override;
32
34 uint16_t Width, Height;
35 uint32_t Flags = 0;
36 float HByteScale = 1.0;
37 float VPixelScale = 1.0;
38 uint32_t ImageDataSize;
39 uint8_t* ImageData = nullptr;
40 // When set, ImageData points into this buffer and must not be delete[]-ed.
41 std::shared_ptr<std::vector<char>> mImageBuffer;
42
44};
45} // namespace Fast
Definition Texture.h:24
size_t GetPointerSize() override
Returns the size (in bytes) of the type pointed to by GetRawPointer().
uint8_t * ImageData
Definition Texture.h:39
uint16_t Height
Definition Texture.h:34
uint16_t Width
Definition Texture.h:34
std::shared_ptr< std::vector< char > > mImageBuffer
Definition Texture.h:41
float VPixelScale
Definition Texture.h:37
TextureType Type
Definition Texture.h:33
uint8_t * GetPointer() override
Returns a typed pointer to the resource payload.
uint32_t Flags
Definition Texture.h:35
uint32_t ImageDataSize
Definition Texture.h:38
float HByteScale
Definition Texture.h:36
Typed resource base class that provides a strongly-typed pointer accessor.
Definition Resource.h:73
Definition gfx_direct3d_common.h:19
TextureType
Definition Texture.h:11