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
82
83
84
85
86
87
88
|
/*
* MaplyVariableTarget.h
* WhirlyGlobe-MaplyComponent
*
* Created by Steve Gifford on 9/18/18.
* 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 <WhirlyGlobe/MaplyTexture.h>
#import <WhirlyGlobe/MaplyRenderTarget.h>
#import <WhirlyGlobe/MaplyRenderController.h>
/**
A variable target manages two pass rendering for one type of variable.
Set up the variable target
*/
@interface MaplyVariableTarget : NSObject
/// Initialize with the variable type and view controller
- (nonnull instancetype)initWithType:(MaplyQuadImageFormat)type viewC:(NSObject<MaplyRenderControllerProtocol> * __nonnull)viewC;
/// Render target created for this variable target
@property (nonatomic,readonly,strong,nonnull) MaplyRenderTarget *renderTarget;
/// Scale the screen by this amount for the render target
- (void)setScale:(double)scale;
/// Color of the rectangle used to draw the render target
@property (nonatomic,strong,nonnull) UIColor *color;
/// Draw priority of the rectangle we'll use to draw the render target to the screen
@property (nonatomic,assign) int drawPriority;
/// If set (by default), then we clear out the render target every frame
@property (nonatomic,assign) bool clearEveryFrame;
/// When we're clearing, use this value. 0 by default
@property (nonatomic,assign) float clearVal;
/// Shader used to draw the render target to the screen.
/// Leave this empty and we'll provide our own
@property (nonatomic,strong,nullable) MaplyShader *shader;
/// By default we'll build a rectangle to display the target
@property (nonatomic,assign) bool buildRectangle;
/// If set, the rectangle rendered to the screen will read from the z Buffer
/// Useful, when doing depth comparisons
@property (nonatomic,assign) bool zBuffer;
/// Rectangle created to show the variable target (if that's set)
@property (nonatomic,readonly,nullable) MaplyComponentObject *rectObj;
/// Size of the texture in pixels for the render target
@property (nonatomic,readonly) CGSize texSize;
/// The texture we're rendering to (as part of the render target)
@property (nonatomic,readonly,strong,nullable) MaplyTexture *renderTex;
/// Passing in another variable target will let us assign that target to the
/// rectangle used to render this variable target's data. This is used if
/// you need the contents of more than one target in a shader.
- (void)addVariableTarget:(MaplyVariableTarget * __nonnull)target;
// Pass this uniform block to the geometry we create for rendering (if it was created)
- (void)setUniformBlock:(NSData *__nonnull)uniBlock buffer:(int)bufferID;
/// Clear the target for the next frame
- (void)clear;
/// Stop rendering to the target and release everything
- (void)shutdown;
@end
|