Oolite
Loading...
Searching...
No Matches
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 "
OOFoundation.h
"
30
#import "
OOTextureInternal.h
"
31
32
static
OONullTexture
*
sSingleton
=
nil
;
33
34
@implementation
OONullTexture
35
36
+ (
OONullTexture
*)
sharedNullTexture
37
{
38
// NOTE: assumes single-threaded access.
39
if
(
sSingleton
==
nil
) {
40
sSingleton
= [[
self
alloc] init];
41
}
42
43
return
sSingleton
;
44
}
45
46
- (void)
apply
47
{
48
[
OOTexture
applyNone
];
49
}
50
51
- (NSSize)
dimensions
52
{
53
return
NSZeroSize;
54
}
55
56
- (BOOL)
isMipMapped
57
{
58
return
NO;
59
}
60
61
- (void)
forceRebind
62
{
63
}
64
65
#ifndef NDEBUG
66
- (NSString*)
name
67
{
68
return
@"<null texture>"
;
69
}
70
#endif
71
72
@end
73
74
@implementation
OONullTexture (Singleton)
75
76
/* Canonical singleton boilerplate.
77
See Cocoa Fundamentals Guide: Creating a Singleton Instance.
78
See also +nullTexture above.
79
80
NOTE: assumes single-threaded access.
81
*/
82
83
+ (id)allocWithZone:(NSZone*)inZone
84
{
85
if
(
sSingleton
==
nil
) {
86
sSingleton
= [
super
allocWithZone:inZone];
87
return
sSingleton
;
88
}
89
return
nil
;
90
}
91
92
- (id)copyWithZone:(NSZone*)inZone
93
{
94
return
self
;
95
}
96
97
- (id)
retain
98
{
99
return
self
;
100
}
101
102
- (NSUInteger)
retainCount
103
{
104
return
UINT_MAX;
105
}
106
107
- (void)
release
108
{
109
}
110
111
- (id)
autorelease
112
{
113
return
self
;
114
}
115
116
@end
OOFoundation.h
OONullTexture.h
sSingleton
static OONullTexture * sSingleton
Definition
OONullTexture.m:32
nil
return nil
Definition
OOProbabilitySet.m:393
OOTextureInternal.h
-[OONullTexture(Singleton) retain]
id retain()
Definition
OONullTexture.m:97
-[OONullTexture(Singleton) retainCount]
NSUInteger retainCount()
Definition
OONullTexture.m:102
-[OONullTexture(Singleton) autorelease]
id autorelease()
Definition
OONullTexture.m:111
-[OONullTexture(Singleton) release]
void release()
Definition
OONullTexture.m:107
OONullTexture
Definition
OONullTexture.h:34
-[OONullTexture forceRebind]
void forceRebind()
Definition
OONullTexture.m:61
-[OONullTexture dimensions]
NSSize dimensions()
Definition
OONullTexture.m:51
-[OONullTexture isMipMapped]
BOOL isMipMapped()
Definition
OONullTexture.m:56
-[OONullTexture name]
NSString * name()
Definition
OONullTexture.m:66
-[OONullTexture apply]
void apply()
Definition
OONullTexture.m:46
+[OONullTexture sharedNullTexture]
OONullTexture * sharedNullTexture()
Definition
OONullTexture.m:36
OOTexture
Definition
OOTexture.h:109
+[OOTexture applyNone]
void applyNone()
Definition
OOTexture.m:263
src
Core
Materials
OONullTexture.m
Generated by
1.15.0