1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00

Fixed bug on iOS5 and .x model loading

git-svn-id: http://xni.googlecode.com/svn/XNI@102 ac433895-eea3-a490-d80a-17149a75e588
This commit is contained in:
Matej Jan 2011-10-24 11:22:32 +00:00
parent 08e15ca3be
commit e56e806481
14 changed files with 80 additions and 75 deletions

View File

@ -66,16 +66,16 @@
// PROPERTIES // PROPERTIES
- (Byte) r {return (Byte)packedValue;} - (Byte) r {return (Byte)packedValue;}
- (void) setR:(Byte)value {packedValue = packedValue & 0xffffff00 | value;} - (void) setR:(Byte)value {packedValue = (packedValue & 0xffffff00) | value;}
- (Byte) g {return (Byte)(packedValue >> 8);} - (Byte) g {return (Byte)(packedValue >> 8);}
- (void) setG:(Byte)value {packedValue = packedValue & 0xffff00ff | ((uint)value << 8);} - (void) setG:(Byte)value {packedValue = (packedValue & 0xffff00ff) | ((uint)value << 8);}
- (Byte) b {return (Byte)(packedValue >> 16);} - (Byte) b {return (Byte)(packedValue >> 16);}
- (void) setB:(Byte)value {packedValue = packedValue & 0xff00ffff | ((uint)value << 16);} - (void) setB:(Byte)value {packedValue = (packedValue & 0xff00ffff) | ((uint)value << 16);}
- (Byte) a {return (Byte)(packedValue >> 24);} - (Byte) a {return (Byte)(packedValue >> 24);}
- (void) setA:(Byte)value {packedValue = packedValue & 0x00ffffff | ((uint)value << 24);} - (void) setA:(Byte)value {packedValue = (packedValue & 0x00ffffff) | ((uint)value << 24);}
@synthesize packedValue; @synthesize packedValue;

View File

@ -92,9 +92,6 @@
NSString *extension = [filePath pathExtension]; NSString *extension = [filePath pathExtension];
NSString *absolutePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension inDirectory:rootDirectory]; NSString *absolutePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension inDirectory:rootDirectory];
// Bug in NSBundle - we are returned an object that doesn't have an object count 0, so we release it ourselves to avoid a leak.
[absolutePath autorelease];
if (!absolutePath) { if (!absolutePath) {
[NSException raise:@"InvalidArgumentException" format:@"Could not locate file '%@' in directory '%@'", filePath, rootDirectory]; [NSException raise:@"InvalidArgumentException" format:@"Could not locate file '%@' in directory '%@'", filePath, rootDirectory];
} }
@ -131,12 +128,12 @@
processor = [[[SoundEffectProcessor alloc] init] autorelease]; processor = [[[SoundEffectProcessor alloc] init] autorelease];
} }
} else if ([extension isEqualToString:@"mp3"]) { } else if ([extension isEqualToString:@"mp3"]) {
// Mp3 audio content // Mp3 audio content
if (!importer) { if (!importer) {
importer = [[[Mp3Importer alloc] init] autorelease]; importer = [[[Mp3Importer alloc] init] autorelease];
} }
if (!processor) { if (!processor) {
processor = [[[SongProcessor alloc] init] autorelease]; processor = [[[SongProcessor alloc] init] autorelease];
} }
} }
@ -147,12 +144,12 @@
// Import content. // Import content.
id content = [importer importFile:absolutePath]; id content = [importer importFile:absolutePath];
// Process content if we have a processor. // Process content if we have a processor.
if (processor) { if (processor) {
content = [processor process:content]; content = [processor process:content];
} }
// Create a reader for converting into realtime data. // Create a reader for converting into realtime data.
input = [[ContentReader alloc] initWithContentManager:self Content:content]; input = [[ContentReader alloc] initWithContentManager:self Content:content];
@ -172,7 +169,7 @@
[loadedFiles setObject:result forKey:filePath]; [loadedFiles setObject:result forKey:filePath];
[input release]; [input release];
[pool release]; [pool release];
return [result autorelease]; return [result autorelease];

View File

@ -20,7 +20,9 @@
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
channels = [[VertexChannelCollection alloc] initWithParent:self]; channels = [[VertexChannelCollection alloc] initWithParent:self];
positionIndices = [[IndexCollection alloc] init]; positionIndices = [[VertexChannel alloc] initWithElementType:[NSNumber class]
name:[VertexChannelNames encodeUsage:VertexElementUsagePosition usageIndex:0]
channelData:nil];
positions = [[IndirectPositionCollection alloc] initWithPositionIndices:positionIndices positions:thePositions]; positions = [[IndirectPositionCollection alloc] initWithPositionIndices:positionIndices positions:thePositions];
} }
return self; return self;

View File

@ -123,7 +123,7 @@ static inline BOOL IsOnBlack(Byte *color) {
for (int y = 0; y < bitmap.height; y++) { for (int y = 0; y < bitmap.height; y++) {
Byte *color = [bitmap getPixelAtX:x Y:y]; Byte *color = [bitmap getPixelAtX:x Y:y];
if (!IsOnCharacter(color) || !usesAlpha && IsOnBlack(color)) { if (!IsOnCharacter(color) || (!usesAlpha && IsOnBlack(color))) {
// If the sprite font does not use an alpha channel we should key the black color. // If the sprite font does not use an alpha channel we should key the black color.
// Always also key the separator color. // Always also key the separator color.
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {

View File

@ -259,6 +259,11 @@
/*int materialIndex =*/ [reader readInt]; /*int materialIndex =*/ [reader readInt];
[reader skipNextNonWhitespace]; [reader skipNextNonWhitespace];
} }
// Handle an extra semicolon
if ([reader currentCharacter] == ';') {
[reader skipNextNonWhitespace];
}
for (int i = 0; i < materialCount; i++) { for (int i = 0; i < materialCount; i++) {
MaterialContent *material = [self readTemplateWithReader:reader]; MaterialContent *material = [self readTemplateWithReader:reader];

View File

@ -20,8 +20,8 @@
- (id) readFromInput:(ContentReader *)input into:(id)existingInstance { - (id) readFromInput:(ContentReader *)input into:(id)existingInstance {
SongContent *content = input.content; SongContent *content = input.content;
Song *song = [[[Song alloc] initWithUrl:content.url] autorelease]; Song *song = [[[Song alloc] initWithUrl:content.url] autorelease];
return song; return song;
} }

View File

@ -57,7 +57,7 @@ static NSArray *drawOrderSort;
// First it is used for constructing a list of components, that need to be initialized. // First it is used for constructing a list of components, that need to be initialized.
// In run it is used to make a copy of enabled/visible components for enumerating over them. // In run it is used to make a copy of enabled/visible components for enumerating over them.
componentsList = [[NSMutableArray alloc] init]; componentsList = [[NSMutableArray alloc] init];
initializedComponents = [[NSMutableSet alloc] init]; initializedComponents = [[NSMutableSet alloc] init];
[components.componentAdded subscribeDelegate: [components.componentAdded subscribeDelegate:

View File

@ -30,8 +30,7 @@
NSLog(@"Starting the game loop."); NSLog(@"Starting the game loop.");
game = [self delegate]; game = [self delegate];
SInt32 runResult; SInt32 runResult;
isExiting = NO; isExiting = NO;

View File

@ -106,7 +106,7 @@ typedef enum {
typedef enum { typedef enum {
IndexElementSizeSixteenBits = 2, IndexElementSizeSixteenBits = 2,
//IndexElementSizeThrityTwoBits = 4, //IndexElementSizeThirtyTwoBits = 4,
} IndexElementSize; } IndexElementSize;
typedef enum { typedef enum {

View File

@ -354,6 +354,8 @@ static VertexPositionColorTextureStruct vertices[4];
case SpriteSortModeFrontToBack: case SpriteSortModeFrontToBack:
[sprites sortUsingDescriptors:frontToBackSort]; [sprites sortUsingDescriptors:frontToBackSort];
break; break;
default:
break;
} }
// Apply the graphics device states. // Apply the graphics device states.

View File

@ -18,10 +18,10 @@
GraphicsProfile graphicsProfile; GraphicsProfile graphicsProfile;
BOOL isFullScreen; BOOL isFullScreen;
BOOL preferMultiSampling; BOOL preferMultiSampling;
SurfaceFormat preferedSurfaceFormat; SurfaceFormat preferredSurfaceFormat;
int preferedBackBufferWidth; int preferredBackBufferWidth;
int preferedBackBufferHeight; int preferredBackBufferHeight;
DepthFormat preferedDepthStencilFormat; DepthFormat preferredDepthStencilFormat;
DisplayOrientation supportedOrientations; DisplayOrientation supportedOrientations;
Game *game; Game *game;
@ -37,10 +37,10 @@
@property (nonatomic) GraphicsProfile graphicsProfile; @property (nonatomic) GraphicsProfile graphicsProfile;
@property (nonatomic) BOOL isFullScreen; @property (nonatomic) BOOL isFullScreen;
@property (nonatomic) BOOL preferMultiSampling; @property (nonatomic) BOOL preferMultiSampling;
@property (nonatomic) SurfaceFormat preferedSurfaceFormat; @property (nonatomic) SurfaceFormat preferredSurfaceFormat;
@property (nonatomic) int preferedBackBufferWidth; @property (nonatomic) int preferredBackBufferWidth;
@property (nonatomic) int preferedBackBufferHeight; @property (nonatomic) int preferredBackBufferHeight;
@property (nonatomic) DepthFormat preferedDepthStencilFormat; @property (nonatomic) DepthFormat preferredDepthStencilFormat;
@property (nonatomic) DisplayOrientation supportedOrientations; @property (nonatomic) DisplayOrientation supportedOrientations;
- (void) toggleFullscreen; - (void) toggleFullscreen;

View File

@ -36,10 +36,10 @@
@synthesize graphicsProfile; @synthesize graphicsProfile;
@synthesize isFullScreen; @synthesize isFullScreen;
@synthesize preferMultiSampling; @synthesize preferMultiSampling;
@synthesize preferedSurfaceFormat; @synthesize preferredSurfaceFormat;
@synthesize preferedBackBufferWidth; @synthesize preferredBackBufferWidth;
@synthesize preferedBackBufferHeight; @synthesize preferredBackBufferHeight;
@synthesize preferedDepthStencilFormat; @synthesize preferredDepthStencilFormat;
@synthesize supportedOrientations; @synthesize supportedOrientations;
@synthesize graphicsDevice; @synthesize graphicsDevice;
@ -72,7 +72,7 @@
- (void) applyChanges { - (void) applyChanges {
[game.window setSupportedOrientations:supportedOrientations]; [game.window setSupportedOrientations:supportedOrientations];
[game.window beginScreenDeviceChangeWithFullscreen:isFullScreen]; [game.window beginScreenDeviceChangeWithFullscreen:isFullScreen];
[game.window endScreenDeviceChangeWithClientWidth:self.preferedBackBufferWidth clientHeight:self.preferedBackBufferHeight]; [game.window endScreenDeviceChangeWithClientWidth:self.preferredBackBufferWidth clientHeight:self.preferredBackBufferHeight];
if (graphicsDevice != nil && graphicsDevice.graphicsProfile != graphicsProfile) { if (graphicsDevice != nil && graphicsDevice.graphicsProfile != graphicsProfile) {
// Different graphics profile requested. // Different graphics profile requested.

View File

@ -1,34 +1,34 @@
#import "FrameworkEnums.h" #import "FrameworkEnums.h"
#import "Protocols.h" #import "Protocols.h"
// Data structures // Data structures
#import "XniPoint.h" #import "XniPoint.h"
#import "Rectangle.h" #import "Rectangle.h"
#import "Color.h" #import "Color.h"
// Game // Game
#import "IGraphicsDeviceManager.h" #import "IGraphicsDeviceManager.h"
#import "Game.h" #import "Game.h"
#import "GameTime.h" #import "GameTime.h"
#import "GameServiceContainer.h" #import "GameServiceContainer.h"
#import "GraphicsDeviceManager.h" #import "GraphicsDeviceManager.h"
// Game host // Game host
#import "GameHost.h" #import "GameHost.h"
#import "GameWindow.h" #import "GameWindow.h"
// Game components // Game components
#import "IGameComponent.h" #import "IGameComponent.h"
#import "IUpdatable.h" #import "IUpdatable.h"
#import "IDrawable.h" #import "IDrawable.h"
#import "GameComponent.h" #import "GameComponent.h"
#import "DrawableGameComponent.h" #import "DrawableGameComponent.h"
#import "GameComponentCollection.h" #import "GameComponentCollection.h"
#import "GameComponentCollectionEventArgs.h" #import "GameComponentCollectionEventArgs.h"
// Linear algebra // Linear algebra
#import "Vector2.h" #import "Vector2.h"
#import "Vector3.h" #import "Vector3.h"
#import "Vector4.h" #import "Vector4.h"
#import "Quaternion.h" #import "Quaternion.h"
#import "Matrix.h" #import "Matrix.h"

View File

@ -905,7 +905,7 @@
B56CC5C6123A928A00B72347 /* ContentTypeReaderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContentTypeReaderManager.m; sourceTree = "<group>"; }; B56CC5C6123A928A00B72347 /* ContentTypeReaderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContentTypeReaderManager.m; sourceTree = "<group>"; };
B56CC5C9123A92BB00B72347 /* Texture2DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Texture2DReader.h; sourceTree = "<group>"; }; B56CC5C9123A92BB00B72347 /* Texture2DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Texture2DReader.h; sourceTree = "<group>"; };
B56CC5CA123A92BB00B72347 /* Texture2DReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Texture2DReader.m; sourceTree = "<group>"; }; B56CC5CA123A92BB00B72347 /* Texture2DReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Texture2DReader.m; sourceTree = "<group>"; };
B570A31E13E1DC3B0085E85E /* libXNI copy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libXNI copy.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B570A31E13E1DC3B0085E85E /* libXNI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libXNI.a; sourceTree = BUILT_PRODUCTS_DIR; };
B572BC03130EB27A00B6DB47 /* Gamer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gamer.h; sourceTree = "<group>"; }; B572BC03130EB27A00B6DB47 /* Gamer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gamer.h; sourceTree = "<group>"; };
B572BC04130EB27A00B6DB47 /* Gamer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Gamer.m; sourceTree = "<group>"; }; B572BC04130EB27A00B6DB47 /* Gamer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Gamer.m; sourceTree = "<group>"; };
B572BC07130EB32100B6DB47 /* SignedInGamerCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignedInGamerCollection.h; sourceTree = "<group>"; }; B572BC07130EB32100B6DB47 /* SignedInGamerCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignedInGamerCollection.h; sourceTree = "<group>"; };
@ -1200,7 +1200,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D2AAC07E0554694100DB518D /* libXNI.a */, D2AAC07E0554694100DB518D /* libXNI.a */,
B570A31E13E1DC3B0085E85E /* libXNI copy.a */, B570A31E13E1DC3B0085E85E /* libXNI.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -2256,7 +2256,7 @@
); );
name = "XNI Release"; name = "XNI Release";
productName = XNI; productName = XNI;
productReference = B570A31E13E1DC3B0085E85E /* libXNI copy.a */; productReference = B570A31E13E1DC3B0085E85E /* libXNI.a */;
productType = "com.apple.product-type.library.static"; productType = "com.apple.product-type.library.static";
}; };
D2AAC07D0554694100DB518D /* XNI */ = { D2AAC07D0554694100DB518D /* XNI */ = {
@ -2282,7 +2282,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0410; LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Retronator; ORGANIZATIONNAME = Retronator;
}; };
buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "XNI" */; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "XNI" */;
@ -2672,7 +2672,7 @@
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = XNI_Prefix.pch; GCC_PREFIX_HEADER = XNI_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
PRODUCT_NAME = XNI; PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2689,7 +2689,7 @@
GCC_MODEL_TUNING = G5; GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = XNI_Prefix.pch; GCC_PREFIX_HEADER = XNI_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
PRODUCT_NAME = XNI; PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2739,7 +2739,7 @@
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = XNI_Prefix.pch; GCC_PREFIX_HEADER = XNI_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
PRODUCT_NAME = XNI; PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2756,7 +2756,7 @@
GCC_MODEL_TUNING = G5; GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = XNI_Prefix.pch; GCC_PREFIX_HEADER = XNI_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
PRODUCT_NAME = XNI; PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;