2010-09-21 21:46:53 +00:00
|
|
|
//
|
|
|
|
// IndexBuffer.m
|
|
|
|
// XNI
|
|
|
|
//
|
|
|
|
// Created by Matej Jan on 21.9.10.
|
|
|
|
// Copyright 2010 Retronator. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "IndexBuffer.h"
|
2010-11-30 23:26:03 +00:00
|
|
|
#import "IndexBuffer+Internal.h"
|
|
|
|
#import "GraphicsDevice+Internal.h"
|
2010-09-21 21:46:53 +00:00
|
|
|
|
2010-11-30 23:26:03 +00:00
|
|
|
#import "Retronator.Xni.Framework.Graphics.h"
|
2010-09-21 21:46:53 +00:00
|
|
|
|
|
|
|
@implementation IndexBuffer
|
|
|
|
|
2010-11-30 23:26:03 +00:00
|
|
|
- (id) initWithGraphicsDevice:(GraphicsDevice *)theGraphicsDevice
|
|
|
|
indexElementSize:(IndexElementSize)theIndexElementSize
|
|
|
|
indexCount:(int)theIndexCount
|
|
|
|
usage:(BufferUsage)theBufferUsage
|
|
|
|
{
|
|
|
|
self = [super initWithGraphicsDevice:theGraphicsDevice];
|
|
|
|
if (self != nil) {
|
|
|
|
bufferID = [graphicsDevice createBuffer];
|
|
|
|
indexElementSize = theIndexElementSize;
|
|
|
|
indexCount = theIndexCount;
|
|
|
|
bufferUsage = theBufferUsage;
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@synthesize indexElementSize, indexCount, bufferUsage;
|
|
|
|
|
|
|
|
- (uint) bufferID {
|
|
|
|
return bufferID;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setData:(IndexArray*)data {
|
|
|
|
[graphicsDevice setData:data.array toIndexBuffer:self];
|
|
|
|
}
|
2010-09-21 21:46:53 +00:00
|
|
|
|
2012-10-23 21:03:00 +00:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[graphicsDevice releaseBuffer:bufferID];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2010-09-21 21:46:53 +00:00
|
|
|
@end
|
2010-11-30 23:26:03 +00:00
|
|
|
|