Exemplo n.º 1
0
void InitObjectViewer(C_Window *win,long client)
{
	float l,t,r,b;

	TheTimeManager.SetTime( ( unsigned long )( 12 * 60 * 60 * 1000 ) );

	viewRot = IMatrix;
	viewPos.x =0.0f;
	viewPos.y =0.0f;
	viewPos.z =0.0f;

	UIrend3d=new Render3D;
	UIrend3d->Setup(gMainHandler->GetFront());
	UIrend3d->SetFOV( 30.0f * PI/180.f );

	CalculateViewport(win,client,&l,&t,&r,&b);

	UIrend3d->SetViewport( l, t, r, b);
	UIrend3d->SetCamera( &viewPos, &viewRot );

	if(gBSPList == NULL)
	{
		gBSPList=new C_BSPList;
		gBSPList->Setup();
	}
	else
		gBSPList->RemoveAll();
}
Exemplo n.º 2
0
void CGammaCompositorPlane::AdjustBufferInfoForScaling(const stm_display_buffer_t * const pFrame,
                                                       GAMMA_QUEUE_BUFFER_INFO           &qbinfo) const
{
    if(!qbinfo.isSourceInterlaced && qbinfo.isDisplayInterlaced)
    {
        if(m_bHasProgressive2InterlacedHW)
        {
            DEBUGF2(3,("%s: using P2I\n", __PRETTY_FUNCTION__));
            qbinfo.isUsingProgressive2InterlacedHW = true;
        }
        else if (m_ulMaxLineStep > 1)
        {
            DEBUGF2(3,("%s: using line skip (max %lu)\n\n",
                       __PRETTY_FUNCTION__, m_ulMaxLineStep));
        }
        else
        {
            /*
             * without a P2I block we have to convert to interlaced using a
             * 2x downscale. But, if the hardware cannot do that or the overall
             * scale then goes outside the hardware capabilities, we treat the
             * source as interlaced instead.
             */
            int maxverticaldownscale = m_ulMaxVSrcInc/2;

            bool convert_to_interlaced = (qbinfo.dst.height
                                          < (qbinfo.src.height
                                             * m_fixedpointONE
                                             / maxverticaldownscale));
            if(convert_to_interlaced)
            {
                DEBUGF2(3,("%s: converting source to interlaced for "
                           "downscaling\n", __PRETTY_FUNCTION__));
                qbinfo.isSourceInterlaced = true;
                qbinfo.firstFieldType     = GNODE_TOP_FIELD;
            }
        }
    }

    if(qbinfo.isDisplayInterlaced)
    {
        /*
         * Convert the height from frame to field lines. Note that we
         * do not support an "odd" number of lines on an interlaced display,
         * there must always be a matched top and bottom field line. The
         * start line must also be located on a top field to prevent fields
         * getting accidentally swapped.
         */
        qbinfo.dst.height /= 2;
        qbinfo.dst.y      &= 0xfffffffe;
    }

    /*
     * Save the original source height in frame coordinates.
     */
    qbinfo.srcFrameHeight = qbinfo.src.height;

    if(qbinfo.isSourceInterlaced)
    {
        /*
         * For interlaced content we change the source height to the height
         * of each field.
         */
        qbinfo.src.height /= 2;

        /*
         * Also change the vertical start position from frame to field
         * coordinates, unless we are using the hardware de-interlacer in
         * which case we keep it in frame coordinates.
         *
         * Remember that this value is in the fixed point format.
         */
        if(!qbinfo.isHWDeinterlacing)
            qbinfo.src.y /= 2;
    }

    CalculateHorizontalScaling(qbinfo);
    CalculateVerticalScaling(qbinfo);

    /*
     * Save the adjusted destination height in frame coordinates
     */
    qbinfo.dstFrameHeight = (qbinfo.isDisplayInterlaced
                             ? qbinfo.dst.height * 2
                             : qbinfo.dst.height);

    /*
     * Now adjust the source coordinate system to take into account line skipping
     */
    qbinfo.src.y /= qbinfo.line_step;

    /*
     * Define the Y coordinate limit in the source image, used to ensure we
     * do not go outside of the required source image crop when the Y position
     * is adjusted for re-scale purposes.
     */
    qbinfo.maxYCoordinate = ((qbinfo.src.y / m_fixedpointONE)
                             + qbinfo.verticalFilterInputSamples - 1);

    /*
     * Now we have the global scale and adjusted destination, deal with
     * any non-linear scaling to convert between pixel aspect ratios.
     *
     * If this succeeds, then the hsrcinc and chroma_hsrcinc fields will have
     * been changed to reflect the zoom in the "centre" region of the image
     * only.
     */
    if(pFrame->dst.ulFlags & STM_PLANE_DST_CONVERT_TO_16_9_DISPLAY)
        CalculateNonLinearZoom(pFrame,qbinfo);

    CalculateViewport(qbinfo);
}