本文整理汇总了C++中ofBuffer::isLastLine方法的典型用法代码示例。如果您正苦于以下问题:C++ ofBuffer::isLastLine方法的具体用法?C++ ofBuffer::isLastLine怎么用?C++ ofBuffer::isLastLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofBuffer
的用法示例。
在下文中一共展示了ofBuffer::isLastLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode
void ramTSVCoder::decode(ofBuffer buffer)
{
if (buffer.size())
{
clear();
do
{
string frame = buffer.getNextLine();
vector<string> values = ofSplitString(frame, "\t");
if (values.size() < 2)
throw std::exception();
const string addr = values.at(0);
const string name = values.at(1);
ramNodeArray NA;
if (addr == RAM_OSC_ADDR_ACTOR)
{
ramActor o;
o.setType(RAM_NODEARRAY_TYPE_ACTOR);
o.setName(name);
NA = o;
}
else
{
ramRigidBody o;
o.setType(RAM_NODEARRAY_TYPE_RIGIDBODY);
o.setName(name);
NA = o;
}
const int numNodes = ofToInt(values.at(2));
for (int i=0; i<numNodes; i++)
{
if (values.size() < i*8+3+7)
throw std::exception();
const string nodeName = values.at(i*8 + 0 + 3);
const float vx = ofToFloat( values.at(i*8 + 1 + 3) );
const float vy = ofToFloat( values.at(i*8 + 2 + 3) );
const float vz = ofToFloat( values.at(i*8 + 3 + 3) );
const float qa = ofToFloat( values.at(i*8 + 4 + 3) );
const float ax = ofToFloat( values.at(i*8 + 5 + 3) );
const float ay = ofToFloat( values.at(i*8 + 6 + 3) );
const float az = ofToFloat( values.at(i*8 + 7 + 3) );
const ofVec3f vec(vx, vy, vz);
const ofVec3f axis(ax, ay, az);
const ofQuaternion quat(qa, axis);
ramNode &node = NA.getNode(i);
node.setID(i);
node.setName(nodeName);
node.setPosition(vec);
node.setOrientation(quat);
node.getAccelerometer().update(vec, quat);
}
NA.setTimestamp(ofToFloat( values.at(numNodes*8 + 0 + 3) ));
mSession.appendFrame(NA);
} while (!buffer.isLastLine());
// cout << "[" << __FUNCTION__ << "] " << "File loaded! " << endl;
// cout << "[" << __FUNCTION__ << "] " << "Actor: " << mSession.getNodeArrayName() << endl;
// cout << "[" << __FUNCTION__ << "] " << "Duration: " << mSession.getDuration() << "sec"<< endl;
// cout << "[" << __FUNCTION__ << "] " << "Frames: " << mSession.getNumFrames() << endl << endl;
}
// return mSession;
}