Exemple #1
0
BillboardObject::BillboardObject( const String& textureName,
                    const float initialSize,
                    const Vector3& position,
                    SceneNode* rootNode,
                    const std::string& material)
{
    SceneManager* sceneMgr = rootNode->getCreator();

    Vector3 finalPosition = position.normalisedCopy() * 1000.f;

    static unsigned int bodyCount=0;

    /// \todo These billboards are not 100% correct, might want to revisit them later
    mBBSet = sceneMgr->createBillboardSet("SkyBillboardSet"+StringConverter::toString(bodyCount), 1);
    mBBSet->setDefaultDimensions(550.f*initialSize, 550.f*initialSize);
    mBBSet->setBillboardType(BBT_PERPENDICULAR_COMMON);
    mBBSet->setCommonDirection( -position.normalisedCopy() );
    mBBSet->setVisibilityFlags(RV_Sky);
    mNode = rootNode->createChildSceneNode();
    mNode->setPosition(finalPosition);
    mNode->attachObject(mBBSet);
    mBBSet->createBillboard(0,0,0);
    mBBSet->setCastShadows(false);

    mMaterial = sh::Factory::getInstance().createMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount), material);
    mMaterial->setProperty("texture", sh::makeProperty<sh::StringValue>(new sh::StringValue(textureName)));

    sh::Factory::getInstance().getMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount))->setListener(this);

    mBBSet->setMaterialName("BillboardMaterial"+StringConverter::toString(bodyCount));

    bodyCount++;
}
Exemple #2
0
int MainMenu::runScene() {
    int buttonPressed = -2;
    SystemRenderUpdater sysRenderer;
    SystemLogicUpdater sysLogic;
    SceneManager* sceneMan = SceneManager::GetSceneManager();
    auto planets = LoadTitleScreenProps();
    while (true) {
        InputManager::getInstance()->update();
        buttonPressed = checkButtons();
        if (!konamiUnlocked)
            checkKonami();
        switch (buttonPressed) {
        case BUTTON_PLAY:
            removeButtons();
            sceneMan->RemoveAllObjects();
            return SCENE_LOBBY;
        case BUTTON_QUIT:
            removeButtons();
            return SCENE_END;
        }
        sysRenderer.RenderUpdate(GameObjects.alive_objects);
        sysLogic.LogicUpdate(GameObjects.alive_objects);
        SceneManager::GetSceneManager()->AssembleScene();
    }
}
Exemple #3
0
	void _drawGridPlane(void)
	{
		Ogre::ManualObject* gridPlane = mSceneMgr->createManualObject("GridPlane");
		Ogre::SceneNode* gridPlaneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("GridPlaneNode");

		Ogre::MaterialPtr gridPlaneMaterial = Ogre::MaterialManager::getSingleton().create("GridPlanMaterial", "General");
		gridPlaneMaterial->setReceiveShadows(false);
		gridPlaneMaterial->getTechnique(0)->setLightingEnabled(true);
		gridPlaneMaterial->getTechnique(0)->getPass(0)->setDiffuse(1, 1, 1, 0);
		gridPlaneMaterial->getTechnique(0)->getPass(0)->setAmbient(1, 1, 1);
		gridPlaneMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1, 1, 1);

		gridPlane->begin("GridPlaneMaterial", Ogre::RenderOperation::OT_LINE_LIST);
		for (int i = 0; i < 21; i++)
		{
			gridPlane->position(-500.0f, 0.0f, 500.0f - i * 50);
			gridPlane->position(500.0f, 0.0f, 500.0f - i * 50);

			gridPlane->position(-500.f + i * 50, 0.f, 500.0f);
			gridPlane->position(-500.f + i * 50, 0.f, -500.f);
		}

		gridPlane->end();

		gridPlaneNode->attachObject(gridPlane);
	}
    //-----------------------------------------------------------------------
	void MeshParticleVisualData::createVisualData(const String &meshName, const String &matName, Node* parentNode)
	{
		SceneManager *sceneMgr = Root::getSingleton()._getCurrentSceneManager();

		// create scene node and entity
		mSceneNode = sceneMgr->createSceneNode();

        parentNode->addChild(mSceneNode);

		// if the name of mesh is empty, we will use the prefab plane.
		if ( "" == meshName )
			mEntity = sceneMgr->createEntity( mSceneNode->getName(), Ogre::SceneManager::PT_PLANE );
		else
			mEntity = sceneMgr->createEntity( mSceneNode->getName(), meshName );

		assert (mEntity);

		mSceneNode->attachObject(mEntity);

		cloneMaterial(matName);

        mEntity->setCastShadows(false);

		mEntity->setMaterialName(mMaterial->getName());

		mInit = true;
	}
Exemple #5
0
BillboardObject::BillboardObject( const String& textureName,
                    const float initialSize,
                    const Vector3& position,
                    SceneNode* rootNode,
                    const std::string& material)
{
    SceneManager* sceneMgr = rootNode->getCreator();

    Vector3 finalPosition = position.normalisedCopy() * 1000.f;

    static unsigned int bodyCount=0;

    mMaterial = sh::Factory::getInstance().createMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount), material);
    mMaterial->setProperty("texture", sh::makeProperty(new sh::StringValue(textureName)));

    static Ogre::Mesh* plane = MeshManager::getSingleton().createPlane("billboard",
                                                                       ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,  Ogre::Plane(Ogre::Vector3(0,0,1), 0), 1, 1, 1, 1, true, 1, 1, 1, Vector3::UNIT_Y).get();
    plane->_setBounds(Ogre::AxisAlignedBox::BOX_INFINITE);
    mEntity = sceneMgr->createEntity("billboard");
    mEntity->setMaterialName("BillboardMaterial"+StringConverter::toString(bodyCount));
    mEntity->setVisibilityFlags(RV_Sky);
    mEntity->setCastShadows(false);

    mNode = rootNode->createChildSceneNode();
    mNode->setPosition(finalPosition);
    mNode->attachObject(mEntity);
    mNode->setScale(Ogre::Vector3(450.f*initialSize));
    mNode->setOrientation(Ogre::Vector3::UNIT_Z.getRotationTo(-position.normalisedCopy()));

    sh::Factory::getInstance().getMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount))->setListener(this);

    bodyCount++;
}
Exemple #6
0
void LoginForm::loginPlayerFinished(Tizen::Base::String statusCode)
{
	AppLogDebug("STAUS : %S",statusCode.GetPointer());

	MessageBox msgBox;
	int modalResult;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ArrayList* pList = new (std::nothrow)ArrayList;
	AppAssert(pList);
	pList->Construct();

	if(statusCode !=  "0")	// (로그인 성공 시) 로그인, 개인페이지로 이동
	{
		String playerKey = statusCode;
		pList->Add( new Tizen::Base::String(playerKey) );	// playerId
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_PLAYER, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY), pList);
	}
	else		// (로그인 실패 시) 로그인 실패 팝업
	{
		msgBox.Construct(L"Login", L"LOGIN fail", MSGBOX_STYLE_OK);
		msgBox.ShowAndWait(modalResult);
	}
}
Exemple #7
0
void
Form2::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);
	pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
}
Exemple #8
0
int main()
{
    SceneManager mgr;

    DirectionLight *dir = new DirectionLight(
            Vector3(-1, -1, 0).normalize(), 
            Vector3::ZERO,
            Vector3::ZERO,
            Vector3::ZERO,
            Vector3::ZERO,
            1000);
    SceneNode *node = new SceneNode();
    node->attachSceneObj(dir);
    mgr.addSceneNode(node);

    PerspectiveCamera *camera = new PerspectiveCamera(
            90, 1.33f, 0.1f, 100.f);
    node = new SceneNode();
    node->attachSceneObj(camera);
    mgr.addSceneNode(node);

    ITraceable *traceable = new Traceable_Mesh("mesh_teapot.txt");
    StaticEntity *entity = new StaticEntity(
            "testEntity", traceable);
    node = new SceneNode();
    node->translate(0, 0, 10);
    node->attachSceneObj(entity);
    mgr.addSceneNode(node);

    mgr.save("Scene.txt");
}
Exemple #9
0
void LightAnimation::CreateLightsWithAnimStatic()
{
	const float3 SponzaExtentInner[] = {
		float3(750,  10, -120),
		float3(750,  10, 230),
		float3(-950, 10, 230),
		float3(-950, 10, -100) };

	SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();

	const int NumLightX = 40;
	const int NumLightZ = 12;
	for (int i = 0; i < NumLightZ; ++i)
	{
		float t = float(i) / NumLightZ;
		float3 start = Lerp(SponzaExtentInner[0], SponzaExtentInner[1], t);
		float3 end = Lerp(SponzaExtentInner[3], SponzaExtentInner[2], t);

		for (int j = 0; j < NumLightX; ++j)
		{
			Light* light = sceneMan->CreateLight("", LT_PointLight);
			light->SetPosition(Lerp(start, end, float(j)/NumLightX));

			float3 color = IntensityDist(rng) * HueToRGB(HueDist(rng));
			light->SetLightColor(color);

			light->SetLightIntensity(1.0);
			light->SetAttenuation(1.0f, 0.0f);
			light->SetRange(25.0f);
			sceneMan->GetRootSceneNode()->AttachObject(light);

			mNumTotalLights++;
		}
	}
}
void DustCloudParticle::Update(){
	unsigned int currenttime = clock();
	unsigned int oldTime = progress;
	progress += currenttime - lasttime;
	//PlayerLogicComponent *  log = dynamic_cast<PlayerLogicComponent * >(parentObject->GetComponent(COMPONENT_LOGIC));
	//if (alive){}
	if (particles.empty()){
		//delete self and remove GameObject from list of objects
		gameObjectRef->isAlive = false;
	}
	for (auto iter = particles.begin(); iter != particles.end();){
		float curr = iter->animations->lengthConversion((int)(progress - iter->timer));
		//if (curr >= 1.0) iter->sprite->setIfRenderImage(false);
		if (curr >= 1.0){
			//iter->sprite->setIfRenderImage(false);
			delete iter->animations;
			SceneManager* sceneMan = SceneManager::GetSceneManager();
			sceneMan->RemoveObject(iter->sprite);
			iter->sprite->renderResource->unload();
			delete iter->sprite->renderResource;
			auto toErase = iter;
			iter++;
			particles.erase(toErase);
		}
		else{
			iter->animations->animate(curr);
			//float parab = curr < 0.5 ? ease_QuadOut(curr * 2) : ease_QuadIn(1-(curr-0.5) * 2);
			iter->sprite->renderResource->setAlpha((Uint8)(255 *ease_QuadOut(1.0f-curr)*0.75f));
			//iter->sprite->renderResource->setColor(rand() % 255, 255, rand() % 255);
			iter++;
		}
	}
	lasttime = currenttime;
}
void
ProfileDetailForm::DeleteProfile(void)
{
	ProfileListForm *pProfileListForm = static_cast< ProfileListForm* >(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl(FORM_LIST));
	if (pProfileListForm != NULL)
	{
		if (pProfileListForm->DeleteProfile(__currentID))
		{
			SceneManager* pSceneManager = SceneManager::GetInstance();
			AppAssert(pSceneManager);

			pSceneManager->GoBackward(BackwardSceneTransition(SCENE_LIST));
		}
	}
	else
	{
		MessageBox messageBox;
		String getError, getFailDelete;
		Application::GetInstance()->GetAppResource()->GetString(IDS_ERROR, getError);
		Application::GetInstance()->GetAppResource()->GetString(IDS_FAIL_DELETE, getFailDelete);
		messageBox.Construct(getError, getFailDelete, MSGBOX_STYLE_OK, 0);
		int doModal;
		messageBox.ShowAndWait(doModal);
	}

}
DustCloudParticle::DustCloudParticle(unsigned int numParticles, float minSize, float maxSize, float xPos, float yPos)
{
	RenderComponent::RenderComponent();
	//gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	ResourceManager* ResMan = ResourceManager::GetResourceManager();
	//RenderResource * originalImage = ;
	//std::function<bool(void)> charge = isCharging;
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, xPos, yPos);
	objRef->toggleVisible();
	for (unsigned int i = 0; i < numParticles; i++){
		SDLRenderObject * sprite = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, xPos, yPos);
		RenderResource * resource = new RenderResource((RenderResource*)ResMan->findResourcebyID(4001));
		resource->load();
		sprite->setResourceObject(resource);
		sprite->setScale(sprite->calcXScale(minSize + (maxSize-minSize)*(rand()%100)/100));
		std::list<motion> movements;
		movements.push_back(makeMotion(moveLinearXY(sprite, xPos, yPos, xPos+ 40 -(rand() % 80),
													yPos + 40 - (rand() % 80)),0, 1, ease_QuadIn));
		movements.push_back(makeMotion(rotateTransform(sprite, rand() % 360, (rand() % 90) - 45), 0, 1));
		Animation * movement = new Animation((float)(700 - (rand() % 200)), movements);
		particle p;
		p.animations = movement;
		p.sprite = sprite;
		p.timer = (float)progress;
		particles.push_back(p);
	}
}
Exemple #13
0
	void LoadContent()
	{
		FileSystem& fileSys = FileSystem::GetSingleton();
		ResourceManager& resMan = ResourceManager::GetSingleton();
		SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();
		RenderFactory* factory = Environment::GetSingleton().GetRenderFactory();
		
		LoadDudeEntity();

		mFont = resMan.GetResourceByName<Font>(RT_Font, "Consolas Regular", "General");
		auto mSDFEffect = resMan.GetResourceByName<Effect>(RT_Effect, "Font.effect.xml", "General") ;
		mSpriteBatch = sceneMan->CreateSpriteBatch(mSDFEffect);

		// Set as default camera
		auto screenFB = Environment::GetSingleton().GetRenderDevice()->GetScreenFrameBuffer();
		screenFB->SetCamera(mCamera);

		Light* mDirLight = sceneMan->CreateLight("Sun", LT_DirectionalLight);
		mDirLight->SetDirection(float3(1, -0.5, 0));
		mDirLight->SetLightColor(float3(1, 1, 1));
		mDirLight->SetLightIntensity(1.0);
		mDirLight->SetCastShadow(false);
		mDirLight->SetShadowCascades(4);
		sceneMan->GetRootSceneNode()->AttachObject(mDirLight);
	}
void
FormModeSelect::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	switch(actionId)
	{
	case IDA_BUTTON_TIME:
		if(checkHeart()) {
			pSceneManager->GoForward(ForwardSceneTransition(SCENE_GAME_TIMETRIAL, SCENE_TRANSITION_ANIMATION_TYPE_FADE_IN_OUT));
		}
		break;
	case IDA_BUTTON_SECONDS:
		if(checkHeart()) {
			pSceneManager->GoForward(ForwardSceneTransition(SCENE_GAME_SECONDS, SCENE_TRANSITION_ANIMATION_TYPE_FADE_IN_OUT));
		}
		break;
	case IDA_BUTTON_MULTI:
		GHPlayerController *playerController = new GHPlayerController();
		bool isLogin = playerController->isLogin();
		if(isLogin) {
			if(checkHeart()) {
				pSceneManager->GoForward(ForwardSceneTransition(SCENE_GAME_MULTI, SCENE_TRANSITION_ANIMATION_TYPE_FADE_IN_OUT));
			}
		} else {
			playerController->playerLogin(this);
		}
		break;
	}
}
Exemple #15
0
bool
UiControls::OnAppInitializing(AppRegistry& appRegistry)
{
	// TODO:
	// Initialize UI resources (forms, buttons, etc.) and application specific data.
	// The application's permanent data and context can be obtained from the appRegistry.
	// If this method is successful, return true; otherwise, return false.
	// If this method returns false, the application will be terminated.
	/////////////////////////////////////////////////////////////////////////////////////
	//this codes is automatically inserted by Tizen application wizard.
	Frame* pAppFrame = new Frame();
	pAppFrame->Construct();
	AddFrame(*pAppFrame);
	////////////////////////////////////////////////////////////////////////////////////

	// Prepare Scene management.

	SceneRegister::RegisterAllScenes();
	SceneManager* pSceneManager = SceneManager::GetInstance();
	pSceneManager->GoForward(ForwardSceneTransition(SCENE_MAIN_FORM));

	// Uncomment the following statement to listen to the screen on/off events.
	//PowerManager::SetScreenEventListener(*this);
	
	return true;
}
void NativeEngine::KillGLObjects() {
    if (mHasGLObjects) {
        SceneManager *mgr = SceneManager::GetInstance();
        mgr->KillGraphics();
        mHasGLObjects = false;
    }
}
void
LocationMapForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	switch (actionId)
	{
	case ID_BUTTON_SELECT:
		pSceneManager->GoBackward(BackwardSceneTransition());
		Tizen::Ui::Controls::Frame* pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		AppLog("test====1");
		if (pSceneManager->GetCurrentSceneId().Equals(SCENE_CREATION, true)) {
			AppLog("test====2");
			CreateProfileForm *pCreateProfileForm = static_cast< CreateProfileForm* >(pFrame->GetControl(FORM_CREATION));
			if (pCreateProfileForm != NULL) {
				pCreateProfileForm->SetMap(this->__latitude, this->__longitude);
			}
		} else if (pSceneManager->GetCurrentSceneId().Equals(SCENE_EDITION, true)) {
			AppLog("test====3");
			EditProfileForm *pEditProfileForm = static_cast< EditProfileForm* >(pFrame->GetControl(FORM_EDITION));
			AppLog("test====3-1");
			if (pEditProfileForm != NULL) {
				pEditProfileForm->SetMap(this->__latitude, this->__longitude);
			}
		}
		AppLog("test====4");

		break;
	}

}
Exemple #18
0
void
SplashForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	pSceneManager->GoForward( SceneTransitionId( TR_MAIN ) );

}
Exemple #19
0
    //-------------------------------------------------------------------------
    void OgreHead::setUp(const String& name)
    {
        // Create visual presence
        SceneManager* sm = World::getSingleton().getSceneManager();
        mEntity = sm->createEntity(name, "OgreHead.mesh");
        mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name);
        mSceneNode->attachObject(mEntity);
        // Add reverse reference
        mEntity->setUserObject(this);

        // Create mass body
        mOdeBody = new dBody(World::getSingleton().getOdeWorld()->id());
        // Set reverse reference
        mOdeBody->setData(this);
        // Set mass 
        setMassSphere(0.1, 25); // TODO change to more realistic values

        this->setBounceParameters(0.3, 0.1);
        this->setSoftness(0.0f);
        this->setFriction(Math::POS_INFINITY);

        // Create collision proxy
        dSphere* odeSphere = new dSphere(0, 25);
        mCollisionProxies.push_back(odeSphere);
        updateCollisionProxies();


    }
Exemple #20
0
 void Actor::placeIntoScene( const Vector3& position, const Quaternion& orientation ,
     const Ogre::String& physicsBone)
 {
     SceneManager* mgr = 
         CoreSubsystem::getSingletonPtr()->getWorld()->getSceneManager();
     placeIntoNode( mgr->getRootSceneNode(), position, orientation, physicsBone );
 }        
Exemple #21
0
void Idl_intro::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
{
		SceneManager* pSceneManager = SceneManager::GetInstance();
		AppAssert(pSceneManager);
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_TUTORIAL1, SCENE_TRANSITION_ANIMATION_TYPE_NONE));

}
Exemple #22
0
	/** Update environment lighting
	 */
	void updateEnvironmentLighting()
	{
		Ogre::Vector3 lightDir = mSkyX->getAtmosphereManager()->getSunDirection();

		bool preForceDisableShadows = mForceDisableShadows;
		mForceDisableShadows = (lightDir.y > 0.15f) ? true : false;

		if (preForceDisableShadows != mForceDisableShadows)
		{
			setShadowMode(mSceneMgr, static_cast<ShadowMode>(mShadowMode));
		}

		// Calculate current color gradients point
		float point = (-lightDir.y + 1.0f) / 2.0f;
		mHydrax->setWaterColor(mWaterGradient.getColor(point));

		Ogre::Vector3 sunPos = mCamera->getDerivedPosition() - lightDir*mSkyX->getMeshManager()->getSkydomeRadius()*0.1;
		mHydrax->setSunPosition(sunPos);

		Ogre::Light *Light0 = mSceneMgr->getLight("Light0"),
					*Light1 = mSceneMgr->getLight("Light1");

		Light0->setPosition(mCamera->getDerivedPosition() - lightDir*mSkyX->getMeshManager()->getSkydomeRadius()*0.02);
		Light1->setDirection(lightDir);

		Ogre::Vector3 sunCol = mSunGradient.getColor(point);
		Light0->setSpecularColour(sunCol.x, sunCol.y, sunCol.z);
		Ogre::Vector3 ambientCol = mAmbientGradient.getColor(point);
		Light0->setDiffuseColour(ambientCol.x, ambientCol.y, ambientCol.z);
		mHydrax->setSunColor(sunCol);
	}
	//-----------------------------------------------------------------------
	void SceneManagerEnumerator::removeFactory(SceneManagerFactory* fact)
	{
        if(!fact)
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Cannot remove a null SceneManagerFactory.", "SceneManagerEnumerator::removeFactory");

		// destroy all instances for this factory
		for (Instances::iterator i = mInstances.begin(); i != mInstances.end(); )
		{
			SceneManager* instance = i->second;
			if (instance->getTypeName() == fact->getMetaData().typeName)
			{
				fact->destroyInstance(instance);
				Instances::iterator deli = i++;
				mInstances.erase(deli);
			}
			else
			{
				++i;
			}
		}
		// remove from metadata
		for (MetaDataList::iterator m = mMetaDataList.begin(); m != mMetaDataList.end(); ++m)
		{
			if(*m == &(fact->getMetaData()))
			{
				mMetaDataList.erase(m);
				break;
			}
		}
		mFactories.remove(fact);
	}
Exemple #24
0
int Game::run()
{
	unsigned int currentTime, lastTime;
    int sleepTime;
    float deltaTime;

	CL_Slot slot_quit = _kernel->getDisplayWindow().sig_window_close().connect(this, &Game::close);

	// Initialize first Scene
	SceneManager *sceneManager = _kernel->getSceneMenager();
	GameScene *gameScene = new GameScene();
	sceneManager->addScene(gameScene);
	sceneManager->changeCurrentScene("GameScene");

	lastTime = CL_System::get_time();

	while(_kernel->isRunning())
	{
		currentTime = CL_System::get_time();
        deltaTime = (float)(currentTime - lastTime);
        lastTime = currentTime;
    
        update(deltaTime);
        draw();
        
        CL_KeepAlive::process();
        
        currentTime = CL_System::get_time();
        sleepTime = FRAMES_PER_SECOND - (currentTime - lastTime);
        if (sleepTime > 0)
            CL_System::sleep(sleepTime);
	}

	return 0;
}
Exemple #25
0
    //-----------------------------------------------------------------------
    void RenderQueue::clear(bool destroyPassMaps)
    {
        // Clear the queues
        SceneManagerEnumerator::SceneManagerIterator scnIt =
            SceneManagerEnumerator::getSingleton().getSceneManagerIterator();

        // Note: We clear dirty passes from all RenderQueues in all 
        // SceneManagers, because the following recalculation of pass hashes
        // also considers all RenderQueues and could become inconsistent, otherwise.
        while (scnIt.hasMoreElements())
        {
            SceneManager* sceneMgr = scnIt.getNext();
            RenderQueue* queue = sceneMgr->getRenderQueue();

            RenderQueueGroupMap::iterator i, iend;
            i = queue->mGroups.begin();
            iend = queue->mGroups.end();
            for (; i != iend; ++i)
            {
                i->second->clear(destroyPassMaps);
            }
        }

        // Now trigger the pending pass updates
        Pass::processPendingPassUpdates();

        // NB this leaves the items present (but empty)
        // We're assuming that frame-by-frame, the same groups are likely to 
        //  be used, so no point destroying the vectors and incurring the overhead
        //  that would cause, let them be destroyed in the destructor.
    }
Exemple #26
0
    void createLights(){
        //creating a light
        light = mSceneMgr->createLight("Light1");
        light->setType(Light::LT_POINT);
        light->setPosition(Vector3(0, 150, 250));

        //setting it's diffuse and specular colour to red
        light->setDiffuseColour(1.0, 0.0, 0.0);
        light->setSpecularColour(1.0, 0.0, 0.0);

        //create a yellow light:
        light = mSceneMgr->createLight("Light3");
        light->setType(Light::LT_DIRECTIONAL);
        light->setDiffuseColour(ColourValue(.25, .25, 0));
        light->setSpecularColour(ColourValue(.25, .25, 0));

        //yellow light direction
        light->setDirection(Vector3( 0, -1, 1 ));


        //blue spot light:
        light = mSceneMgr->createLight("Light2");
        light->setType(Light::LT_SPOTLIGHT);
        light->setDiffuseColour(0, 0, 1.0);
        light->setSpecularColour(0, 0, 1.0);

        light->setDirection(-1, -1, 0);
        light->setPosition(Vector3(300, 300, 0));

        light->setSpotlightRange(Degree(35), Degree(50));
    }
	//-----------------------------------------------------------------------
	void SceneManagerEnumerator::removeFactory(SceneManagerFactory* fact)
	{
		// destroy all instances for this factory
		for (Instances::iterator i = mInstances.begin(); i != mInstances.end(); )
		{
			SceneManager* instance = i->second;
			if (instance->getTypeName() == fact->getMetaData().typeName)
			{
				fact->destroyInstance(instance);
				Instances::iterator deli = i++;
				mInstances.erase(deli);
			}
			else
			{
				++i;
			}
		}
		// remove from metadata
		for (MetaDataList::iterator m = mMetaDataList.begin(); m != mMetaDataList.end(); ++m)
		{
			if(*m == &(fact->getMetaData()))
			{
				mMetaDataList.erase(m);
				break;
			}
		}
		mFactories.remove(fact);
	}
Exemple #28
0
void
BaseForm::OnFormBackRequested(Form& source)
{
    SceneManager* pSceneManager = SceneManager::GetInstance();
    AppAssert(pSceneManager);
    pSceneManager->GoBackward(BackwardSceneTransition());
}
Exemple #29
0
//--------------------------------------------------------------------------------------
// Create any D3D11 resources that depend on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain,
                                          const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
  UNREFERENCED_PARAMETER(pSwapChain);
  UNREFERENCED_PARAMETER(pUserContext);

  HRESULT hr;
  XMVECTOR vMeshExtents = g_Scene.GetSceneAABBMax() - g_Scene.GetSceneAABBMin();
  XMVECTOR vMeshLength = XMVector3Length( vMeshExtents );
  FLOAT    fMeshLength = XMVectorGetByIndex( vMeshLength, 0);
  
  V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
  V_RETURN( g_D3DSettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) );
  
  g_fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT ) pBackBufferSurfaceDesc->Height;
  
  g_ViewerCamera.SetProjParams( XM_PI / 4, g_fAspectRatio, 0.05f, fMeshLength);
  
  g_Scene.OnResize(pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height);
     
  g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 );
  g_HUD.SetSize( 170, 170 );
  g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 300 );
  g_SampleUI.SetSize( 170, 300 );
  
  return S_OK;
}
Exemple #30
0
void
EventListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
	if (status == LIST_ITEM_STATUS_SELECTED)
	{
		CalEventInstance* pCalEventInstance = null;

		if (groupIndex == GROUP_INDEX_ALL_DAY_EVENT)
		{
			pCalEventInstance = GetAllDayEventAt(index);
		}
		else
		{
			pCalEventInstance = GetNonAllDayEventAt(index);
		}

		if (pCalEventInstance != null)
		{
			SceneManager* pSceneManager = SceneManager::GetInstance();
			AppAssert(pSceneManager);

			ArrayList* pList = new (std::nothrow) ArrayList();
			pList->Construct();
			pList->Add(*(new (std::nothrow) CalEventInstance(*pCalEventInstance)));
			pSceneManager->GoForward(ForwardSceneTransition(SCENE_EVENT_DETAIL), pList);
		}
	}
}