Oolite
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 "OOFoundation.h"
30#import "OOTextureInternal.h"
31
33
34@implementation OONullTexture
35
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{
49}
50
51- (NSSize)dimensions
52{
53 return NSZeroSize;
54}
55
57{
58 return NO;
59}
60
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
112{
113 return self;
114}
115
116@end
static OONullTexture * sSingleton
return nil
NSSize dimensions()
NSString * name()
OONullTexture * sharedNullTexture()
void applyNone()
Definition OOTexture.m:263