File: OOTextureGenerator.m

package info (click to toggle)
oolite 1.77.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 41,264 kB
  • ctags: 5,362
  • sloc: objc: 132,090; ansic: 10,457; python: 2,225; sh: 1,325; makefile: 332; perl: 259; xml: 125; php: 5
file content (65 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
//  OOTextureGenerator.m
//  textureGeneratorTestRig
//
//  Created by Jens Ayton on 2009-12-15.
//  Copyright 2009 Jens Ayton. All rights reserved.
//

#import "OOTextureGenerator.h"
#import "textureGeneratorTestRig.h"


@implementation OOTextureGenerator

- (BOOL) isReady
{
	return _ready;
}


- (BOOL) enqueue
{
	return NO;
}

- (BOOL) getResult:(void **)outData
			format:(OOTextureDataFormat *)outFormat
			 width:(uint32_t *)outWidth
			height:(uint32_t *)outHeight
{
	*outData = data;
	*outFormat = format;
	*outWidth = width;
	*outHeight = height;
	
	return YES;
}


- (void) loadTexture
{
	
}


- (void) render
{
	[self loadTexture];
	_ready = YES;
}


- (void) dumpToRGBFile:(NSString *)rgbName andAlphaFile:(NSString *)alphaName
{
	NSAssert(_ready, @"Must call -render before -dumpToRGBFile:andAlphaFile:");
	
	[UNIVERSE dumpRGBAToRGBFileNamed:rgbName
					andGrayFileNamed:alphaName
							   bytes:data
							   width:width
							  height:height
							rowBytes:width * 4];
}

@end