2010-09-21 21:46:53 +00:00
|
|
|
//
|
|
|
|
// VertexArray.m
|
|
|
|
// XNI
|
|
|
|
//
|
|
|
|
// Created by Matej Jan on 21.9.10.
|
|
|
|
// Copyright 2010 Retronator. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "VertexArray.h"
|
2010-11-30 23:26:03 +00:00
|
|
|
|
|
|
|
#import "XniAdaptiveArray.h"
|
2010-09-21 21:46:53 +00:00
|
|
|
|
|
|
|
@implementation VertexArray
|
|
|
|
|
|
|
|
- (id) initWithItemSize:(int)itemSize initialCapacity:(int)initialCapacity {
|
|
|
|
if (self = [super init]) {
|
2010-11-30 23:26:03 +00:00
|
|
|
array = [[XniAdaptiveArray alloc] initWithItemSize:itemSize initialCapacity:initialCapacity];
|
2010-09-21 21:46:53 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2012-05-14 08:40:49 +00:00
|
|
|
- (id)initWithArray:(VertexArray *)source {
|
|
|
|
if (self = [super init]) {
|
|
|
|
array = [[XniAdaptiveArray alloc] initWithArray:source->array];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2010-09-21 21:46:53 +00:00
|
|
|
- (void *) array {
|
|
|
|
return array.array;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) count {
|
|
|
|
return array.count;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) sizeInBytes {
|
|
|
|
return array.count * array.itemSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (VertexDeclaration *) vertexDeclaration { return nil; }
|
|
|
|
|
|
|
|
- (void) clear {
|
|
|
|
[array clear];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) addVertex:(void *)vertex {
|
|
|
|
[array addItem:vertex];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
[array release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|