Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOBasicMaterial.h
Go to the documentation of this file.
1/*
2
3OOBasicMaterial.h
4
5Material using basic OpenGL properties. Normal materials
6(OOSingleTextureMaterial, OOShaderMaterial) are subclasses of this. It may be
7desireable to have a material which does not use normal GL material
8properties, in which case it should be based on OOMaterial directly.
9
10
11Copyright (C) 2007-2013 Jens Ayton
12
13Permission is hereby granted, free of charge, to any person obtaining a copy
14of this software and associated documentation files (the "Software"), to deal
15in the Software without restriction, including without limitation the rights
16to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17copies of the Software, and to permit persons to whom the Software is
18furnished to do so, subject to the following conditions:
19
20The above copyright notice and this permission notice shall be included in all
21copies or substantial portions of the Software.
22
23THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29SOFTWARE.
30
31*/
32
33#import "OOMaterial.h"
34#import "OOColor.h"
35
36
38{
39@private
40 NSString *materialName;
41
42 // Colours
43 GLfloat diffuse[4],
47
48 // Specular exponent
49 uint8_t shininess; // Default: 0.0
50}
51
52/* Initialize with default values (historical Olite defaults, not GL defaults):
53 diffuse { 1.0, 1.0, 1.0, 1.0 }
54 specular { 0.0, 0.0, 0.0, 1.0 }
55 ambient { 1.0, 1.0, 1.0, 1.0 }
56 emission { 0.0, 0.0, 0.0, 1.0 }
57 shininess 0
58*/
59- (id)initWithName:(NSString *)name;
60
61/* Initialize with dictionary. Accepted keys:
62 diffuse colour description
63 specular colour description
64 ambient colour description
65 emission colour description
66 shininess integer
67
68 "Colour description" refers to anything +[OOColor colorWithDescription:]
69 will accept.
70*/
71- (id)initWithName:(NSString *)name configuration:(NSDictionary *)configuration;
72
73- (OOColor *)diffuseColor;
74- (void)setDiffuseColor:(OOColor *)color;
75- (void)setAmbientAndDiffuseColor:(OOColor *)color;
76- (OOColor *)specularColor;
77- (void)setSpecularColor:(OOColor *)color;
78- (OOColor *)ambientColor;
79- (void)setAmbientColor:(OOColor *)color;
80- (OOColor *)emmisionColor;
81- (void)setEmissionColor:(OOColor *)color;
82
83- (void)getDiffuseComponents:(GLfloat[4])outComponents;
84- (void)setDiffuseComponents:(const GLfloat[4])components;
85- (void)setAmbientAndDiffuseComponents:(const GLfloat[4])components;
86- (void)getSpecularComponents:(GLfloat[4])outComponents;
87- (void)setSpecularComponents:(const GLfloat[4])components;
88- (void)getAmbientComponents:(GLfloat[4])outComponents;
89- (void)setAmbientComponents:(const GLfloat[4])components;
90- (void)getEmissionComponents:(GLfloat[4])outComponents;
91- (void)setEmissionComponents:(const GLfloat[4])components;
92
93- (void)setDiffuseRed:(GLfloat)r green:(GLfloat)g blue:(GLfloat)b alpha:(GLfloat)a;
94- (void)setAmbientAndDiffuseRed:(GLfloat)r green:(GLfloat)g blue:(GLfloat)b alpha:(GLfloat)a;
95- (void)setSpecularRed:(GLfloat)r green:(GLfloat)g blue:(GLfloat)b alpha:(GLfloat)a;
96- (void)setAmbientRed:(GLfloat)r green:(GLfloat)g blue:(GLfloat)b alpha:(GLfloat)a;
97- (void)setEmissionRed:(GLfloat)r green:(GLfloat)g blue:(GLfloat)b alpha:(GLfloat)a;
98
99- (uint8_t)shininess;
100- (void)setShininess:(uint8_t)value; // Clamped to [0, 128]
101
102
103/* For subclasses: return true to permit specular settings, false to deny
104 them. By default, this is ![UNIVERSE reducedDetail].
105*/
106- (BOOL) permitSpecular;
107
108@end
NSString * materialName
GLfloat emission[4]
GLfloat specular[4]