Exemplo n.º 1
0
 void Context::Render()
 {
    if (_AttachedScene)
    {
       _AttachedScene->Render(GetRenderEngine());
    }
 }
Exemplo n.º 2
0
void i3dNodeArtwork::OnInit()
{
   IRenderEngine* pEngine = GetRenderEngine();
   if (pEngine)
   {
      _pi3dArtwork = pEngine->CreateTexture();
      _pCompassRose = pEngine->CreateTexture();
      _pCompassBackground = pEngine->CreateTexture();

      _pi3dArtwork->CreateTexture(
         Texture::GFX_TEXTURE_2D, 
         getWidth_i3d(), 
         getHeight_i3d(),
         Texture::GFX_RGBA,
         Texture::GFX_UNSIGNED_BYTE,
         getImage_i3d());

      _pCompassRose->CreateTexture(
         Texture::GFX_TEXTURE_2D, 
         getWidth_cmp128r(), 
         getHeight_cmp128r(),
         Texture::GFX_RGBA,
         Texture::GFX_UNSIGNED_BYTE,
         getImage_cmp128r());

      _pCompassBackground->CreateTexture(
         Texture::GFX_TEXTURE_2D, 
         getWidth_cmp128bg(), 
         getHeight_cmp128bg(),
         Texture::GFX_RGBA,
         Texture::GFX_UNSIGNED_BYTE,
         getImage_cmp128bg());
   }

}
Exemplo n.º 3
0
void i3dNodeArtwork::OnExit()
{  
   IRenderEngine* pEngine = GetRenderEngine();
   if (pEngine)
   {
      if (_pi3dArtwork) pEngine->Destroy(_pi3dArtwork);
      if (_pCompassRose) pEngine->Destroy(_pCompassRose);
      if (_pCompassBackground) pEngine->Destroy(_pCompassBackground);
   }
}
void TerrainViewer::Client::Start()
{
   Init(800, 600, false);

   ChangeScene(std::shared_ptr<Scene>(
      new TerrainViewer::MainScene(
         *this,
         GetGraphicsTaskManager(),
         GetRenderEngine(),
         GetKeyboardActionManager())));

   Run();
}
Exemplo n.º 5
0
   //---------------------------------------------------------------------------
   void Context::CreateContext()
   {
      _qRenderWindow = RenderFactory::RenderWindow(_options);
      
      _assignCallbacks();
      _qRenderWindow->SetParentContext(this);
      _qRenderWindow->Create();
      _scenegraph = new SceneGraph(GetRenderEngine());
      _scenegraph->Setup();      // this also calls OnInit on every node...

      // Because the render window didn't have the scenegraph yet, 
      // the resize event must be called manually.
      int w = _qRenderWindow->GetWidth();
      int h = _qRenderWindow->GetHeight();
      _scenegraph->Resize(w,h); // force resize event!
   }
Exemplo n.º 6
0
void ForwardDirectional::UpdateUniforms(const mat4& modelMatrix, const Material& material)
{
	static Texture WHITE = Texture(1, 1, whitePixel);

	if (material.GetTexture() != NULL)
		material.GetTexture()->Bind(0);
	else
	{
		WHITE.Bind(0);
	}
	mat4 MVP = GetRenderEngine()->GetCamera()->GetProjectionMatrix() * GetRenderEngine()->GetCamera()->GetViewMatrix() * modelMatrix;

	SetUniform("MVP", MVP);
	SetUniform("ModelMatrix", modelMatrix);
	SetUniform("NormalMatrix", glm::inverseTranspose(mat3(modelMatrix)));

	SetUniform("directionalLight.direction", static_cast<DirectionalLight*>(GetRenderEngine()->GetActiveLight())->GetDirection());
	SetUniform("directionalLight.base.color", static_cast<DirectionalLight*>(GetRenderEngine()->GetActiveLight())->GetColor());
	SetUniform("directionalLight.base.intensity", static_cast<DirectionalLight*>(GetRenderEngine()->GetActiveLight())->GetIntensity());

	SetUniform("specularIntensity", material.GetSpecularIntensity());
	SetUniform("specularPower", material.GetSpecularPower());
	SetUniform("eyePosition", GetRenderEngine()->GetCamera()->GetPosition());
}