Untitled Game engine no.5
1.0
|
11 TextureCoord(glm::vec2 pos, glm::vec2 size): tex_pos(pos), tex_size(size) {};
25 std::vector<Ref<TextureCoord>> mapping = std::vector<Ref<TextureCoord>>();
26 static Ref<TextureMap> Map2D(
float width,
float height,
float x,
float y);
28 auto map = CreateRef<TextureMap>();
29 auto map2d = TextureMap::Map2D(1, 1, 0, 0)->mapping;
30 for (
int i = 0; i < 6; i++) {
31 for (
auto a : map2d) {
32 map->mapping.emplace_back(a);
43 std::vector<glm::vec4> mapping;
55 virtual uint32_t
getID()
const {
return 0;};
65 virtual void setSize(
float width,
float height) {};
67 virtual void setID(uint32_t
id) {};
70 virtual void Bind(uint32_t slot = 0)
const {};
85 virtual Ref<Texture> genClip(uint32_t width, uint32_t height, uint32_t x, uint32_t y)
const {
return nullptr;};
86 virtual void loadTextureData(stbi_uc *data,
const int w,
const int h, uint type) { };
Representation of a 2D texture.
Definition: Texture.hpp:79
Ref< TextureMap > map
Mapping reference.
Definition: Texture.hpp:97
Container for texture data.
Definition: Texture.hpp:50
virtual float getWidth() const
visual width of the texture in game dimensions
Definition: Texture.hpp:57
Texture Coordinate data.
Definition: Texture.hpp:10
virtual void setSize(float width, float height)
visual size of the texture in game dimensions
Definition: Texture.hpp:65
std::shared_ptr< T > Ref
Has stuff for making references a lot more easily shared smart pointer.
Definition: Base.hpp:21
Wrapper for a texture reference and a texture mapping.
Definition: Texture.hpp:92
Ref< Texture > tex
texture reference
Definition: Texture.hpp:95
virtual Ref< Texture > genClip(uint32_t width, uint32_t height, uint32_t x, uint32_t y) const
generate a clipped texture from texture coordinates
Definition: Texture.hpp:85
virtual void setHeight(float height)
visual height of the texture in game dimensions
Definition: Texture.hpp:63
uint width
texture width
Definition: Texture.hpp:99
virtual uint32_t getID() const
Texture id - an id link to the texture.
Definition: Texture.hpp:55
virtual float getHeight() const
visual height of the texture in game dimensions
Definition: Texture.hpp:59
virtual void setWidth(float width)
visual width of the texture in game dimensions
Definition: Texture.hpp:61
virtual void setID(uint32_t id)
set texture id
Definition: Texture.hpp:67
virtual Ref< TextureMap > getDefaultMapping() const
Get the texture mapping.
Definition: Texture.hpp:72
Definition: Animation.hpp:14
virtual void Bind(uint32_t slot=0) const
Definition: Texture.hpp:70
List of texture coordinates for indexing vector data.
Definition: Texture.hpp:24
uint height
texture height
Definition: Texture.hpp:101
Vertex map for colors.
Definition: Texture.hpp:42
static Ref< Texture2D > Create(const std::string &path)
Generate a texture from a string path.
Definition: Texture.cpp:6