Beispiel #1
0
void App::onInit() {
    GApp::onInit();
    s_app = this;
    cameraAdjustment = 0.7f;

    m_sonicSculptureFilename = "default.Soundscape.Any";

    m_freezeEverything = false;

    g_sampleWindowIndex = 0;
    m_lastSampleWindowProcessed = 0;
    m_initialTime = System::time();

    m_appMode = AppMode::DEFAULT;
    // TODO: Print instructions
    m_maxSavedTimeSlices = 128;
    m_lastInterestingEventTime = System::time();
    initializeAudio();

    m_rawAudioTexture = Texture::createEmpty("Raw Audio Texture", g_currentAudioBuffer.size(), 1, ImageFormat::R32F());
    m_frequencyAudioTexture = Texture::createEmpty("Frequency Audio Texture", g_currentAudioBuffer.size()/2, 1, ImageFormat::RG32F());

    m_smoothedRootMeanSquare = 0.0f;


    setFrameDuration(1.0f/30.0f);
    makeGUI();
    loadScene("Sculpting");
}
Beispiel #2
0
// Called before the application loop begins.  Load data here and
// not in the constructor so that common exceptions will be
// automatically caught.
void App::onInit() {
    GApp::onInit();
    /*
    shared_ptr<Texture> texture = Texture::fromFile(System::findDataFile("house.jpg"));
    shared_ptr<PixelTransferBuffer> ptb = texture->toPixelTransferBuffer();
    ptb->mapRead();
    ptb->unmap();
    */
    // This program renders to texture for most 3D rendering, so it can
    // explicitly delay calling swapBuffers until the Film::exposeAndRender call,
    // since that is the first call that actually affects the back buffer.  This
    // reduces frame tearing without forcing vsync on.
    renderDevice->setSwapBuffersAutomatically(false);

    setFrameDuration(1.0f / 30.0f);

    // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace
    // the default scene here.
    
    showRenderingStats      = false;
    m_showWireframe         = false;

    makeGUI();
    m_lastLightingChangeTime = 0.0;
    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene(
        "G3D Cornell Box" // Load something simple
         //    developerWindow->sceneEditorWindow->selectedSceneName()  // Load the first scene encountered 
        );
}
Beispiel #3
0
// Called before the application loop begins.  Load data here and
// not in the constructor so that common exceptions will be
// automatically caught.
void App::onInit() {
    GApp::onInit();

    // This program renders to texture for most 3D rendering, so it can
    // explicitly delay calling swapBuffers until the Film::exposeAndRender call,
    // since that is the first call that actually affects the back buffer.  This
    // reduces frame tearing without forcing vsync on.
    renderDevice->setSwapBuffersAutomatically(false);

    setFrameDuration(1.0f / 30.0f);

    // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace
    // the default scene here.

    showRenderingStats      = false;
    m_showWireframe         = false;

    makeGBuffer();
    makeGUI();

    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene(developerWindow->sceneEditorWindow->selectedSceneName());
}
Beispiel #4
0
void App::onInit() {
    GApp::onInit();

    m_gbufferSpecification.encoding[GBuffer::Field::CS_FACE_NORMAL].format = NULL;

    m_gbufferSpecification.encoding[GBuffer::Field::CS_NORMAL] = Texture::Encoding(ImageFormat::RGB10A2(), FrameName::CAMERA, 2.0f, -1.0f);

    m_gbufferSpecification.encoding[GBuffer::Field::SS_EXPRESSIVE_MOTION]    = 
        Texture::Encoding(GLCaps::supportsTexture(ImageFormat::RG8()) ? ImageFormat::RG8() : ImageFormat::RGBA8(),
        FrameName::SCREEN, 128.0f, -64.0f);

    m_gbufferSpecification.encoding[GBuffer::Field::EMISSIVE]           =  
        GLCaps::supportsTexture(ImageFormat::RGB5()) ? 
            Texture::Encoding(ImageFormat::RGB5(), FrameName::NONE, 3.0f, 0.0f) : 
            Texture::Encoding(ImageFormat::R11G11B10F());

    m_gbufferSpecification.encoding[GBuffer::Field::LAMBERTIAN]         = ImageFormat::RGB8();
    m_gbufferSpecification.encoding[GBuffer::Field::GLOSSY]             = ImageFormat::RGBA8();
    m_gbufferSpecification.encoding[GBuffer::Field::DEPTH_AND_STENCIL]  = ImageFormat::DEPTH32F();
    m_gbufferSpecification.depthEncoding = DepthEncoding::HYPERBOLIC;

    // Update the actual m_gbuffer before makeGUI creates the buffer visualizer
    m_gbuffer->setSpecification(m_gbufferSpecification);
    m_gbuffer->resize(renderDevice->width() + m_settings.depthGuardBandThickness.x * 2, renderDevice->height() + m_settings.depthGuardBandThickness.y * 2);

    dynamic_pointer_cast<DefaultRenderer>(m_renderer)->setDeferredShading(true);

    renderDevice->setSwapBuffersAutomatically(false);

    makeGUI();
    loadScene("G3D Cornell Box");// developerWindow->sceneEditorWindow->selectedSceneName());
}
Beispiel #5
0
void App::onInit() {
    GApp::onInit();
    // Called before the application loop begins.  Load data here and
    // not in the constructor so that common exceptions will be
    // automatically caught.
    showRenderingStats    = false;

    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);

    m_scene = PhysicsScene::create();
    setScene(m_scene);

    m_firstPersonMode = true;

    m_playerName = "player";

    makeGBuffer();
    makeGUI();

    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene("Level");
    setActiveCamera(m_scene->typedEntity<Camera>("camera"));
    developerWindow->sceneEditorWindow->setPreventEntitySelect(true);
}
Beispiel #6
0
void App::onInit() {
    GApp::onInit();
    // Called before the application loop begins.  Load data here and
    // not in the constructor so that common exceptions will be
    // automatically caught.

    showRenderingStats    = false;
    m_showLightSources    = true;
    m_showAxes            = true;
    m_showWireframe       = false;
    m_preventEntityDrag   = false;
    m_preventEntitySelect = false;

    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);

    makeGUI();

    // Start wherever the developer HUD last marked as "Home"
    defaultCamera.setCoordinateFrame(bookmark("Home"));

    m_shadowMap = ShadowMap::create();

    loadScene();
}
VideoRecordDialog::VideoRecordDialog(const shared_ptr<GuiTheme>& theme, const String& prefix, GApp* app) : 
    GuiWindow("Screen Capture", theme, Rect2D::xywh(0, 100, 320, 200),
              GuiTheme::DIALOG_WINDOW_STYLE, GuiWindow::HIDE_ON_CLOSE),
    m_app(app),
    m_templateIndex(0),
    m_playbackFPS(30),
    m_recordFPS(30),
    m_halfSize(true),
    m_enableMotionBlur(false),
    m_motionBlurFrames(10),
    m_screenshotPending(false),
    m_quality(1.0),
    m_framesBox(NULL),
    m_captureGUI(true),
    m_showCursor(false),
    m_filenamePrefix(prefix) {
    m_hotKey = GKey::F6;
    m_hotKeyMod = GKeyMod::NONE;
    m_hotKeyString = m_hotKey.toString();

    m_ssHotKey = GKey::F4;
    m_ssHotKeyMod = GKeyMod::NONE;
    m_ssHotKeyString = m_ssHotKey.toString();

    m_settingsTemplate.append(VideoOutput::Settings::MPEG4(640, 680));
    m_settingsTemplate.append(VideoOutput::Settings::WMV(640, 680));
    //m_settingsTemplate.append(VideoOutput::Settings::CinepakAVI(640, 680));
    m_settingsTemplate.append(VideoOutput::Settings::rawAVI(640, 680));

    // Remove unsupported formats and build a drop-down list
    for (int i = 0; i < m_settingsTemplate.size(); ++i) {
        if (! VideoOutput::supports(m_settingsTemplate[i].codec)) {
            m_settingsTemplate.remove(i);
            --i;
        } else {
            m_formatList.append(m_settingsTemplate[i].description);
        }
    }

    m_templateIndex = 0;
    // Default to MPEG4 since that combines quality and size
    for (int i = 0; i < m_settingsTemplate.size(); ++i) {
        if (m_settingsTemplate[i].codec == VideoOutput::CODEC_ID_MPEG4) {
            m_templateIndex = i;
            break;
        }
    }

    m_font = GFont::fromFile(System::findDataFile("arial.fnt"));

    makeGUI();
    
    m_recorder.reset(new Recorder());
    m_recorder->dialog = this;
}
Beispiel #8
0
    void onInit() override {
        renderDevice->setColorClearValue(Color3::white());
        m_name = NetAddress::localHostname();
        window()->setCaption(m_name + " (" + NetAddress(m_name, 0).ipString() + ":" + format("%d", PORT) + ")");

        m_server = NetServer::create(NetAddress(NetAddress::DEFAULT_ADAPTER_HOST, PORT));
        createDeveloperHUD();
        developerWindow->setVisible(false);
        developerWindow->cameraControlWindow->setVisible(false);
        makeGUI();
        showRenderingStats = false;
        debugWindow->setVisible(true);
    }
Beispiel #9
0
int main(int argv, char *argc[])
{
	gchar dataName[500];
	strcpy(dataName, getenv("HOME"));		
	strcat(dataName, "/.config/cwallpaper/config");
	int configIndex = 0;
	gboolean lastWallpaper = FALSE;
	if (argv < 2)
	{
		loadSettings(dataName);	
	}
	else //Open the file which is arg 1 
	{
		int x;
		for (x =0; x < argv; x++)
		{
			//Check for additional options.
			if (strcmp(argc[x], "-l") == 0)
			{
				lastWallpaper = TRUE;
				
			}
			if (strcmp(argc[x], "-c") == 0)
			{
				configIndex = x + 1;
				
			}
		}
		if (configIndex > 0)
		{
			loadSettings(argc[configIndex]);
		}
		else
		{
			loadSettings(dataName);
		}
		if (lastWallpaper == TRUE)
		{
			loadAndSetLast();
			return 0;
		}
	}
	
	gtk_init(&argv, &argc);	
	makeGUI();
	
	
	gtk_main();
	return 0;
}
Beispiel #10
0
// Called before the application loop begins.  Load data here and
// not in the constructor so that common exceptions will be
// automatically caught.
void App::onInit() {
    GApp::onInit();
	debugAssertGLOk();

    setFrameDuration(1.0f / 120.0f);

    // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace
    // the default scene here.
    
    showRenderingStats      = false;

	SVO::Specification spec;

	spec.encoding[GBuffer::Field::LAMBERTIAN].format = ImageFormat::RGBA16F();
	spec.encoding[GBuffer::Field::WS_NORMAL].format  = ImageFormat::RGBA16F();
	spec.encoding[GBuffer::Field::GLOSSY].format     = ImageFormat::RGBA16F();

	//spec.encoding[GBuffer::Field::WS_FACE_NORMAL].format  = ImageFormat::RG16F();	//Test. 2xFP16 for atomic min

#	if 0 //def G3D_DEBUG
		// Not used, but the program crashes without this
		spec.encoding[GBuffer::Field::WS_POSITION].format = ImageFormat::RGBA16F();
#	endif

	spec.dimension = Texture::DIM_3D;
	
	debugAssertGLOk();


	m_svo = SVO::create(spec, "SVO", true);
	
    makeGUI();
    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene(
        //"G3D Sponza"
		//"G3D Cornell Box" // Load something simple
		"Test Scene"
        //developerWindow->sceneEditorWindow->selectedSceneName()  // Load the first scene encountered 
        );

    dynamic_pointer_cast<DefaultRenderer>(m_renderer)->setOrderIndependentTransparency(false);
}
Beispiel #11
0
// Called before the application loop begins.  Load data here and
// not in the constructor so that common exceptions will be
// automatically caught.
void App::onInit() {
    super::onInit();
    // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace
    // the default scene here.
    
    showRenderingStats      = true;

    makeGUI();
    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene(
        "G3D Holodeck"
		//"G3D Cornell Box" // Load something simple
        //developerWindow->sceneEditorWindow->selectedSceneName()  // Load the first scene encountered 
        );
}
Beispiel #12
0
void App::onInit() {
	tick();

    message("Loading...");
	renderDevice->setSwapBuffersAutomatically(true);

	m_world = new World(m_worldScene);

    // Create one random number generator per thread
    m_rng.resize(GThread::numCores());
    for (int i = 0; i < m_rng.size(); ++i) {
        //m_rng[i].reset(0xF018A4D2 ^ i, false);
		//m_rng[i].reset(uint32(System::time()) ^ i);
    }
	Array<Plane,10> clipPlanes;
	float a,b,c,d;

    showRenderingStats = false;
    createDeveloperHUD();
    developerWindow->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(false);
    m_debugCamera->filmSettings().setAntialiasingEnabled(false);
	m_debugCamera->filmSettings().setAntialiasingHighQuality(false);
	m_debugCamera->filmSettings().setBloomStrength(0.0f);
	m_debugCamera->setFrame(m_world->frame);
	m_debugCamera->setFieldOfView(m_world->FOVDeg*pi()/180.0,FOVDirection::VERTICAL);
	m_debugCamera->getClipPlanes(Rect2D(Vector2(window()->width(),window()->height())),clipPlanes);

	clipPlanes[0].getEquation(a,b,c,d);
	m_focalPlane = Plane::fromEquation(-a,-b,-c,-(d-(m_world->focalDist)));	
	
    makeGUI();
    // Force re-render on first frame
    m_prevCFrame = CFrame(Matrix3::zero());
	float time = tock("Loading scene");

	//Initialize StatsData class 
	m_featureData.init(m_imgWidth,m_imgHeight,m_sampleBudget,m_samplesPerIteration);
	//Initialize filter with the features data pointers;
	m_CBFilter.init(&m_featureData);
}
Beispiel #13
0
void App::onInit() {
    message("Loading...");
	
    m_world = new World();
	
    showRenderingStats = false;
    createDeveloperHUD();
    developerWindow->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(false);
    m_debugCamera->filmSettings().setAntialiasingEnabled(true);
    m_debugCamera->filmSettings().setContrastToneCurve();

    // Starting position
    m_debugCamera->setFrame(CFrame::fromXYZYPRDegrees(24.3f, 0.4f, 2.5f, 68.7f, 1.2f, 0.0f));
    m_debugCamera->frame();

    makeGUI();

    // Force re-render on first frame
    m_prevCFrame = CFrame(Matrix3::zero());
}
Beispiel #14
0
void App::onInit() {
    GApp::onInit();
	renderDevice->setSwapBuffersAutomatically(true);
    
    showRenderingStats    = false;
    m_showWireframe       = false;

    // May be using a web browser on the same machine in the foreground
    setLowerFrameRateInBackground(false);
    setFrameDuration(1.0f / 30);

    m_scene = Scene::create();

    makeGBuffer();
    makeGUI();

    developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->setVisible(false);
    developerWindow->sceneEditorWindow->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(false);

    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    m_finalBuffer = Texture::createEmpty("App::m_finalBuffer", renderDevice->width(), renderDevice->height(), ImageFormat::RGB8(), Texture::DIM_2D); 
    m_finalFramebuffer = Framebuffer::create(m_finalBuffer);
    //loadScene(developerWindow->sceneEditorWindow->selectedSceneName());
    loadScene("G3D Sponza");

    
    setActiveCamera(m_debugCamera);



    startWebServer();

    m_font = GFont::fromFile(System::findDataFile("arial.fnt"));
    const NetAddress serverAddress(NetAddress::localHostname(), WEB_PORT);
    m_addressString = serverAddress.toString();
    m_qrTexture = qrEncodeHTTPAddress(serverAddress);
    debugPrintf("Server Address: %s\n", serverAddress.toString().c_str());
}
Beispiel #15
0
// Called before the application loop begins.  Load data here and
// not in the constructor so that common exceptions will be
// automatically caught.
void App::onInit() {
    GApp::onInit();
    m_rainbowMode = true;
    setFrameDuration(1.0f / 60.0f);
    m_showHelp = true;
    m_guiFont = GFont::fromFile(System::findDataFile("console.fnt"));
    initializeAudio();
    
    loadGrid();
    // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace
    // the default scene here.
    
    showRenderingStats      = true;

    makeGUI();
    // For higher-quality screenshots:
    // developerWindow->videoRecordDialog->setScreenShotFormat("PNG");
    // developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    loadScene("Test Scene");

}