Esempio n. 1
0
void Enemy::initialize(Shader* p_shader)
{
    m_shader = p_shader;

    ////////////ONLY FOR TESTING/////////////
    float p_arrayScatter[] = {7,7,5,5};
    float p_arrayChase[] = {20,20,20,INT_MAX};
    m_ai->init(0, 20, 10, p_arrayScatter, p_arrayChase, 6, *m_mapMatrix, D3DXVECTOR2(25, 0), D3DXVECTOR2(14, 14));
    createBoundingVolume();
    m_volume->updatePosition( m_scale, m_translate );
}
Esempio n. 2
0
Torch::Torch(int posX, int posY, int posZ)
{
    load("media/char/torch2.md2");
    scale(4);
    createBoundingVolume(Solid::BOX);
    staticBody();
    position(posX,posY,posZ);
    luz.point();
    luz.position(posX,posY+5,posZ);
    luz.intensity(5.0);
    luz.attenuation(0.4); // o quao rapido uma claridade na luz diminui de acordo com a distancia
    luz.quadraticAttenuation(0.01); // de acordo com o quadrado da distancia
    luz.color(245,170,45);
    particula.position(posX,posY+5,posZ);
    particula.generate(Particle::GLOW);
    particula.setAnimationType(Particle::FLAME);
    particula.scale(3.25);
    particula.color(250,70,45);
    particula.visible(true);
    label(TOCHA);
}
Esempio n. 3
0
    /*!
     * \overload
     *
     * This method creates a new BoundingVolume as a copy of \p copy.
     */
    BoundingVolume* BoundingVolume::createBoundingVolume(World* world, const BoundingVolume* copy, BvhNode* parent) {
        if (!copy) {
            return createBoundingVolume(world, parent);
        }

        if (copy->getVolumeType() != getCreateRigidBoundingVolumeType(world)) {
            std::stringstream errormessage;
            errormessage << "ERROR: requested a copy of BV type "
                    << copy->getVolumeType()
                    << ", but expected type " << getCreateRigidBoundingVolumeType(world)
                    << std::endl;
            throw TypeMismatchException(errormessage.str());
        }

        BoundingVolume* bv = 0;
        switch (getCreateRigidBoundingVolumeType(world)) {
            case BV_TYPE_AABB:
                bv = new Aabb(*static_cast<const Aabb*>(copy));
                break;
            case BV_TYPE_KDOP:
                bv = new Kdop(*static_cast<const Kdop*>(copy));
                break;
            case BV_TYPE_SPHERE:
                bv = new BoundingSphere(*static_cast<const BoundingSphere*>(copy));
                break;
            case BV_TYPE_OBB:
                bv = new Obb(*static_cast<const Obb*>(copy));
                break;
            default:
                // TODO: exception!!
                std::cerr << dc_funcinfo << "FATAL ERROR: bounding volume type " << getCreateRigidBoundingVolumeType(world) << " not supported" << std::endl;
                exit(1);
                return 0;
        }
        bv->setHierarchyNode(parent);
        return bv;
    }
Esempio n. 4
0
void Cherry::initialize()
{
	createBoundingVolume();
	m_volume->updatePosition( m_scale, m_translate );
}