blob: 3af444ffb2f8a9a5ee16eb02a06e1c07af02c13f (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* MaplyAtmosphere.h
* WhirlyGlobe-MaplyComponent
*
* Created by Steve Gifford on 6/30/15.
* Copyright 2011-2022 mousebird consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <UIKit/UIKit.h>
#import <WhirlyGlobeMaplyComponent/MaplyComponentObject.h>
#import <WhirlyGlobeMaplyComponent/WhirlyGlobeViewController.h>
#import <WhirlyGlobeMaplyComponent/MaplyLight.h>
/**
Sets up the objects and shaders to implement an atmosphere.
This object sets up a shader implementation of the simple atmosphere from GPU Gems 2 http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html
*/
@interface MaplyAtmosphere : NSObject
/// Initialize the view controller. Will place objects in that view controller.
- (nullable instancetype)initWithViewC:(WhirlyGlobeViewController *__nonnull)viewC;
/// Rayleigh scattering constant (0.0025 by default)
@property (nonatomic) float Kr;
/// Mie scattering constant (0.0010 by default)
@property (nonatomic) float Km;
/// Brightness of the sun (20.0 by default)
@property (nonatomic) float ESun;
/// Number of samples for the ray through the atmosphere (3 by default)
@property (nonatomic) int numSamples;
/// Outer radius of the atmosphere (1.05 by default). Earth is radius 1.0.
@property (nonatomic) float outerRadius;
/// Constant used in the fragment shader. Default is -0.95.
@property (nonatomic) float g;
/// Exposure constant in fragment shader. Default is 2.0.
@property (nonatomic) float exposure;
/// The ground shader we set up. You need to apply it yourself.
@property (nonatomic,nullable,strong) MaplyShader *groundShader;
/// If set we'll lock the sun direction to the camera position. Permanent daylight.
@property (nonatomic) bool lockToCamera;
/// Wavelengths of the light (RGB). Three floats, defaults are: 0.650, 0.570, 0.475
- (void)setWavelength:(float *__nonnull)wavelength;
/// Wavelengths of the light (RGB). Defaults are: 0.650, 0.570, 0.475
- (void)setWavelengthRed:(float) redWavelength green:(float)greenWavelength blue:(float)blueWavelength;
/// Return the current wavelength settings (RGB)
- (void)getWavelength:(float *__nonnull)wavelength;
/// Return the current wavelength settings (RGB). The component is 0 for red, 1 for green and 2 for blue
- (float)getWavelengthForComponent:(short)component;
/// Set the sun's position relative to the earth. This is what comes out of MaplySun.
- (void)setSunPosition:(MaplyCoordinate3d)sunDir;
/// Remove objects from the view controller we set it up in.
- (void)removeFromViewC;
@end
|