本文整理汇总了C++中plKey类的典型用法代码示例。如果您正苦于以下问题:C++ plKey类的具体用法?C++ plKey怎么用?C++ plKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了plKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EatKey
virtual bool EatKey(const plKey& key)
{
uint32_t count = plCommonObjLib::GetNumLibs();
for (uint32_t i = 0; i < count; i++)
{
plCommonObjLib* lib = plCommonObjLib::GetLib(i);
if (lib->IsInteresting(key))
{
// Lib wants this guy, so load the object and add it
// Note: we want to switch to passive mode here, so any keys read in
// will NOT force a load on whichever page those keys belong to. Otherwise,
// we'd have to load that entire page and ref all the objects all over
// again and I just really don't want to do that...
plResMgrSettings::Get().SetPassiveKeyRead(true);
hsKeyedObject* object = key->VerifyLoaded();
plResMgrSettings::Get().SetPassiveKeyRead(false);
lib->AddObject(object);
break;
}
}
return true;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:25,代码来源:plPluginResManager.cpp
示例2: GetRefCount
bool plPluginResManager::NukeKeyAndObject(plKey& objectKey)
{
class plPublicRefKey : public plKeyImp
{
public:
uint16_t GetRefCount() const { return fRefCount; }
};
plKeyImp* keyData = (plKeyImp*)objectKey;
// Check the ref count on the object. Nobody should have a ref to it
// except the key
hsKeyedObject* object = objectKey->ObjectIsLoaded();
if (object != nil)
{
if (keyData->GetActiveRefs())
// Somebody still has a ref to this object, so we can't nuke it
return false;
}
// Nobody has a ref to the object, so we're clear to nuke
keyData->SetObjectPtr(nil);
// Check the key. The refcount should be 1 at this point, for the copy
// we're holding in this function. Nobody else should be holding the key
// now that the object is gone.
if (((plPublicRefKey*)keyData)->GetRefCount() > 1)
return false;
// Nuke out the key as well
objectKey = nil;
// All done!
return true;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:35,代码来源:plPluginResManager.cpp
示例3: UpdateDetectorsInScene
void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering)
{
// search thru the actors in a scene looking for convex hull detectors and see if the avatar is inside it
// ... and then send appropiate collision message if needed
NxScene* scene = GetScene(world);
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->ObjectIsLoaded());
const plCoordinateInterface* ci = avObj->GetCoordinateInterface();
hsPoint3 soPos = ci->GetWorldPos();
if (scene)
{
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
plPXPhysical* physical = (plPXPhysical*)actors[i]->userData;
if (physical && physical->DoDetectorHullWorkaround())
{
if ( physical->IsObjectInsideHull(pos) )
{
physical->SetInsideConvexHull(entering);
// we are entering this world... say we entered this detector
ISendCollisionMsg(physical->GetObjectKey(), avatar, entering);
}
}
}
}
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:28,代码来源:plSimulationMgr.cpp
示例4: ICheckSubworlds
// check to make sure that the avatar and the exclude region are in the same subworld
bool plExcludeRegionModifier::ICheckSubworlds(plKey avatar)
{
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->GetObjectPtr());
if (avObj)
{
// get the avatar modifier
const plArmatureMod *avMod = (plArmatureMod*)avObj->GetModifierByType(plArmatureMod::Index());
if (avMod)
{
// get the avatar controller
plPhysicalControllerCore* avController = avMod->GetController();
if (avController)
{
// get physical of the detector region
plPhysical* phys = GetPhysical(GetTarget());
if (phys)
{
// are they in the same subworld?
if ( phys->GetWorldKey() == avController->GetSubworld() )
return true;
else
return false;
}
}
}
}
return false;
}
开发者ID:MultiShard,项目名称:Plasma,代码行数:29,代码来源:plExcludeRegionModifier.cpp
示例5: IFindClosestSafePoint
int plExcludeRegionModifier::IFindClosestSafePoint(plKey avatar)
{
float closestDist = 0.f;
int closestIdx = -1;
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->GetObjectPtr());
if (!avObj)
return -1;
hsVector3 avPos;
avObj->GetCoordinateInterface()->GetLocalToWorld().GetTranslate(&avPos);
for (int i = 0; i < fSafePoints.size(); i++)
{
plSceneObject* safeObj = plSceneObject::ConvertNoRef(fSafePoints[i]->GetObjectPtr());
hsVector3 safePos;
safeObj->GetCoordinateInterface()->GetLocalToWorld().GetTranslate(&safePos);
float dist = (safePos - avPos).Magnitude();
if (dist < closestDist || closestIdx == -1)
{
closestDist = dist;
closestIdx = i;
}
}
return closestIdx;
}
开发者ID:MultiShard,项目名称:Plasma,代码行数:29,代码来源:plExcludeRegionModifier.cpp
示例6: ISendNetMsg
//
// write to net msg and send to server
//
void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint32_t sendFlags)
{
hsAssert(senderKey, "nil senderKey?");
plSynchedObject* sobj = plSynchedObject::ConvertNoRef(senderKey->ObjectIsLoaded());
if (sobj && (sobj->IsInSDLVolatileList(GetSDLName())))
state->SetFlags(state->GetFlags() | plStateDataRecord::kVolatile);
bool dirtyOnly = (sendFlags & plSynchedObject::kForceFullSend) == 0;
bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0;
int writeOptions=0;
// if (dirtyOnly)
writeOptions |= plSDL::kDirtyOnly;
if (broadcast)
writeOptions |= plSDL::kBroadcast;
writeOptions |= plSDL::kTimeStampOnRead;
// send to server
plNetMsgSDLState* msg = state->PrepNetMsg(0, writeOptions);
msg->SetNetProtocol(kNetProtocolCli2Game);
msg->ObjectInfo()->SetUoid(senderKey->GetUoid());
if (sendFlags & plSynchedObject::kNewState)
msg->SetBit(plNetMessage::kNewSDLState);
if (sendFlags & plSynchedObject::kUseRelevanceRegions)
msg->SetBit(plNetMessage::kUseRelevanceRegions);
if (sendFlags & plSynchedObject::kDontPersistOnServer)
msg->SetPersistOnServer(false);
if (sendFlags & plSynchedObject::kIsAvatarState)
msg->SetIsAvatarState(true);
if (broadcast && plNetClientApp::GetInstance())
{
msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID());
}
plNetClientApp::GetInstance()->SendMsg(msg);
msg->UnRef();
fSentOrRecvdState = true;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:50,代码来源:plSDLModifier.cpp
示例7: MakeCCRInvisible
//
// a remote ccr is turning [in]visible
//
void plNetClientMgr::MakeCCRInvisible(plKey avKey, int level)
{
if (!avKey)
{
ErrorMsg("Failed to make remote CCR Invisible, nil avatar key");
return;
}
if (level<0)
{
ErrorMsg("Failed to make remote CCR Invisible, negative level");
return;
}
if (!avKey->ObjectIsLoaded() || !avKey->ObjectIsLoaded()->IsFinal())
{
hsAssert(false, "avatar not loaded or final");
return;
}
plAvatarStealthModeMsg *msg = new plAvatarStealthModeMsg();
msg->SetSender(avKey);
msg->fLevel = level;
if (GetCCRLevel()<level) // I'm a lower level than him, so he's invisible to me
msg->fMode = plAvatarStealthModeMsg::kStealthCloaked;
else
{
// he's visible to me
if (AmCCR() && level > 0)
msg->fMode = plAvatarStealthModeMsg::kStealthCloakedButSeen; // draw as semi-invis
else
msg->fMode = plAvatarStealthModeMsg::kStealthVisible;
}
DebugMsg("Handled MakeCCRInvisible - sending stealth msg");;
// This fxn is called when avatar SDL state is received from the server,
// so this msg will inherit the 'non-local' status of the parent sdl msg.
// That means that the avatar linkSound won't receive it, since the linkSound
// is set as localOnly.
// So, terminate the remote cascade and start a new (local) cascade.
msg->SetBCastFlag(plMessage::kNetStartCascade);
msg->Send();
}
开发者ID:MareinK,项目名称:Plasma,代码行数:49,代码来源:plNetClientMgr.cpp
示例8: IResMgrProgressBarCallback
//============================================================================
void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) {
#ifndef PLASMA_EXTERNAL_RELEASE
if (s_instance)
s_instance->progressBar->SetStatusText(key->GetName());
#endif
if (s_instance)
s_instance->progressBar->Increment(1);
}
开发者ID:,项目名称:,代码行数:9,代码来源:
示例9: AddLooseEnd
void plPluginResManager::AddLooseEnd(plKey key)
{
if( key )
{
key->RefObject();
fLooseEnds.Append(key);
}
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例10: IsInteresting
virtual bool IsInteresting( const plKey &objectKey )
{
if( objectKey->GetUoid().GetClassType() == plCubicEnvironmap::Index() ||
objectKey->GetUoid().GetClassType() == plMipmap::Index() )
{
return true;
}
return false;
}
开发者ID:Mirphak,项目名称:Plasma,代码行数:9,代码来源:plBitmapCreator.cpp
示例11:
plPhysicsSoundMgr::CollidePair::CollidePair(const plKey& firstPhys, const plKey& secondPhys, const hsPoint3& point, const hsVector3& normal)
{
// To simplify searching and sorting, all pairs are set up with the pointer value of the
// first element greater than the pointer value of the second.
if (firstPhys->GetObjectPtr() < secondPhys->GetObjectPtr())
{
this->firstPhysKey = secondPhys;
this->secondPhysKey = firstPhys;
}
else
{
this->firstPhysKey = firstPhys;
this->secondPhysKey = secondPhys;
}
this->point = point;
this->normalForce = normal;
}
开发者ID:GPNMilano,项目名称:Plasma,代码行数:18,代码来源:plPhysicsSoundMgr.cpp
示例12: ISaveOrLoad
//
// save or load a key. return the key.
//
const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, bool32 save, hsStream* stream, hsResMgr* mgr)
{
if (save)
{
if (key)
{
stream->WriteByte(1);
// I need to write a key to MY stream...
#if 0 // DEBUG
plStringBuffer<char> buf = key->GetName()->ToIso8859_1();
stream->WriteLE32(buf.GetSize());
stream->Write(buf.GetSize(), buf.GetData());
#endif
key->GetUoid().Write(stream);
}
else
{
stream->WriteByte(0);
}
return key;
}
else
{
int32_t has=stream->ReadByte();
if (has)
{
// read a key from MY stream
#if 0 // DEBUG
int32_t len = stream->ReadLE32();
char tmp[256];
hsAssert(len<256, "key name overflow");
stream->Read(len, tmp);
#endif
plUoid uoid;
uoid.Read(stream);
return mgr->FindKey(uoid);
}
else
return (nil);
}
return nil;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:45,代码来源:plSynchedValue.cpp
示例13: pfKIListPlayerItem
pfKIListPlayerItem( plKey key, bool inRange = false ) : pfGUIListText(), fPlayerKey( key )
{
static char str[ 256 ];
if( key == nil )
SetText( "<Everyone>" );
else
{
const char *name = plNetClientMgr::GetInstance()->GetPlayerName( key );
if( inRange )
{
sprintf( str, ">%s<", name != nil ? name : key->GetName() );
SetText( str );
}
else
SetText( name != nil ? name : key->GetName() );
}
ISetJustify( true );
}
开发者ID:branan,项目名称:Plasma-nobink,代码行数:20,代码来源:pfKI.cpp
示例14: SetTarget
void plAvTaskSeek::SetTarget(plKey target)
{
hsAssert(target, "Bad key to seek task");
if(target)
{
fSeekObject = plSceneObject::ConvertNoRef(target->ObjectIsLoaded());
}
else
{
fSeekObject = nil;
}
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:12,代码来源:plAvTaskSeek.cpp
示例15: KeyedObjectProc
void plPageOptimizer::KeyedObjectProc(plKey key)
{
plString keyName = key->GetName();
const char* className = plFactory::GetNameOfClass(key->GetUoid().GetClassType());
// For now, ignore any key that isn't in the location we're looking at. That means stuff like textures.
if (fInstance->fLoc != key->GetUoid().GetLocation())
return;
KeySet& loadedKeys = fInstance->fLoadedKeys;
KeyVec& loadOrder = fInstance->fKeyLoadOrder;
KeySet::iterator it = loadedKeys.lower_bound(key);
if (it != loadedKeys.end() && *it == key)
{
printf("Keyed object %s(%s) loaded more than once\n", keyName.c_str(), className);
}
else
{
loadedKeys.insert(it, key);
loadOrder.push_back(key);
}
}
开发者ID:Asteral,项目名称:Plasma,代码行数:23,代码来源:plPageOptimizer.cpp
示例16: del
void plKeyCollector::del(plKey key) {
std::vector<plKey>& keyList = keys[key->getLocation()][key->getType()];
std::vector<plKey>::iterator it = keyList.begin();
size_t sub = 0;
while (it != keyList.end()) {
if ((*it) == key) {
it = keyList.erase(it);
sub++;
} else {
(*it)->setID((*it)->getID() - sub);
it++;
}
}
if (keyList.empty())
keys[key->getLocation()].erase(key->getType());
if (keys[key->getLocation()].empty())
keys.erase(key->getLocation());
if (key.Exists() && key.isLoaded()) {
delete key->getObj();
key->setObj(NULL);
}
}
开发者ID:dpogue,项目名称:libhsplasma,代码行数:22,代码来源:plKeyCollector.cpp
示例17: hsAssert
bool plCommonObjLib::RemoveObjectAndKey( plKey &key )
{
if (!key)
{
hsAssert( false, "Received RemoveObjectAndKey() call for a key that is invalid. Nillifying key anyway." );
key = nil;
return true;
}
hsKeyedObject *object = hsKeyedObject::ConvertNoRef( key->ObjectIsLoaded() );
if( object == nil )
{
hsAssert( false, "Received RemoveObjectAndKey() call for a key that isn't loaded. Nillifying key anyway." );
key = nil;
return true;
}
int idx = fObjects.Find( object );
if( idx == fObjects.kMissingIndex )
{
hsAssert( false, "Trying to RemoveObjectAndKey() for a common object not in the lib." );
key = nil;
return true;
}
// Unref and remove from our list
fObjects[ idx ]->GetKey()->UnRefObject();
fObjects.Remove( idx );
// Nuke out the key and its object
if( !plPluginResManager::ResMgr()->NukeKeyAndObject( key ) )
{
hsAssert( false, "Trouble nuking out the key for this texture. Problems abound...." );
return false;
}
// All done!
return true;
}
开发者ID:Hoikas,项目名称:Plasma,代码行数:38,代码来源:plCommonObjLib.cpp
示例18: Capture
// plCaptureRender::Capture
bool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height)
{
// Create our render target
const uint16_t flags = plRenderTarget::kIsOffscreen;
const uint8_t bitDepth(32);
const uint8_t zDepth(-1);
const uint8_t stencilDepth(-1);
plRenderTarget* rt = new plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth);
static int idx=0;
ST::string buff = ST::format("tRT{}", idx++);
hsgResMgr::ResMgr()->NewKey(buff, rt, ack->GetUoid().GetLocation());
// Create a render request and render request message
plCaptureRenderRequest* req = new plCaptureRenderRequest;
const float pri(-100.f);
req->SetPriority(pri);
req->SetRenderTarget(rt);
const uint32_t renderState
= plPipeline::kRenderNormal
| plPipeline::kRenderClearColor
| plPipeline::kRenderClearDepth;
req->SetRenderState(renderState);
// Set the Ack to be our requestor
req->RequestAck(ack);
// Submit
plRenderRequestMsg* msg = new plRenderRequestMsg(ack, req);
hsRefCnt_SafeUnRef(req);
msg->Send();
return true;
}
开发者ID:H-uru,项目名称:Plasma,代码行数:39,代码来源:plCaptureRender.cpp
示例19: SetSceneObject
void plWinAudible::SetSceneObject(plKey obj)
{
plKey oldKey = nil;
// remove old SDL mod
if (fSDLMod && fSceneObj && fSceneObj != obj)
{
oldKey = fSceneObj;
plSceneObject* so=plSceneObject::ConvertNoRef(fSceneObj->ObjectIsLoaded());
if (so)
so->RemoveModifier(fSDLMod);
delete fSDLMod;
fSDLMod=nil;
}
fSceneObj = obj;
plSceneObject* so=plSceneObject::ConvertNoRef(obj ? obj->ObjectIsLoaded() : nil);
if (so)
{
so->RemoveModifier(fSDLMod);
delete fSDLMod;
fSDLMod=new plSoundSDLModifier;
so->AddModifier(fSDLMod);
}
for( int i = 0; i < fSoundObjs.Count(); i++ )
{
if( fSoundObjs[ i ] != nil && fSoundObjs[ i ]->GetKey() != nil )
{
if( obj != nil )
{
plGenRefMsg *replaceMsg = new plGenRefMsg( fSoundObjs[ i ]->GetKey(), plRefMsg::kOnReplace, 0, plSound::kRefParentSceneObject );
hsgResMgr::ResMgr()->AddViaNotify( obj, replaceMsg, plRefFlags::kPassiveRef );
}
else if( oldKey != nil )
fSoundObjs[ i ]->GetKey()->Release( oldKey );
}
}
}
开发者ID:Drakesinger,项目名称:Plasma,代码行数:38,代码来源:plWinAudible.cpp
示例20: MoveKey
void plKeyCollector::MoveKey(plKey key, const plLocation& to) {
std::vector<plKey>& keyList = keys[key->getLocation()][key->getType()];
std::vector<plKey>::iterator it = keyList.begin();
size_t sub = 0;
while (it != keyList.end()) {
if ((*it) == key) {
it = keyList.erase(it);
sub++;
} else {
(*it)->setID((*it)->getID() - sub);
it++;
}
}
if (keyList.empty())
keys[key->getLocation()].erase(key->getType());
if (keys[key->getLocation()].empty())
keys.erase(key->getLocation());
key->setLocation(to);
add(key);
}
开发者ID:dpogue,项目名称:libhsplasma,代码行数:20,代码来源:plKeyCollector.cpp
注:本文中的plKey类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论