Oolite
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:impress:bias:intoData:width:height:

Detailed Description

Definition at line 40 of file TextureStore.h.

Method Documentation

◆ getCloudTextureNameFor:impress:bias:intoData:width:height:

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

Definition at line 139 of file TextureStore.m.

139 :(OOColor*)color impress:(GLfloat)impress bias:(GLfloat)bias intoData:(unsigned char**)textureData width:(GLuint*)textureWidth height:(GLuint*)textureHeight
140{
141 int texture_h = PROC_TEXTURE_SIZE;
142 int texture_w = PROC_TEXTURE_SIZE;
143 int tex_bytes;
144
145 tex_bytes = texture_w * texture_h * 4;
146
147 NSParameterAssert(textureData != NULL && textureWidth != NULL && textureHeight != NULL);
148
149 unsigned char* imageBuffer = malloc(tex_bytes);
150 if (imageBuffer == NULL)
151 return NO;
152
153 *textureData = imageBuffer;
154 *textureWidth = texture_w;
155 *textureHeight = texture_h;
156
157 fillSquareImageDataWithCloudTexture(imageBuffer, texture_w, color, impress, bias);
158
159 return YES;
160}
static void fillSquareImageDataWithCloudTexture(unsigned char *imageBuffer, int width, OOColor *cloudcolor, float impress, float bias)
#define PROC_TEXTURE_SIZE

References fillSquareImageDataWithCloudTexture(), and PROC_TEXTURE_SIZE.

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 100 of file TextureStore.m.

100 :(NSDictionary*)planetInfo intoData:(unsigned char**)textureData width:(GLuint*)textureWidth height:(GLuint*)textureHeight
101{
102 int texture_h = PROC_TEXTURE_SIZE;
103 int texture_w = PROC_TEXTURE_SIZE;
104
105 int tex_bytes = texture_w * texture_h * 4;
106
107 NSParameterAssert(textureData != NULL && textureWidth != NULL && textureHeight != NULL);
108
109 unsigned char* imageBuffer = malloc(tex_bytes);
110 if (imageBuffer == NULL)
111 return NO;
112
113 *textureData = imageBuffer;
114 *textureWidth = texture_w;
115 *textureHeight = texture_h;
116
117 float land_fraction = [[planetInfo objectForKey:@"land_fraction"] floatValue];
118 float sea_bias = land_fraction - 1.0;
119
120 OOLog(kOOLogPlanetTextureGen, @"genning texture for land_fraction %.5f", land_fraction);
121
122 FloatRGB land_color = FloatRGBFromDictColor(planetInfo, @"land_color");
123 FloatRGB sea_color = FloatRGBFromDictColor(planetInfo, @"sea_color");
124 FloatRGB polar_land_color = FloatRGBFromDictColor(planetInfo, @"polar_land_color");
125 FloatRGB polar_sea_color = FloatRGBFromDictColor(planetInfo, @"polar_sea_color");
126
127 // Pale sea colour gives a better transition between land and sea., Backported from the new planets code.
128 FloatRGB pale_sea_color = Blend(0.45, polar_sea_color, Blend(0.7, sea_color, land_color));
129
130 fillSquareImageWithPlanetTex(imageBuffer, texture_w, 1.0, sea_bias,
131 sea_color,
132 pale_sea_color,
133 land_color,
134 polar_land_color);
135
136 return YES;
137}
#define OOLog(class, format,...)
Definition OOLogging.h:84
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

References Blend(), fillSquareImageWithPlanetTex(), FloatRGBFromDictColor(), kOOLogPlanetTextureGen, OOLog, and PROC_TEXTURE_SIZE.

Here is the call graph for this function:

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