本文整理汇总了C++中ProxyObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ProxyObjectPtr类的具体用法?C++ ProxyObjectPtr怎么用?C++ ProxyObjectPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProxyObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unsetParent
void ProxyObject::setParent(const ProxyObjectPtr &parent,
TemporalValue<Location>::Time timeStamp,
const Location &absLocation,
const Location &relLocation) {
if (!parent) {
unsetParent(timeStamp, absLocation);
return;
}
ProxyObjectPtr oldParent (getParentProxy());
if (oldParent) {
oldParent->ProxyObjectProvider::removeListener(this);
}
parent->ProxyObjectProvider::addListener(this);
// Using now() should best allow a linear extrapolation to work.
Location lastPosition(globalLocation(timeStamp));
mParentId = parent->getObjectReference();
Location newparentLastGlobal(parent->globalLocation(timeStamp));
/*
std::cout<<" Last parent global "<<std::endl<<newparentLastGlobal<<std::endl<<
"global loc = "<<std::endl<<lastPosition<<
std::endl<<"local loc = "<<std::endl<<lastPosition.toLocal(newparentLastGlobal)<<std::endl;
*/
mLocation.resetValue(timeStamp, lastPosition.toLocal(newparentLastGlobal));
mLocation.updateValue(timeStamp, relLocation);
PositionProvider::notify(&PositionListener::setParent,
parent,
timeStamp,
absLocation,
relLocation);
}
示例2: updateFrom
void JSAggregateVisibleData::updateFrom(ProxyObjectPtr proxy) {
Mutex::scoped_lock locker (childMutex);
if (mChildren.find(proxy->getObjectReference()) == mChildren.end()) {
// Note that we currently pass in NULL so we don't get
// notifications. We'd only get them upon clearing our children list in
// the destructor anyway.
mChildren[proxy->getObjectReference()] = JSVisibleDataPtr(new JSProxyVisibleData(NULL, proxy));
}
mBest = proxy->getObjectReference();
}
示例3: PROXYMAN_SERIALIZED
void ProxyManager::resetAllProxies() {
PROXYMAN_SERIALIZED();
for (ProxyMap::const_iterator iter = mProxyMap.begin(); iter != mProxyMap.end(); ++iter) {
// Just try locking the weak pointer, if that doesn't work nothing
// will. Note that we want to catch *everything*, even ones we don't
// keep a strong ref to. This ensures that we if we reuse a proxy later
// via the weak reference, we won't forget to reset it. Since resetting
// only affects seqnos, this shouldn't have any adverse affects on those
// still holding a reference.
ProxyObjectPtr proxy = iter->second.wptr.lock();
if (proxy) proxy->reset();
}
}
示例4: calculatePriority
double SAngleDownloadPlanner::calculatePriority(ProxyObjectPtr proxy)
{
if (camera == NULL || !proxy) return 0;
float radius = proxy->bounds().radius();
Vector3d objLoc(proxy->location().position());
Vector3d cameraLoc = camera->getPosition();
if (withinBound(radius, objLoc, cameraLoc)) return 0.99;
Vector3d diff = cameraLoc - objLoc;
SolidAngle sa = SolidAngle::fromCenterRadius((Vector3f)diff, radius);
float priority = (sa.asFloat())/(SolidAngle::Max.asFloat());
return (double)priority;
}
示例5: iValidated
void ProxyEntity::iValidated(ProxyObjectPtr ptr,Liveness::Token lt)
{
if (!lt)
return;
assert(ptr == mProxy);
SILOG(ogre, detailed, "Validating ProxyEntity " << ptr->getObjectReference().toString());
mCanDestroy = false;
mDestroyTimer->cancel();
// Because this could be a new ProxyEntity, created after a bunch
// of updates have been received by the ProxyObject, we need to
// refresh its important data
iUpdateLocation( mProxy, mProxy->location(), mProxy->orientation(), mProxy->bounds(), SpaceObjectReference::null(),lt );
if (!mActive)
{
getScene()->downloadPlanner()->addNewObject(mProxy, this);
mActive = true;
}
}
示例6: createViewedObject
void ObjectHostProxyManager::createViewedObject(const ProxyObjectPtr &newObj, QueryTracker*viewer) {
std::pair<ProxyMap::iterator, bool> result = mProxyMap.insert(
ProxyMap::value_type(newObj->getObjectReference().object(), newObj));
if (result.second==true) {
notify(&ProxyCreationListener::onCreateProxy,newObj);
}
result.first->second.viewers.insert(viewer);
}
示例7: Entity
ProxyEntity::ProxyEntity(OgreRenderer *scene, const ProxyObjectPtr &ppo)
: Entity(scene, ppo->getObjectReference().toString()),
mProxy()
{
mDestroyTimer = Network::IOTimer::create(
mScene->context()->ioService,
std::tr1::bind(&ProxyEntity::handleDestroyTimeout, this)
);
}
示例8: initializeToProxy
void ProxyEntity::initializeToProxy(const ProxyObjectPtr &ppo) {
assert( ppo );
assert( !mProxy || (mProxy->getObjectReference() == ppo->getObjectReference()) );
setIsAggregate(ppo->isAggregate());
/**
FIXME: ADDING AND REMOVING LISTENERS COULD INVALIDATE ITERATORS
*/
if (mProxy) {
mProxy->ProxyObjectProvider::removeListener(this);
mProxy->PositionProvider::removeListener(this);
mProxy->MeshProvider::removeListener(this);
}
mProxy = ppo;
mProxy->ProxyObjectProvider::addListener(this);
mProxy->PositionProvider::addListener(this);
mProxy->MeshProvider::addListener(this);
checkDynamic();
}
示例9: setParent
void Entity::setParent(const ProxyObjectPtr &parent, Time ti, const Location &absLocation, const Location &relLocation)
{
Entity *parentEntity = mScene->getEntity(parent);
if (!parentEntity) {
SILOG(ogre,fatal,"No Entity has been created for proxy " << parent->getObjectReference() <<
" which is to become parent of "<<getProxy().getObjectReference());
return;
}
addToScene(parentEntity->mSceneNode);
}
示例10: processLocationUpdate
void HostedObject::processLocationUpdate(
const SpaceID& space, ProxyObjectPtr proxy_obj, bool predictive,
TimedMotionVector3f* loc, uint64 loc_seqno,
TimedMotionQuaternion* orient, uint64 orient_seqno,
BoundingSphere3f* bounds, uint64 bounds_seqno,
String* mesh, uint64 mesh_seqno,
String* phy, uint64 phy_seqno
) {
if (loc)
proxy_obj->setLocation(*loc, loc_seqno);
if (orient)
proxy_obj->setOrientation(*orient, orient_seqno);
if (bounds)
proxy_obj->setBounds(*bounds, bounds_seqno);
if (mesh)
proxy_obj->setMesh(Transfer::URI(*mesh), mesh_seqno);
if (phy && *phy != "")
proxy_obj->setPhysics(*phy, phy_seqno);
}
示例11: initializeToProxy
void ProxyEntity::initializeToProxy(const ProxyObjectPtr &ppo) {
assert( ppo );
assert( !mProxy || (mProxy->getObjectReference() == ppo->getObjectReference()) );
if (mProxy) {
mProxy->ProxyObjectProvider::removeListener(this);
mProxy->PositionProvider::removeListener(this);
mProxy->MeshProvider::removeListener(this);
}
mProxy = ppo;
mProxy->ProxyObjectProvider::addListener(this);
mProxy->PositionProvider::addListener(this);
mProxy->MeshProvider::addListener(this);
checkDynamic();
}
示例12: destroyObject
void ProxyManager::destroyObject(const ProxyObjectPtr &delObj) {
PROXYMAN_SERIALIZED();
ProxyMap::iterator iter = mProxyMap.find(delObj->getObjectReference().object());
if (iter != mProxyMap.end()) {
iter->second.ptr->destroy();
notify(&ProxyCreationListener::onDestroyProxy,iter->second.ptr);
// Here we only erase the strong reference, keeping the weak one so we
// can recover it if its still in use and we get a re-addition. Be
// careful not to use the iterator after this since this may trigger
// destruction of the object which will call proxyDeleted and invalidate
// it!
iter->second.ptr.reset();
}
}
示例13: setParent
void ProxyObject::setParent(const ProxyObjectPtr &parent,
TemporalValue<Location>::Time timeStamp) {
if (!parent) {
unsetParent(timeStamp);
return;
}
Location globalParent (parent->globalLocation(timeStamp));
Location globalLoc (globalLocation(timeStamp));
// std::cout << "Extrapolated = "<<extrapolateLocation(timeStamp)<<std::endl;
Location localLoc (globalLoc.toLocal(globalParent));
/*
std::cout<<" Setting parent "<<std::endl<<globalParent<<std::endl<<
"global loc = "<<std::endl<<globalLoc<<
std::endl<<"local loc = "<<std::endl<<localLoc<<std::endl;
*/
setParent(parent, timeStamp, globalLoc, localLoc);
}
示例14: iInvalidated
void ProxyEntity::iInvalidated(ProxyObjectPtr ptr, bool permanent,Liveness::Token lt)
{
if (!lt)
return;
assert(ptr == mProxy);
SILOG(ogre, detailed, "Invalidating ProxyEntity " << ptr->getObjectReference().toString());
if (!mActive) return;
// If the the object really disconnected, it'll be marked as a permanent
// removal. If it just left the result set then it should still be in the
// world and shouldn't hurt to leave it around for awhile, and we'll get
// less flickering if we try to mask an removal/addition pair due to quick
// changes/data structure rearrangement by the space server.
if (permanent)
iHandleDestroyTimeout(lt);
else
mDestroyTimer->wait(Duration::seconds(15));
}
示例15: addUpdateFromExisting
void OrphanLocUpdateManager::addUpdateFromExisting(ProxyObjectPtr proxyPtr) {
addUpdateFromExisting(
proxyPtr->getObjectReference(),
*(dynamic_cast<SequencedPresenceProperties*>(proxyPtr.get()))
);
}