oam_entry::shape_size oam_entry::get_shape_size() const
{
	u32 attr0_shape_no_shift = get_bits( attr0, obj_attr0_shape_mask,
		obj_attr0_shape_shift );
	u32 attr1_size_no_shift = get_bits( attr1, obj_attr1_size_mask,
		obj_attr1_size_shift );
	
	// Error checking
	if ( attr0_shape_no_shift >= num_attr0_shapes 
		|| attr1_size_no_shift >= num_attr1_sizes )
	{
		//return ss_attrs_no_shift_to_ss_enum_arr_2d[0][0];
		return shape_size(0);
	}
	else
	{
		//return ss_attrs_no_shift_to_ss_enum_arr_2d[attr0_shape_no_shift]
		//	[attr1_size_no_shift];
		
		// Multiply by num_attr1_sizes because the expression becomes a
		// single shift and an add instead of a shift and two adds.
		return shape_size( attr0_shape_no_shift * num_attr1_sizes 
			+ attr1_size_no_shift );
	}
}
btRigidBody* DefaultGameObjectFactory::CreateBallRigidBody(GameObject* ball,
        BulletSimulationPhysics* physics) {

    btScalar mass = 1.f;
    btVector3 inertia(0, 0, 0);

    Size size = ball->size();
    btVector3 shape_size(size.x / 2.f, size.y / 2.f, size.z / 2.f);
#ifdef DEBUG
    btCollisionShape* collision_shape = new btBoxShape(shape_size);
#else
    btCollisionShape* collision_shape = new btBox2dShape(shape_size);
#endif
    if (mass > 0.f) {
        collision_shape->calculateLocalInertia(mass, inertia);
    }

    btRigidBody::btRigidBodyConstructionInfo info(mass, physics,
        collision_shape, inertia);
    btRigidBody* rigid_body = new btRigidBody(info);
    rigid_body->setLinearFactor(btVector3(1, 1, 0));
    rigid_body->setAngularFactor(btVector3(0, 0, 1));
    rigid_body->setDamping(0.001, 0.1f);
    rigid_body->setFriction(1);
    rigid_body->setRestitution(1);
    rigid_body->setActivationState(DISABLE_DEACTIVATION);

    return rigid_body;
}
예제 #3
0
파일: type.c 프로젝트: Kalimehtar/racket
static int shape_fixup(void *p, struct NewGC *gc) {
#ifndef GC_NO_FIXUP_PROCEDURE_NEEDED
  intptr_t *shape_str = shape_strs[*(Scheme_Type *)p];

  while (*shape_str != SCHEME_GC_SHAPE_TERM) {
    if (shape_str[0] == SCHEME_GC_SHAPE_PTR_OFFSET) {
      gcFIXUP2(*(void **)((char *)p + shape_str[1]), gc);
    }
    shape_str += 2;
  }

# ifdef GC_NO_SIZE_NEEDED_FROM_PROCS
  return 0;
# else
  return shape_size(p, gc);
# endif
#endif
}
btGhostObject*
DefaultGameObjectFactory::CreateTriggerPlayer1GhostObject(
        GameObject* trigger, BulletTriggerPhysics* physics) {

    Size size = trigger->size();
    btVector3 shape_size(size.x / 2.f, size.y / 2.f, size.z / 2.f);
#ifdef DEBUG
    btCollisionShape* collision_shape = new btBoxShape(shape_size);
#else
    btCollisionShape* collision_shape = new btBox2dShape(shape_size);
#endif

    btGhostObject* ghost = new btGhostObject();
    ghost->setWorldTransform(physics->transform());
    ghost->setCollisionShape(collision_shape);
    ghost->setActivationState(DISABLE_DEACTIVATION);
    ghost->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);

    return ghost;
}
예제 #5
0
파일: ndarray.hpp 프로젝트: okhat/ngraph
 NDArrayBase(const Shape& shape)
     : m_shape(shape)
     , m_elements(shape_size(m_shape))
 {
 }
예제 #6
0
 virtual length_type& size()
 {
     return shape_size(shape(shell_.second));
 }
예제 #7
0
 length_type mobility_radius() const
 {
     return shape_size(shape(shell_.second)) - base_type::particle().second.radius();
 }