示例#1
0
void BaseCamera::pan( float x_amount, float y_amount, bool move_focus /*= false*/, bool proportional /*= true*/ )
{
	noVec3 dir = m_from - m_to;

	float len = proportional ? dir.Length() : 1.0f;

	noVec3 move;
	move.Zero();
	if (x_amount != 0.0f) 
	{
		
		noVec3 right =GetRight();
		move = right * (len * x_amount);	
	}
	if (y_amount != 0.0f)
	{
		move.x += m_up.x * (len * y_amount);
		move.y += m_up.y * (len * y_amount);
		move.z += m_up.z * (len * y_amount);
	}
	m_from = m_from + move;

	if (move_focus)
		m_to = m_to + move;

	computeModelView();
	if (m_mode == CAMERA_COMPUTE_ORTHOGRAPHIC)
		ComputeProjection();
}
示例#2
0
void BaseCamera::rotateAboutTo( float angle, const float axis[3], bool upLock /*= false*/ )
{
	noQuat q;
	//q.FromAngleAxis(angle, noVec3(axis[0], axis[1], axis[2]));
	noRotation rot(vec3_zero, noVec3(axis[0], axis[1], axis[2]), angle);
	q = rot.ToQuat();

	
	
	noVec3 dir;
	dir = m_from - m_to;

	dir = q * dir;
	//dir = q.RotateVec3(dir);
	
	if (!upLock)
		//m_up = q.RotateVec3(m_up);
		m_up = q * m_up;

	m_from = m_to + dir;

	computeModelView();
	if (m_mode == CAMERA_COMPUTE_ORTHOGRAPHIC)
		ComputeProjection();
}
示例#3
0
    void frameAssemble( const eq::Frames& frames )
    {
        eq::PixelViewport coveredPVP;
        eq::Frames dbFrames;

        // Make sure all frames are ready and gather some information on them
        prepareFramesAndSetPvp( frames, dbFrames, coveredPVP );
        coveredPVP.intersect( _channel->getPixelViewport( ));

        if( dbFrames.empty() || !coveredPVP.hasArea( ))
            return;

        if( useDBSelfAssemble( )) // add self to determine ordering
        {
            eq::FrameDataPtr data = _frame.getFrameData();
            _frame.clear( );
            _frame.setOffset( eq::Vector2i( 0, 0 ));
            data->setRange( _drawRange );
            data->setPixelViewport( coveredPVP );
            dbFrames.push_back( &_frame );
        }

        orderFrames( dbFrames, computeModelView( ));

        if( useDBSelfAssemble( )) // read back self frame
        {
            if( dbFrames.front() == &_frame ) // OPT: first in framebuffer!
                dbFrames.erase( dbFrames.begin( ));
            else
            {
                _frame.readback( _channel->getObjectManager(),
                                 _channel->getDrawableConfig(),
                                 _channel->getRegions( ));
                clearViewport( coveredPVP );
                // offset for assembly
                _frame.setOffset( eq::Vector2i( coveredPVP.x, coveredPVP.y ));
            }
        }

        LBINFO << "Frame order: ";
        for( const eq::Frame* frame : dbFrames )
            LBINFO << frame->getName() <<  " "
                   << frame->getFrameData()->getRange() << " : ";
        LBINFO << std::endl;

        try // blend DB frames in computed order
        {
            eq::Compositor::blendFrames( dbFrames, _channel, 0 );
        }
        catch( const std::exception& e )
        {
            LBWARN << e.what() << std::endl;
        }

        // Update draw range
        for( size_t i = 0; i < dbFrames.size(); ++i )
            _drawRange.merge( dbFrames[i]->getRange( ));
    }
示例#4
0
	Object::Object()
	{
		id = idCounter++;
		idColor = vec4(Util::Clamp(id*0.1, 0.0, 1.0), Util::Clamp((id*0.1) - 1, 0.0, 1.0), Util::Clamp((id*0.1) - 2, 0.0, 1.0), 1.0);

		position = vec4();
		color = vec4(0.0, 0.0, 0.0, 1.0);
		theta = vec3();
		scale = vec3(1.0, 1.0, 1.0);
		computeModelView();
	}
示例#5
0
void BaseCamera::dolly( float z_amount, bool move_focus /*= false*/, bool proportional /*= true*/ )
{
	noVec3 dir;
	dir = m_from - m_to;

	if (proportional)
	{
		dir = dir * z_amount;
	}
	else 
	{
		float len = dir.Length(); 
		dir = dir * z_amount / len;
	}
	m_from = dir + m_from;

	if (move_focus)
		m_to = dir + m_to;

	computeModelView();
	if (m_mode == CAMERA_COMPUTE_ORTHOGRAPHIC)
		ComputeProjection();
}
示例#6
0
	void Object::Scale(float scaleFactor)
	{
		scale.x *= scaleFactor;
		scale.y *= scaleFactor;
		computeModelView();
	}
示例#7
0
	void Object::SetScale(float x, float y)
	{
		scale.x = x;
		scale.y = y;
		computeModelView();
	}
示例#8
0
	void Object::SetScale(float s)
	{
		scale.x = scale.y = scale.z = s;
		computeModelView();
	}
示例#9
0
	void Object::SetScaleZ(float z)
	{
		scale.z = z;
		computeModelView();
	}
示例#10
0
	void Object::SetScaleY(float y)
	{
		scale.y = y;
		computeModelView();
	}
示例#11
0
	void Object::SetScaleX(float x)
	{
		scale.x = x;
		computeModelView();
	}