Oolite
Loading...
Searching...
No Matches
OOTexture Class Reference

#include <OOTexture.h>

Inheritance diagram for OOTexture:
Collaboration diagram for OOTexture:

Instance Methods

(void) - apply
(void) - ensureFinishedLoading
(BOOL) - isFinishedLoading
(NSString *) - cacheKey
(NSSize) - dimensions
(NSSize) - originalDimensions
(BOOL) - isMipMapped
(OOPixMap) - copyPixMapRepresentation
(BOOL) - isRectangleTexture
(BOOL) - isCubeMap
(NSSize) - texCoordsScale
(GLint) - glTextureName
(id) - init [implementation]
(void) - dealloc [implementation]
(void) - forceRebind [implementation]
(void) - addToCaches [implementation]
(void) - removeFromCaches [implementation]
Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
(id) - weakRetain [implementation]
(void) - weakRefDied: [implementation]
Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED

Class Methods

(id) + textureWithName:inFolder:options:anisotropy:lodBias:
(id) + textureWithName:inFolder:
(id) + textureWithConfiguration:
(id) + textureWithConfiguration:extraOptions:
(id) + nullTexture
(id) + textureWithGenerator:
(id) + textureWithGenerator:enqueue:
(void) + applyNone
(void) + clearCache
(void) + rebindAllTextures
(OOTexture *) + existingTextureForKey: [implementation]
(void) + checkExtensions [implementation]

Additional Inherited Members

Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Detailed Description

Definition at line 109 of file OOTexture.h.

Method Documentation

◆ addToCaches

- (void) addToCaches
implementation

Provided by category OOTexture(SubclassInterface).

Definition at line 412 of file OOTexture.m.

413{
414#ifndef OOTEXTURE_NO_CACHE
415 NSString* cacheKey = [self cacheKey];
416 if (cacheKey == nil)
417 return;
418
419 // Add self to in-use textures cache, wrapped in an NSValue so the texture isn't retained by the cache.
421 sLiveTextureCache = [[NSMutableDictionary alloc] init];
422
423 SET_TRACE_CONTEXT(@"in-use textures cache - SHOULD NOT RETAIN");
424 [sLiveTextureCache setObject:[NSValue valueWithPointer:self] forKey:cacheKey];
426
427 // Add self to recent textures cache.
429 sRecentTextures = [[OOCache alloc] init];
430 [sRecentTextures setName:@"recent textures"];
432 [sRecentTextures setPruneThreshold:kRecentTexturesCount];
433 }
434
435 SET_TRACE_CONTEXT(@"adding to recent textures cache");
436 [sRecentTextures setObject:self forKey:cacheKey];
438#endif
439}
#define EXPECT_NOT(x)
return nil
#define CLEAR_TRACE_CONTEXT()
Definition OOTexture.m:128
#define SET_TRACE_CONTEXT(str)
Definition OOTexture.m:124
static OOCache * sRecentTextures
Definition OOTexture.m:94
static NSMutableDictionary * sLiveTextureCache
Definition OOTexture.m:92
void setPruneThreshold:(unsigned threshold)
Definition OOCache.m:279
void setName:(NSString *name)
Definition OOCache.m:350
void setAutoPrune:(BOOL flag)
Definition OOCache.m:294
void setObject:forKey:(id value,[forKey] id key)
Definition OOCache.m:256
NSString * cacheKey()
Definition OOTexture.m:287

References OOTexture(OOPrivate)::addToCaches, cacheKey, CLEAR_TRACE_CONTEXT, EXPECT_NOT, nil, SET_TRACE_CONTEXT, OOCache::setAutoPrune:, OOCache::setName:, OOCache::setObject:forKey:, OOCache::setPruneThreshold:, sLiveTextureCache, and sRecentTextures.

Referenced by OOTexture(OOPrivate)::addToCaches, and OOConcreteTexture::initWithLoader:key:options:anisotropy:lodBias:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply

- (void) apply

Reimplemented in OOConcreteTexture, and OONullTexture.

Provided by category OOTexture(SubclassResponsibilities).

Definition at line 258 of file OOTexture.m.

259{
261}
#define OOLogGenericSubclassResponsibility()
Definition OOLogging.h:141

References apply, and OOLogGenericSubclassResponsibility.

Referenced by apply, OOTextureSprite::blitToX:Y:Z:alpha:, OOSingleTextureMaterial::doApply, DustEntity::drawImmediate:translucent:, OOLaserShotEntity::drawImmediate:translucent:, OOLightParticleEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, HeadUpDisplay(Private)::drawScannerZoomIndicator:, OOExhaustPlumeEntity::drawSubEntityImmediate:translucent:, OOTrumble::drawTrumble:, PlanetEntity::drawUnconditionally, HeadUpDisplay::OODrawPlanetInfo, HeadUpDisplay::OOStartDrawingStrings, and OOSkyQuadSet::render.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyNone

+ (void) applyNone

Definition at line 263 of file OOTexture.m.

264{
266 OOGL(glBindTexture(GL_TEXTURE_2D, 0));
267#if OO_TEXTURE_CUBE_MAP
269 OOGL(glBindTexture(GL_TEXTURE_CUBE_MAP, 0));
270#endif
271
272#if GL_EXT_texture_lod_bias
274 OOGL(glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0));
275#endif
276}
#define OO_ENTER_OPENGL()
#define OOGL(statement)
Definition OOOpenGL.h:262
BOOL OOCubeMapsAvailable(void)
Definition OOTexture.m:643
OOTextureInfo gOOTextureInfo
Definition OOTexture.m:97
unsigned textureLODBiasAvailable

References applyNone, gOOTextureInfo, OO_ENTER_OPENGL, OOCubeMapsAvailable(), and OOGL.

Referenced by OONullTexture::apply, applyNone, OOBasicMaterial::doApply, GuiDisplayGen(Internal)::drawGLDisplay:y:z:alpha:, HeadUpDisplay(Private)::drawScannerZoomIndicator:, PlanetEntity::drawUnconditionally, HeadUpDisplay::OODrawPlanetInfo, HeadUpDisplay::OOStopDrawingStrings, and OOSingleTextureMaterial::unapplyWithNext:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cacheKey

- (NSString *) cacheKey

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 287 of file OOTexture.m.

288{
289 return nil;
290}

References cacheKey, nil, and textureWithConfiguration:extraOptions:.

Referenced by OOTexture(OOPrivate)::addToCaches, cacheKey, and OOTexture(SubclassInterface)::removeFromCaches.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkExtensions

+ (void) checkExtensions
implementation

Provided by category OOTexture(OOPrivate).

Definition at line 481 of file OOTexture.m.

482{
484
485 sCheckedExtensions = YES;
486
487 OOOpenGLExtensionManager* extMgr = [OOOpenGLExtensionManager sharedManager];
488 BOOL ver120 = [extMgr versionIsAtLeastMajor:1 minor:2];
489 BOOL ver130 = [extMgr versionIsAtLeastMajor:1 minor:3];
490
491#if GL_EXT_texture_filter_anisotropic
492 gOOTextureInfo.anisotropyAvailable = [extMgr haveExtension:@"GL_EXT_texture_filter_anisotropic"];
493 OOGL(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gOOTextureInfo.anisotropyScale));
494 gOOTextureInfo.anisotropyScale *= OOClamp_0_1_f([[NSUserDefaults standardUserDefaults] oo_floatForKey:@"texture-anisotropy-scale" defaultValue:0.5]);
495#endif
496
497#ifdef GL_CLAMP_TO_EDGE
498 gOOTextureInfo.clampToEdgeAvailable = ver120 || [extMgr haveExtension:@"GL_SGIS_texture_edge_clamp"];
499#endif
500
501#if OO_GL_CLIENT_STORAGE
502 gOOTextureInfo.clientStorageAvailable = [extMgr haveExtension:@"GL_APPLE_client_storage"];
503#endif
504
505 gOOTextureInfo.textureMaxLevelAvailable = ver120 || [extMgr haveExtension:@"GL_SGIS_texture_lod"];
506
507#if GL_EXT_texture_lod_bias
508 if ([[NSUserDefaults standardUserDefaults] oo_boolForKey:@"use-texture-lod-bias" defaultValue:YES]) {
509 gOOTextureInfo.textureLODBiasAvailable = [extMgr haveExtension:@"GL_EXT_texture_lod_bias"];
510 } else {
512 }
513#endif
514
515#if GL_EXT_texture_rectangle
516 gOOTextureInfo.rectangleTextureAvailable = [extMgr haveExtension:@"GL_EXT_texture_rectangle"];
517#endif
518
519#if OO_TEXTURE_CUBE_MAP
520 if (![[NSUserDefaults standardUserDefaults] boolForKey:@"disable-cube-maps"]) {
521 gOOTextureInfo.cubeMapAvailable = ver130 || [extMgr haveExtension:@"GL_ARB_texture_cube_map"];
522 } else {
524 }
525
526#endif
527}
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
static BOOL sCheckedExtensions
Definition OOTexture.m:96
BOOL versionIsAtLeastMajor:minor:(unsigned maj,[minor] unsigned min)
OOOpenGLExtensionManager * sharedManager()
BOOL haveExtension:(NSString *extension)
unsigned clientStorageAvailable
unsigned textureMaxLevelAvailable
unsigned anisotropyAvailable
unsigned clampToEdgeAvailable
unsigned cubeMapAvailable
unsigned rectangleTextureAvailable

References checkExtensions, gOOTextureInfo, OOOpenGLExtensionManager::haveExtension:, OO_ENTER_OPENGL, OOClamp_0_1_f(), OOGL, sCheckedExtensions, OOOpenGLExtensionManager::sharedManager, and OOOpenGLExtensionManager::versionIsAtLeastMajor:minor:.

Referenced by checkExtensions, and textureWithName:inFolder:options:anisotropy:lodBias:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCache

+ (void) clearCache

Definition at line 335 of file OOTexture.m.

336{
337 /* Does not clear sAllLiveTextures - that really must refer to all
338 live texture objects.
339 */
340 SET_TRACE_CONTEXT(@"clearing sLiveTextureCache");
341 [sLiveTextureCache autorelease];
343
344 SET_TRACE_CONTEXT(@"clearing sRecentTextures");
345 [sRecentTextures autorelease];
348}

References CLEAR_TRACE_CONTEXT, clearCache, nil, SET_TRACE_CONTEXT, sLiveTextureCache, and sRecentTextures.

Referenced by clearCache, and Universe::reinitAndShowDemo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyPixMapRepresentation

- (struct OOPixMap) copyPixMapRepresentation

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 309 of file OOTexture.m.

310{
311 return kOONullPixMap;
312}
const OOPixMap kOONullPixMap
Definition OOPixMap.m:30

References copyPixMapRepresentation, and kOONullPixMap.

Referenced by copyPixMapRepresentation, and OOCombinedEmissionMapGenerator(Private)::initWithEmissionMapSpec:emissionColor:diffuseMap:diffuseColor:illuminationMapSpec:illuminationColor:isCombinedMap:optionsSpecifier:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOWeakRefObject.

Reimplemented in OOConcreteTexture.

Definition at line 251 of file OOTexture.m.

252{
253 [sAllLiveTextures removeObject:[NSValue valueWithPointer:self]];
254
255 [super dealloc];
256}

References dealloc, and OOWeakRefObject::dealloc.

Referenced by OOConcreteTexture::dealloc, and dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dimensions

- (NSSize) dimensions

Reimplemented in OOConcreteTexture, and OONullTexture.

Provided by category OOTexture(SubclassResponsibilities).

Definition at line 292 of file OOTexture.m.

293{
295 return NSZeroSize;
296}

References dimensions, nil, OOLogGenericSubclassResponsibility, and textureWithName:inFolder:options:anisotropy:lodBias:.

Referenced by HeadUpDisplay::addLegend:, dimensions, HeadUpDisplay(Private)::drawCustomImage:, and originalDimensions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureFinishedLoading

- (void) ensureFinishedLoading

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 278 of file OOTexture.m.

279{
280}

References ensureFinishedLoading, and textureWithName:inFolder:options:anisotropy:lodBias:.

Referenced by PlanetEntity::drawUnconditionally, OOSingleTextureMaterial::ensureFinishedLoading, ensureFinishedLoading, and OOProbabilisticTextureManager::ensureTexturesLoaded.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ existingTextureForKey:

+ (OOTexture *) existingTextureForKey: (NSString*) key
implementation

Provided by category OOTexture(SubclassInterface).

Definition at line 469 of file OOTexture.m.

469 :(NSString*)key
470{
471#ifndef OOTEXTURE_NO_CACHE
472 if (key != nil) {
473 return (OOTexture*)[[sLiveTextureCache objectForKey:key] pointerValue];
474 }
475 return nil;
476#else
477 return nil;
478#endif
479}

References nil.

Referenced by textureWithGenerator:enqueue:, and textureWithName:inFolder:options:anisotropy:lodBias:.

Here is the caller graph for this function:

◆ forceRebind

- (void) forceRebind
implementation

Reimplemented in OOConcreteTexture, and OONullTexture.

Provided by category OOTexture(SubclassResponsibilities).

Definition at line 407 of file OOTexture.m.

References OOTexture(OOPrivate)::forceRebind, and OOLogGenericSubclassResponsibility.

Referenced by OOTexture(OOPrivate)::existingTextureForKey:, and OOTexture(OOPrivate)::forceRebind.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ glTextureName

- (GLint) glTextureName

Reimplemented in OOConcreteTexture.

Definition at line 329 of file OOTexture.m.

330{
332 return 0;
333}

References glTextureName, and OOLogGenericSubclassResponsibility.

Referenced by glTextureName.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init

- (id) init
implementation

Definition at line 240 of file OOTexture.m.

241{
242 if ((self = [super init])) {
244 sAllLiveTextures = [[NSMutableSet alloc] init];
245 [sAllLiveTextures addObject:[NSValue valueWithPointer:self]];
246 }
247
248 return self;
249}
static NSMutableSet * sAllLiveTextures
Definition OOTexture.m:93

References EXPECT_NOT, init, nil, and sAllLiveTextures.

Referenced by init, and OOConcreteTexture::initWithLoader:key:options:anisotropy:lodBias:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCubeMap

- (BOOL) isCubeMap

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 319 of file OOTexture.m.

320{
321 return NO;
322}

References isCubeMap.

Referenced by isCubeMap, and OOSingleTextureMaterial::wantsNormalsAsTextureCoordinates.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFinishedLoading

- (BOOL) isFinishedLoading

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 282 of file OOTexture.m.

283{
284 return YES;
285}

References isFinishedLoading.

Referenced by OOSingleTextureMaterial::isFinishedLoading, and isFinishedLoading.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMipMapped

- (BOOL) isMipMapped

Reimplemented in OOConcreteTexture, and OONullTexture.

Definition at line 303 of file OOTexture.m.

304{
306 return NO;
307}

References isMipMapped, and OOLogGenericSubclassResponsibility.

Referenced by isMipMapped.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isRectangleTexture

- (BOOL) isRectangleTexture

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 314 of file OOTexture.m.

315{
316 return NO;
317}

References isRectangleTexture.

Referenced by isRectangleTexture.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nullTexture

+ (id) nullTexture

Definition at line 204 of file OOTexture.m.

205{
207}
OONullTexture * sharedNullTexture()

References nullTexture, and OONullTexture::sharedNullTexture.

Referenced by nullTexture.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ originalDimensions

- (NSSize) originalDimensions

Reimplemented in OOConcreteTexture.

Definition at line 298 of file OOTexture.m.

299{
300 return [self dimensions];
301}

References dimensions, and originalDimensions.

Referenced by OOTextureSprite::initWithTexture:, GuiDisplayGen::NewTextureSpriteWithDescriptor, and originalDimensions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rebindAllTextures

+ (void) rebindAllTextures

Definition at line 350 of file OOTexture.m.

351{
352 NSEnumerator* textureEnum = nil;
353 id texture = nil;
354
355 // Keeping around unused, cached textures is unhelpful at this point.
357
358 for (textureEnum = [sAllLiveTextures objectEnumerator]; (texture = [[textureEnum nextObject] pointerValue]);) {
359 [texture forceRebind];
360 }
361}
#define DESTROY(x)

References DESTROY, nil, rebindAllTextures, sAllLiveTextures, and sRecentTextures.

Referenced by rebindAllTextures, and OOGraphicsResetManager::resetGraphicsState.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromCaches

- (void) removeFromCaches
implementation

Provided by category OOTexture(SubclassInterface).

Definition at line 441 of file OOTexture.m.

442{
443#ifndef OOTEXTURE_NO_CACHE
444 NSString* cacheKey = [self cacheKey];
445 if (cacheKey == nil)
446 return;
447
448 [sLiveTextureCache removeObjectForKey:cacheKey];
449 if (EXPECT_NOT([sRecentTextures objectForKey:cacheKey] == self)) {
450 /* Experimental for now: I think the recent crash problems may
451 * be because if the last reference to a texture is in
452 * sRecentTextures, and the texture is regenerated, it
453 * replaces the texture, causing a release. Therefore, if this
454 * texture *isn't* overretained in the texture cache, the 2009
455 * crash avoider will delete its replacement from the cache
456 * ... possibly before that texture has been fully added to
457 * the cache itself. So, the texture is only removed from the
458 * cache by key if it was in it with that key. The extra time
459 * needed to generate a planet texture compared with loading a
460 * standard one may be why this problem shows up. - CIM 20140122
461 */
462 NSAssert2(0, @"Texture retain count error for %@; cacheKey is %@.", self, cacheKey); // miscount in autorelease
463 // The following line is needed in order to avoid crashes when there's a 'texture retain count error'. Please do not delete. -- Kaks 20091221
464 [sRecentTextures removeObjectForKey:cacheKey]; // make sure there's no reference left inside sRecentTexture ( was a show stopper for 1.73)
465 }
466#endif
467}
void removeObjectForKey:(id key)
Definition OOCache.m:269

References cacheKey, EXPECT_NOT, nil, OOTexture(SubclassInterface)::removeFromCaches, OOCache::removeObjectForKey:, and sRecentTextures.

Referenced by OOConcreteTexture::dealloc, and OOTexture(SubclassInterface)::removeFromCaches.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ texCoordsScale

- (NSSize) texCoordsScale

Reimplemented in OOConcreteTexture.

Provided by category OOTexture(SubclassOptional).

Definition at line 324 of file OOTexture.m.

325{
326 return NSMakeSize(1.0, 1.0);
327}

References texCoordsScale.

Referenced by texCoordsScale.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textureWithConfiguration:

+ (id) textureWithConfiguration: (id) configuration

Definition at line 186 of file OOTexture.m.

186 :(id)configuration
187{
188 return [self textureWithConfiguration:configuration extraOptions:0];
189}

Referenced by OOSingleTextureMaterial::initWithName:configuration:.

Here is the caller graph for this function:

◆ textureWithConfiguration:extraOptions:

+ (id) textureWithConfiguration: (id) configuration
extraOptions: (OOTextureFlags) extraOptions 

Definition at line 191 of file OOTexture.m.

191 :(id)configuration extraOptions:(OOTextureFlags)extraOptions
192{
193 NSString* name = nil;
194 OOTextureFlags options = 0;
195 GLfloat anisotropy = 0.0f;
196 GLfloat lodBias = 0.0f;
197
198 if (!OOInterpretTextureSpecifier(configuration, &name, &options, &anisotropy, &lodBias, NO))
199 return nil;
200
201 return [self textureWithName:name inFolder:@"Textures" options:options | extraOptions anisotropy:anisotropy lodBias:lodBias];
202}
uint32_t OOTextureFlags
Definition OOTexture.h:95
BOOL OOInterpretTextureSpecifier(id specifier, NSString **outName, OOTextureFlags *outOptions, float *outAnisotropy, float *outLODBias, BOOL ignoreExtract)
Definition OOTexture.m:648

Referenced by OOTexture(SubclassOptional)::cacheKey, and PlanetEntity(OOPrivate)::loadTexture:.

Here is the caller graph for this function:

◆ textureWithGenerator:

+ (id) textureWithGenerator: (OOTextureGenerator*) generator

Definition at line 209 of file OOTexture.m.

209 :(OOTextureGenerator*)generator
210{
211 return [self textureWithGenerator:generator enqueue:NO];
212}

References textureWithGenerator:enqueue:.

Referenced by PlanetEntity(OOPrivate)::cloudTextureWithCloudColor:cloudImpress:cloudBias:, and PlanetEntity(OOPrivate)::planetTextureWithInfo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textureWithGenerator:enqueue:

+ (id) textureWithGenerator: (OOTextureGenerator*) generator
enqueue: (BOOL) enqueue 

Definition at line 214 of file OOTexture.m.

214 :(OOTextureGenerator*)generator enqueue:(BOOL)enqueue
215{
216 if (generator == nil)
217 return nil;
218
219#ifndef OOTEXTURE_NO_CACHE
220 OOTexture* existing = [OOTexture existingTextureForKey:[generator cacheKey]];
221 if (existing != nil && !enqueue)
222 return [[existing retain] autorelease];
223#endif
224
225 if (![generator enqueue]) {
226 OOLogERR(@"texture.generator.queue.failed", @"Failed to queue generator %@", generator);
227 return nil;
228 }
229 OOLog(@"texture.generator.queue", @"Queued texture generator %@", generator);
230
231 OOTexture* result = [[[OOConcreteTexture alloc] initWithLoader:generator
232 key:[generator cacheKey]
233 options:OOApplyTextureOptionDefaults([generator textureOptions])
234 anisotropy:[generator anisotropy]
235 lodBias:[generator lodBias]] autorelease];
236
237 return result;
238}
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
#define OOLog(class, format,...)
Definition OOLogging.h:84
OOTexture * existingTextureForKey:(NSString *key)
Definition OOTexture.m:469

References OOTextureGenerator::anisotropy, OOTextureGenerator::cacheKey, existingTextureForKey:, OOTextureGenerator::lodBias, nil, OOLog, OOLogERR, and OOTextureGenerator::textureOptions.

Referenced by textureWithGenerator:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textureWithName:inFolder:

+ (id) textureWithName: (NSString*) name
inFolder: (NSString*) directory 

Definition at line 176 of file OOTexture.m.

176 :(NSString*)name
177 inFolder:(NSString*)directory
178{
179 return [self textureWithName:name
180 inFolder:directory
181 options:kOOTextureDefaultOptions
182 anisotropy:kOOTextureDefaultAnisotropy
183 lodBias:kOOTextureDefaultLODBias];
184}

References textureWithName:inFolder:options:anisotropy:lodBias:.

Referenced by OOMaterial(OOConvenienceCreators)::materialWithName:cacheKey:materialDictionary:shadersDictionary:macros:bindingTarget:forSmoothedMesh:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textureWithName:inFolder:options:anisotropy:lodBias:

+ (id) textureWithName: (NSString*) name
inFolder: (NSString*) directory
options: (OOTextureFlags) options
anisotropy: (GLfloat) anisotropy
lodBias: (GLfloat) lodBias 

Definition at line 132 of file OOTexture.m.

132 :(NSString*)name
133 inFolder:(NSString*)directory
134 options:(OOTextureFlags)options
135 anisotropy:(GLfloat)anisotropy
136 lodBias:(GLfloat)lodBias
137{
138 NSString* key = nil;
139 OOTexture* result = nil;
140 NSString* path = nil;
141 BOOL noFNF;
142
143 if (EXPECT_NOT(name == nil))
144 return nil;
146 [self checkExtensions];
147
149 anisotropy = 0.0f;
150 }
152 lodBias = 0.0f;
153 }
154
155 noFNF = (options & kOOTextureNoFNFMessage) != 0;
157
158 // Look for existing texture
159 key = OOGenerateTextureCacheKey(directory, name, options, anisotropy, lodBias);
160 result = [OOTexture existingTextureForKey:key];
161 if (result == nil) {
162 path = [ResourceManager pathForFileNamed:name inFolder:directory];
163 if (path == nil) {
164 if (!noFNF)
165 OOLogWARN(kOOLogFileNotFound, @"Could not find texture file \"%@\".", name);
166 return nil;
167 }
168
169 // No existing texture, load texture.
170 result = [[[OOConcreteTexture alloc] initWithPath:path key:key options:options anisotropy:anisotropy lodBias:lodBias] autorelease];
171 }
172
173 return result;
174}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:126
NSString *const kOOLogFileNotFound
Definition OOLogging.m:601
OOTextureFlags OOApplyTextureOptionDefaults(OOTextureFlags options)
Definition OOTexture.m:819
@ kOOTextureNoFNFMessage
Definition OOTexture.h:58
@ kOOTextureMinFilterMask
Definition OOTexture.h:72
@ kOOTextureMinFilterMipMap
Definition OOTexture.h:48
NSString * OOGenerateTextureCacheKey(NSString *directory, NSString *name, OOTextureFlags options, float anisotropy, float lodBias)
Definition OOTexture.m:862
void checkExtensions()
Definition OOTexture.m:481
NSString * pathForFileNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

References checkExtensions, existingTextureForKey:, EXPECT_NOT, gOOTextureInfo, kOOLogFileNotFound, kOOTextureMinFilterMask, kOOTextureMinFilterMipMap, kOOTextureNoFNFMessage, nil, OOApplyTextureOptionDefaults(), OOGenerateTextureCacheKey(), OOLogWARN, ResourceManager::pathForFileNamed:inFolder:, and sCheckedExtensions.

Referenced by HeadUpDisplay::addLegend:, OOTexture(SubclassResponsibilities)::dimensions, HeadUpDisplay(Private)::drawCustomImage:, OOTexture(SubclassOptional)::ensureFinishedLoading, DustEntity::init, OOExplosionCloudEntity(OOPrivate)::initExplosionCloudWithEntity:size:andSettings:, HeadUpDisplay::InitTextEngine(void), OOProbabilisticTextureManager::initWithPListName:options:anisotropy:lodBias:seed:, OOTrumble::setupForPlayer:digram:, OOExhaustPlumeEntity::setUpTexture, OOFlashEffectEntity::setUpTexture, OOLaserShotEntity::setUpTexture, OOLightParticleEntity::setUpTexture, GuiDisplayGen::TextureForGUITexture, and textureWithName:inFolder:.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: