1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00
XNI/Classes/Retronator/Xni/Framework/Graphics/SamplerStateCollection.m

61 lines
1.2 KiB
Mathematica
Raw Normal View History

//
// SamplerStateCollection.m
// XNI
//
// Created by Matej Jan on 21.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "SamplerStateCollection.h"
#import "SamplerStateCollection+Internal.h"
#import "XniSamplerEventArgs.h"
#import "XniSamplerEventArgs+Internal.h"
#import "Retronator.Xni.Framework.Graphics.h"
@interface SamplerStateCollection (){
XniSamplerEventArgs *eventArgs;
}
@end
@implementation SamplerStateCollection
- (id) init
{
self = [super init];
if (self != nil) {
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
samplerStates[i] = nil;
}
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
samplerStateChanged = [[Event alloc] init];
}
return self;
}
- (Event *) samplerStateChanged {
return samplerStateChanged;
}
- (SamplerState*)itemAtIndex:(NSUInteger)index {
return samplerStates[index];
}
- (void)setItem:(SamplerState*)item atIndex:(NSUInteger)index {
if (samplerStates[index] != item) {
samplerStates[index] = item;
eventArgs.samplerIndex = index;
[samplerStateChanged raiseWithSender:self eventArgs:eventArgs];
}
}
- (void) dealloc
{
[eventArgs release];
[samplerStateChanged release];
[super dealloc];
}
@end