Ejemplo n.º 1
0
ViewData *ViewDataMap::getViewData(osg::Object *viewer, const osg::Vec3f& viewPoint, bool& needsUpdate)
{
    Map::const_iterator found = mViews.find(viewer);
    ViewData* vd = nullptr;
    if (found == mViews.end())
    {
        vd = createOrReuseView();
        mViews[viewer] = vd;
    }
    else
        vd = found->second;

    if (!suitable(vd, viewPoint, mReuseDistance))
    {
        for (Map::const_iterator other = mViews.begin(); other != mViews.end(); ++other)
        {
            if (suitable(other->second, viewPoint, mReuseDistance) && other->second->getNumEntries())
            {
                vd->copyFrom(*other->second);
                needsUpdate = false;
                return vd;
            }
        }
        vd->setViewPoint(viewPoint);
        needsUpdate = true;
    }
    else
        needsUpdate = false;

    return vd;
}
Ejemplo n.º 2
0
seq::ViewData* Application::createViewData()
{
    ViewData* viewData = new ViewData;

    viewData->setApplication( this );

    return static_cast<seq::ViewData*>( viewData );
}
Ejemplo n.º 3
0
bool View::_handleEvent(E& event)
{
    ViewData* data = getViewData();
    LBASSERT(data);
    if (!data)
        return false;
    if (isActive())
        return data->handleEvent(event);
    return false;
}
Ejemplo n.º 4
0
bool View::updateData()
{
    if (!isActive())
        return false;

    ViewData* data = getViewData();
    LBASSERT(data);
    if (data)
        return data->update();
    return false;
}
Ejemplo n.º 5
0
bool View::handleEvent( const eq::ConfigEvent* event )
{
    ViewData* data = getViewData();
    LBASSERT( data );
    if( !data )
        return false;
    if( isActive( ))
        return data->handleEvent( event );
    data->handleEvent( event );
    return false;
}
Ejemplo n.º 6
0
void ViewDataMap::clearUnusedViews(double referenceTime)
{
    for (Map::iterator it = mViews.begin(); it != mViews.end(); )
    {
        ViewData* vd = it->second;
        if (vd->getLastUsageTimeStamp() + mExpiryDelay < referenceTime)
        {
            vd->clear();
            mUnusedViews.push_back(vd);
            mViews.erase(it++);
        }
        else
            ++it;
    }
}
Ejemplo n.º 7
0
void ViewGroup::AddView(const char* viewName, int x,int y, int w, int h, const char* imageName){
	
    SE_SpatialID spatialID = SE_ID::createSpatialID();
    View* geometry = new View(spatialID,this);
	addChild(geometry);
	geometry->setParent(this);

	mViewMap[std::string(viewName)] = geometry;

    ViewData* simObj = new ViewData(geometry);
    simObj->setName(viewName);
	simObj->Init(0,0,w,h,imageName);
	//mViewList.push_back(simObj);
    geometry->SetViewdata(simObj);
    geometry->setPosition(x,y);
	
    geometry->setMovable(false);
    geometry->setCollisionable(false);
    geometry->updateWorldTransform();
    geometry->setBVType(1);
    geometry->updateBoundingVolume();

    SE_DepthTestState* rds = new SE_DepthTestState();
	rds->setDepthTestProperty(SE_DepthTestState::DEPTHTEST_DISABLE);
	geometry->setRenderState(DEPTHTESTSTATE, rds);
	geometry->updateRenderState();

    SE_BlendState *rs = new SE_BlendState();
    rs->setBlendProperty(SE_BlendState::BLEND_ENABLE);
    geometry->setRenderState(BLENDSTATE,rs);
    //geometry->setLocalLayer(2);
    //geometry->updateRenderState();
    geometry->updateWorldLayer(); 
    geometry->updateRenderState();
 
    //geometry->updateWorldLayer();
    geometry->setAlpha(1);
    geometry->setVisible(true);
    
}
Ejemplo n.º 8
0
bool CCameraHandler::LoadViewData(const ViewData& vd)
{
	if (vd.empty())
		return false;

	const auto it = vd.find("mode");

	if (it != vd.end()) {
		const unsigned int camMode = it->second;
		const unsigned int curMode = currCamCtrlNum;

		if (camMode >= camControllers.size())
			return false;

		if (camMode != currCamCtrlNum) {
			CameraTransition(1.0f);
			camControllers[currCamCtrlNum = camMode]->SwitchTo(curMode, camMode != curMode);
		}
	}

	return camControllers[currCamCtrlNum]->SetState(vd);
}
Ejemplo n.º 9
0
bool CCameraHandler::LoadViewData(const ViewData& vd)
{
	if (vd.empty()) {
		return false;
	}

	ViewData::const_iterator it = vd.find("mode");
	if (it != vd.end()) {
		const unsigned int camMode = (unsigned int)it->second;
		if (camMode >= camControllers.size()) {
			return false;
		}
		const unsigned int currentMode = currCamCtrlNum;
		if (camMode != currCamCtrlNum) {
			currCamCtrlNum = camMode;
			currCamCtrl = camControllers[camMode];
			const bool showMode = (camMode != currentMode);
			currCamCtrl->SwitchTo(showMode);
			CameraTransition(1.0f);
		}
	}
	return currCamCtrl->SetState(vd);
}