Oolite
1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
src
Core
Materials
OOMaterial.h
Go to the documentation of this file.
1
/*
2
3
OOMaterial.h
4
5
A material which can be applied to an OpenGL object, or more accurately, to
6
the current OpenGL render state.
7
8
This is an abstract class; actual materials should be subclasses.
9
10
Currently, only shader materials are supported. Direct use of textures should
11
also be replaced with an OOMaterial subclass.
12
13
14
Copyright (C) 2007-2013 Jens Ayton and contributors
15
16
Permission is hereby granted, free of charge, to any person obtaining a copy
17
of this software and associated documentation files (the "Software"), to deal
18
in the Software without restriction, including without limitation the rights
19
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
copies of the Software, and to permit persons to whom the Software is
21
furnished to do so, subject to the following conditions:
22
23
The above copyright notice and this permission notice shall be included in all
24
copies or substantial portions of the Software.
25
26
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
SOFTWARE.
33
34
*/
35
36
#import <Foundation/Foundation.h>
37
#import "
OOOpenGL.h
"
38
#import "
OOWeakReference.h
"
39
#import "
OOOpenGLExtensionManager.h
"
40
41
42
@interface
OOMaterial
: NSObject
43
44
// Called once at startup (by -[Universe init]).
45
+ (void)
setUp
;
46
47
48
- (NSString *)
name
;
49
50
// Make this the current material.
51
- (void)
apply
;
52
53
/* Make no material the current material, tearing down anything set up by the
54
current material.
55
*/
56
+ (void)
applyNone
;
57
58
/* Get current material.
59
*/
60
+ (
OOMaterial
*)
current
;
61
62
/* Ensure material is ready to be used in a display list. This is not
63
required before using a material directly.
64
*/
65
- (void)
ensureFinishedLoading
;
66
- (BOOL)
isFinishedLoading
;
67
68
// Only used by shader material, but defined for all materials for convenience.
69
- (void) setBindingTarget:(
id
<OOWeakReferenceSupport>)target;
70
71
// True if material wants three-component cube map texture coordinates.
72
- (BOOL)
wantsNormalsAsTextureCoordinates
;
73
74
#if OO_MULTITEXTURE
75
// Nasty hack: number of texture units for which the drawable should set its basic texture coordinates.
76
- (NSUInteger) countOfTextureUnitsWithBaseCoordinates;
77
#endif
78
79
#ifndef NDEBUG
80
- (NSSet *)
allTextures
;
81
#endif
82
83
@end
84
85
86
@interface
OOMaterial (OOSubclassInterface)
87
88
// Subclass responsibilities - don't call directly.
89
- (BOOL)
doApply
;
// Override instead of -apply
90
- (void) unapplyWithNext:(
OOMaterial
*)next;
91
92
// Call at top of dealloc
93
- (void)
willDealloc
;
94
95
@end
OOOpenGLExtensionManager.h
OOOpenGL.h
OOWeakReference.h
-[OOMaterial(OOSubclassInterface) doApply]
BOOL doApply()
Definition
OOMaterial.m:138
-[OOMaterial(OOSubclassInterface) willDealloc]
void willDealloc()
Definition
OOMaterial.m:151
OOMaterial
Definition
OOMaterial.h:43
-[OOMaterial apply]
void apply()
Definition
OOMaterial.m:67
-[OOMaterial ensureFinishedLoading]
void ensureFinishedLoading()
Definition
OOMaterial.m:94
+[OOMaterial current]
OOMaterial * current()
Definition
OOMaterial.m:88
-[OOMaterial isFinishedLoading]
BOOL isFinishedLoading()
Definition
OOMaterial.m:100
+[OOMaterial setUp]
void setUp()
Definition
OOMaterial.m:38
+[OOMaterial applyNone]
void applyNone()
Definition
OOMaterial.m:80
-[OOMaterial wantsNormalsAsTextureCoordinates]
BOOL wantsNormalsAsTextureCoordinates()
Definition
OOMaterial.m:112
-[OOMaterial name]
NSString * name()
Definition
OOMaterial.m:59
-[OOMaterial allTextures]
NSSet * allTextures()
Definition
OOMaterial.m:127
Generated by
1.12.0