PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/OJGL/GLLight.j

http://github.com/tartiflop/ojgl
Unknown | 57 lines | 41 code | 16 blank | 0 comment | 0 complexity | b667cddd62e1d2f1084da86eecb092a3 MD5 | raw file
 1@import <Foundation/CPObject.j>
 2
 3@implementation GLLight : CPObject {
 4	Array _position;
 5	
 6	Array _ambientLight;
 7	Array _diffuseLight;
 8	Array _specularLight;
 9
10	float _attenuation;
11}
12
13- (id)initWithHexColor:(String)color specularColor:(String)specularColor attenuation:(float)attenuation {
14	self = [super init];
15	
16	if (self) {
17		_position = [0, 0, 0];
18		_attenuation = attenuation;
19		
20		_ambientLight = hexToRGB(color);
21		_diffuseLight = [_ambientLight[0], _ambientLight[1], _ambientLight[2], 1.0];
22		_specularLight = hexToRGB(specularColor);
23	}
24	
25	return self;
26}
27
28- (void)setPosition:(Array)position {
29	_position = position;
30}
31
32- (void)setAttenuation:(float)attenuation {
33	_attenuation = attenuation;
34}
35
36- (Array)position {
37	return [_position[0], _position[1], _position[2], 1];
38}
39
40- (Array)ambientLight {
41	return _ambientLight;
42}
43
44- (Array)diffuseLight {
45	return _diffuseLight;
46}
47
48- (Array)specularLight {
49	return _specularLight;
50}
51
52- (float)attenuation {
53	return _attenuation;
54}
55
56
57@end