Like r3494, but useful.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3501 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-06-11 22:12:37 +00:00
parent 69c8203c9e
commit cf24d2f7c0
2 changed files with 7 additions and 8 deletions

View File

@ -75,7 +75,7 @@ static NSString * const kCacheKeyCaches = @"caches";
enum
{
kEndianTagValue = 0x0123456789ABCDEFULL,
kFormatVersionValue = 40
kFormatVersionValue = 41
};

View File

@ -812,9 +812,7 @@ shaderBindingTarget:(id<OOWeakReferenceSupport>)target
if (self == nil) return nil;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
_normalMode = smooth ? kNormalModeSmooth : kNormalModePerFace;
if (cacheKey != nil && smooth) cacheKey = [cacheKey stringByAppendingString:@":smooth"];
_normalMode = smooth ? kNormalModeSmooth : kNormalModePerFace;
#if OOMESH_PROFILE
_stopwatch = [[OOProfilingStopwatch alloc] init];
@ -1080,10 +1078,11 @@ shaderBindingTarget:(id<OOWeakReferenceSupport>)target
NSString *failString = @"***** ";
unsigned i, j;
NSMutableDictionary *texFileName2Idx = nil;
NSString *cacheKey = nil;
BOOL using_preloaded = NO;
BOOL using_preloaded = NO;
cacheData = [OOCacheManager meshDataForName:filename];
cacheKey = [NSString stringWithFormat:@"%@:%u", filename, _normalMode];
cacheData = [OOCacheManager meshDataForName:cacheKey];
if (cacheData != nil)
{
if ([self setModelFromModelData:cacheData name:filename])
@ -1516,7 +1515,7 @@ shaderBindingTarget:(id<OOWeakReferenceSupport>)target
}
// save the resulting data for possible reuse
[OOCacheManager setMeshData:[self modelData] forName:filename];
[OOCacheManager setMeshData:[self modelData] forName:cacheKey];
PROFILE(@"saved to cache");
if (failFlag)