Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
TextureStore Class Reference

#include <TextureStore.h>

+ Inheritance diagram for TextureStore:
+ Collaboration diagram for TextureStore:

Class Methods

(BOOL) + getPlanetTextureNameFor:intoData:width:height:
 
(BOOL) + getCloudTextureNameFor:color:impress:intoData:width:height:
 

Detailed Description

Definition at line 42 of file TextureStore.h.

Method Documentation

◆ getCloudTextureNameFor:color:impress:intoData:width:height:

+ (BOOL) getCloudTextureNameFor: (OOColor *)
color: (GLfloat)
impress: (GLfloat) bias
intoData: (unsigned char **) textureData
width: (GLuint *) textureWidth
height: (GLuint *) textureHeight 

Definition at line 293 of file TextureStore.m.

153 :(OOColor*)color :(GLfloat)impress :(GLfloat)bias intoData:(unsigned char **)textureData width:(GLuint *)textureWidth height:(GLuint *)textureHeight
154{
155 int texture_h = PROC_TEXTURE_SIZE;
156 int texture_w = PROC_TEXTURE_SIZE;
157 int tex_bytes;
158
159 tex_bytes = texture_w * texture_h * 4;
160
161 NSParameterAssert(textureData != NULL && textureWidth != NULL && textureHeight != NULL);
162
163 unsigned char *imageBuffer = malloc(tex_bytes);
164 if (imageBuffer == NULL) return NO;
165
166 *textureData = imageBuffer;
167 *textureWidth = texture_w;
168 *textureHeight = texture_h;
169
170 fillSquareImageDataWithCloudTexture( imageBuffer, texture_w, color, impress, bias);
171
172 return YES;
173}
static void fillSquareImageDataWithCloudTexture(unsigned char *imageBuffer, int width, OOColor *cloudcolor, float impress, float bias)
#define PROC_TEXTURE_SIZE

References addNoise(), FloatRGB::b, FloatRGB::g, RANROTSeed::high, RANROTSeed::low, OOLog, PlanetTextureColor(), q_factor(), FloatRGB::r, sNoiseSeed, x, and y.

+ Here is the call graph for this function:

◆ getPlanetTextureNameFor:intoData:width:height:

+ (BOOL) getPlanetTextureNameFor: (NSDictionary *) planetInfo
intoData: (unsigned char **) textureData
width: (GLuint *) textureWidth
height: (GLuint *) textureHeight 

Definition at line 293 of file TextureStore.m.

114 :(NSDictionary *)planetInfo intoData:(unsigned char **)textureData width:(GLuint *)textureWidth height:(GLuint *)textureHeight
115{
116 int texture_h = PROC_TEXTURE_SIZE;
117 int texture_w = PROC_TEXTURE_SIZE;
118
119 int tex_bytes = texture_w * texture_h * 4;
120
121 NSParameterAssert(textureData != NULL && textureWidth != NULL && textureHeight != NULL);
122
123 unsigned char *imageBuffer = malloc(tex_bytes);
124 if (imageBuffer == NULL) return NO;
125
126 *textureData = imageBuffer;
127 *textureWidth = texture_w;
128 *textureHeight = texture_h;
129
130 float land_fraction = [[planetInfo objectForKey:@"land_fraction"] floatValue];
131 float sea_bias = land_fraction - 1.0;
132
133 OOLog(kOOLogPlanetTextureGen, @"genning texture for land_fraction %.5f", land_fraction);
134
135 FloatRGB land_color = FloatRGBFromDictColor(planetInfo, @"land_color");
136 FloatRGB sea_color = FloatRGBFromDictColor(planetInfo, @"sea_color");
137 FloatRGB polar_land_color = FloatRGBFromDictColor(planetInfo, @"polar_land_color");
138 FloatRGB polar_sea_color = FloatRGBFromDictColor(planetInfo, @"polar_sea_color");
139
140 // Pale sea colour gives a better transition between land and sea., Backported from the new planets code.
141 FloatRGB pale_sea_color = Blend(0.45, polar_sea_color, Blend(0.7, sea_color, land_color));
142
143 fillSquareImageWithPlanetTex(imageBuffer, texture_w, 1.0, sea_bias,
144 sea_color,
145 pale_sea_color,
146 land_color,
147 polar_land_color);
148
149 return YES;
150}
#define OOLog(class, format,...)
Definition OOLogging.h:88
static FloatRGB FloatRGBFromDictColor(NSDictionary *dictionary, NSString *key)
static FloatRGB Blend(float fraction, FloatRGB a, FloatRGB b)
static void fillSquareImageWithPlanetTex(unsigned char *imageBuffer, int width, float impress, float bias, FloatRGB seaColor, FloatRGB paleSeaColor, FloatRGB landColor, FloatRGB paleLandColor)
static NSString *const kOOLogPlanetTextureGen

The documentation for this class was generated from the following files: