88 bool select(
const std::string &
name);
102 void bindOwner(uint32_t ownerId);
105 void setHostVisible(
bool visible);
107 void setHostLayer(
int layer);
110 void updateTransforms();
112 void updateTransformsAll();
115 bool setNodePosition(
const std::string &
id,
float x,
float y,
float z);
117 bool setNodeRotation(
const std::string &
id,
float yaw,
float pitch,
float roll);
119 bool setNodeScale(
const std::string &
id,
float sx,
float sy,
float sz);
121 bool setNodeVisible(
const std::string &
id,
bool visible);
128 bool unlinkNode(
const std::string &
nodeId);
133 bool linkRenderable2DAt(
const std::string &hostName,
const std::string &
nodeId,
136 bool linkRenderable3DAt(
const std::string &hostName,
const std::string &
nodeId,
139 bool linkPhysics2DAt(
const std::string &hostName,
const std::string &
nodeId,
142 bool linkPhysics3DAt(
const std::string &hostName,
const std::string &
nodeId,
145 bool linkCamera3DAt(
const std::string &hostName,
const std::string &
nodeId,
148 bool linkAudio3DAt(
const std::string &hostName,
const std::string &
nodeId,
151 bool unlinkNodeAt(
const std::string &hostName,
const std::string &
nodeId);
153 bool unlinkNodeKindAt(
const std::string &hostName,
const std::string &
nodeId,
154 const std::string &
kind);
156 int linkCountAt(
const std::string &hostName,
const std::string &
nodeId);
162 std::vector<float> getNodePositionAt(
const std::string &hostName,
163 const std::string &
nodeId)
const;
165 std::vector<float> getNodeRotationAt(
const std::string &hostName,
166 const std::string &
nodeId)
const;
168 std::vector<float> getNodeScaleAt(
const std::string &hostName,
169 const std::string &
nodeId)
const;
171 bool getNodeVisibleAt(
const std::string &hostName,
const std::string &
nodeId)
const;
173 std::vector<float> getNodeWorldPositionAt(
const std::string &hostName,
174 const std::string &
nodeId)
const;
176 std::vector<float> getNodeWorldRotationAt(
const std::string &hostName,
177 const std::string &
nodeId)
const;
179 std::vector<float> getNodeWorldScaleAt(
const std::string &hostName,
180 const std::string &
nodeId)
const;
183 std::vector<float> localToWorldAt(
const std::string &hostName,
184 const std::string &
nodeId,
float x,
float y,
187 std::vector<float> worldToLocalAt(
const std::string &hostName,
188 const std::string &
nodeId,
float x,
float y,
192 bool setNodeParentAt(
const std::string &hostName,
const std::string &childId,
195 bool removeNodeAt(
const std::string &hostName,
const std::string &
nodeId);
197 bool addChildAt(
const std::string &hostName,
const std::string &
parentId,
198 const std::string &childId);
200 bool removeChildAt(
const std::string &hostName,
const std::string &
parentId,
201 const std::string &childId);
204 bool setNodeQuaternionAt(
const std::string &hostName,
const std::string &
nodeId,
205 float qx,
float qy,
float qz,
float qw);
207 std::vector<float> getNodeQuaternionAt(
const std::string &hostName,
208 const std::string &
nodeId)
const;
210 bool setNodeLookAtAt(
const std::string &hostName,
const std::string &
nodeId,
211 float tx,
float ty,
float tz);
214 bool addNodeTagAt(
const std::string &hostName,
const std::string &
nodeId,
215 const std::string &
tag);
217 bool removeNodeTagAt(
const std::string &hostName,
const std::string &
nodeId,
218 const std::string &
tag);
220 bool hasNodeTagAt(
const std::string &hostName,
const std::string &
nodeId,
221 const std::string &
tag)
const;
223 std::vector<std::string> getNodeTagsAt(
const std::string &hostName,
224 const std::string &
nodeId)
const;
226 std::vector<std::string> collectIdsByTagAt(
const std::string &hostName,
227 const std::string &
tag)
const;
229 bool setNodeLayerAt(
const std::string &hostName,
const std::string &
nodeId,
int layer);
231 int getNodeLayerAt(
const std::string &hostName,
const std::string &
nodeId)
const;
239 bool setNodeEventHandlerAt(
const std::string &hostName, ssq::Object cb);
243 bool setNodeBoundsAt(
const std::string &hostName,
const std::string &
nodeId,
244 float minX,
float minY,
float minZ,
float maxX,
float maxY,
247 bool hasNodeBoundsAt(
const std::string &hostName,
const std::string &
nodeId)
const;
249 std::vector<float> getNodeBoundsAt(
const std::string &hostName,
250 const std::string &
nodeId)
const;
254 std::string serializeHostAt(
const std::string &hostName)
const;
256 bool deserializeHostAt(
const std::string &hostName,
const std::string &json);
260 std::string pickRayAt(
const std::string &hostName,
float ox,
float oy,
float oz,
261 float dx,
float dy,
float dz)
const;
264 float screenX,
float screenY,
float viewW,
float viewH)
const;
268 std::vector<std::string> collectFrustumIdsAt(
const std::string &hostName,
282 [[nodiscard]]
Result<int> applyPcgTerrainCullingAt(
const std::string &hostName,
285 bool syncSpatialIndexAt(
const std::string &hostName,
spatial::Octree *ot)
const;
287 std::string nodeIdFromSpatialIdAt(
const std::string &hostName,
int index)
const;
291 bool hasNode(
const std::string &
id);
295 std::string getRootId();
297 std::string getParentId(
const std::string &
id);
299 int getChildCount(
const std::string &
id);
301 std::string getChildIdAt(
const std::string &
parentId,
int childOrdinal);
303 std::string findIdByName(
const std::string &
name);
305 std::string findIdByPath(
const std::string &
path);
307 std::string getNodePath(
const std::string &
id);
309 bool isAncestor(
const std::string &ancestorId,
const std::string &
nodeId);
311 bool isDescendant(
const std::string &
nodeId,
const std::string &ancestorId);
313 std::vector<std::string> collectIds();
315 std::vector<std::string> collectIdsFrom(
const std::string &
id);
317 std::vector<std::string> collectIdsByName(
const std::string &
name);
319 std::vector<std::string> collectIdsVisible(
bool visible);
321 std::vector<std::string> collectChildIds(
const std::string &
parentId);
323 std::vector<std::string> walkDepthFirstIds();
325 std::vector<std::string> walkBreadthFirstIds();
331 void beginNode(
const std::string &
id,
const std::string &
name =
"");
333 void beginGroup(
const std::string &
id =
"");
337 void addNode(
const std::string &
id,
const std::string &
name =
"");
339 void setBuildPosition(
float x,
float y,
float z = 0.f);
341 void setBuildRotation(
float yaw,
float pitch = 0.f,
float roll = 0.f);
343 void setBuildScale(
float sx,
float sy,
float sz = 1.f);
345 void setBuildSpace(
const std::string &space);
347 void setBuildVisible(
bool visible);
351 bool mountBuildAs(
const std::string &
name);
353 bool remountBuildAs(
const std::string &
name);
361 [[nodiscard]]
SceneHost *resolveHost(
const std::string &hostName)
const;
364 bool rootEntity(
const std::string &hostName,
const std::string &
nodeId,
365 ssq::Object instance);
367 bool unrootEntityAt(
const std::string &hostName,
const std::string &
nodeId,
370 int forEachEntity(
const std::string &hostName,
const std::string &
nodeId,
373 void updateScripts(
float dt);
386 [[nodiscard]]
eve::Result<void> scheduleDetachEntityAt(
const std::string &hostName,
387 const std::string &
nodeId,
388 ssq::Object instance);
390 void flushDelayedDetaches();
393 std::string currentHostName()
const;
395 [[nodiscard]]
SceneNodeRef *getNodeRefAt(
const std::string &hostName,
const std::string &
nodeId)
const;
397 [[nodiscard]]
SceneNodeRef *getNodeRefByPathAt(
const std::string &hostName,
const std::string &
path)
const;
400 struct DelayedDetach {
401 std::string hostName;
403 HSQOBJECT instance{};
405 [[nodiscard]] SceneHost *ensureSelected(
const std::string &preferredName =
"");
406 NodeDesc ¤tParent();
407 void pushOpen(NodeDesc
d);
408 bool buildComplete()
const;
410 [[nodiscard]] SceneObject *findSceneObjectById(uint32_t
id)
const;
411 [[nodiscard]] SceneObject *findSceneObjectByPersistentId(
eve::SceneObjectId id)
const;
412 [[nodiscard]] SceneObject *ensureSceneObject(SceneHost *
host, SceneNode *
node,
const std::string &hostName);
414 void pruneOrphanObjects();
416 void teardownBindings(SceneObject *obj);
418 void syncBindingRefs(SceneObject *obj);
420 bool callMethod(HSQOBJECT inst,
const char *
name,
float dt);
421 bool callMethod0(HSQOBJECT inst,
const char *
name);
422 bool callCallback(HSQOBJECT
fn, HSQOBJECT inst,
int index);
423 void callEventCallback(
const std::string &hostName,
const std::string &
action,
426 SceneHost *selected_ =
nullptr;
428 std::unordered_map<std::string, HSQOBJECT> eventCbs_;
429 std::vector<DelayedDetach> delayedDetaches_;
430 bool flushingDelayedDetaches_ =
false;
432 std::vector<NodeDesc> openStack_;
434 bool hasBuiltRoot_ =
false;
3D rigid body (Box3D) in meter-space coordinates (+Y up by convention). Owned by a World3D; create pr...
2D rigid body (Box2D) in pixel-space coordinates. Owned by a World; create shapes with newRectangleFi...