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