Last change
on this file since 2001 was
2001,
checked in by sam, 7 years ago
|
tutorial: add a new texture generation example.
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
1 | // |
---|
2 | // Lol Engine |
---|
3 | // |
---|
4 | // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> |
---|
5 | // This program is free software; you can redistribute it and/or |
---|
6 | // modify it under the terms of the Do What The Fuck You Want To |
---|
7 | // Public License, Version 2, as published by Sam Hocevar. See |
---|
8 | // http://sam.zoy.org/projects/COPYING.WTFPL for more details. |
---|
9 | // |
---|
10 | |
---|
11 | // |
---|
12 | // The Texture class |
---|
13 | // ----------------- |
---|
14 | // |
---|
15 | |
---|
16 | #if !defined __LOL_TEXTURE_H__ |
---|
17 | #define __LOL_TEXTURE_H__ |
---|
18 | |
---|
19 | namespace lol |
---|
20 | { |
---|
21 | |
---|
22 | struct PixelFormat |
---|
23 | { |
---|
24 | /* XXX: make sure to update texture.cpp when this changes */ |
---|
25 | enum Value |
---|
26 | { |
---|
27 | Unknown = 0, |
---|
28 | R8G8B8, |
---|
29 | A8R8G8B8, |
---|
30 | A8B8G8R8, |
---|
31 | } |
---|
32 | m_value; |
---|
33 | |
---|
34 | inline PixelFormat() : m_value(Unknown) {} |
---|
35 | inline PixelFormat(Value v) : m_value(v) {} |
---|
36 | inline operator Value() { return m_value; } |
---|
37 | }; |
---|
38 | |
---|
39 | class Texture |
---|
40 | { |
---|
41 | public: |
---|
42 | Texture(ivec2 size, PixelFormat format); |
---|
43 | ~Texture(); |
---|
44 | |
---|
45 | void Bind(); |
---|
46 | void SetData(void *data); |
---|
47 | void SetSubData(ivec2 origin, ivec2 size, void *data); |
---|
48 | |
---|
49 | ShaderTexture GetTexture() const; |
---|
50 | |
---|
51 | private: |
---|
52 | class TextureData *m_data; |
---|
53 | }; |
---|
54 | |
---|
55 | } /* namespace lol */ |
---|
56 | |
---|
57 | #endif // __LOL_TEXTURE_H__ |
---|
58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.