本文整理汇总了C++中SpaceSW类的典型用法代码示例。如果您正苦于以下问题:C++ SpaceSW类的具体用法?C++ SpaceSW怎么用?C++ SpaceSW使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpaceSW类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: space_get_contact_count
int PhysicsServerSW::space_get_contact_count(RID p_space) const {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND_V(!space,0);
return space->get_debug_contact_count();
}
示例2: space_set_debug_contacts
void PhysicsServerSW::space_set_debug_contacts(RID p_space,int p_max_contacts) {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
space->set_debug_contacts(p_max_contacts);
}
示例3:
Vector<Vector3> PhysicsServerSW::space_get_contacts(RID p_space) const {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND_V(!space,Vector<Vector3>());
return space->get_debug_contacts();
}
示例4: space_set_param
void PhysicsServerSW::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
space->set_param(p_param, p_value);
}
示例5: flush_queries
void PhysicsServerSW::flush_queries() {
#ifndef _3D_DISABLED
if (!active)
return;
doing_sync = true;
flushing_queries = true;
uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
SpaceSW *space = (SpaceSW *)E->get();
space->call_queries();
}
flushing_queries = false;
if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) {
uint64_t total_time[SpaceSW::ELAPSED_TIME_MAX];
static const char *time_name[SpaceSW::ELAPSED_TIME_MAX] = {
"integrate_forces",
"generate_islands",
"setup_constraints",
"solve_constraints",
"integrate_velocities"
};
for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
total_time[i] = 0;
}
for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
total_time[i] += E->get()->get_elapsed_time(SpaceSW::ElapsedTime(i));
}
}
Array values;
values.resize(SpaceSW::ELAPSED_TIME_MAX * 2);
for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
values[i * 2 + 0] = time_name[i];
values[i * 2 + 1] = USEC_TO_SEC(total_time[i]);
}
values.push_back("flush_queries");
values.push_back(USEC_TO_SEC(OS::get_singleton()->get_ticks_usec() - time_beg));
ScriptDebugger::get_singleton()->add_profiling_frame_data("physics", values);
}
#endif
};
示例6: ERR_FAIL_COND_V
RID PhysicsServerSW::body_get_space(RID p_body) const {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body,RID());
SpaceSW *space = body->get_space();
if (!space)
return RID();
return space->get_self();
};
示例7: area_set_param
void PhysicsServerSW::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) {
if (space_owner.owns(p_area)) {
SpaceSW *space = space_owner.get(p_area);
p_area = space->get_default_area()->get_self();
}
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
area->set_param(p_param, p_value);
};
示例8: area_get_object_instance_id
ObjectID PhysicsServerSW::area_get_object_instance_id(RID p_area) const {
if (space_owner.owns(p_area)) {
SpaceSW *space = space_owner.get(p_area);
p_area = space->get_default_area()->get_self();
}
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND_V(!area, 0);
return area->get_instance_id();
}
示例9: area_attach_object_instance_id
void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_ID) {
if (space_owner.owns(p_area)) {
SpaceSW *space = space_owner.get(p_area);
p_area = space->get_default_area()->get_self();
}
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
area->set_instance_id(p_ID);
}
示例10: area_get_param
Variant PhysicsServerSW::area_get_param(RID p_area, AreaParameter p_param) const {
if (space_owner.owns(p_area)) {
SpaceSW *space = space_owner.get(p_area);
p_area = space->get_default_area()->get_self();
}
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND_V(!area, Variant());
return area->get_param(p_param);
};
示例11:
PhysicsDirectSpaceState *PhysicsServerSW::space_get_direct_state(RID p_space) {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND_V(!space, NULL);
if (!doing_sync || space->is_locked()) {
ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
ERR_FAIL_V(NULL);
}
return space->get_direct_state();
}
示例12: memnew
RID PhysicsServerSW::space_create() {
SpaceSW *space = memnew( SpaceSW );
RID id = space_owner.make_rid(space);
space->set_self(id);
RID area_id = area_create();
AreaSW *area = area_owner.get(area_id);
ERR_FAIL_COND_V(!area,RID());
space->set_default_area(area);
area->set_space(space);
area->set_priority(-1);
RID sgb = body_create();
body_set_space(sgb,id);
body_set_mode(sgb,BODY_MODE_STATIC);
space->set_static_global_body(sgb);
return id;
};
示例13: while
void PhysicsServerSW::free(RID p_rid) {
if (shape_owner.owns(p_rid)) {
ShapeSW *shape = shape_owner.get(p_rid);
while(shape->get_owners().size()) {
ShapeOwnerSW *so=shape->get_owners().front()->key();
so->remove_shape(shape);
}
shape_owner.free(p_rid);
memdelete(shape);
} else if (body_owner.owns(p_rid)) {
BodySW *body = body_owner.get(p_rid);
// if (body->get_state_query())
// _clear_query(body->get_state_query());
// if (body->get_direct_state_query())
// _clear_query(body->get_direct_state_query());
body->set_space(NULL);
while( body->get_shape_count() ) {
body->remove_shape(0);
}
while (body->get_constraint_map().size()) {
RID self = body->get_constraint_map().front()->key()->get_self();
ERR_FAIL_COND(!self.is_valid());
free(self);
}
body_owner.free(p_rid);
memdelete(body);
} else if (area_owner.owns(p_rid)) {
AreaSW *area = area_owner.get(p_rid);
// if (area->get_monitor_query())
// _clear_query(area->get_monitor_query());
area->set_space(NULL);
while( area->get_shape_count() ) {
area->remove_shape(0);
}
area_owner.free(p_rid);
memdelete(area);
} else if (space_owner.owns(p_rid)) {
SpaceSW *space = space_owner.get(p_rid);
while(space->get_objects().size()) {
CollisionObjectSW *co = (CollisionObjectSW *)space->get_objects().front()->get();
co->set_space(NULL);
}
active_spaces.erase(space);
free(space->get_default_area()->get_self());
free(space->get_static_global_body());
space_owner.free(p_rid);
memdelete(space);
} else if (joint_owner.owns(p_rid)) {
JointSW *joint = joint_owner.get(p_rid);
for(int i=0;i<joint->get_body_count();i++) {
joint->get_body_ptr()[i]->remove_constraint(joint);
}
joint_owner.free(p_rid);
memdelete(joint);
} else {
ERR_EXPLAIN("Invalid ID");
ERR_FAIL();
}
};