Ejemplo n.º 1
0
void OffsetCameraDecorator::getProjection( Matrix &result, 
                                         UInt32 width, UInt32 height)
{
    if(width == 0 || height == 0)
    {
        result.setIdentity();
        return;
    }

    CameraPtr camera = getDecoratee();
    if(camera == NullFC)
    {
        FWARNING(("OffsetCameraDecorator::getProjection: no decoratee!\n"));
        result.setIdentity();
        return;
    }

    if(getFullWidth() != 0)
        width = getFullWidth();

    if(getFullHeight() != 0)
        height = getFullHeight();

    camera->getProjection(result, width, height);

    Real32 x = getOffsetX() / Real32(width);
    Real32 y = getOffsetY() / Real32(height);

    Matrix sm(  1, 0, 0, x,
                0, 1, 0, y,
                0, 0, 1, 0, 
                0, 0, 0, 1);

    result.multLeft(sm);
}
void HeadTrackedStereoCameraDecorator::getViewing(Matrix &result, 
                                           UInt32  OSG_CHECK_ARG(width ),
                                           UInt32  OSG_CHECK_ARG(height))
{
    Node *pUser = getUser();

    if(pUser == NULL)
    {
        FWARNING(("HeadTrackedStereoCameraDecorator::getViewing: no user!\n"));

        Camera *pCamera = getDecoratee();

        if(pCamera == NULL)
        {
            result.setIdentity();

            return;
        }

        pCamera->getBeacon()->getToWorld(result);

        result.invert();
    }
    else
    {
        pUser->getToWorld(result);

        result.invert();
    }
}
//! Set the value of the CameraDecorator::_sfFar field.
void CameraDecoratorBase::setFar(const Real32 value)
{
    if(_sfDecoratee.getValue() != NULL)
    {
        getDecoratee()->setFar(value);
    }
    else
    {
        Inherited::setFar(value);
    }
}
//! Get the value of the CameraDecorator::_sfFar field.
      Real32  CameraDecoratorBase::getFar(void) const
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->getFar();
    }
    else
    {
        return Inherited::getFar();
    }
}
//! Get the value of the CameraDecorator::_sfFar field.
Real32 &CameraDecoratorBase::editFar(void)
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->editFar();
    }
    else
    {
        return Inherited::editFar();
    }
}
//! Set the value of the CameraDecorator::_sfBeacon field.
void CameraDecoratorBase::setBeacon(Node * const value)
{
    if(_sfDecoratee.getValue() != NULL)
    {
        getDecoratee()->setBeacon(value);
    }
    else
    {
        Inherited::setBeacon(value);
    }
}
//! Get the value of the CameraDecorator::_sfBeacon field.
Node * CameraDecoratorBase::getBeacon(void) const
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->getBeacon();
    }
    else
    {
        return Inherited::getBeacon();
    }
}
const SFReal32 *CameraDecoratorBase::getSFFar(void) const
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->getSFFar();
    }
    else
    {
        return NULL;
    }
}
SFReal32 *CameraDecoratorBase::editSFNear(void)
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->editSFNear();
    }
    else
    {
        return NULL;
    }
}
//! Get the CameraDecorator::_sfBeacon field.
SFWeakNodePtr *CameraDecoratorBase::editSFBeacon(void)
{
    if(_sfDecoratee.getValue() != NULL)
    {
        return getDecoratee()->editSFBeacon();
    }
    else
    {
        return NULL;
    }
}
Ejemplo n.º 11
0
void MatrixCameraDecorator::getViewing(Matrix &result, 
                                       UInt32 width, UInt32 height)
{
    CameraPtr camera = getDecoratee();
    if(camera == NullFC)
    {
        FWARNING(("MatrixCameraDecorator::getViewing: no decoratee!\n"));
        result.setIdentity();
        return;
    }
    camera->getViewing(result, width, height);
    
    result.multLeft(getPostViewing());
    result.mult(getPreViewing());
}                                       
Ejemplo n.º 12
0
void MatrixCameraDecorator::getProjectionTranslation(Matrix &result, 
                                                     UInt32 width, UInt32 height)
{
    CameraPtr camera = getDecoratee();
    if(camera == NullFC)
    {
        FWARNING(("MatrixCameraDecorator::getProjectionTranslation: no decoratee!\n"));
        result.setIdentity();
        return;
    }
    camera->getProjectionTranslation(result, width, height);

    result.multLeft(getPostProjectionTranslation());
    result.mult(getPreProjectionTranslation());
}                                       
bool BurstParticleDecorator::generate(ParticleSystemRefPtr System, const Time& elps)
{
	getDecoratee()->generate(System, elps);
	return false;
}