载入中...
搜索中...
未找到
World3DTopology.cpp
浏览该文件的文档.
1#include <utility>
2#include "common/Exception.h"
3#include "physics/Body3D.h"
4#include "physics/Joint3D.h"
5#include "physics/Shape3D.h"
6#include "physics/World3D.h"
7
8namespace eve::physics {
9void World3D::adoptPreparedTopology(World3D &prepared) {
10 cancelForceStep();
11 adoptCouplings3D(prepared);
12 auto swapped = rigidBackend_->swapTopology(*prepared.rigidBackend_);
13 if (!swapped) throw eve::Exception("%s", swapped.status().describe().c_str());
14 std::swap(nextId_, prepared.nextId_);
15 std::swap(nextShapeId_, prepared.nextShapeId_);
16 std::swap(nextJointId_, prepared.nextJointId_);
17 std::swap(nextBodyHandleIndex_, prepared.nextBodyHandleIndex_);
18 std::swap(nextShapeHandleIndex_, prepared.nextShapeHandleIndex_);
19 std::swap(nextJointHandleIndex_, prepared.nextJointHandleIndex_);
20 std::swap(bodies_, prepared.bodies_);
21 std::swap(shapes_, prepared.shapes_);
22 std::swap(joints_, prepared.joints_);
23 std::swap(mechanisms_, prepared.mechanisms_);
24 std::swap(restoredBodies_, prepared.restoredBodies_);
25 std::swap(restoredShapes_, prepared.restoredShapes_);
26 std::swap(restoredJoints_, prepared.restoredJoints_);
27 std::swap(shapeRecords_, prepared.shapeRecords_);
28 std::swap(shapeHandles_, prepared.shapeHandles_);
29 std::swap(shapeRawHandles_, prepared.shapeRawHandles_);
30 std::swap(jointHandles_, prepared.jointHandles_);
31 std::swap(simulationTick_, prepared.simulationTick_);
32 for (Body3D *body : bodies_) body->world_ = this;
33 for (Shape3D *shape : shapes_) shape->world_ = this;
34 for (Joint3D *joint : joints_) joint->world_ = this;
35 for (Body3D *body : prepared.bodies_) body->world_ = &prepared;
36 for (Shape3D *shape : prepared.shapes_) shape->world_ = &prepared;
37 for (Joint3D *joint : prepared.joints_) joint->world_ = &prepared;
38}
39
40} // namespace eve::physics
ShaderImageInput shape
std::string body
EVENGINE_API_FOUNDATION public API.
Definition Exception.h:13
friend class Body3D
Definition World3D.h:1058
friend class Joint3D
Definition World3D.h:1059
friend class Shape3D
Definition World3D.h:1063
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36