Пример #1
0
CPlayer::CPlayer(ISceneNode *pNode, IrrlichtDevice *pDevice, f32 fCamAspectRatio, CGame *pGame) {
	init(pDevice,pGame);
	m_bInitOK=pNode!=NULL;
	m_pMarble=(CIrrOdeBody *)pNode;

	ISceneNode *pCam=findCamera(pNode);
	if (pCam==NULL)
		printf("No Camera scene node found\n");
	else
		if (m_bInitOK) {
			m_pCam=(ICameraSceneNode *)pCam;
			m_pCam->setAspectRatio(fCamAspectRatio);
			m_pCam->setTarget(m_pMarble->getAbsolutePosition());

			m_pAnimator=new CMarbleFollowCameraAnimator(m_pCam,pDevice->getSceneManager());
			m_pAnimator->setBody(m_pMarble);
			m_pAnimator->setSelector(pGame->getTriangleSelector());
			m_pAnimator->setCollisionManager(m_pDevice->getSceneManager()->getSceneCollisionManager());
			m_pAnimator->setSoundEngine(m_pSndEngine);
			//m_pCam->addAnimator(m_pAnimator);
			CIrrOdeKlangManager::getSharedInstance()->setListener(m_pCam,0);
		}
		else printf("marble node is NULL\n");

		CRenderToTextureManager::getSharedInstance()->addTarget(pNode);
}
Пример #2
0
ISceneNode *CPlayer::findCamera(ISceneNode *pParent) {
	if (pParent->getType()==ESNT_CAMERA) {
		return pParent;
	}

	list<ISceneNode *> childList=pParent->getChildren();
	list<ISceneNode *>::Iterator it;

	ISceneNode *pRet=NULL;
	for (it=childList.begin(); it!=childList.end(); it++) {
		pRet=findCamera(*it);
		if (pRet) break;
	}
	return pRet;
}
Пример #3
0
bool findCamera(MDagPath& dagPath)
{
    if (dagPath.node().hasFn(MFn::kCamera))
        return true;
    uint numChilds = dagPath.childCount();
    for (uint chId = 0; chId < numChilds; chId++)
    {
        MDagPath childPath = dagPath;
        MStatus stat = childPath.push(dagPath.child(chId));
        if (!stat)
        {
            continue;
        }
        MString childName = childPath.fullPathName();
        return findCamera(childPath);
    }

    return false;
}
Пример #4
0
// doSkinning() just renders (skins) the given pose
void Gdc2005Demo::doCamera (const hkaPose& thePose)
{
	// update camera
	{
		hkVector4 pos;
		const hkInt16 headIdx = hkaSkeletonUtils::findBoneWithName( *m_animatedSkeleton->getSkeleton(), "root");
		pos.setTransformedPos( m_currentTransform, thePose.getBoneModelSpace(headIdx).m_translation );

		if (m_options.m_Display.m_cameraMode == hkGdcDisplayOptions::CLOSEST)
		{
			findCamera( pos );
			fixedCamera( pos );
		}
		else if (m_options.m_Display.m_cameraMode == hkGdcDisplayOptions::TRACKING)
		{
			otsCamera( pos );
		}

	}
}
Пример #5
0
void CameraSource::init(QByteArray cam){
    if(cam.isEmpty()){
        //find the camera
        cam = findCamera();
    }

    setCamera(cam);

    //Capture Still Supported
    qDebug("Capture Viewfinder %ssupported",(camera->isCaptureModeSupported(QCamera::CaptureViewfinder) ? "" : "not "));
    qDebug("Capture Image %ssupported",(camera->isCaptureModeSupported(QCamera::CaptureStillImage) ? "" : "not "));
    qDebug("Capture Video %ssupported",(camera->isCaptureModeSupported(QCamera::CaptureVideo) ? "" : "not "));

    if(camera->isCaptureModeSupported(QCamera::CaptureVideo)){
        camera->setCaptureMode(QCamera::CaptureVideo);
    } else {
        qFatal("Video capture not supported by webcam.");
    }

    camera->setViewfinder(surface);
}
Пример #6
0
CPlayer::CPlayer(u32 iNum, u32 iLocalNum, IrrlichtDevice *pDevice, f32 fCamAspectRatio, CGame *pGame, f32 fPan, bool bNetClient) {
	kinectWrapper = KFCVWrapper::getInstance();
	init(pDevice,pGame);
	m_iNum=iNum;
	m_fPan=fPan;
	m_bNetClient=bNetClient;

	c8 sNodeName[0xFF];
	sprintf(sNodeName,"player%i",iNum);

	m_pCamMode =NULL;
	m_pLap     =NULL;
	m_pFinished=NULL;
	m_pSpeed   =NULL;
	m_pInfo    =NULL;
	m_pCpTime  =NULL;
	m_pName    =NULL;
	m_pCpInfo  =NULL;
	m_pLapTab  =NULL;

	m_bCamStepped=false;

	ISceneNode *pNode=pDevice->getSceneManager()->getSceneNodeFromName(sNodeName);

	if (pNode==NULL) {
		m_bInitOK=false;
		printf("Player %i node (%s) not found!\n",iNum,sNodeName);
	}
	else {
		m_bInitOK=true;
		m_pMarble=(CIrrOdeBody *)pNode;
		ISceneNode *pCam=findCamera(pNode);
		if (pCam==NULL)
			printf("No Camera scene node found for player %i\n",iNum);
		else {
			m_pCam=(ICameraSceneNode *)pCam;
			m_pCam->setAspectRatio(fCamAspectRatio);
			m_pCam->setTarget(m_pMarble->getAbsolutePosition());

			m_pAnimator=new CMarbleFollowCameraAnimator(m_pCam,m_pDevice->getSceneManager());
			m_pAnimator->setBody(m_pMarble);
			m_pAnimator->setSelector(pGame->getTriangleSelector());
			m_pAnimator->setCollisionManager(m_pDevice->getSceneManager()->getSceneCollisionManager());
			m_pAnimator->setSoundEngine(m_pSndEngine);
			m_pCam->addAnimator(m_pAnimator);
			printf("\n\t\tiLocalNum: %i\n\n",iLocalNum);
			CIrrOdeKlangManager::getSharedInstance()->setListener(m_pCam,iLocalNum-1);
		}
		CRenderToTextureManager::getSharedInstance()->addTarget(pNode);
	}

	for (u32 i=0; i<10; i++) {
		c8 sName[0xFF];
		sprintf(sName,"data/numbers/%i.png",i);
		ITexture *tex=m_pDevice->getVideoDriver()->getTexture(sName);
		m_aNumbers.push_back(tex);
	}

	ITexture *tex=m_pDevice->getVideoDriver()->getTexture("data/numbers/slash.png"); m_aNumbers.push_back(tex);
	tex=m_pDevice->getVideoDriver()->getTexture("data/numbers/space.png"); m_aNumbers.push_back(tex);
}
Пример #7
0
LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta)
{
    MetadataMatch ret  = MetadataNoMatch;
    d->settings        = LensFunContainer();
    d->usedCamera      = 0;
    d->usedLens        = 0;
    d->lensDescription.clear();

    if (meta.isEmpty())
    {
        qCDebug(DIGIKAM_DIMG_LOG) << "No metadata available";
        return LensFunIface::MetadataUnavailable;
    }

    PhotoInfoContainer photoInfo = meta.getPhotographInformation();
    d->makeDescription           = photoInfo.make.trimmed();
    d->modelDescription          = photoInfo.model.trimmed();
    bool exactMatch              = true;

    if (d->makeDescription.isEmpty())
    {
        qCDebug(DIGIKAM_DIMG_LOG) << "No camera maker info available";
        exactMatch = false;
    }
    else
    {
        // NOTE: see bug #184156:
        // Some rules to wrap unknown camera device from Lensfun database, which have equivalent in fact.
        if (d->makeDescription == QLatin1String("Canon"))
        {
            if (d->modelDescription == QLatin1String("Canon EOS Kiss Digital X"))
            {
                d->modelDescription = QLatin1String("Canon EOS 400D DIGITAL");
            }

            if (d->modelDescription == QLatin1String("G1 X"))
            {
                d->modelDescription = QLatin1String("G1X");
            }
        }

        d->lensDescription = photoInfo.lens.trimmed();

        // ------------------------------------------------------------------------------------------------

        DevicePtr lfCamera = findCamera(d->makeDescription, d->modelDescription);

        if (lfCamera)
        {
            setUsedCamera(lfCamera);

            qCDebug(DIGIKAM_DIMG_LOG) << "Camera maker   : " << d->settings.cameraMake;
            qCDebug(DIGIKAM_DIMG_LOG) << "Camera model   : " << d->settings.cameraModel;

            // ------------------------------------------------------------------------------------------------
            // -- Performing lens description searches.

            if (!d->lensDescription.isEmpty())
            {
                LensList lensMatches;
                QString  lensCutted;
                LensList lensList;

                // STAGE 1, search in LensFun database as well.
                lensList = findLenses(d->usedCamera, d->lensDescription);
                qCDebug(DIGIKAM_DIMG_LOG) << "* Check for lens by direct query (" << d->lensDescription << " : " << lensList.count() << ")";
                lensMatches.append(lensList);

                // STAGE 2, Adapt exiv2 strings to lensfun strings for Nikon.
                lensCutted = d->lensDescription;

                if (lensCutted.contains(QLatin1String("Nikon")))
                {
                    lensCutted.remove(QLatin1String("Nikon "));
                    lensCutted.remove(QLatin1String("Zoom-"));
                    lensCutted.replace(QLatin1String("IF-ID"), QLatin1String("ED-IF"));
                    lensList = findLenses(d->usedCamera, lensCutted);
                    qCDebug(DIGIKAM_DIMG_LOG) << "* Check for Nikon lens (" << lensCutted << " : " << lensList.count() << ")";
                    lensMatches.append(lensList);
                }

                // TODO : Add here more specific lens maker rules.

                // LAST STAGE, Adapt exiv2 strings to lensfun strings. Some lens description use something like that :
                // "10.0 - 20.0 mm". This must be adapted like this : "10-20mm"
                lensCutted = d->lensDescription;
                lensCutted.replace(QRegExp(QLatin1String("\\.[0-9]")), QLatin1String("")); //krazy:exclude=doublequote_chars
                lensCutted.replace(QLatin1String(" - "), QLatin1String("-"));
                lensCutted.replace(QLatin1String(" mm"), QLatin1String("mn"));
                lensList   = findLenses(d->usedCamera, lensCutted);
                qCDebug(DIGIKAM_DIMG_LOG) << "* Check for no maker lens (" << lensCutted << " : " << lensList.count() << ")";
                lensMatches.append(lensList);

                // Remove all duplicate lenses in the list by using QSet.
                lensMatches = lensMatches.toSet().toList();

                // Display the results.

                if (lensMatches.isEmpty())
                {
                    qCDebug(DIGIKAM_DIMG_LOG) << "lens matches   : NOT FOUND";
                    exactMatch &= false;
                }
                else
                {
                    // Best case for an exact match is to have only one item returned by Lensfun searches.
                    if(lensMatches.count() == 1)
                    {
                        setUsedLens(lensMatches.first());
                        qCDebug(DIGIKAM_DIMG_LOG) << "Lens found     : " << d->settings.lensModel;
                        qCDebug(DIGIKAM_DIMG_LOG) << "Crop Factor    : " << d->settings.cropFactor;
                    }
                    else
                    {
                        qCDebug(DIGIKAM_DIMG_LOG) << "lens matches   : more than one...";
                        const lfLens* exact = 0;

                        Q_FOREACH(const lfLens* const l, lensMatches)
                        {
                            if(QLatin1String(l->Model) == d->lensDescription)
                            {
                                qCDebug(DIGIKAM_DIMG_LOG) << "found exact match from" << lensMatches.count() << "possitibilites:" << l->Model;
                                exact = l;
                            }
                        }

                        if(exact)
                        {
                            setUsedLens(exact);
                        }
                        else
                        {
                            exactMatch &= false;
                        }
                    }
                }
            }
            else
            {
                qCDebug(DIGIKAM_DIMG_LOG) << "Lens description string is empty";
                exactMatch &= false;
            }
        }