Oolite
1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
src
Core
Materials
OONullTexture.m
Go to the documentation of this file.
1
/*
2
3
OONullTexture.m
4
5
6
Copyright (C) 2008-2013 Jens Ayton
7
8
Permission is hereby granted, free of charge, to any person obtaining a copy
9
of this software and associated documentation files (the "Software"), to deal
10
in the Software without restriction, including without limitation the rights
11
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
copies of the Software, and to permit persons to whom the Software is
13
furnished to do so, subject to the following conditions:
14
15
The above copyright notice and this permission notice shall be included in all
16
copies or substantial portions of the Software.
17
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
SOFTWARE.
25
26
*/
27
28
#import "
OONullTexture.h
"
29
#import "
OOCocoa.h
"
30
#import "
OOTextureInternal.h
"
31
32
33
static
OONullTexture
*
sSingleton
=
nil
;
34
35
36
@implementation
OONullTexture
37
38
+ (
OONullTexture
*)
sharedNullTexture
39
{
40
// NOTE: assumes single-threaded access.
41
if
(
sSingleton
==
nil
)
42
{
43
sSingleton
= [[
self
alloc] init];
44
}
45
46
return
sSingleton
;
47
}
48
49
50
- (void)
apply
51
{
52
[
OOTexture
applyNone
];
53
}
54
55
56
- (NSSize)
dimensions
57
{
58
return
NSZeroSize;
59
}
60
61
62
- (BOOL)
isMipMapped
63
{
64
return
NO;
65
}
66
67
68
- (void)
forceRebind
69
{
70
71
}
72
73
74
#ifndef NDEBUG
75
- (NSString *)
name
76
{
77
return
@"<null texture>"
;
78
}
79
#endif
80
81
@end
82
83
84
@implementation
OONullTexture (Singleton)
85
86
/* Canonical singleton boilerplate.
87
See Cocoa Fundamentals Guide: Creating a Singleton Instance.
88
See also +nullTexture above.
89
90
NOTE: assumes single-threaded access.
91
*/
92
93
+ (id)allocWithZone:(NSZone *)inZone
94
{
95
if
(
sSingleton
==
nil
)
96
{
97
sSingleton
= [
super
allocWithZone:inZone];
98
return
sSingleton
;
99
}
100
return
nil
;
101
}
102
103
104
- (id)copyWithZone:(NSZone *)inZone
105
{
106
return
self
;
107
}
108
109
110
- (id)
retain
111
{
112
return
self
;
113
}
114
115
116
- (NSUInteger)
retainCount
117
{
118
return
UINT_MAX;
119
}
120
121
122
- (void)
release
123
{}
124
125
126
- (id)
autorelease
127
{
128
return
self
;
129
}
130
131
@end
OOCocoa.h
sSingleton
static OODebugMonitor * sSingleton
Definition
OODebugMonitor.m:50
OONullTexture.h
sSingleton
static OONullTexture * sSingleton
Definition
OONullTexture.m:33
nil
return nil
Definition
OOProbabilitySet.m:449
OOTextureInternal.h
-[OONullTexture(Singleton) retain]
id retain()
Definition
OONullTexture.m:110
-[OONullTexture(Singleton) retainCount]
NSUInteger retainCount()
Definition
OONullTexture.m:116
-[OONullTexture(Singleton) autorelease]
id autorelease()
Definition
OONullTexture.m:126
-[OONullTexture(Singleton) release]
void release()
Definition
OONullTexture.m:122
OONullTexture
Definition
OONullTexture.h:35
-[OONullTexture forceRebind]
void forceRebind()
Definition
OONullTexture.m:68
-[OONullTexture dimensions]
NSSize dimensions()
Definition
OONullTexture.m:56
-[OONullTexture isMipMapped]
BOOL isMipMapped()
Definition
OONullTexture.m:62
-[OONullTexture name]
NSString * name()
Definition
OONullTexture.m:75
-[OONullTexture apply]
void apply()
Definition
OONullTexture.m:50
+[OONullTexture sharedNullTexture]
OONullTexture * sharedNullTexture()
Definition
OONullTexture.m:38
OOTexture
Definition
OOTexture.h:117
+[OOTexture applyNone]
void applyNone()
Definition
OOTexture.m:275
Generated by
1.12.0