-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathScene.java
More file actions
250 lines (217 loc) · 6.59 KB
/
Copy pathScene.java
File metadata and controls
250 lines (217 loc) · 6.59 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
package app.f3d.F3D;
import java.util.List;
public class Scene {
/** Thrown when a file or mesh cannot be loaded into the scene. */
public static class LoadFailureException extends F3DException {
public LoadFailureException(String message) { super(message); }
}
/** Thrown when a light operation fails (e.g. invalid index). */
public static class LightException extends F3DException {
public LightException(String message) { super(message); }
}
/** Thrown when a scene hierarchy node operation fails (e.g. invalid index). */
public static class NodeException extends F3DException {
public NodeException(String message) { super(message); }
}
public Scene(long nativeAddress) {
mNativeAddress = nativeAddress;
}
/**
* Add and load a file into the scene.
*
* @param filePath file path to add
* @return this scene for method chaining
*/
public native Scene add(String filePath);
/**
* Add and load multiple files into the scene.
*
* @param filePaths list of file paths to add
* @return this scene for method chaining
*
* @deprecated use `add(List<String> filePaths)` instead.
* This function will be private in 4.0
*/
@Deprecated
public native Scene addAll(List<String> filePaths);
/**
* Add and load multiple files into the scene.
*
* @param filePaths list of file paths to add
* @return this scene for method chaining
*/
public Scene add(List<String> filePaths)
{
return this.addAll(filePaths);
}
/**
* Add and load a mesh into the scene.
*
* @param mesh mesh to add
* @return this scene for method chaining
*
* @deprecated use `add(Types.Mesh mesh)` instead.
* This function will be private in 4.0
*/
@Deprecated
public native Scene addMesh(Types.Mesh mesh);
/**
* Add and load a mesh into the scene.
*
* @param mesh mesh to add
* @return this scene for method chaining
*/
public Scene add(Types.Mesh mesh)
{
return this.addMesh(mesh);
}
/**
* Add and load a buffer containing a file into the scene.
*
* @param buffer Memory buffer to load
* @param size Size of memory buffer to load
* @return this scene for method chaining
*
* @deprecated use `add(byte[] buffer)` instead.
* This function will be removed in 4.0
*/
@Deprecated
public Scene addBuffer(byte[] buffer, int size)
{
return this.addBuffer(buffer);
}
private native Scene addBuffer(byte[] buffer);
/**
* Add and load a buffer containing a file into the scene.
*
* @param buffer Memory buffer to load
* @return this scene for method chaining
*/
public Scene add(byte[] buffer)
{
return this.addBuffer(buffer);
}
/**
* Clear the scene of all added files.
*
* @return this scene for method chaining
*/
public native Scene clear();
/**
* Get the list of files currently added to the scene.
*
* @return list of added file paths
*/
public native List<String> getAddedFiles();
/**
* Add a light based on a light state.
*
* @param lightState light state
* @return index of the added light
*/
public native int addLight(Types.LightState lightState);
/**
* Get the number of lights.
*
* @return number of lights in the scene
*/
public native int getLightCount();
/**
* Get the light state at provided index.
*
* @param index index of the light
* @return light state
*/
public native Types.LightState getLight(int index);
/**
* Update a light at provided index with the provided light state.
*
* @param index index of the light to update
* @param lightState new light state
* @return this scene for method chaining
*/
public native Scene updateLight(int index, Types.LightState lightState);
/**
* Remove a light at provided index.
*
* @param index index of the light to remove
* @return this scene for method chaining
*/
public native Scene removeLight(int index);
/**
* Remove all lights from the scene.
*
* @return this scene for method chaining
*/
public native Scene removeAllLights();
/**
* Get the scene hierarchy of all added files, in depth-first pre-order, so that a parent
* node always precedes its children.
*
* @return the list of scene hierarchy nodes
*/
public native List<Types.NodeState> getSceneHierarchy();
/**
* Set the visibility of a scene hierarchy node and of all the nodes in its subtree.
*
* @param nodeId index of the node
* @param visible visibility to set
* @return this scene for method chaining
*/
public native Scene setNodeVisibility(int nodeId, boolean visible);
/**
* Check if a file path is supported by the scene.
*
* @param filePath file path to check
* @return true if supported, false otherwise
*/
public native boolean supports(String filePath);
/**
* Load added files at provided time value if they contain any animation.
*
* @param timeValue time value to load
* @return this scene for method chaining
*/
public native Scene loadAnimationTime(double timeValue);
/**
* Get animation time range of currently added files.
*
* @return array of 2 doubles [min_time, max_time]
*/
public native double[] animationTimeRange();
/**
* Get animation keyframe's time of currently added files.
*
* @return list of double
*/
public native double[] getAnimationKeyFrames();
/**
* Return the number of animations available in the currently loaded files.
*
* @return number of available animations
*/
public native int availableAnimations();
/**
* Get the current animation name, if any.
*
* @return animation names or string error
*/
public String getAnimationName() {
// note : -1 gets the current animation
return getAnimationName(-1);
}
/**
* Get the animation name of a given animation index, if any.
*
* @param index animation index, -1 for current animation
* @return animation name or string error
*/
public native String getAnimationName(int index);
/**
* Get all of the animation names, if any.
*
* @return list of animation names
*/
public native List<String> getAnimationNames();
private long mNativeAddress;
}