Exemplo n.º 1
0
void VimridViewer::Init()
{
	this->GlutApplication::Init();

	glEnable(GL_CULL_FACE);
	glEnable(GL_BLEND);
	glEnable(GL_TEXTURE_2D);

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	// Setup after everything else has initialised.
	setupInterface();

	// Tell the slices to stay out once scrolled out.
	GetMriVisualiser().GetScrollController().ChangeScrollMode(SM_LEAVE_OUT);

	/*for (int i = 0; i < 15; i++)
	{
		GetMriVisualiser().AddTextureAsSlice(new SampleTexture());
	}*/

	// Default camera after init so drag is based on trackd position.
	defaultCamera();

	/*// Reset cursor so it appears centered in menu.
	GetUtility().ResetCursor();

	// Show during init to ensure UI container has been setup.
	mMainMenu->Show();*/
}
Exemplo n.º 2
0
void BVIRayTracerApplication::CreateScene07()
{
    ClearScene();
    Material::shared_ptr m_Material01(new StandardMaterial(1.0, 0.5, COLOUR_GREEN));
    Material::shared_ptr m_Material_Scatter(new ScatterBoardMaterial(1.0, 0.5, COLOUR_RED, COLOUR_GREEN));
    Material::shared_ptr m_Material_PerlinNoiseRed(new PerlinNoiseMaterial(0.0, 1.0, COLOUR_RED));
    Material::shared_ptr m_Material_PerlinNoiseBlue(new PerlinNoiseMaterial(0.0, 1.0, COLOUR_BLUE));
    m_Camera = Camera::shared_ptr(defaultCamera());
    Scene& scene = *m_Scene;

    scene.AddPointLight(new PointLight(TColor(1), Vector( 300,  300, 300), 800));
    scene.AddPointLight(new PointLight(TColor(1), Vector(-300, -300, 300), 450));
    scene.AddPointLight(new PointLight(TColor(1), Vector( 300, -300, 300), 450));
    scene.AddPointLight(new PointLight(TColor(1), Vector(-300,  300, 300), 450));

    int c = 0;
    for (int x = -100; x <= 100; x += 20)
    {
        if (x != 0)
        {
            for (int y = -100; y <= 100; y += 20)
            {
                for (int z =-1000; z <= 100; z += 20)
                {
                    c++;
                    switch(c % 4)
                    {

                    case 0:
                    {

                        scene.AddSceneObject(new Sphere(m_Material01, Vector( x,   y,   z),  5));
                        break;
                    }
                    case 1:
                        scene.AddSceneObject(new Sphere(m_Material_PerlinNoiseBlue, Vector( x,   y,   z),  5));
                        break;

                    case 2:
                        scene.AddSceneObject(new Sphere(m_Material_PerlinNoiseRed, Vector( x,   y,   z),  5));
                        break;
                    case 3:
                        scene.AddSceneObject(new Sphere(m_Material_Scatter, Vector( x,   y,   z),  5));
                        break;
                    }
                }
            }
        }
    }
}