本文整理汇总了C++中wp函数的典型用法代码示例。如果您正苦于以下问题:C++ wp函数的具体用法?C++ wp怎么用?C++ wp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rp
void Impl::Unlock(BytesPtr srcBytes, BytesPtr dstBytes)
{
bytes::read_proc rp(srcBytes);
ProxyId id;
rp(id);
IDirect3DVertexBuffer9 *self = procMap_->getPtr<IDirect3DVertexBuffer9>(id);
UINT offset, size;
DWORD flags;
rp(offset);
rp(size);
rp(flags);
char *ptr = nullptr;
HRESULT res;
res = self->Lock(offset, size, reinterpret_cast<void**>(&ptr), flags);
if (SUCCEEDED(res))
{
rp.array(ptr, size);
res = self->Unlock();
Assert(SUCCEEDED(res));
}
else
{
vector<char> dump(size);
rp.array(dump.data(), size);
Assert(false);
}
bytes::write_proc wp(dstBytes);
wp(res);
}
示例2: WinMain
int WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
{
try
{
dll_t("SciLexer.dll");
HACCEL haccel = LoadAccelerators(instance, "accel_main");
window_class_t wc("MAINFRAME", MainFrameProc);
wc.install();
window_maker_t wm(wc);
wm.create();
SetWindowText(wm.handle, "skeletype");
window_positioner_t wp(wm.handle);
wp.setsize(782, 400);
wp.center_to_screen();
UpdateWindow(wm.handle);
ShowWindow(wm.handle, SW_SHOW);
return win::run(wm.handle, haccel);
}
catch(error_t& e)
{
e.print();
}
return -1;
}
示例3: wp
void World::UnregisterObject(uint32 Id, PlayerSession *Reg)
{
stdext::hash_map<uint32, WorldObject*>::iterator itr = Registrated_Objects.find(Id);
if(itr != Registrated_Objects.end())
{
delete itr->second;
Registrated_Objects.erase(itr);
}
if(GetSessionCount() > 1)
{
Reg->GetPlayer()->UpdateInRangePlayers();
if(Reg->GetPlayer()->m_inRangePlayers.size())
{
for(set<Player*>::iterator itr = Reg->GetPlayer()->m_inRangePlayers.begin(); itr != Reg->GetPlayer()->m_inRangePlayers.end(); ++itr)
{
WorldPacket wp(SMSG_OBJECT_UNREGISTER,4);
wp << Id;
(*itr)->GetSession()->SendPacket(&wp);
}
}
}
}
示例4: lock
void active::schedule::own_thread::thread_fn()
{
platform::unique_lock<platform::mutex> lock(m_mutex);
while( !m_shutdown )
{
if( m_object )
{
any_object * obj = m_object;
m_object = nullptr;
lock.unlock();
obj->run();
lock.lock();
if(m_pool) m_pool->stop_work();
if( m_shared )
{
platform::weak_ptr<any_object> wp(m_shared);
platform::shared_ptr<any_object> shared;
shared.swap(m_shared);
lock.unlock();
shared.reset();
if( wp.expired() ) return; // Object destroyed
lock.lock();
}
}
if( !m_object && !m_shutdown )
m_ready.wait(lock);
}
}
示例5: cp
void KinectViewer::resetNavigation(void)
{
/* Calculate a bounding box around all projectors' points of interests: */
Geometry::Box<Vrui::Scalar,3> bbox=Geometry::Box<Vrui::Scalar,3>::empty;
for(std::vector<KinectStreamer*>::iterator sIt=streamers.begin();sIt!=streamers.end();++sIt)
{
/* Calculate the world position of a point 1m in front of the streamer's projector: */
Kinect::FrameSource::ExtrinsicParameters::Point cp(0.0,0.0,-100.0); // 1m along projection line
Vrui::Point wp((*sIt)->projector->getProjectorTransform().transform(cp));
#if KINECT_CONFIG_FRAMESOURCE_EXTRINSIC_PROJECTIVE
Vrui::Vector ws(200.0,200.0,200.0);
#else
/* Calculate the projector's influence radius: */
Vrui::Scalar s((*sIt)->projector->getProjectorTransform().getScaling()*100.0);
Vrui::Vector ws(s,s,s);
#endif
/* Add the projector's influence to the bounding box: */
bbox.addPoint(wp-ws);
bbox.addPoint(wp+ws);
}
/* Center the resulting box in the view: */
Vrui::setNavigationTransformation(Geometry::mid(bbox.min,bbox.max),Math::div2(Geometry::dist(bbox.min,bbox.max)));
}
示例6: CreateGridMesh
void CreateGridMesh(
const VoxelGrid<Discretizer>& vg,
std::vector<Vector3>& vertices)
{
std::vector<Vector3> voxel_mesh;
CreateBoxMesh(vg.res().x(), vg.res().y(), vg.res().z(), voxel_mesh);
vertices.reserve(voxel_mesh.size() * vg.sizeX() * vg.sizeY() * vg.sizeZ());
for (int x = 0; x < vg.sizeX(); ++x) {
for (int y = 0; y < vg.sizeY(); ++y) {
for (int z = 0; z < vg.sizeZ(); ++z) {
const MemoryCoord mc(x, y, z);
const WorldCoord wc(vg.memoryToWorld(mc));
Vector3 wp(wc.x, wc.y, wc.z);
std::printf("%d, %d, %d -> %0.3f, %0.3f, %0.3f\n", x, y, z, wc.x, wc.y, wc.z);
// translate all triangles by the voxel position
for (const Vector3& v : voxel_mesh) {
vertices.push_back(v + wp);
}
}
}
}
}
示例7: main
int main()
{
Regular_triangulation rt;
for (int y=0 ; y<3 ; y++)
for (int x=0 ; x<3 ; x++)
rt.insert(Weighted_point(K::Point_2(x,y), 0));
//coordinate computation
Weighted_point wp(K::Point_2(1.2, 0.7),2);
Point_coordinate_vector coords;
CGAL::Triple<
std::back_insert_iterator<Point_coordinate_vector>,
K::FT, bool> result =
CGAL::regular_neighbor_coordinates_2(rt, wp,
std::back_inserter(coords));
if(!result.third){
std::cout << "The coordinate computation was not successful."
<< std::endl;
std::cout << "The point (" <<wp.point() << ") lies outside the convex hull."
<< std::endl;
}
K::FT norm = result.second;
std::cout << "Coordinate computation successful." << std::endl;
std::cout << "Normalization factor: " <<norm << std::endl;
std::cout << "done" << std::endl;
return 0;
}
示例8: lockModWinList
std::shared_ptr<Windows::Window>& WindowManager::addNewMainWindow(Windows::Window* other){
std::lock_guard<std::mutex> lockModWinList(modifyMangedWindows);
d_managedWindows.push_back(std::shared_ptr<Windows::Window>(d_factory->createWindow(other)));
std::lock_guard<std::mutex> lock(d_managedWindows.back()->windowMutex);
std::weak_ptr<Windows::Window> wp(d_managedWindows.back());
std::for_each(d_managedWindows.back()->getEmbededWnd().begin(), d_managedWindows.back()->getEmbededWnd().end(), [&](std::unique_ptr<Windows::Window>& arg){arg->setParent(wp);});
return d_managedWindows.back();
}
示例9: BM_WeakPtrIncDecRef
static void BM_WeakPtrIncDecRef(benchmark::State& st) {
auto sp = std::make_shared<int>(42);
benchmark::DoNotOptimize(sp.get());
while (st.KeepRunning()) {
std::weak_ptr<int> wp(sp);
benchmark::ClobberMemory();
}
}
示例10: wp
void World::RegisterProjectileToServer(SFBullet *proj)
{
WorldPacket wp(CMSG_NEW_PROJECTILE, 12+12+4);
wp << proj->GetInitialPos();
wp << proj->GetVelocity();
wp << (float)proj->GetLifeTime();
sCore.GetCharacterSession()->SendPacket(&wp);
}
示例11: wp
IMPDISPLAY_BEGIN_NAMESPACE
void WriteOptimizerState::write(WriterAdaptor w) const {
IMP::OwnerPointer<Writer> wp(w);
for (unsigned int i=0; i< get_number_of_geometries(); ++i) {
get_geometry(i)->set_was_used(true);
w->add_geometry(get_geometry(i));
}
}
示例12: DeleteWords
void CPDF_VariableText::SetText(const FX_WCHAR* text,
int32_t charset,
const CPVT_SecProps* pSecProps,
const CPVT_WordProps* pWordProps) {
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
CFX_WideString swText = text;
CPVT_WordPlace wp(0, 0, -1);
CPVT_SectionInfo secinfo;
if (m_bRichText) {
if (pSecProps)
secinfo.pSecProps = new CPVT_SecProps(*pSecProps);
if (pWordProps)
secinfo.pWordProps = new CPVT_WordProps(*pWordProps);
}
if (CSection* pSection = m_SectionArray.GetAt(0))
pSection->m_SecInfo = secinfo;
int32_t nCharCount = 0;
for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar)
break;
if (m_nCharArray > 0 && nCharCount >= m_nCharArray)
break;
uint16_t word = swText.GetAt(i);
switch (word) {
case 0x0D:
if (m_bMultiLine) {
if (swText.GetAt(i + 1) == 0x0A)
i += 1;
wp.nSecIndex++;
wp.nLineIndex = 0;
wp.nWordIndex = -1;
AddSection(wp, secinfo);
}
break;
case 0x0A:
if (m_bMultiLine) {
if (swText.GetAt(i + 1) == 0x0D)
i += 1;
wp.nSecIndex++;
wp.nLineIndex = 0;
wp.nWordIndex = -1;
AddSection(wp, secinfo);
}
break;
case 0x09:
word = 0x20;
default:
wp = InsertWord(wp, word, charset, pWordProps);
break;
}
nCharCount++;
}
}
示例13: MakeWaypoint
static Waypoint
MakeWaypoint(const TCHAR *name, int altitude,
double longitude, double latitude)
{
Waypoint wp(GeoPoint(Angle::Degrees(longitude),
Angle::Degrees(latitude)));
wp.name = name;
wp.elevation = fixed(altitude);
return wp;
}
示例14: wp
void
WayPointFile::add_waypoint(Waypoints &way_points,
const Waypoint &new_waypoint)
{
// Append the new waypoint to the waypoint list and
// return successful line parse
Waypoint wp(new_waypoint);
way_points.append(wp);
return;
}
示例15: CHANGED_NETWORK_STATE
void CNetPlayerInput::DoSetState(const SSerializedPlayerInput& input )
{
m_newInterpolation |= (input.position != m_curInput.position) || (input.deltaMovement != m_curInput.deltaMovement);
const bool wasSprinting = m_curInput.sprint;
m_curInput = input;
CHANGED_NETWORK_STATE(m_pPlayer, CPlayer::ASPECT_INPUT_CLIENT );
if(wasSprinting != input.sprint)
{
SInputEventData inputEventData( SInputEventData::EInputEvent_Sprint, m_pPlayer->GetEntityId(), CCryName("sprint"), input.sprint ? eAAM_OnPress : eAAM_OnRelease, 0.f );
m_pPlayer->StateMachineHandleEventMovement( SStateEventPlayerInput( &inputEventData ) );
}
// not having these set seems to stop a remote avatars rotation being reflected
m_curInput.aiming = true;
m_curInput.allowStrafing = true;
m_curInput.usinglookik = true;
IAIActor* pAIActor = CastToIAIActorSafe(m_pPlayer->GetEntity()->GetAI());
if (pAIActor)
pAIActor->GetState().bodystate=input.bodystate;
CMovementRequest moveRequest;
moveRequest.SetStance( (EStance)m_curInput.stance );
if(IsDemoPlayback())
{
Vec3 localVDir(m_pPlayer->GetViewQuatFinal().GetInverted() * m_curInput.lookDirection);
Ang3 deltaAngles(asinf(localVDir.z),0,atan2_tpl(-localVDir.x,localVDir.y));
moveRequest.AddDeltaRotation(deltaAngles*gEnv->pTimer->GetFrameTime());
}
moveRequest.SetPseudoSpeed(CalculatePseudoSpeed());
moveRequest.SetAllowStrafing(input.allowStrafing);
m_pPlayer->GetMovementController()->RequestMovement(moveRequest);
#if !defined(_RELEASE)
// debug..
if (g_pGameCVars->g_debugNetPlayerInput & 1)
{
IPersistantDebug * pPD = gEnv->pGame->GetIGameFramework()->GetIPersistantDebug();
pPD->Begin( string("net_player_input_") + m_pPlayer->GetEntity()->GetName(), true );
pPD->AddSphere( moveRequest.GetLookTarget(), 0.5f, ColorF(1,0,1,1), 1.0f );
// pPD->AddSphere( moveRequest.GetMoveTarget(), 0.5f, ColorF(1,1,0,1), 1.0f );
Vec3 wp(m_pPlayer->GetEntity()->GetWorldPos() + Vec3(0,0,2));
pPD->AddDirection( wp, 1.5f, m_curInput.deltaMovement, ColorF(1,0,0,1), 1.0f );
pPD->AddDirection( wp, 1.5f, m_curInput.lookDirection, ColorF(0,1,0,1), 1.0f );
}
#endif
}