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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/*
* MaplyGeomModel.h
* WhirlyGlobe-MaplyComponent
*
* Created by Steve Gifford on 11/26/14.
* 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/MaplyCoordinate.h>
#import <WhirlyGlobe/MaplyMatrix.h>
#import <WhirlyGlobe/MaplyShape.h>
@class MaplyShader;
/**
Contains a big pile of geometry and textures (e.g. a model).
The geometry model
*/
@interface MaplyGeomModel : NSObject
/**
Initialize with the full path to a Wavefront OBJ model file.
This creates a model from a Wavefront OBJ file, a standard, simple file format for models. You can then instance and place this model where you might like.
*/
- (nullable instancetype)initWithObj:(NSString *__nonnull)fullPath;
/**
Initialize with a shape.
The given shape will be turned into a geometry model so it can be instanced.
*/
- (nonnull instancetype)initWithShape:(MaplyShape *__nonnull)shape;
@end
/**
Place a geometry model at a given location
Geometry models tend to be expensive so we load and place them in a two step process. First you create the MaplyGeomModel and then you place it in one or more spots with this MaplyGeomModelInstance.
*/
@interface MaplyGeomModelInstance : NSObject
/**
User data object for selection
When the user selects a feature and the developer gets it in their delegate, this is an object they can use to figure out what the model instance means to them.
*/
@property (nonatomic,strong,nullable) id userObject;
/// The model to instance
@property (nonatomic,strong,nullable) MaplyGeomModel *model;
/**
Where we'd like to place the instanced model.
This is the center of the object in geographic radians.
*/
@property (nonatomic) MaplyCoordinate3d center;
/// Transform used to oriented the model instance
@property (nonatomic,strong,nullable) MaplyMatrix *transform;
/// Color to force all polygons to use.
/// If set, this will force all polygons to use this color. nil by default.
@property (nonatomic,strong,nullable) UIColor *colorOverride;
/// Set if you want to select these
@property (nonatomic) bool selectable;
@end
/**
A version of the geometry model instance that moves.
This version of the geometry model instance can move in a limited way over time.
*/
@interface MaplyMovingGeomModelInstance : MaplyGeomModelInstance
/// The end point for animation
@property (nonatomic,assign) MaplyCoordinate3d endCenter;
/// How long it will take to get to the endCenter
@property (nonatomic,assign) NSTimeInterval duration;
@end
/**
Sometimes we don't know how many instances there will be of a model until
some logic runs on the GPU. We can then take that number and run that
number of instances of the given model. [Metal only]
*/
@interface MaplyGeomModelGPUInstance : NSObject
/// The model to instance
@property (nonatomic,strong,nullable) MaplyGeomModel *model;
/// Texture to derive the number of instances from (picked out of the highest, smallest level)
@property (nonatomic,nullable) MaplyTexture *numInstSource;
/// Need a shader to pull the number of instances out of a texture and shove them in the indirect buffer
@property (nonatomic,nullable) MaplyShader *numInstShader;
/// Shader to run over for this instance
@property (nonatomic,nullable) MaplyShader *shader;
@end
|