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
- (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);}
- (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);}
- (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);}
- (void) setA:(Byte)value {packedValue = packedValue & 0x00ffffff | ((uint)value << 24);}
- (void) setA:(Byte)value {packedValue = (packedValue & 0x00ffffff) | ((uint)value << 24);}
@synthesize packedValue;

View File

@ -92,9 +92,6 @@
NSString *extension = [filePath pathExtension];
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) {
[NSException raise:@"InvalidArgumentException" format:@"Could not locate file '%@' in directory '%@'", filePath, rootDirectory];
}
@ -131,12 +128,12 @@
processor = [[[SoundEffectProcessor alloc] init] autorelease];
}
} else if ([extension isEqualToString:@"mp3"]) {
// Mp3 audio content
// Mp3 audio content
if (!importer) {
importer = [[[Mp3Importer alloc] init] autorelease];
importer = [[[Mp3Importer alloc] init] autorelease];
}
if (!processor) {
processor = [[[SongProcessor alloc] init] autorelease];
processor = [[[SongProcessor alloc] init] autorelease];
}
}
@ -147,12 +144,12 @@
// Import content.
id content = [importer importFile:absolutePath];
// Process content if we have a processor.
if (processor) {
content = [processor process:content];
}
// Create a reader for converting into realtime data.
input = [[ContentReader alloc] initWithContentManager:self Content:content];
@ -172,7 +169,7 @@
[loadedFiles setObject:result forKey:filePath];
[input release];
[pool release];
return [result autorelease];

View File

@ -20,7 +20,9 @@
self = [super init];
if (self != nil) {
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];
}
return self;

View File

@ -123,7 +123,7 @@ static inline BOOL IsOnBlack(Byte *color) {
for (int y = 0; y < bitmap.height; 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.
// Always also key the separator color.
for (int i = 0; i < 4; i++) {

View File

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

View File

@ -20,8 +20,8 @@
- (id) readFromInput:(ContentReader *)input into:(id)existingInstance {
SongContent *content = input.content;
Song *song = [[[Song alloc] initWithUrl:content.url] autorelease];
Song *song = [[[Song alloc] initWithUrl:content.url] autorelease];
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.
// In run it is used to make a copy of enabled/visible components for enumerating over them.
componentsList = [[NSMutableArray alloc] init];
initializedComponents = [[NSMutableSet alloc] init];
[components.componentAdded subscribeDelegate:

View File

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

View File

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

View File

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

View File

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

View File

@ -36,10 +36,10 @@
@synthesize graphicsProfile;
@synthesize isFullScreen;
@synthesize preferMultiSampling;
@synthesize preferedSurfaceFormat;
@synthesize preferedBackBufferWidth;
@synthesize preferedBackBufferHeight;
@synthesize preferedDepthStencilFormat;
@synthesize preferredSurfaceFormat;
@synthesize preferredBackBufferWidth;
@synthesize preferredBackBufferHeight;
@synthesize preferredDepthStencilFormat;
@synthesize supportedOrientations;
@synthesize graphicsDevice;
@ -72,7 +72,7 @@
- (void) applyChanges {
[game.window setSupportedOrientations:supportedOrientations];
[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) {
// Different graphics profile requested.

View File

@ -1,34 +1,34 @@
#import "FrameworkEnums.h"
#import "Protocols.h"
// Data structures
#import "XniPoint.h"
#import "Rectangle.h"
#import "Color.h"
// Game
#import "IGraphicsDeviceManager.h"
#import "Game.h"
#import "GameTime.h"
#import "GameServiceContainer.h"
#import "GraphicsDeviceManager.h"
// Game host
#import "GameHost.h"
#import "GameWindow.h"
// Game components
#import "IGameComponent.h"
#import "IUpdatable.h"
#import "IDrawable.h"
#import "GameComponent.h"
#import "DrawableGameComponent.h"
#import "GameComponentCollection.h"
#import "GameComponentCollectionEventArgs.h"
// Linear algebra
#import "Vector2.h"
#import "Vector3.h"
#import "Vector4.h"
#import "Quaternion.h"
#import "FrameworkEnums.h"
#import "Protocols.h"
// Data structures
#import "XniPoint.h"
#import "Rectangle.h"
#import "Color.h"
// Game
#import "IGraphicsDeviceManager.h"
#import "Game.h"
#import "GameTime.h"
#import "GameServiceContainer.h"
#import "GraphicsDeviceManager.h"
// Game host
#import "GameHost.h"
#import "GameWindow.h"
// Game components
#import "IGameComponent.h"
#import "IUpdatable.h"
#import "IDrawable.h"
#import "GameComponent.h"
#import "DrawableGameComponent.h"
#import "GameComponentCollection.h"
#import "GameComponentCollectionEventArgs.h"
// Linear algebra
#import "Vector2.h"
#import "Vector3.h"
#import "Vector4.h"
#import "Quaternion.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>"; };
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>"; };
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>"; };
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>"; };
@ -1200,7 +1200,7 @@
isa = PBXGroup;
children = (
D2AAC07E0554694100DB518D /* libXNI.a */,
B570A31E13E1DC3B0085E85E /* libXNI copy.a */,
B570A31E13E1DC3B0085E85E /* libXNI.a */,
);
name = Products;
sourceTree = "<group>";
@ -2256,7 +2256,7 @@
);
name = "XNI Release";
productName = XNI;
productReference = B570A31E13E1DC3B0085E85E /* libXNI copy.a */;
productReference = B570A31E13E1DC3B0085E85E /* libXNI.a */;
productType = "com.apple.product-type.library.static";
};
D2AAC07D0554694100DB518D /* XNI */ = {
@ -2282,7 +2282,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0410;
LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Retronator;
};
buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "XNI" */;
@ -2672,7 +2672,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
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)";
PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2689,7 +2689,7 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
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)";
PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2739,7 +2739,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
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)";
PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
@ -2756,7 +2756,7 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
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)";
PRODUCT_NAME = XNI;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;