MSFPostProcessEffect
Objective-C
@interface MSFPostProcessEffect : NSObject {
void *swigCPtr;
BOOL swigCMemOwn;
}
Swift
class MSFPostProcessEffect : NSObject
A full-screen post-processing effect. When attached to the map via MapRenderer::setPostProcessEffect, the map is rendered into an offscreen buffer and the effect fragment shader produces the final screen output.
The fragment shader must be GLSL ES 1.00 (#version 100) source. The following uniforms are provided by the renderer:
- sampler2D uColorTex: the rendered map frame (premultiplied alpha).
- sampler2D uTerrainDepthTex: packed terrain depth buffer (only if terrain depth is required; RGB = 24-bit fixed point linear depth 0..1 relative to the far plane, A = terrain coverage). Use dot(rgb, vec3(1.0, 1.0/255.0, 1.0/65025.0)) to unpack.
- vec2 uInvScreenSize: 1/width, 1/height of the screen in pixels.
- float uNear, uFar: view frustum distances (internal units).
- vec2 uProjInvScale: tan(fovy/2) * aspect, tan(fovy/2). With the terrain depth this reconstructs the eye-space position of a pixel: vec3(ndc * uProjInvScale, -1.0) * depth * uFar, ndc = uv * 2 - 1.
- float uTime: seconds since the effect was attached. Additionally all float parameters set via setFloatParameter are available as float uniforms, and all colors set via setColorParameter as vec4 uniforms (rgba 0..1). Screen texture coordinates can be computed as gl_FragCoord.xy * uInvScreenSize.
Note: this class is experimental and may change or even be removed in future SDK versions.
-
Checks if this object is equal to the specified object.
Declaration
Objective-C
- (BOOL)isEqual:(id)object;Swift
func isEqual(_ object: Any!) -> BoolParameters
objectThe reference object.
Return Value
True when objects are equal, false otherwise.
-
Returns the hash value of this object.
Declaration
Objective-C
- (NSUInteger)hash;Swift
func hash() -> UIntReturn Value
The hash value of this object.
-
Constructs a post-process effect from a fragment shader.
Declaration
Objective-C
- (id)initWithName:(NSString *)name fragmentShader:(NSString *)fragmentShader;Swift
init!(name: String!, fragmentShader: String!)Parameters
nameThe name of the effect (used for shader caching, should be unique).
fragmentShaderThe GLSL ES 1.00 fragment shader source.
-
Returns the name of the effect.
Declaration
Objective-C
- (NSString *)getName;Swift
func getName() -> String!Return Value
The name of the effect.
-
Returns the fragment shader source of the effect.
Declaration
Objective-C
- (NSString *)getFragmentShader;Swift
func getFragmentShader() -> String!Return Value
The fragment shader source.
-
Returns true if the effect needs the terrain depth pre-pass (uTerrainDepthTex).
Declaration
Objective-C
- (BOOL)isTerrainDepthRequired;Swift
func isTerrainDepthRequired() -> BoolReturn Value
True if terrain depth is rendered for the effect. The default is false.
-
Sets whether the effect needs the terrain depth pre-pass.
Declaration
Objective-C
- (void)setTerrainDepthRequired:(BOOL)required;Swift
func setTerrainDepthRequired(_ required: Bool)Parameters
requiredTrue if the terrain depth should be rendered for the effect.
-
Returns the value of a float parameter.
Declaration
Objective-C
- (float)getFloatParameter:(NSString *)name;Swift
func getFloatParameter(_ name: String!) -> FloatParameters
nameThe name of the parameter.
Return Value
The value of the parameter, or 0 if not set.
-
Sets a float parameter. The parameter is exposed to the fragment shader as a uniform.
Declaration
Objective-C
- (void)setFloatParameter:(NSString *)name value:(float)value;Swift
func setFloatParameter(_ name: String!, value: Float)Parameters
nameThe name of the parameter (must be a valid GLSL identifier).
valueThe new value for the parameter.
-
Sets a color parameter. The parameter is exposed to the fragment shader as a vec4 uniform with components in the 0..1 range.
Declaration
Objective-C
- (void)setColorParameter:(NSString *)name color:(MSFColor *)color;Swift
func setColorParameter(_ name: String!, color: MSFColor!)Parameters
nameThe name of the parameter (must be a valid GLSL identifier).
colorThe new value for the parameter.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()