Line data Source code
1 0 : /* 2 : 3 : OOPlanetTextureGenerator.h 4 : 5 : Generator for planet diffuse maps. 6 : 7 : 8 : Oolite 9 : Copyright (C) 2004-2013 Giles C Williams and contributors 10 : 11 : This program is free software; you can redistribute it and/or 12 : modify it under the terms of the GNU General Public License 13 : as published by the Free Software Foundation; either version 2 14 : of the License, or (at your option) any later version. 15 : 16 : This program is distributed in the hope that it will be useful, 17 : but WITHOUT ANY WARRANTY; without even the implied warranty of 18 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 : GNU General Public License for more details. 20 : 21 : You should have received a copy of the GNU General Public License 22 : along with this program; if not, write to the Free Software 23 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 : MA 02110-1301, USA. 25 : 26 : */ 27 : 28 : #import "OOTextureGenerator.h" 29 : #import "OOMaths.h" 30 : 31 : 32 : @class OOPlanetNormalMapGenerator, OOPlanetAtmosphereGenerator; 33 : 34 : 35 0 : typedef struct OOPlanetTextureGeneratorInfo 36 : { 37 0 : RANROTSeed seed; 38 : 39 0 : unsigned width; 40 0 : unsigned height; 41 : 42 : // Planet parameters. 43 0 : float landFraction; 44 0 : float polarFraction; 45 0 : FloatRGB landColor; 46 0 : FloatRGB seaColor; 47 0 : FloatRGB deepSeaColor; 48 0 : FloatRGB paleLandColor; 49 0 : FloatRGB polarSeaColor; 50 0 : FloatRGB paleSeaColor; 51 : 52 : // Planet mixing coefficients. 53 0 : float mix_hi; 54 0 : float mix_oh; 55 0 : float mix_ih; 56 0 : float mix_polarCap; 57 : 58 : // Atmosphere parameters. 59 0 : float cloudAlpha; 60 0 : float cloudFraction; 61 0 : FloatRGB airColor; 62 0 : FloatRGB cloudColor; 63 0 : FloatRGB paleCloudColor; 64 : 65 : // Noise generation stuff. 66 0 : float *fbmBuffer; 67 0 : float *qBuffer; 68 : 69 0 : uint16_t *permutations; 70 : 71 0 : unsigned planetAspectRatio; 72 0 : unsigned planetScaleOffset; 73 0 : BOOL perlin3d; 74 0 : } OOPlanetTextureGeneratorInfo; 75 : 76 : 77 : 78 0 : @interface OOPlanetTextureGenerator: OOTextureGenerator 79 : { 80 : @private 81 0 : OOPlanetTextureGeneratorInfo _info; 82 0 : unsigned _planetScale; 83 : 84 0 : OOPlanetNormalMapGenerator *_nMapGenerator; 85 0 : OOPlanetAtmosphereGenerator *_atmoGenerator; 86 : } 87 : 88 : 89 0 : - (id) initWithPlanetInfo:(NSDictionary *)planetInfo; 90 : 91 0 : + (OOTexture *) planetTextureWithInfo:(NSDictionary *)planetInfo; 92 0 : + (BOOL) generatePlanetTexture:(OOTexture **)texture andAtmosphere:(OOTexture **)atmosphere withInfo:(NSDictionary *)planetInfo; 93 0 : + (BOOL) generatePlanetTexture:(OOTexture **)texture secondaryTexture:(OOTexture **)secondaryTexture withInfo:(NSDictionary *)planetInfo; 94 0 : + (BOOL) generatePlanetTexture:(OOTexture **)texture secondaryTexture:(OOTexture **)secondaryTexture andAtmosphere:(OOTexture **)atmosphere withInfo:(NSDictionary *)planetInfo; 95 : 96 : @end