Example #1
0
void UndoTransaction::moveFrameBefore(int frame, int before_frame)
{
  if (frame != before_frame &&
      frame >= 0 &&
      frame < m_sprite->getTotalFrames() &&
      before_frame >= 0 &&
      before_frame < m_sprite->getTotalFrames()) {
    // change the frame-lengths...

    int frlen_aux = m_sprite->getFrameDuration(frame);

    // moving the frame to the future
    if (frame < before_frame) {
      for (int c=frame; c<before_frame-1; c++)
        setFrameDuration(c, m_sprite->getFrameDuration(c+1));

      setFrameDuration(before_frame-1, frlen_aux);
    }
    // moving the frame to the past
    else if (before_frame < frame) {
      for (int c=frame; c>before_frame; c--)
        setFrameDuration(c, m_sprite->getFrameDuration(c-1));

      setFrameDuration(before_frame, frlen_aux);
    }

    // change the cels of position...
    moveFrameBeforeLayer(m_sprite->getFolder(), frame, before_frame);
  }
}
Example #2
0
void DocumentApi::moveFrameBefore(Sprite* sprite, FrameNumber frame, FrameNumber beforeFrame)
{
  if (frame != beforeFrame &&
      frame >= 0 &&
      frame <= sprite->getLastFrame() &&
      beforeFrame >= 0 &&
      beforeFrame <= sprite->getLastFrame()) {
    // Change the frame-lengths...
    int frlen_aux = sprite->getFrameDuration(frame);

    // Moving the frame to the future.
    if (frame < beforeFrame) {
      for (FrameNumber c=frame; c<beforeFrame.previous(); ++c)
        setFrameDuration(sprite, c, sprite->getFrameDuration(c.next()));

      setFrameDuration(sprite, beforeFrame.previous(), frlen_aux);
    }
    // Moving the frame to the past.
    else if (beforeFrame < frame) {
      for (FrameNumber c=frame; c>beforeFrame; --c)
        setFrameDuration(sprite, c, sprite->getFrameDuration(c.previous()));

      setFrameDuration(sprite, beforeFrame, frlen_aux);
    }

    // change the cels of position...
    moveFrameBeforeLayer(sprite->getFolder(), frame, beforeFrame);
  }
}
Example #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();
    /*
    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 
        );
}
Example #4
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");
}
Example #5
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());
}
Example #6
0
void Sprite::removeFrame(FrameNumber newFrame)
{
  FrameNumber newTotal = m_frames.previous();
  for (FrameNumber i=newFrame; i<newTotal; i=i.next())
    setFrameDuration(i, getFrameDuration(i.next()));
  setTotalFrames(newTotal);
}
Example #7
0
void Sprite::addFrame(frame_t newFrame)
{
  setTotalFrames(m_frames+1);
  for (frame_t i=m_frames-1; i>=newFrame; --i)
    setFrameDuration(i, frameDuration(i-1));

  folder()->displaceFrames(newFrame, +1);
}
Example #8
0
void Sprite::removeFrame(frame_t frame)
{
  folder()->displaceFrames(frame, -1);

  frame_t newTotal = m_frames-1;
  for (frame_t i=frame; i<newTotal; ++i)
    setFrameDuration(i, frameDuration(i+1));
  setTotalFrames(newTotal);
}
Example #9
0
void SpriteAnimator::playAnimation(int line, int numFrames, float frameDuration, int numLoops)
{
	setLine(line);
	setColumn(0);
	FLAT_ASSERT(numFrames <= getAtlasWidth());
	setNumFrames(numFrames);
	setFrameDuration(frameDuration);
	setNumLoops(numLoops);
	setAnimated(true);
	m_animationStarted = false;
}
Example #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);
}
Example #11
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());
}
Example #12
0
File: App.cpp Project: Mx7f/substep
// 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");

}
Example #13
0
void Sprite::addFrame(FrameNumber newFrame)
{
  setTotalFrames(m_frames.next());
  for (FrameNumber i=m_frames.previous(); i>=newFrame; i=i.previous())
    setFrameDuration(i, getFrameDuration(i.previous()));
}