Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
OONullTexture.m
Go to the documentation of this file.
1/*
2
3OONullTexture.m
4
5
6Copyright (C) 2008-2013 Jens Ayton
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE.
25
26*/
27
28#import "OONullTexture.h"
29#import "OOCocoa.h"
30#import "OOTextureInternal.h"
31
32
34
35
36@implementation OONullTexture
37
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{
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
static OODebugMonitor * sSingleton
static OONullTexture * sSingleton
return nil
NSSize dimensions()
NSString * name()
OONullTexture * sharedNullTexture()
void applyNone()
Definition OOTexture.m:275