Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOProbabilisticTextureManager.h
Go to the documentation of this file.
1/*
2
3OOProbabilisticTextureManager.h
4
5Manages a set of textures, specified in a property list, with associated
6probabilities. To avoid interfering with other PRNG-based code, it uses its
7own ranrot state.
8
9
10Copyright (C) 2007-2013 Jens Ayton
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files (the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions:
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29
30*/
31
32#import <Foundation/Foundation.h>
33#import "OOTexture.h"
34#import "OOMaths.h"
35
36
38{
39@private
40 unsigned _count;
42 float *_prob;
43 int *_galaxy;
44 float _probMax;
47}
48
49/* plistName is the name of the property list specifying the actual textures
50 to use. The plist will be loaded from Config directories and merged. It
51 should contain an array of dictionaries; each dictionary must have a
52 "texture" entry specifying the texture file name (in Textures directories)
53 and an optional "probability" entry (default: 1.0). As a convenience, an
54 entry may also be a string, in which case probability will be 1.0.
55
56 If no seed is specified, the current seed will be copied.
57*/
58- (id)initWithPListName:(NSString *)plistName
59 options:(uint32_t)options
60 anisotropy:(GLfloat)anisotropy
61 lodBias:(GLfloat)lodBias;
62
63- (id)initWithPListName:(NSString *)plistName
64 options:(uint32_t)options
65 anisotropy:(GLfloat)anisotropy
66 lodBias:(GLfloat)lodBias
67 seed:(RANROTSeed)seed;
68
69/* Select a texture, weighted-randomly.
70*/
71- (OOTexture *)selectTexture;
72
73- (unsigned)textureCount;
74
75- (void)ensureTexturesLoaded;
76
77- (RANROTSeed)seed;
78- (void)setSeed:(RANROTSeed)seed;
79
80@end