Example #1
0
void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount,
                        PrimitiveType type, const RenderStates& states)
{
    // Nothing to draw?
    if (!vertices || (vertexCount == 0))
        return;

    // GL_QUADS is unavailable on OpenGL ES
    #ifdef SFML_OPENGL_ES
        if (type == Quads)
        {
            err() << "sf::Quads primitive type is not supported on OpenGL ES platforms, drawing skipped" << std::endl;
            return;
        }
        #define GL_QUADS 0
    #endif

    if (setActive(true))
    {
        // First set the persistent OpenGL states if it's the very first call
        if (!m_cache.glStatesSet)
            resetGLStates();

        // Check if the vertex count is low enough so that we can pre-transform them
        bool useVertexCache = (vertexCount <= StatesCache::VertexCacheSize);
        if (useVertexCache)
        {
            // Pre-transform the vertices and store them into the vertex cache
            for (std::size_t i = 0; i < vertexCount; ++i)
            {
                Vertex& vertex = m_cache.vertexCache[i];
                vertex.position = states.transform * vertices[i].position;
                vertex.color = vertices[i].color;
                vertex.texCoords = vertices[i].texCoords;
            }

            // Since vertices are transformed, we must use an identity transform to render them
            if (!m_cache.useVertexCache)
                applyTransform(Transform::Identity);
        }
        else
        {
            applyTransform(states.transform);
        }

        // Apply the view
        if (m_cache.viewChanged)
            applyCurrentView();

        // Apply the blend mode
        if (states.blendMode != m_cache.lastBlendMode)
            applyBlendMode(states.blendMode);

        // Apply the texture
        Uint64 textureId = states.texture ? states.texture->m_cacheId : 0;
        if (textureId != m_cache.lastTextureId)
            applyTexture(states.texture);

        // Apply the shader
        if (states.shader)
            applyShader(states.shader);

        // If we pre-transform the vertices, we must use our internal vertex cache
        if (useVertexCache)
        {
            // ... and if we already used it previously, we don't need to set the pointers again
            if (!m_cache.useVertexCache)
                vertices = m_cache.vertexCache;
            else
                vertices = NULL;
        }

        // Check if texture coordinates array is needed, and update client state accordingly
        bool enableTexCoordsArray = (states.texture || states.shader);
        if (enableTexCoordsArray != m_cache.texCoordsArrayEnabled)
        {
            if (enableTexCoordsArray)
                glCheck(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
            else
                glCheck(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
            m_cache.texCoordsArrayEnabled = enableTexCoordsArray;
        }

        // Setup the pointers to the vertices' components
        if (vertices)
        {
            const char* data = reinterpret_cast<const char*>(vertices);
            glCheck(glVertexPointer(2, GL_FLOAT, sizeof(Vertex), data + 0));
            glCheck(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), data + 8));
            if (enableTexCoordsArray)
                glCheck(glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), data + 12));
        }

        // Find the OpenGL primitive type
        static const GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES,
                                       GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS};
        GLenum mode = modes[type];

        // Draw the primitives
        glCheck(glDrawArrays(mode, 0, vertexCount));

        // Unbind the shader, if any
        if (states.shader)
            applyShader(NULL);

        // If the texture we used to draw belonged to a RenderTexture, then forcibly unbind that texture.
        // This prevents a bug where some drivers do not clear RenderTextures properly.
        if (states.texture && states.texture->m_fboAttachment)
            applyTexture(NULL);

        // Update the cache
        m_cache.useVertexCache = useVertexCache;
    }
}
Example #2
0
GlContext::~GlContext()
{
    // Deactivate the context before killing it, unless we're inside Cleanup()
    if (sharedContext)
        setActive(false);
}
Example #3
0
int H264::handlePacket(AVPacket* packet)
{
	int gotFrame;
	int bytes;
	H264Context* h = (H264Context*)stream()->codec->priv_data;
	
	// Transform timestamps to relative timestamps
	packet->dts = pts_rel(packet->dts);
	packet->pts = pts_rel(packet->pts);
	
	if(m_decoding && !m_syncing)
		parseNAL(packet->data, packet->size);
	
	if(!m_decoding)
	{
		if(m_nc && m_nc->time - packet->pts < m_startDecodeOffset)
		{
			log_debug("Switching decoder on at PTS %'10lld (m_nc: %'10lld)",
				packet->pts, m_nc->time);
			m_decoding = true;
			
			avcodec_flush_buffers(stream()->codec);
		}
	}
	
	if(m_decoding)
	{
		if(avcodec_decode_video2(stream()->codec, &m_frame, &gotFrame, packet) < 0)
			return error("Could not decode packet");
	}
	
	if(!m_encoding && m_nc)
	{
		if(m_nc->direction == CutPoint::OUT && m_nc->time < packet->dts)
		{
			m_decoding = false;
			m_isCutout = true;
			
			int64_t current_time = m_nc->time;
			m_nc = cutList().nextCutPoint(packet->dts);
			
			if(m_nc)
				setTotalCutout(m_nc->time - (current_time - totalCutout()));
			else
				setActive(false); // last cutpoint reached
		}
		else if(m_nc->direction == CutPoint::IN && m_nc->time <= packet->dts)
		{
			m_encoding = true;
			m_encFrameCount = 0;
			
			log_debug("Opening encoder for frame with PTS %'10lld", packet->dts);

			AVDictionary* opts = 0;
			av_dict_set(&opts, "profile", "main", 0);
			av_dict_set(&opts, "preset", "ultrafast", 0);
			
			if(avcodec_open2(outputStream()->codec, m_codec, &opts) != 0)
				return error("Could not open encoder");
		}
	}
	
	if(m_encoding && m_encFrameCount > 20 && packet->flags & AV_PKT_FLAG_KEY && h->s.current_picture_ptr)
	{
		m_syncing = true;
		m_syncPoint = packet->pts;
		
		log_debug("SYNC: start with keyframe packet PTS %'10lld", m_syncPoint);
// 		log_debug("SYNC: frame_num of first original frame is %d",
// 				h->s.current_picture_ptr->frame_num
// 		);
	}

	if(m_syncing)
	{
		log_debug("decode=%d, gotFrame=%d, keyframe=%d, t=%d", m_decoding, gotFrame, m_frame.key_frame, m_frame.pict_type);
	}
	
	if(m_syncing && gotFrame && m_frame.pict_type == 1)
	{
		// Flush out encoder
		while(1)
		{
			log_debug("SYNC: Flushing out encoder");
			bytes = avcodec_encode_video(
				outputStream()->codec,
				m_encodeBuffer, ENCODE_BUFSIZE,
				NULL
			);
			outputStream()->codec->has_b_frames = 6;
			
			if(!bytes)
				break;
			
			int64_t pts = av_rescale_q(outputStream()->codec->coded_frame->pts,
					outputStream()->codec->time_base, outputStream()->time_base
				);
			
			if(pts + totalCutout() >= m_syncPoint)
			{
				log_debug("SYNC: (encoder) Skipping PTS %'10lld >= sync point %'10lld",
					pts + totalCutout(), m_syncPoint
				);
				continue;
			}
			
			if(writeOutputPacket(m_encodeBuffer, bytes, pts) != 0)
				return error("SYNC: (encoder) Could not write packet");
		}
		log_debug("SYNC: closing encoder");
		avcodec_close(outputStream()->codec);
		
		// Flush out sync buffer
		for(int i = 0; i < m_syncBuffer.size(); ++i)
		{
			log_debug("SYNC: writing packet from buffer");

			AVPacket* packet = &m_syncBuffer[i];
			if(packet->pts < m_syncPoint)
			{
				log_debug("SYNC: (buffer) Skipping PTS %'10lld < sync point %'10lld",
					packet->pts, m_syncPoint
				);
				continue;
			}
			
			if(writeInputPacket(packet) != 0)
				return error("SYNC: (buffer) Could not write packet");
		}
		m_syncBuffer.clear();
		
		m_encoding = false;
		m_isCutout = false;
		m_decoding = false;
		m_syncing = false;
		
		log_debug("SYNC: finished, got keyframe from decoder with PTS %'10lld", packet->dts);
		
		m_nc = cutList().nextCutPoint(packet->dts);
	}
	
	if(m_syncing)
	{
		m_syncBuffer.push_back(copyPacket(*packet));
	}
	
	if(m_encoding && gotFrame)
	{
		setFrameFields(&m_frame, packet->dts - totalCutout());
		
		bytes = avcodec_encode_video(
			outputStream()->codec,
			m_encodeBuffer, ENCODE_BUFSIZE,
			&m_frame
		);
		outputStream()->codec->has_b_frames = 6;
		
		if(bytes)
		{
			writeOutputPacket(
				m_encodeBuffer, bytes,
				av_rescale_q(outputStream()->codec->coded_frame->pts,
					outputStream()->codec->time_base, outputStream()->time_base
				)
			);
			m_encFrameCount++;
		}
	}
	
	if(!m_isCutout && !m_encoding)
	{
		if(m_syncPoint > 0 && packet->pts < m_syncPoint)
		{
			log_debug("COPY: Skipping packet with PTS %'10lld", packet->pts);
			return 0;
		}
		
		if(m_sps.data || m_pps.data)
		{
			int size = packet->size + m_sps.size + m_pps.size;
			uint8_t* buf = (uint8_t*)malloc(size);
			int off = 0;
			
			memcpy(buf + off, m_sps.data, m_sps.size);
			off += m_sps.size;
			memcpy(buf + off, m_pps.data, m_pps.size);
			off += m_pps.size;
			
			memcpy(buf + off, packet->data, packet->size);
			
			writeOutputPacket(buf, size, packet->pts - totalCutout());
			
			free(m_sps.data); m_sps.data = 0;
			free(m_pps.data); m_pps.data = 0;
			free(buf);
			return 0;
		}
		
// 		log_debug("COPY: packet with PTS %'10lld", packet->pts);
		outputStream()->codec->has_b_frames = 6;
		if(writeInputPacket(packet) != 0)
		{
			log_debug("PTS buffer:");
			
			for(int i = 0; i < outputStream()->codec->has_b_frames; ++i)
				log_debug(" %s", tstoa(outputStream()->pts_buffer[i]));
			
			return error("Could not copy input packet (has_b_frames: %d, max_b_frames: %d)",
				outputStream()->codec->has_b_frames, outputStream()->codec->max_b_frames
			);
		}
	}
	
	return 0;
}
Example #4
0
//-------------------------------------------------------------------------
// @brief 
//-------------------------------------------------------------------------
void ForceField::handleMessage( const Message& msg )
{
    const ActivationMessage& activateMsg = (const ActivationMessage&)msg;
    setActive(activateMsg.shouldActivate());
}
Example #5
0
void IrcChannelPrivate::disconnected()
{
    setActive(false);
}
Example #6
0
void WebView::initialize()
{
    m_page->initializeWebPage();
    setActive(true);
}
Example #7
0
Context::Context(const ContextSettings &settings, uint32 width, uint32 height) {
	mContext = GLContext::create(settings, width, height);
	setActive(true);
}
Example #8
0
//-------------------------------------------------------------------------
// @brief 
//-------------------------------------------------------------------------
void GunTurret::handleMessage( const Message& msg )
{
    const ActivationMessage& activateMsg = (const ActivationMessage&)msg;
    setActive(activateMsg.shouldActivate());
}
Example #9
0
MainMenu::MainMenu(AWidget *parent) :
  AMenu(parent)
{
  _start = new Button(this);
  _pvp = new Button(this);
  _pve = new Button(this);
  _5breakable = new Button(this);
  _doubleThree = new Button(this);

  _start->setSize(sf::Vector2f(200, 50));
  _start->setPosition(sf::Vector2f(150, 225));
  _start->setBackgroundTexture("../Assets/button_unselect.png");
  _start->setFont("../Assets/fontBambo.ttf");
  _start->setFontSize(30);
  _start->setText("START");
  _start->setAction([this] {
	  Arbitre::updateRules(_doubleThree->isActive(), _5breakable->isActive());
	  if (_pvp->isActive())
		  getGameInstance()->reset<Human>();
	  else
		  getGameInstance()->reset<AxelAI>();
	  setActive(false);
  });
  _pvp->setSize(sf::Vector2f(200, 50));
  _pvp->setPosition(sf::Vector2f(25, 25));
  _pvp->setBackgroundTexture("../Assets/button_select.png");
  _pvp->setFont("../Assets/fontBambo.ttf");
  _pvp->setFontSize(30);
  _pvp->setText("PVP");
  _pvp->setActive(true);
  _pvp->setAction([this] {
	  _pvp->setBackgroundTexture("../Assets/button_select.png");
	  _pvp->setActive(true);
	  _pve->setBackgroundTexture("../Assets/button_unselect.png");
	  _pve->setActive(false);
  });
  _pve->setSize(sf::Vector2f(200, 50));
  _pve->setPosition(sf::Vector2f(275, 25));
  _pve->setBackgroundTexture("../Assets/button_unselect.png");
  _pve->setFont("../Assets/fontBambo.ttf");
  _pve->setFontSize(30);
  _pve->setText("PVE");
  _pve->setActive(false);
  _pve->setAction([this] {
	  _pvp->setBackgroundTexture("../Assets/button_unselect.png");
	  _pvp->setActive(false);
	  _pve->setBackgroundTexture("../Assets/button_select.png");
	  _pve->setActive(true);
  });
  _5breakable->setSize(sf::Vector2f(200, 50));
  _5breakable->setPosition(sf::Vector2f(25, 125));
  _5breakable->setBackgroundTexture("../Assets/button_unselect.png");
  _5breakable->setFont("../Assets/fontBambo.ttf");
  _5breakable->setFontSize(30);
  _5breakable->setText("5 Cassables");
  _5breakable->setActive(false);
  _5breakable->setAction([this] {
	  _5breakable->setBackgroundTexture((_5breakable->isActive() ? "../Assets/button_unselect.png" : "../Assets/button_select.png" ));
	  _5breakable->setActive(!_5breakable->isActive());
  });
  _doubleThree->setSize(sf::Vector2f(200, 50));
  _doubleThree->setPosition(sf::Vector2f(275, 125));
  _doubleThree->setBackgroundTexture("../Assets/button_unselect.png");
  _doubleThree->setFont("../Assets/fontBambo.ttf");
  _doubleThree->setFontSize(30);
  _doubleThree->setText("Double Trois");
  _doubleThree->setActive(false);
  _doubleThree->setAction([this] {
	  _doubleThree->setBackgroundTexture((_doubleThree->isActive() ? "../Assets/button_unselect.png" : "../Assets/button_select.png" ));
	  _doubleThree->setActive(!_doubleThree->isActive());
  });

  setPosition(sf::Vector2f(149, 249));
  setSize(sf::Vector2f(500, 300));
  setBackgroundColor(sf::Color(0, 0, 0, 127));
}
bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice * )
{
    setActive( true );
    return true;
}
bool QwtNullPaintDevice::PaintEngine::end()
{
    setActive( false );
    return true;
}
Example #12
0
void QgsDataDefinedButton::updateGui()
{
  QString oldDef = mCurrentDefinition;
  QString newDef( "" );
  bool hasExp = !getExpression().isEmpty();
  bool hasField = !getField().isEmpty();

  if ( useExpression() && !hasExp )
  {
    setActive( false );
    setUseExpression( false );
  }
  else if ( !useExpression() && !hasField )
  {
    setActive( false );
  }

  QIcon icon = mIconDataDefine;
  QString deftip = tr( "undefined" );
  if ( useExpression() && hasExp )
  {
    icon = isActive() ? mIconDataDefineExpressionOn : mIconDataDefineExpression;
    newDef = deftip = getExpression();

    QgsExpression exp( getExpression() );
    if ( exp.hasParserError() )
    {
      setActive( false );
      icon = mIconDataDefineExpressionError;
      deftip = tr( "Parse error: %1" ).arg( exp.parserErrorString() );
      newDef = "";
    }
  }
  else if ( !useExpression() && hasField )
  {
    icon = isActive() ? mIconDataDefineOn : mIconDataDefine;
    newDef = deftip = getField();

    if ( !mFieldNameList.contains( getField() ) )
    {
      setActive( false );
      icon = mIconDataDefineError;
      deftip = tr( "'%1' field missing" ).arg( getField() );
      newDef = "";
    }
  }

  setIcon( icon );

  // update and emit current definition
  if ( newDef != oldDef )
  {
    mCurrentDefinition = newDef;
    emit dataDefinedChanged( mCurrentDefinition );
  }

  // build full description for tool tip and popup dialog
  mFullDescription = tr( "<b><u>Data defined override</u></b><br>" );

  mFullDescription += tr( "<b>Active: </b>%1&nbsp;&nbsp;&nbsp;<i>(ctrl|right-click toggles)</i><br>" ).arg( isActive() ? tr( "yes" ) : tr( "no" ) );

  if ( !mUsageInfo.isEmpty() )
  {
    mFullDescription += tr( "<b>Usage:</b><br>%1<br>" ).arg( mUsageInfo );
  }

  if ( !mInputDescription.isEmpty() )
  {
    mFullDescription += tr( "<b>Expected input:</b><br>%1<br>" ).arg( mInputDescription );
  }

  if ( !mDataTypesString.isEmpty() )
  {
    mFullDescription += tr( "<b>Valid input types:</b><br>%1<br>" ).arg( mDataTypesString );
  }

  QString deftype( "" );
  if ( deftip != tr( "undefined" ) )
  {
    deftype = QString( " (%1)" ).arg( useExpression() ? tr( "expression" ) : tr( "field" ) );
  }

  // truncate long expressions, or tool tip may be too wide for screen
  if ( deftip.length() > 75 )
  {
    deftip.truncate( 75 );
    deftip.append( "..." );
  }

  mFullDescription += tr( "<b>Current definition %1:</b><br>%2" ).arg( deftype ).arg( deftip );

  setToolTip( mFullDescription );

}
Example #13
0
void QgsDataDefinedButton::menuActionTriggered( QAction* action )
{
  if ( action == mActionActive )
  {
    setActive( mActionActive->data().toBool() );
    updateGui();
  }
  else if ( action == mActionDescription )
  {
    showDescriptionDialog();
  }
  else if ( action == mActionExpDialog )
  {
    showExpressionDialog();
  }
  else if ( action == mActionExpression )
  {
    setUseExpression( true );
    setActive( true );
    updateGui();
  }
  else if ( action == mActionCopyExpr )
  {
    QApplication::clipboard()->setText( getExpression() );
  }
  else if ( action == mActionPasteExpr )
  {
    QString exprString = QApplication::clipboard()->text();
    if ( !exprString.isEmpty() )
    {
      setExpression( exprString );
      setUseExpression( true );
      setActive( true );
      updateGui();
    }
  }
  else if ( action == mActionClearExpr )
  {
    // only deactivate if defined expression is being used
    if ( isActive() && useExpression() )
    {
      setUseExpression( false );
      setActive( false );
    }
    setExpression( QString( "" ) );
    updateGui();
  }
  else if ( mFieldsMenu->actions().contains( action ) )  // a field name clicked
  {
    if ( action->isEnabled() )
    {
      if ( getField() != action->text() )
      {
        setField( action->data().toString() );
      }
      setUseExpression( false );
      setActive( true );
      updateGui();
    }
  }
}
Example #14
0
void Window::setVerticalSyncEnabled(bool enabled)
{
    if (setActive())
        m_context->setVerticalSyncEnabled(enabled);
}
Example #15
0
void WebView::enterAcceleratedCompositingMode(const LayerTreeContext&)
{
    setActive(true);
}
Example #16
0
/*
 * Adds new command to queue of commands.
 * when the chainQueues are all empty,
 * a command is popped, locked, and chopped.
 * CAUTION: Will DELETE the enqueued command,
 * so do not resend commands. One use per command.
 * Only one BodyJointCommand can be enqueued at
 * a time, even if they deal with different joints or chains.
 */
void ScriptedProvider::setCommand(const BodyJointCommand::ptr command) {
    bodyCommandQueue.push(command);
    setActive();
}
Example #17
0
void WebView::exitAcceleratedCompositingMode()
{
    setActive(false);
}
void Tutorial::showVideoTutorial()
{
    if (_video)
    {
        auto delay0 = DelayTime::create(2.f);
        
        auto idleRightCallback = CallFunc::create([this]()
        {
            Utility::fadeInNodeWithTime(_video, tutorialDefs::FADE_TIME);
            auto idleAnimation = _video->getAnimationWithName("idle");
            if (idleAnimation)
            {
                idleAnimation->setActive(true);
                _video->setScaleX(1);
                idleAnimation->restart();
            }
        });
        
        auto delay1 = DelayTime::create(2.f);
        
        auto playRightCallback = CallFunc::create([this]()
        {
            auto playAnimation = _video->getAnimationWithName("play");
            if (playAnimation)
            {
                playAnimation->setActive(true);
                playAnimation->restart();
            }
        });
        
        auto delay2 = DelayTime::create(7.f);
        
        auto fadeOutCallback = CallFunc::create([this]()
        {
            Utility::fadeOutNodeWithTime(_video, 2.f);
        });
        
        auto delay3 = DelayTime::create(2.f);
        
        auto idleLeftCallback = CallFunc::create([this]()
        {
            Utility::fadeInNodeWithTime(_video, tutorialDefs::FADE_TIME);
            auto idleAnimation = _video->getAnimationWithName("idle");
            if (idleAnimation)
            {
                idleAnimation->setActive(true);
                _video->setScaleX(-1);
                idleAnimation->restart();
            }
        });
        
        auto delay4 = DelayTime::create(1.f);
        
        auto playLeftCallback = CallFunc::create([this]()
        {
            auto playAnimation = _video->getAnimationWithName("play");
            if (playAnimation)
            {
                playAnimation->setActive(true);
                playAnimation->restart();
            }
        });
        
        auto sequence = Sequence::create(delay0, idleRightCallback, delay1, playRightCallback, delay2, fadeOutCallback, delay3, idleLeftCallback, delay4, playLeftCallback, delay2, fadeOutCallback, NULL);
        
        auto action = RepeatForever::create(sequence);
        action->setTag(tutorialDefs::VIDEO_ANIMATION_TAG);
        
        _video->runAction(action);
    }
}
GradientLineQmlAdaptor::GradientLineQmlAdaptor(QWidget *parent) :
    QmlEditorWidgets::GradientLine(parent)
{
    setActive(false);
    connect(this, SIGNAL(gradientChanged()), this, SLOT(writeGradient()));
}
Example #20
0
void QPalette::setNormal( const QColorGroup &g )
{
    setActive( g );
}
Example #21
0
Context::Context() {
	mContext = GLContext::create();
	setActive(true);
}
void SoundManager2::activate( void ){
    setActive(true);
}
Example #23
0
void IrcChannelPrivate::connected()
{
    // not active until joined
    setActive(false);
}
void SoundManager2::deactivate( void ){
   setActive(false);
}
Example #25
0
	LLNearbyListUpdater(callback_t cb)
	:	LLAvatarListUpdater(cb, NEARBY_LIST_UPDATE_INTERVAL)
	{
		setActive(false);
	}
void PlaneMoveManipulator::mouseButtonPress(const UInt16 button,
                                   const Int16  x,
                                   const Int16  y     )
{
    Transform *t = dynamic_cast<Transform *>(getTarget()->getCore());
    
    if (t == NULL)
    {
        SWARNING << "PlaneMoveManipulator::mouseButtonPress() target is not a Transform!" << endLog;
        return;
    }

    SLOG << "PlaneMoveManipulator::mouseButtonPress() button=" << button << " x=" << x << " y=" << y  << std::endl << endLog;

    OSG::Line viewray;
    getViewport()->getCamera()->calcViewRay(viewray, x, y, *getViewport());

    OSG::Node *scene = getTarget();
    while (scene->getParent() != 0)
    {
        scene = scene->getParent();
    }

    OSG::IntersectActionRefPtr act = OSG::IntersectAction::create();
    act->setLine( viewray );
    act->apply( scene );

    SLOG << "PlaneMoveManipulator::mouseButtonPress() viewray=" << viewray << " scene=" << scene << endLog;
 
    if ( act->didHit() )
    {
        SLOG << "PlaneMoveManipulator::mouseButtonPress() hit! at " << act->getHitPoint() << endLog;

        // Get manipulator plane into world space
        OSG::Matrix m = getTarget()->getToWorld();

        Vec3f      translation;       // for matrix decomposition
        Quaternion rotation;
        Vec3f      scaleFactor;
        Quaternion scaleOrientation;

        t->getMatrix().getTransform(translation, rotation, scaleFactor,
                                    scaleOrientation);

        Vec3f rot_axis;
        rotation.multVec(Vec3f(0,1,0), rot_axis);

        Plane pl(rot_axis, act->getHitPoint());

        SLOG << "PlaneMoveManipulator::mouseButtonPress() world plane: " << pl << endLog;
 
        setClickPoint(act->getHitPoint());

        setBaseTranslation(translation);
        setBaseRotation(rotation);
        
        setActive(true);
    }

    act = NULL;
}
Example #27
0
Geocode::~Geocode() {
  setActive(false);
}
Example #28
0
void sfContext_setActive(sfContext* context, sfBool active)
{
    CSFML_CALL(context, setActive(active == sfTrue));
}
Example #29
0
void WidgetButton::mouseUp(uint8 state, float x, float y) {
	if (isDisabled())
		return;

	setActive(true);
}
Example #30
0
void TaskView::setModel(TaskTableModel& model)
{
    if (_model != &model)
    {
        _model = &model;
        connect(&model, &TaskTableModel::dataChanged, this, &TaskView::modelDataChanged);
        connect(&model, &TaskTableModel::taskActivated, [this](size_t rowIdx) { if (rowIdx == _rowIdx) setActive(true); });
        connect(&model, &TaskTableModel::taskDeactivated, [this](size_t rowIdx) { if (rowIdx == _rowIdx) setActive(false); });
    }
}