当前位置: 首页>>代码示例>>C++>>正文


C++ ObjModel::getDisplayList方法代码示例

本文整理汇总了C++中ObjModel::getDisplayList方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjModel::getDisplayList方法的具体用法?C++ ObjModel::getDisplayList怎么用?C++ ObjModel::getDisplayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjModel的用法示例。


在下文中一共展示了ObjModel::getDisplayList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initShips

void World::initShips()
{
	// space ship
	PhysicsObjectId id(PhysicsObjectId::TYPE_SHIP, PhysicsObjectId::FLEET_PLAYER, 0);
	m_playerShip.init("Grapple", Const::SHIP_SIZE);
	m_playerShip.setId(id);
	m_playerShip.setPosition(Const::SHIP_POSITION);
	m_playerShip.setAmmo(8);
	m_playerShip.setHealth(Const::PLAYER_HEALTH);
	m_playerShip.setSpeed(Const::MOVE_PER_FRAME);


	// space ships
	id.m_type = PhysicsObjectId::TYPE_SHIP;
	id.m_fleet = PhysicsObjectId::FLEET_ENEMY;
	ObjModel model;
	model.load(Const::MODEL_DIR + Const::ENEMY_SHIP_MODEL_NAME + Const::EXTENSION);
	DisplayList displayList = model.getDisplayList();
	for (int i = 1; i <= Const::MOON_COUNT; i++)
	{
		for (int j = 0; j < Const::SHIPS_PER_MOON; j++){
			int index = (i - 1) * Const::SHIPS_PER_MOON + j;
			id.m_index = index;
			Vector3 position = m_planetoids[i].getPosition() + Vector3::getRandomUnitVector()*(m_planetoids[i].getScaledSize() + 500.0);
			m_ships[index].initPhysics(id, position, 1.0, 0, displayList, Const::ENEMY_SHIP_SIZE);
			m_ships[index].setHealth(1);
			m_ships[index].setUnitAi(new StemCell::UnitAiMoonGuard(m_ships[index], *this, m_planetoids[i].getId()));
			m_ships[index].setManeuverability(Const::SHIP_MAX_SPEED,Const::SHIP_ACCELERATION,Const::ROTATION_RATE);
		}
	}
}
开发者ID:whitelight2134,项目名称:spacewar,代码行数:31,代码来源:World.cpp

示例2: init

void World :: init ()
{
	if(!isInitialized())
	{
        // Skybox Init
        ObjModel sb;
        sb.load("Models/Skybox.obj");
        skybox = sb.getDisplayList();
        
        // Planet Init
        ObjModel p;
        p.load(planetInfo.filename);
        DisplayList p_dl = p.getDisplayList();
        PhysicsObjectId p_id = PhysicsObjectId(PhysicsObjectId::TYPE_PLANETOID,
                                             PhysicsObjectId::FLEET_NATURE,
                                             0);
        planet.initPlanetoid(p_id, planetInfo.position, planetInfo.radius, p_dl, 1.f);
        
        // Moon Init
        for (int i = 0; i < MOON_COUNT; i++)
        {
            ObjModel m;
            m.load(moonInfo[i].filename);
            DisplayList m_dl = m.getDisplayList();
            PhysicsObjectId m_id = PhysicsObjectId(PhysicsObjectId::TYPE_PLANETOID,
                                                   PhysicsObjectId::FLEET_NATURE,
                                                   i + 1);
            moons[i].initPlanetoid(m_id, moonInfo[i].position, moonInfo[i].radius, m_dl, 1.f);
        }
        
        // Ship Init
        ObjModel s;
        s.load("Models/Grapple.obj");
        DisplayList s_dl = s.getDisplayList();
        for (int i = 0; i < SHIP_COUNT; i++)
        {
            PhysicsObjectId s_id = PhysicsObjectId(PhysicsObjectId::TYPE_SHIP,
                                                   PhysicsObjectId::FLEET_ENEMY,
                                                   i);
            
            int moonIndex = rand() % MOON_COUNT;
            Vector3 pos = moonInfo[moonIndex].position
                            + Vector3::getRandomUnitVector()
                            * (moonInfo[moonIndex].radius + 500.0);
            
            ships[i].initPhysics(s_id, pos, 100.f, Vector3::getRandomUnitVector(), s_dl, 1.f);
            ships[i].setHealth(1);
            ships[i].setAmmo(0);
            ships[i].setSpeed(0.f);
        }
        
        // Add Bullets
        ObjModel b;
        b.load("Models/Bolt.obj");
        DisplayList b_dl = b.getDisplayList();
        for (int i = 0; i < BULLET_COUNT; i++)
        {
            PhysicsObjectId b_id = PhysicsObjectId(PhysicsObjectId::TYPE_BULLET,
                                                   PhysicsObjectId::FLEET_MAX,
                                                   i);
            bullets[i].initPhysics(b_id, {0, 0, 0}, 1.f, {0, 0, 0}, b_dl, 2.5f);
        }

		assert(mp_explosion_manager != NULL);
		mp_explosion_manager->init("Explode1.png", 15);
	}

	assert(invariant());
}
开发者ID:streibeb,项目名称:cs409,代码行数:69,代码来源:World.cpp

示例3: init

void init()
{
	initDisplay();
	bucket.load("firebucket.obj");
    bucket_list = bucket.getDisplayList();
}
开发者ID:streibeb,项目名称:cs409,代码行数:6,代码来源:main5.cpp


注:本文中的ObjModel::getDisplayList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。