Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOTextureInternal.h
Go to the documentation of this file.
1/*
2
3OOTextureInternal.h
4
5Subclass interface for OOTexture.
6
7
8Copyright (C) 2007-2013 Jens Ayton and contributors
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files (the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26SOFTWARE.
27
28*/
29
30#import "OOTexture.h"
32
33
34@interface OOTexture (SubclassInterface)
35
36- (void) addToCaches;
37- (void) removeFromCaches; // Must be called on -dealloc (while -cacheKey is still valid) for cacheable textures.
38
39+ (OOTexture *) existingTextureForKey:(NSString *)key;
40
41@end
42
43
44@interface OOTexture (SubclassResponsibilities)
45
46- (void)apply;
47- (NSSize)dimensions;
48
49
50- (void) forceRebind;
51
52@end
53
54
55@interface OOTexture (SubclassOptional)
56
57- (void)ensureFinishedLoading; // Default: does nothing
58- (BOOL) isFinishedLoading; // Default: YES
59- (NSString *) cacheKey; // Default: nil
60- (BOOL) isRectangleTexture; // Default: NO
61- (BOOL) isCubeMap; // Default: NO
62- (NSSize)texCoordsScale; // Default: 1,1
63- (struct OOPixMap) copyPixMapRepresentation; // Default: kOONullPixMap
64
65@end
66
67
68/* OOGenerateTextureCacheKey()
69 OOTextureCacheKeyForSpecifier()
70
71 Generate texture cache keys of the form used by normal file-based textures.
72 */
73NSString *OOGenerateTextureCacheKey(NSString *directory, NSString *name, OOTextureFlags options, float anisotropy, float lodBias);
74NSString *OOTextureCacheKeyForSpecifier(id specifier);
75
76
88
90
91
92#ifndef GL_EXT_texture_filter_anisotropic
93#warning GL_EXT_texture_filter_anisotropic unavailable -- are you using an up-to-date glext.h?
94#endif
95
96#ifndef GL_CLAMP_TO_EDGE
97#ifdef GL_SGIS_texture_edge_clamp
98#define GL_CLAMP_TO_EDGE GL_CLAMP_TO_EDGE_SGIS
99#else
100#warning GL_CLAMP_TO_EDGE (OpenGL 1.2) and GL_SGIS_texture_edge_clamp are unavailable -- are you using an up-to-date gl.h?
101#define GL_CLAMP_TO_EDGE GL_CLAMP
102#endif
103#endif
104
105#if defined(GL_APPLE_client_storage) && !OOTEXTURE_RELOADABLE
106#define OO_GL_CLIENT_STORAGE (1)
107#define EnableClientStorage() OOGL(glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE))
108#else
109#define OO_GL_CLIENT_STORAGE (0)
110#define EnableClientStorage() do {} while (0)
111#endif
112
113
114#ifndef GL_TEXTURE_MAX_LEVEL
115#ifdef GL_TEXTURE_MAX_LEVEL_SGIS
116#define GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MAX_LEVEL_SGIS
117#else
118#define GL_TEXTURE_MAX_LEVEL 0x813D
119#endif
120#endif
121
122
123#if OO_TEXTURE_CUBE_MAP
124#ifndef GL_TEXTURE_CUBE_MAP
125#define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_ARB
126#define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
127#endif
128#endif
129
struct OOTextureInfo OOTextureInfo
uint32_t OOTextureFlags
Definition OOTexture.h:98
NSString * OOTextureCacheKeyForSpecifier(id specifier)
Definition OOTexture.m:924
NSString * OOGenerateTextureCacheKey(NSString *directory, NSString *name, OOTextureFlags options, float anisotropy, float lodBias)
Definition OOTexture.m:908
OOTextureInfo gOOTextureInfo
Definition OOTexture.m:101
unsigned clientStorageAvailable
unsigned textureMaxLevelAvailable
unsigned anisotropyAvailable
unsigned clampToEdgeAvailable
unsigned cubeMapAvailable
unsigned rectangleTextureAvailable
unsigned textureLODBiasAvailable