当前位置: 首页>>代码示例>>C++>>正文


C++ ArRef::writeFloat方法代码示例

本文整理汇总了C++中ArRef::writeFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ ArRef::writeFloat方法的具体用法?C++ ArRef::writeFloat怎么用?C++ ArRef::writeFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArRef的用法示例。


在下文中一共展示了ArRef::writeFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
UDPKinectSkeleton::_transmitCurrentPoseOSC()
{
if (_udp.valid() && _skeleton.valid())
  {
  ArConstRef<Joint> torso = _skeleton->findJoint("torso");

  ArRef<MemoryBlock> memory = MemoryBlock::NEW();
  ArRef<MemoryOStream> stream = MemoryOStream::NEW(memory,0);
  _writeStringOSC("/skeleton",stream);

  ArRef<MemoryBlock> memory2 = MemoryBlock::NEW();
  ArRef<MemoryOStream> stream2 = MemoryOStream::NEW(memory2,0);
  _writeStringOSC("/skeleton_local",stream2);

  unsigned int nb = _skeleton->getNbJoints();
  StlString typeString = ",";
  for (size_t i(0);i<nb;++i)
    { typeString+="sfff"; }
  _writeStringOSC(typeString,stream);
  _writeStringOSC(typeString,stream2);

  for (unsigned int i(0);i<nb;++i)
    {
    ArConstRef<Joint> joint = _skeleton->getJoint(i);
    const StlString jointName = joint->getName();
    _writeStringOSC(jointName,stream);   
    _writeStringOSC(jointName,stream2);   
    double x,y,z;
    joint->getPosition(x,y,z);
    stream->writeFloat(x);
    stream->writeFloat(y);
    stream->writeFloat(z);

    if ( (torso.valid()) && (joint != torso) )
      { torso->globalToLocalPosition(x,y,z); }
    stream2->writeFloat(x);
    stream2->writeFloat(y);
    stream2->writeFloat(z);
    }

  for (unsigned int i(0);i<_addresses.size();++i)
    {
    if (_addresses[i].OSC)
      {
      _udp->sendBytes(memory,0,memory->getSize(),
                                 _addresses[i].ip,_addresses[i].port);
      if (_addresses[i].port2 != 0)
        {
        _udp->sendBytes(memory2,0,memory2->getSize(),
                                 _addresses[i].ip,_addresses[i].port2);
        }
      }
    }
  }
}
开发者ID:ClementRivaille,项目名称:Avant_la_tempete,代码行数:56,代码来源:udpKinectSkeleton.cpp


注:本文中的ArRef::writeFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。