示例#1
0
void Level::loadFromLv(b2World& World, std::string levelPath)
{
  std::cout << levelPath << std::endl;
  std::string line;
  std::ifstream myfile (levelPath);
  if (myfile.is_open())
  {
    //current level object init
    while ( getline (myfile,line) )
    {
      std::regex groundRegex("(ground),(.*),(.*),(.*),(.*),(.*)");
      std::smatch groundObject;

      if (std::regex_match(line,groundObject,groundRegex))
      {
        std::cout <<  groundObject[5].str() << std::endl;

        CreateGround(World, std::stof(groundObject[2].str()), stof(groundObject[3].str()), stof(groundObject[4].str()), stof(groundObject[5].str()));
        // CreateGround(World, 5, 5, 5, stof(groundObject[5].str()));
        GroundTexture.loadFromFile(groundObject[6]);

        GroundTexture.setRepeated(true);

      }


    }
    std::cout << levelPath << std::endl;

    myfile.close();
  }
  else std::cout << "Unable to open file" << std::endl;
}
//----------------------------------------------------------------------------
void RoughPlaneSolidBox::CreateScene ()
{
    mScene = new0 Node();
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    mScene->AttachChild(CreateGround());
    mScene->AttachChild(CreateRamp());
    mScene->AttachChild(CreateBox());

    mScene->LocalTransform.SetRotate(HMatrix(AVector::UNIT_Z, 0.661917f));
}
示例#3
0
void LightSample::createScene()
{
	//BaseApplication::createScene();

	InitAmbientLight();

	//CreateSpotLight();
	CreatePointLight();
	CreateDirectionalLight();

	CreateGround();
	CreateNinja();
}
示例#4
0
void Stage3Object::LayerInit()
{
	auto factory = CObjectFactory::getInstance();
	auto mgr = CDataManager::getInstance();
	auto profile = m_pLayerData->m_pPlayer->getActorProfile();

	for (auto itr = mgr->getBoxData()->begin(); itr != mgr->getBoxData()->end(); itr++)
	{
		auto box = factory->CreateBox(this, m_pLayerData->m_pWorld, profile, *itr);
		m_pLayerData->m_arrObject.push_back(box);
	}

	for (auto itr = mgr->getMirageData()->begin(); itr != mgr->getMirageData()->end(); itr++)
	{
		auto mirage = factory->CreateMirage(this, m_pLayerData->m_pWorld, profile, *itr);
		m_pLayerData->m_arrObject.push_back(mirage);
	}

	for (auto itr = mgr->getWaterData()->begin(); itr != mgr->getWaterData()->end(); itr++)
	{
		auto water = factory->CreateWater(this, profile, *itr);
		m_pLayerData->m_arrObject.push_back(water);
	}

	for (auto itr = mgr->getSandData()->begin(); itr != mgr->getSandData()->end(); itr++)
	{
		auto sand = factory->CreateSand(this, m_pLayerData->m_pWorld, *itr);
		CObjectManager::getInstance()->getSandArray()->InsertObject(sand);
	}

	for (auto itr = mgr->getWindBoxData()->begin(); itr != mgr->getWindBoxData()->end(); itr++)
	{
		auto windBox = factory->CreateWindBox(this, m_pLayerData->m_pWorld, profile, *itr);
		m_pLayerData->m_arrObject.push_back(windBox);
		m_arrWindBox.push_back(windBox);
	}

	for (auto itr = mgr->getGroundData()->begin(); itr != mgr->getGroundData()->end(); itr++)
	{
		factory->CreateGround(this, m_pLayerData->m_pWorld, *itr);
	}

	scheduleUpdate();
}
示例#5
0
	Environment::Environment(ID3D10Device* device, Model::Level level)
		: mDevice(device), mBuffer(NULL), mEffect(NULL), mWallObject(device, "wallSegment.obj")
	{
		CreateGround(level.GetWidth(), level.GetHeight());
		CreateWalls(level);
	}