zenilib: zenilib/jni/external/zenilib/zeni_graphics/Texture.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Texture.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <zeni_graphics.h>
19
20 #include <iostream>
21
22 #include <Zeni/GLU.h>
23
24 #ifndef DISABLE_DX9
25 #include <d3dx9.h>
26 #endif
27
28 #include <Zeni/Define.h>
29
30 namespace Zeni {
31
32 Sprite::Sprite()
33 : Texture(false),
34 m_frame(0)
35 {
36 }
37
38 Sprite::Sprite(const Sprite &rhs)
39 : Texture(false),
40 m_frames(rhs.m_frames),
41 m_frame(rhs.m_frame)
42 {
43 }
44
45 Sprite & Sprite::operator=(const Sprite &rhs) {
46 Sprite lhs(rhs);
47 std::swap(lhs.m_frames, m_frames);
48 std::swap(lhs.m_frame, m_frame);
49 return *this;
50 }
51
52 void Sprite::append_frame(const String &name) {
53 append_frame(name, get_Textures().get_id(name));
54 }
55
56 void Sprite::append_frame(const String &name, const unsigned long &id) {
57 m_frames.push_back(std::make_pair(name, id));
58 }
59
60 int Sprite::find_frame(const String &name, const int &starting_point) const {
61 if(starting_point < 0)
62 throw Frame_Out_of_Range();
63
64 for(int i = starting_point, end = int(m_frames.size()); i < end; ++i)
65 if(m_frames[size_t(i)].first == name)
66 return i;
67 return -1;
68 }
69
70 void Sprite::insert_frame(const String &name, const int &at_this_index) {
71 insert_frame(name, get_Textures().get_id(name), at_this_index);
72 }
73
74 void Sprite::insert_frame(const String &name, const unsigned long &id, const int &at_this_index) {
75 std::pair<String, unsigned long> new_frame = std::make_pair(name, id);
76
77 if(at_this_index < 0 || at_this_index > int(m_frames.size()))
78 throw Frame_Out_of_Range();
79
80 m_frames.push_back(new_frame);
81
82 memmove(
83 &m_frames + at_this_index + 1,
84 &m_frames + at_this_index,
85 (m_frames.size() - at_this_index - 1) * sizeof(std::pair<String, unsigned long>));
86
87 m_frames[size_t(at_this_index)] = new_frame;
88 }
89
90 void Sprite::remove_frame(const int &frame_number) {
91 if(frame_number < 0 || frame_number > int(m_frames.size()))
92 throw Frame_Out_of_Range();
93
94 memmove(
95 &m_frames + frame_number,
96 &m_frames + frame_number + 1,
97 (m_frames.size() - frame_number - 1) * sizeof(std::pair<String, unsigned long>));
98
99 m_frames.pop_back();
100 }
101
102 int Sprite::get_num_frames() const {
103 return int(m_frames.size());
104 }
105
106 int Sprite::get_current_frame() const {
107 if(m_frames.empty())
108 return -1;
109 return m_frame;
110 }
111
112 void Sprite::set_current_frame(const int &frame_number) {
113 if(frame_number < 0 || frame_number > int(m_frames.size()))
114 throw Frame_Out_of_Range();
115
116 m_frame = frame_number;
117 }
118
119 void Sprite::apply_Texture() const {
120 static bool no_recurse = true;
121
122 if(no_recurse)
123 no_recurse = false;
124 else
125 throw Sprite_Containing_Sprite();
126
127 if(m_frames.empty() || m_frame < 0 || m_frame >= int(m_frames.size()))
128 throw Frame_Out_of_Range();
129
130 try {
131 get_Textures().apply_Texture(m_frames[size_t(m_frame)].second);
132 }
133 catch(Database_Entry_Not_Found &) {
134 try {
135 m_frames[size_t(m_frame)].second = get_Textures().get_id(m_frames[size_t(m_frame)].first);
136 get_Textures().apply_Texture(m_frames[size_t(m_frame)].second);
137 }
138 catch(...) {
139 no_recurse = true;
140 throw;
141 }
142 }
143 catch(...) {
144 no_recurse = true;
145 throw;
146 }
147 no_recurse = true;
148 }
149
150 #ifndef DISABLE_GL
151 Texture_GL::Texture_GL(const String &filename, const bool &repeat, const bool &lazy_loading)
152 : Texture(repeat),
153 m_texture_id(0),
154 m_render_buffer(0),
155 m_frame_buffer_object(0),
156 m_filename(filename)
157 {
158 if(!lazy_loading)
159 load(m_filename, m_repeat);
160 }
161
162 Texture_GL::Texture_GL(const Image &image)
163 : Texture(image.tileable()),
164 m_size(Point2i(image.width(), image.height())),
165 m_texture_id(build_from_Image(image)),
166 m_render_buffer(0),
167 m_frame_buffer_object(0)
168 #ifdef TEMP_DISABLE
169 , m_filename(1, '\0')
170 #endif
171 {
172 }
173
174 Texture_GL::Texture_GL(const Point2i &size, const bool &repeat)
175 : Texture(repeat),
176 m_size(size),
177 m_texture_id(build_from_Image(Image(size, Image::RGBA, repeat))),
178 m_render_buffer(0),
179 m_frame_buffer_object(0)
180 #ifdef TEMP_DISABLE
181 , m_filename(1, '\0')
182 #endif
183 {
184 }
185
186 Texture_GL::~Texture_GL() {
187 if(m_render_buffer)
188 #ifdef REQUIRE_GL_ES
189 glDeleteBuffers(1, &m_render_buffer);
190 #else
191 glDeleteRenderbuffersEXT(1, &m_render_buffer);
192 #endif
193 if(m_frame_buffer_object)
194 #ifdef REQUIRE_GL_ES
195 glDeleteBuffers(1, &m_frame_buffer_object);
196 #else
197 glDeleteFramebuffersEXT(1, &m_frame_buffer_object);
198 #endif
199
200 if(m_texture_id)
201 glDeleteTextures(1, &m_texture_id);
202 }
203
204 void Texture_GL::apply_Texture() const {
205 if(!m_texture_id)
206 load(m_filename, m_repeat);
207
208 glEnable(GL_TEXTURE_2D);
209
210 glBindTexture(GL_TEXTURE_2D, m_texture_id);
211
212 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
213 }
214
215 GLuint Texture_GL::build_from_Image(const Image &image) {
216 GLuint texture_id = 0;
217
218 const GLenum format =
219 image.color_space() == Image::Luminance ? GL_LUMINANCE :
220 image.color_space() == Image::Luminance_Alpha ? GL_LUMINANCE_ALPHA :
221 image.color_space() == Image::RGB ? GL_RGB :
222 GL_RGBA;
223
224 int bit_count = 0;
225 for(int bit = 1; bit; bit <<= 1)
226 bit_count += ((image.width() & bit) != 0) + ((image.height() & bit) != 0);
227 if(bit_count != 2) {
228 ZENI_LOGE("Dimensions of textures must be powers of 2.");
229 throw Texture_Init_Failure();
230 }
231
232 glGenTextures(1, &texture_id);
233 if(!texture_id) {
234 ZENI_LOGE("glGenTextures(...) failed.");
235 throw Texture_Init_Failure();
236 }
237
238 glBindTexture(GL_TEXTURE_2D, texture_id);
239
240 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image.tileable() ? GL_REPEAT : GL_CLAMP_TO_EDGE);
241 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image.tileable() ? GL_REPEAT : GL_CLAMP_TO_EDGE);
242
243 if(glGetError() == GL_INVALID_ENUM) {
244 static bool printed = false;
245 if(!printed) {
246 ZENI_LOGW("Quality Warning: Your graphics card does not support GL_CLAMP_TO_EDGE in OpenGL.");
247 printed = true;
248 }
249 }
250
251 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Textures::get_bilinear_filtering() ? GL_LINEAR : GL_NEAREST);
252
253 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
254 Textures::get_mipmapping() ?
255 (Textures::get_bilinear_filtering() ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) :
256 (Textures::get_bilinear_filtering() ? GL_LINEAR : GL_NEAREST));
257
258 #ifndef REQUIRE_GL_ES
259 if(Textures::get_anisotropic_filtering()) {
260 if(Textures::get_anisotropic_filtering() < 0 || Textures::get_anisotropic_filtering() > get_Video().get_maximum_anisotropy())
261 Textures::set_texturing_mode(get_Video().get_maximum_anisotropy(), Textures::get_bilinear_filtering(), Textures::get_mipmapping());
262
263 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Textures::get_anisotropic_filtering());
264 }
265 #endif
266
267 /*
268 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
269 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
270 glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
271 glHint(GL_FOG_HINT, GL_NICEST);
272 */
273 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
274
275 if(
276 #ifndef REQUIRE_GL_ES
277 GLEW_VERSION_1_4 &&
278 #endif
279 Textures::get_mipmapping())
280 {
281 glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
282 }
283 #ifndef REQUIRE_GL_ES
284 if(GLEW_VERSION_1_4 || !Textures::get_mipmapping())
285 #endif
286 {
287 glTexImage2D(GL_TEXTURE_2D, 0, format, image.width(), image.height(), 0, format, GL_UNSIGNED_BYTE, static_cast<const GLvoid *>(image.get_data()));
288 }
289 #ifndef REQUIRE_GL_ES
290 else {
291 Zeni::gluBuild2DMipmaps(GL_TEXTURE_2D, format, image.width(), image.height(), format, GL_UNSIGNED_BYTE, static_cast<const GLvoid *>(image.get_data()));
292 }
293 #endif
294
295 return texture_id;
296 }
297
298 void Texture_GL::load(const String &filename, const bool &repeat) const {
299 Image image(filename, repeat);
300
301 m_size.x = image.width();
302 m_size.y = image.height();
303
304 m_texture_id = build_from_Image(image);
305 }
306
307 #endif
308
309 #ifndef TEMP_DISABLE
310 #ifndef DISABLE_DX9
311 Texture_DX9::Texture_DX9(const String &filename, const bool &repeat)
312 : Texture(repeat),
313 m_texture(0),
314 m_render_to_surface(0)
315 {
316 load(filename);
317 }
318
319 Texture_DX9::Texture_DX9(const Image &image)
320 : Texture(image.tileable()),
321 m_size(image.size()),
322 m_texture(build_from_Image(image)),
323 m_render_to_surface(0)
324 {
325 }
326
327 Texture_DX9::Texture_DX9(const Point2i &size, const bool &repeat)
328 : Texture(repeat),
329 m_size(size),
330 m_texture(0),
331 m_render_to_surface(0)
332 {
333 Video_DX9 &vr = static_cast< Video_DX9 &>(get_Video());
334
335 set_sampler_states(true);
336
337 if(FAILED(Video_DX9::D3DXCreateTexture()(vr.get_d3d_device(),
338 UINT(size.x), UINT(size.y),
339 D3DX_DEFAULT,
340 D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP,
341 D3DFMT_A8R8G8B8,
342 D3DPOOL_DEFAULT,
343 &m_texture)))
344 {
345 throw Texture_Init_Failure();
346 }
347
348 if(FAILED(Video_DX9::D3DXCreateRenderToSurface()(vr.get_d3d_device(),
349 UINT(size.x), UINT(size.y),
350 D3DFMT_A8R8G8B8,
351 true,
352 D3DFMT_D16,
353 &m_render_to_surface)))
354 {
355 if(m_texture)
356 m_texture->Release();
357
358 throw Texture_Init_Failure();
359 }
360 }
361
362 Texture_DX9::~Texture_DX9() {
363 if(m_render_to_surface)
364 m_render_to_surface->Release();
365
366 if(m_texture)
367 m_texture->Release();
368 }
369
370 void Texture_DX9::apply_Texture() const {
371 Video_DX9 &vdx = static_cast< Video_DX9 &>(get_Video());
372
373 vdx.get_d3d_device()->SetSamplerState(0, D3DSAMP_ADDRESSU, m_repeat ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
374 vdx.get_d3d_device()->SetSamplerState(0, D3DSAMP_ADDRESSV, m_repeat ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP);
375
376 vdx.get_d3d_device()->SetTexture(0, m_texture);
377
378 if(vdx.get_lighting()) {
379 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
380 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
381 }
382 else {
383 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
384 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
385 }
386
387 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
388 vdx.get_d3d_device()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
389 }
390
391 void Texture_DX9::set_sampler_states(const bool &disable_mipmapping) {
392 Video_DX9 &vr = static_cast< Video_DX9 &>(get_Video());
393
394 if(Textures::get_anisotropic_filtering()) {
395 if(Textures::get_anisotropic_filtering() < 0 || Textures::get_anisotropic_filtering() > vr.get_maximum_anisotropy())
396 Textures::set_texturing_mode(vr.get_maximum_anisotropy(), Textures::get_bilinear_filtering(), Textures::get_mipmapping());
397
398 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC);
399 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
400 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MAXANISOTROPY, DWORD(Textures::get_anisotropic_filtering()));
401 }
402 else if(Textures::get_bilinear_filtering()) {
403 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
404 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
405 }
406 else {
407 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
408 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
409 }
410
411 vr.get_d3d_device()->SetSamplerState(0, D3DSAMP_MIPFILTER, (!disable_mipmapping && Textures::get_mipmapping() ? D3DTEXF_LINEAR : D3DTEXF_NONE));
412 }
413
414 IDirect3DTexture9 * Texture_DX9::build_from_Image(const Image &image) {
415 Video_DX9 &vdx = dynamic_cast< Video_DX9 &>(get_Video());
416
417 IDirect3DTexture9 * ppTexture;
418
419 D3DFORMAT format;
420 switch(image.color_space()) {
421 case Image::Luminance:
422 format = D3DFMT_L8;
423 break;
424
425 case Image::Luminance_Alpha:
426 format = D3DFMT_A8B8G8R8;
427 break;
428
429 case Image::RGB:
430 format = D3DFMT_A8B8G8R8;
431 break;
432
433 case Image::RGBA:
434 format = D3DFMT_A8B8G8R8;
435 break;
436
437 default:
438 format = D3DFMT_UNKNOWN;
439 abort();
440 }
441
442 set_sampler_states();
443
444 if(FAILED(Video_DX9::D3DXCreateTexture()(vdx.get_d3d_device(),
445 UINT(image.width()), UINT(image.height()),
446 D3DX_DEFAULT,
447 0,
448 format,
449 D3DPOOL_MANAGED,
450 &ppTexture)))
451 throw Texture_Init_Failure();
452
453 D3DLOCKED_RECT rect;
454 if(FAILED(ppTexture->LockRect(0, &rect, 0, 0))) {
455 ppTexture->Release();
456 throw Texture_Init_Failure();
457 }
458
459 if(image.color_space() == Image::Luminance) {
460 memcpy(rect.pBits, image.get_data(), image.width() * image.height());
461 }
462 else if(image.color_space() == Image::Luminance_Alpha) {
463 Uint8 * dest = reinterpret_cast< Uint8 *>(rect.pBits);
464 const Uint8 * src = image.get_data();
465 for(Uint8 * const dest_end = dest + image.width() * image.height() * 4; dest != dest_end; dest += 4, src += 2) {
466 dest[0] = src[0];
467 dest[1] = src[0];
468 dest[2] = src[0];
469 dest[3] = src[1];
470 }
471 }
472 else if(image.color_space() == Image::RGB) {
473 Uint8 * dest = reinterpret_cast< Uint8 *>(rect.pBits);
474 const Uint8 * src = image.get_data();
475 for(Uint8 * const dest_end = dest + image.width() * image.height() * 4; dest != dest_end; dest += 4, src += 3) {
476 dest[0] = src[2];
477 dest[1] = src[1];
478 dest[2] = src[0];
479 dest[3] = 0xFF;
480 }
481 }
482 else /*if(image.color_space() == Image::RGBA)*/ {
483 Uint8 * dest = reinterpret_cast< Uint8 *>(rect.pBits);
484 const Uint8 * src = image.get_data();
485 for(Uint8 * const dest_end = dest + image.width() * image.height() * 4; dest != dest_end; dest += 4, src += 4) {
486 dest[0] = src[2];
487 dest[1] = src[1];
488 dest[2] = src[0];
489 dest[3] = src[3];
490 }
491 }
492
493 if(FAILED(ppTexture->UnlockRect(0))) {
494 ppTexture->Release();
495 throw Texture_Init_Failure();
496 }
497
498 if(FAILED(Video_DX9::D3DXFilterTexture()(ppTexture, 0, D3DX_DEFAULT, D3DX_DEFAULT))) {
499 ppTexture->Release();
500 throw Texture_Init_Failure();
501 }
502
503 return ppTexture;
504 }
505
506 void Texture_DX9::load(const String &filename) const {
507 //Video_DX9 &vr = reinterpret_cast<Video_DX9 &>(get_Video());
508
509 //set_sampler_states();
510
511 //if(FAILED(D3DXCreateTextureFromFile(vr.get_d3d_device(), filename.c_str(), &m_texture)))
512 // throw Texture_Init_Failure();
513
514 Image image(filename);
515
516 m_texture = build_from_Image(image);
517 m_size = image.size();
518 }
519 #endif
520 #endif
521
522 }
523
524 #include <Zeni/Undefine.h>
glHint
#define glHint
Definition: gl_mangle.h:918
GL_NICEST
#define GL_NICEST
Definition: gl2.h:229
glTexParameteri
#define glTexParameteri
Definition: gl_mangle.h:1763
D3DFMT_D16
Definition: d3d9types.h:1390
GL_TRUE
#define GL_TRUE
Definition: gl2.h:51
Zeni::Point2i::y
Sint32 y
Definition: Coordinate.h:94
D3DTADDRESS_CLAMP
Definition: d3d9types.h:250
GLEW_VERSION_1_4
#define GLEW_VERSION_1_4
Definition: glew.h:1602
GL_LINEAR_MIPMAP_LINEAR
#define GL_LINEAR_MIPMAP_LINEAR
Definition: gl2.h:316
GLU.h
Zeni::Database_Entry_Not_Found
Definition: Database.h:142
GL_LUMINANCE_ALPHA
#define GL_LUMINANCE_ALPHA
Definition: gl2.h:250
D3DPOOL_MANAGED
Definition: d3d9types.h:1489
Zeni::Video_DX9
The Direct3D9 Rendering System.
Definition: Video_DX9.h:62
GL_MODULATE
#define GL_MODULATE
Definition: glew_head.h:620
Zeni::gluBuild2DMipmaps
GLint gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data)
Definition: GLU.cpp:22
GL_TEXTURE_ENV_MODE
#define GL_TEXTURE_ENV_MODE
Definition: glew_head.h:622
Zeni::Video_DX9::get_d3d_device
LPDIRECT3DDEVICE9 & get_d3d_device()
See DirectX Documentation for details.
Definition: Video_DX9.hxx:48
Zeni::Sprite::insert_frame
void insert_frame(const String &name, const int &at_this_index)
Insert a frame.
Definition: Texture.cpp:70
Zeni::Frame_Out_of_Range
Definition: Texture.h:180
GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE
Definition: gl2.h:375
GLenum
unsigned int GLenum
Definition: gl2.h:23
Zeni::Image::RGB
Definition: Image.h:54
Zeni::Texture_DX9::Video_DX9
friend class Video_DX9
Definition: Texture.h:149
D3DUSAGE_AUTOGENMIPMAP
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:1596
Zeni::Image::RGBA
Definition: Image.h:54
GL_TEXTURE_2D
#define GL_TEXTURE_2D
Definition: gl2.h:145
Zeni::Video::get_lighting
static bool get_lighting()
Determine whether dynamic lighting is enabled.
Definition: Video.hxx:41
memmove
#define memmove
Definition: SDL_qsort.c:81
Zeni::Textures::get_anisotropic_filtering
static int get_anisotropic_filtering()
Check the current level of anisotropy.
Definition: Textures.hxx:40
Zeni::Image::get_data
const Uint8 * get_data() const
Get access to the raw image data.
Definition: Image.hxx:29
glTexEnvf
#define glTexEnvf
Definition: gl_mangle.h:1741
Zeni::Database::get_id
unsigned long get_id(const String &name) const
Get an id by name, possibly throwing an Error.
Definition: Database.hxx:172
height
EGLSurface EGLint EGLint EGLint EGLint height
Definition: eglext.h:293
GL_LUMINANCE
#define GL_LUMINANCE
Definition: gl2.h:249
D3DTEXF_POINT
Definition: d3d9types.h:631
GL_RGB
#define GL_RGB
Definition: gl2.h:247
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
D3DSAMP_MINFILTER
Definition: d3d9types.h:513
GL_TEXTURE_MAG_FILTER
#define GL_TEXTURE_MAG_FILTER
Definition: gl2.h:319
D3DTSS_COLOROP
Definition: d3d9types.h:480
Zeni::Image::tileable
bool tileable() const
Determine if the given Image is tileable.
Definition: Image.hxx:49
Undefine.h
UINT
typedef UINT(WINAPI *PFNWGLGETCONTEXTGPUIDAMDPROC)(HGLRC hglrc)
Zeni::Texture_Init_Failure
Definition: Texture.h:176
glTexImage2D
#define glTexImage2D
Definition: gl_mangle.h:1753
Zeni::Sprite::Sprite
Sprite()
Definition: Texture.cpp:32
glDeleteFramebuffersEXT
#define glDeleteFramebuffersEXT
Definition: glew.h:9002
Zeni::Image
Image.
Definition: Image.h:52
GL_REPEAT
#define GL_REPEAT
Definition: gl2.h:374
Zeni::Sprite::operator=
Sprite & operator=(const Sprite &rhs)
Definition: Texture.cpp:45
image
EGLImageKHR image
Definition: eglext.h:88
d3dx9.h
Zeni::Texture_GL::~Texture_GL
virtual ~Texture_GL()
Definition: Texture.cpp:186
ZENI_LOGW
void ZENI_LOGW(const Zeni::String &str)
Definition: Android.h:56
Zeni::String
Definition: String.h:29
GL_PERSPECTIVE_CORRECTION_HINT
#define GL_PERSPECTIVE_CORRECTION_HINT
Definition: glew_head.h:417
D3DX_DEFAULT
#define D3DX_DEFAULT
Definition: d3dx9.h:21
_D3DLOCKED_RECT
Definition: d3d9types.h:1723
D3DTSS_COLORARG1
Definition: d3d9types.h:481
D3DFORMAT
enum _D3DFORMAT D3DFORMAT
D3DSAMP_ADDRESSV
Definition: d3d9types.h:509
Zeni::Texture
An Abstraction of a Texture.
Definition: Texture.h:61
D3DTOP_MODULATE
Definition: d3d9types.h:559
Zeni::Sprite::set_current_frame
void set_current_frame(const int &frame_number)
Set this frame.
Definition: Texture.cpp:112
D3DUSAGE_RENDERTARGET
#define D3DUSAGE_RENDERTARGET
Definition: d3d9types.h:1580
first
GLint first
Definition: gl2ext.h:1011
GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_MIN_FILTER
Definition: gl2.h:320
GL_TEXTURE_ENV
#define GL_TEXTURE_ENV
Definition: glew_head.h:624
D3DTSS_ALPHAOP
Definition: d3d9types.h:483
Zeni::Texture_DX9::~Texture_DX9
virtual ~Texture_DX9()
Definition: Texture.cpp:362
D3DTADDRESS_WRAP
Definition: d3d9types.h:248
int
int
Definition: SDL_systhread.c:37
Define.h
Zeni::Sprite::apply_Texture
virtual void apply_Texture() const
Apply the current Texture frame to upcoming polygons.
Definition: Texture.cpp:119
Zeni::Sprite::find_frame
int find_frame(const String &name, const int &starting_point=0) const
Search for a frame.
Definition: Texture.cpp:60
width
EGLSurface EGLint EGLint EGLint width
Definition: eglext.h:293
Zeni::Video_DX9::get_maximum_anisotropy
int get_maximum_anisotropy() const
Get the current level of anisotrophy.
Definition: Video_DX9.cpp:254
D3DPOOL_DEFAULT
Definition: d3d9types.h:1488
sort_controllers.filename
string filename
Definition: sort_controllers.py:8
glEnable
#define glEnable
Definition: gl_mangle.h:441
glDeleteTextures
#define glDeleteTextures
Definition: gl_mangle.h:371
Zeni::Image::Luminance
Definition: Image.h:54
Zeni::Sprite::append_frame
void append_frame(const String &name)
Add a frame to the Sprite.
Definition: Texture.cpp:52
glGenTextures
#define glGenTextures
Definition: gl_mangle.h:575
Zeni::Video_DX9::D3DXCreateRenderToSurface
static D3DXCreateRenderToSurface_fcn D3DXCreateRenderToSurface()
Definition: Video_DX9.h:114
GL_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_TEXTURE_MAX_ANISOTROPY_EXT
Definition: gl2ext.h:405
glDeleteRenderbuffersEXT
#define glDeleteRenderbuffersEXT
Definition: glew.h:9003
Zeni::Image::color_space
Color_Space color_space() const
Determine the Color_Space of the raw image data.
Definition: Image.hxx:25
format
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl2ext.h:845
D3DTA_TFACTOR
#define D3DTA_TFACTOR
Definition: d3d9types.h:618
GL_GENERATE_MIPMAP
#define GL_GENERATE_MIPMAP
Definition: glew.h:1474
Zeni::Sprite::remove_frame
void remove_frame(const int &frame_number)
Remove a frame.
Definition: Texture.cpp:90
Zeni::Video_DX9::D3DXCreateTexture
static D3DXCreateTexture_fcn D3DXCreateTexture()
Definition: Video_DX9.h:115
Zeni::Video_DX9::D3DXFilterTexture
static D3DXFilterTexture_fcn D3DXFilterTexture()
Definition: Video_DX9.h:116
D3DSAMP_MAXANISOTROPY
Definition: d3d9types.h:517
D3DSAMP_MIPFILTER
Definition: d3d9types.h:514
ZENI_LOGE
void ZENI_LOGE(const Zeni::String &str)
Definition: Android.h:59
GL_LINEAR
#define GL_LINEAR
Definition: gl2.h:308
Zeni::get_Textures
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
GL_INVALID_ENUM
#define GL_INVALID_ENUM
Definition: gl2.h:158
Zeni::Sprite
Definition: Texture.h:77
D3DFMT_A8R8G8B8
Definition: d3d9types.h:1343
GL_RGBA
#define GL_RGBA
Definition: gl2.h:248
Zeni::Textures::apply_Texture
void apply_Texture(const String &name)
Apply a texture for upcoming polygons (Called by Video::apply_Texture)
Definition: Textures.cpp:68
glGetError
#define glGetError
Definition: gl_mangle.h:643
Zeni::Image::width
int width() const
Get the number of pixels in the image in the x-direction.
Definition: Image.hxx:41
D3DTEXF_ANISOTROPIC
Definition: d3d9types.h:633
GLuint
unsigned int GLuint
Definition: gl2.h:32
Zeni::Sprite_Containing_Sprite
Definition: Texture.h:184
Zeni::Sprite::get_current_frame
int get_current_frame() const
Get the currently selected frame number.
Definition: Texture.cpp:106
Zeni::Texture_GL::apply_Texture
virtual void apply_Texture() const
Apply a Texture to upcoming polygons.
Definition: Texture.cpp:204
Zeni::Point2i::x
Sint32 x
Definition: Coordinate.h:94
swap
void swap(Zeni::String &lhs, Zeni::String &rhs)
Definition: String.cpp:578
memcpy
#define memcpy
Definition: SDL_malloc.c:634
D3DTEXF_NONE
Definition: d3d9types.h:630
GL_TEXTURE_WRAP_T
#define GL_TEXTURE_WRAP_T
Definition: gl2.h:322
D3DFMT_L8
Definition: d3d9types.h:1363
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
D3DFMT_UNKNOWN
Definition: d3d9types.h:1340
DWORD
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
GL_UNSIGNED_BYTE
#define GL_UNSIGNED_BYTE
Definition: gl2.h:236
GL_TEXTURE_WRAP_S
#define GL_TEXTURE_WRAP_S
Definition: gl2.h:321
Zeni::Sprite::get_num_frames
int get_num_frames() const
Get the number of frames.
Definition: Texture.cpp:102
Zeni::Image::height
int height() const
Get the number of pixels in the image in the y-direction.
Definition: Image.hxx:45
IDirect3DTexture9
interface IDirect3DTexture9 IDirect3DTexture9
Definition: d3d9.h:264
Zeni::Texture::m_repeat
const bool m_repeat
Definition: Texture.h:74
end
GLuint GLuint end
Definition: glew.h:1239
Zeni::Textures::set_texturing_mode
static void set_texturing_mode(const int &anisotropic_filtering_, const bool &bilinear_filtering_, const bool &mipmapping_)
Check to see if Textures is set to use lazy loading if possible.
Definition: Textures.cpp:104
_D3DLOCKED_RECT::pBits
void * pBits
Definition: d3d9types.h:1726
D3DSAMP_ADDRESSU
Definition: d3d9types.h:508
glBindTexture
#define glBindTexture
Definition: gl_mangle.h:98
Zeni::get_Video
Video & get_Video()
Get access to the singleton.
Definition: Video.cpp:149
GLvoid
void GLvoid
Definition: gl2.h:21
D3DFMT_A8B8G8R8
Definition: d3d9types.h:1354
src
GLenum src
Definition: glew.h:2396
Zeni::Textures::get_mipmapping
static bool get_mipmapping()
Check if mipmapping is in use.
Definition: Textures.hxx:32
i
int i
Definition: pngrutil.c:1377
D3DTA_DIFFUSE
#define D3DTA_DIFFUSE
Definition: d3d9types.h:615
Zeni::Textures::get_bilinear_filtering
static bool get_bilinear_filtering()
Check if bilinear filtering is in use.
Definition: Textures.hxx:28
zeni_graphics.h
glDeleteBuffers
GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers)
Zeni::Texture_DX9::apply_Texture
virtual void apply_Texture() const
Apply a Texture to upcoming polygons.
Definition: Texture.cpp:370
D3DTSS_ALPHAARG1
Definition: d3d9types.h:484
GL_NEAREST_MIPMAP_NEAREST
#define GL_NEAREST_MIPMAP_NEAREST
Definition: gl2.h:313
D3DTEXF_LINEAR
Definition: d3d9types.h:632
false
#define false
Definition: ftrandom.c:50
GL_NEAREST
#define GL_NEAREST
Definition: gl2.h:307
size_t
unsigned int size_t
Definition: SDL_config_windows.h:67
Zeni::Image::Luminance_Alpha
Definition: Image.h:54
D3DSAMP_MAGFILTER
Definition: d3d9types.h:512
size
GLsizei size
Definition: gl2ext.h:1467
Zeni::Point2i
A 2D Point represented with integers.
Definition: Coordinate.h:85