34static NSString *
const kStageName =
@"Testing textures and images";
37@interface OOTextureVerifierStage (OOPrivate)
39- (void)checkTextureNamed:(NSString *)name inFolder:(NSString *)folder;
51 _usedTextures = [[NSMutableSet alloc] init];
59 [_usedTextures release];
65+ (NSString *)nameForReverseDependencyForVerifier:(
OOOXPVerifier *)verifier
79 return [_usedTextures count] != 0 || [[[
self verifier] fileScannerStage] filesInFolder:@"Images"] !=
nil;
85 NSEnumerator *nameEnum =
nil;
87 NSAutoreleasePool *pool =
nil;
89 for (nameEnum = [_usedTextures objectEnumerator]; (name = [nameEnum nextObject]); )
91 pool = [[NSAutoreleasePool alloc] init];
92 [
self checkTextureNamed:name inFolder:@"Textures"];
95 [_usedTextures release];
99 nameEnum = [[[[
self verifier] fileScannerStage] filesInFolder:@"Images"] objectEnumerator];
100 while ((name = [nameEnum nextObject]))
102 [
self checkTextureNamed:name inFolder:@"Images"];
107- (void) textureNamed:(NSString *)name usedInContext:(NSString *)context
111 if (name ==
nil)
return;
112 if ([_usedTextures containsObject:name])
return;
113 [_usedTextures addObject:name];
115 fileScanner = [[
self verifier] fileScannerStage];
116 if (![fileScanner fileExists:name
118 referencedFrom:context
121 OOLog(
@"verifyOXP.texture.notFound",
@"----- WARNING: texture \"%@\
" referenced in %@ could not be found in %@ or in Oolite.", name, context, [[
self verifier] oxpDisplayName]);
128@implementation OOTextureVerifierStage (OOPrivate)
130- (void)checkTextureNamed:(NSString *)name inFolder:(NSString *)folder
133 NSString *path =
nil;
135 NSString *displayName =
nil;
141 fileScanner = [[
self verifier] fileScannerStage];
147 if (path ==
nil)
return;
150 options:kOOTextureMinFilterNearest |
151 kOOTextureMinFilterNearest |
153 kOOTextureNoFNFMessage |
154 kOOTextureNeverScale];
159 OOLog(
@"verifyOXP.texture.failed",
@"***** ERROR: image %@ could not be read.", displayName);
169 if (pixmap.
width != rWidth || pixmap.
height != rHeight)
171 OOLog(
@"verifyOXP.texture.notPOT",
@"----- WARNING: image %@ has non-power-of-two dimensions; it will have to be rescaled (from %ux%u pixels to %ux%u pixels) at runtime.", displayName, pixmap.
width, pixmap.
height, rWidth, rHeight);
175 OOLog(
@"verifyOXP.verbose.texture.OK",
@"- %@ (%ux%u px) OK.", displayName, pixmap.
width, pixmap.
height);
182 OOLog(
@"verifyOXP.texture.failed",
@"***** ERROR: texture loader failed to load %@.", displayName);
static NSString *const kStageName
id loaderWithPath:options:(NSString *path,[options] uint32_t options)
BOOL getResult:format:originalWidth:originalHeight:(OOPixMap *result,[format] OOTextureDataFormat *outFormat,[originalWidth] uint32_t *outWidth,[originalHeight] uint32_t *outHeight)
NSString * nameForReverseDependencyForVerifier:(OOOXPVerifier *verifier)