Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOTextureVerifierStage(OOPrivate) Category Reference

Instance Methods

(void) - checkTextureNamed:inFolder:
 

Detailed Description

Definition at line 37 of file OOTextureVerifierStage.m.

Method Documentation

◆ checkTextureNamed:inFolder:

- (void) checkTextureNamed: (NSString *) name
inFolder: (NSString *) folder 

Extends class OOTextureVerifierStage.

Definition at line 34 of file OOTextureVerifierStage.m.

130 :(NSString *)name inFolder:(NSString *)folder
131{
132 OOTextureLoader *loader = nil;
133 NSString *path = nil;
134 OOFileScannerVerifierStage *fileScanner = nil;
135 NSString *displayName = nil;
136 OOPixMapDimension rWidth, rHeight;
137 BOOL success;
138 OOPixMap pixmap;
139 OOTextureDataFormat format;
140
141 fileScanner = [[self verifier] fileScannerStage];
142 path = [fileScanner pathForFile:name
143 inFolder:folder
145 checkBuiltIn:NO];
146
147 if (path == nil) return;
148
149 loader = [OOTextureLoader loaderWithPath:path
150 options:kOOTextureMinFilterNearest |
151 kOOTextureMinFilterNearest |
152 kOOTextureNoShrink |
153 kOOTextureNoFNFMessage |
154 kOOTextureNeverScale];
155
156 displayName = [fileScanner displayNameForFile:name andFolder:folder];
157 if (loader == nil)
158 {
159 OOLog(@"verifyOXP.texture.failed", @"***** ERROR: image %@ could not be read.", displayName);
160 }
161 else
162 {
163 success = [loader getResult:&pixmap format:&format originalWidth:NULL originalHeight:NULL];
164
165 if (success)
166 {
167 rWidth = OORoundUpToPowerOf2_PixMap((2 * pixmap.width) / 3);
168 rHeight = OORoundUpToPowerOf2_PixMap((2 * pixmap.height) / 3);
169 if (pixmap.width != rWidth || pixmap.height != rHeight)
170 {
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);
172 }
173 else
174 {
175 OOLog(@"verifyOXP.verbose.texture.OK", @"- %@ (%ux%u px) OK.", displayName, pixmap.width, pixmap.height);
176 }
177
178 OOFreePixMap(&pixmap);
179 }
180 else
181 {
182 OOLog(@"verifyOXP.texture.failed", @"***** ERROR: texture loader failed to load %@.", displayName);
183 }
184 }
185}
#define OOLog(class, format,...)
Definition OOLogging.h:88
uint_fast32_t OOPixMapDimension
Definition OOPixMap.h:33
void OOFreePixMap(OOPixMap *ioPixMap)
Definition OOPixMap.m:86
OOPixMapFormat
Definition OOPixMap.h:39
#define OORoundUpToPowerOf2_PixMap
Definition OOPixMap.h:35
return nil
id displayNameForFile:andFolder:(NSString *file,[andFolder] NSString *folder)
NSString * pathForFile:inFolder:referencedFrom:checkBuiltIn:(NSString *file,[inFolder] NSString *folder,[referencedFrom] NSString *context,[checkBuiltIn] BOOL checkBuiltIn)
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)
OOPixMapDimension height
Definition OOPixMap.h:50
OOPixMapDimension width
Definition OOPixMap.h:50

The documentation for this category was generated from the following file: