Oolite
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#pragma once
31
33#import "OOTexture.h"
34
35@interface OOTexture (SubclassInterface)
36
37- (void)addToCaches;
38- (void)removeFromCaches; // Must be called on -dealloc (while -cacheKey is still valid) for cacheable textures.
39
40+ (OOTexture*)existingTextureForKey:(NSString*)key;
41
42@end
43
44@interface OOTexture (SubclassResponsibilities)
45
46- (void)apply;
47- (NSSize)dimensions;
48
49- (void)forceRebind;
50
51@end
52
53@interface OOTexture (SubclassOptional)
54
55- (void)ensureFinishedLoading; // Default: does nothing
56- (BOOL)isFinishedLoading; // Default: YES
57- (NSString*)cacheKey; // Default: nil
58- (BOOL)isRectangleTexture; // Default: NO
59- (BOOL)isCubeMap; // Default: NO
60- (NSSize)texCoordsScale; // Default: 1,1
61- (struct OOPixMap)copyPixMapRepresentation; // Default: kOONullPixMap
62
63@end
64
65/* OOGenerateTextureCacheKey()
66 OOTextureCacheKeyForSpecifier()
67
68 Generate texture cache keys of the form used by normal file-based textures.
69 */
70NSString* OOGenerateTextureCacheKey(NSString* directory, NSString* name, OOTextureFlags options, float anisotropy, float lodBias);
71NSString* OOTextureCacheKeyForSpecifier(id specifier);
72
83
85
86#ifndef GL_EXT_texture_filter_anisotropic
87#warning GL_EXT_texture_filter_anisotropic unavailable -- are you using an up-to-date glext.h?
88#endif
89
90#ifndef GL_CLAMP_TO_EDGE
91#ifdef GL_SGIS_texture_edge_clamp
92#define GL_CLAMP_TO_EDGE GL_CLAMP_TO_EDGE_SGIS
93#else
94#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?
95#define GL_CLAMP_TO_EDGE GL_CLAMP
96#endif
97#endif
98
99#if defined(GL_APPLE_client_storage) && !OOTEXTURE_RELOADABLE
100#define OO_GL_CLIENT_STORAGE (1)
101#define EnableClientStorage() OOGL(glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE))
102#else
103#define OO_GL_CLIENT_STORAGE (0)
104#define EnableClientStorage() \
105 do { \
106 } while (0)
107#endif
108
109#ifndef GL_TEXTURE_MAX_LEVEL
110#ifdef GL_TEXTURE_MAX_LEVEL_SGIS
111#define GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MAX_LEVEL_SGIS
112#else
113#define GL_TEXTURE_MAX_LEVEL 0x813D
114#endif
115#endif
116
117#if OO_TEXTURE_CUBE_MAP
118#ifndef GL_TEXTURE_CUBE_MAP
119#define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_ARB
120#define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
121#endif
122#endif
struct OOTextureInfo OOTextureInfo
uint32_t OOTextureFlags
Definition OOTexture.h:95
NSString * OOTextureCacheKeyForSpecifier(id specifier)
Definition OOTexture.m:875
NSString * OOGenerateTextureCacheKey(NSString *directory, NSString *name, OOTextureFlags options, float anisotropy, float lodBias)
Definition OOTexture.m:862
OOTextureInfo gOOTextureInfo
Definition OOTexture.m:97
struct OOPixMap copyPixMapRepresentation()
Definition OOTexture.m:309
unsigned clientStorageAvailable
unsigned textureMaxLevelAvailable
unsigned anisotropyAvailable
unsigned clampToEdgeAvailable
unsigned cubeMapAvailable
unsigned rectangleTextureAvailable
unsigned textureLODBiasAvailable