mirror of
https://github.com/thes3m/XNI
synced 2024-12-26 13:26:06 +01:00
50 lines
1.0 KiB
Objective-C
50 lines
1.0 KiB
Objective-C
//
|
|
// VertexBuffer.m
|
|
// XNI
|
|
//
|
|
// Created by Matej Jan on 21.9.10.
|
|
// Copyright 2010 Retronator. All rights reserved.
|
|
//
|
|
|
|
#import "VertexBuffer.h"
|
|
#import "VertexBuffer+Internal.h"
|
|
#import "GraphicsDevice+Internal.h"
|
|
|
|
#import "Retronator.Xni.Framework.Graphics.h"
|
|
|
|
@implementation VertexBuffer
|
|
|
|
- (id) initWithGraphicsDevice:(GraphicsDevice *)theGraphicsDevice
|
|
vertexDeclaration:(VertexDeclaration *)theVertexDeclaration
|
|
vertexCount:(int)theVertexCount
|
|
usage:(BufferUsage)theBufferUsage
|
|
{
|
|
self = [super initWithGraphicsDevice:theGraphicsDevice];
|
|
if (self != nil) {
|
|
bufferID = [graphicsDevice createBuffer];
|
|
vertexDeclaration = [theVertexDeclaration retain];
|
|
vertexCount = theVertexCount;
|
|
bufferUsage = theBufferUsage;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
@synthesize vertexCount, bufferUsage, vertexDeclaration;
|
|
|
|
- (uint) bufferID {
|
|
return bufferID;
|
|
}
|
|
|
|
- (void) setData:(VertexArray*)data {
|
|
[graphicsDevice setData:data.array toVertexBuffer:self];
|
|
}
|
|
|
|
- (void) dealloc
|
|
{
|
|
[vertexDeclaration release];
|
|
[super dealloc];
|
|
}
|
|
|
|
|
|
@end
|