本文整理汇总了C++中Stopwatch::after方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::after方法的具体用法?C++ Stopwatch::after怎么用?C++ Stopwatch::after使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch::after方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onRender
void App::onRender() {
// Show message
message("Rendering...");
Stopwatch timer;
rayTraceImage(1.0f, m_raysPerPixel);
timer.after("Trace");
debugPrintf("%f s\n", timer.elapsedTime());
// m_result->toImage3uint8()->save("result.png");
}
示例2: bi
void ArticulatedModel::load3DS(const Specification& specification) {
// During loading, we make no attempt to optimize the mesh. We leave that until the
// Parts have been created. The vertex arrays are therefore much larger than they
// need to be.
Stopwatch timer;
Parse3DS parseData;
{
BinaryInput bi(specification.filename, G3D_LITTLE_ENDIAN);
timer.after(" open file");
parseData.parse(bi);
timer.after(" parse");
}
name = FilePath::base(specification.filename);
const std::string& path = FilePath::parent(specification.filename);
/*
if (specification.stripMaterials) {
stripMaterials(parseData);
}
if (specification.mergeMeshesByMaterial) {
mergeGroupsAndMeshesByMaterial(parseData);
}*/
for (int p = 0; p < parseData.objectArray.size(); ++p) {
Parse3DS::Object& object = parseData.objectArray[p];
// Create a unique name for this part
std::string name = object.name;
int count = 0;
while (this->part(name) != NULL) {
++count;
name = object.name + format("_#%d", count);
}
// Create the new part
// All 3DS parts are promoted to the root in the current implementation.
Part* part = addPart(name);
// Process geometry
part->cpuVertexArray.vertex.resize(object.vertexArray.size());
part->cframe = object.keyframe.approxCoordinateFrame();
debugAssert(isFinite(part->cframe.rotation.determinant()));
debugAssert(part->cframe.rotation.isOrthonormal());
if (! part->cframe.rotation.isRightHanded()) {
// TODO: how will this impact other code? I think we can't just force it like this -- Morgan
part->cframe.rotation.setColumn(0, -part->cframe.rotation.column(0));
}
debugAssert(part->cframe.rotation.isRightHanded());
//debugPrintf("%s %d %d\n", object.name.c_str(), object.hierarchyIndex, object.nodeID);
if (part->cpuVertexArray.vertex.size() > 0) {
// Convert vertices to object space (there is no surface normal data at this point)
Matrix4 netXForm = part->cframe.inverse().toMatrix4();
debugAssertM(netXForm.row(3) == Vector4(0,0,0,1),
"3DS file loading requires that the last row of the xform matrix be 0, 0, 0, 1");
if (object.texCoordArray.size() > 0) {
part->m_hasTexCoord0 = true;
part->cpuVertexArray.hasTexCoord0 = true;
}
const Matrix3& S = netXForm.upper3x3();
const Vector3& T = netXForm.column(3).xyz();
for (int v = 0; v < part->cpuVertexArray.vertex.size(); ++v) {
# ifdef G3D_DEBUG
{
const Vector3& vec = object.vertexArray[v];
debugAssert(vec.isFinite());
}
# endif
CPUVertexArray::Vertex& vertex = part->cpuVertexArray.vertex[v];
vertex.position = S * object.vertexArray[v] + T;
vertex.tangent = Vector4::nan();
vertex.normal = Vector3::nan();
if (part->m_hasTexCoord0) {
vertex.texCoord0 = object.texCoordArray[v];
}
# ifdef G3D_DEBUG
{
const Vector3& vec = vertex.position;
debugAssert(vec.isFinite());
}
# endif
}
if (object.faceMatArray.size() == 0) {
// Merge all geometry into one mesh since there are no materials
//.........这里部分代码省略.........
示例3: initOBJ
//.........这里部分代码省略.........
if (ti.peek().type() == Token::SYMBOL) {
ti.readSymbol("/");
if (ti.peek().type() == Token::NUMBER) {
n = ti.readNumber();
if (n < 0) {
n = rawNormal.size() + 1 + n;
}
}
}
}
// Switch to zero-based indexing
--v;
--n;
--t;
faceTempIndex.append(v, t, n);
}
alwaysAssertM(faceTempIndex.size() >= 3*3, "Face with fewer than three vertices in model.");
numTris += (faceTempIndex.size()/3) - 2;
// The faceTempIndex is now a triangle fan. Convert it to a triangle list and use unique vertices
for (int i = 2; i < faceTempIndex.size()/3; ++i) {
// Always start with vertex 0
cookVertex.append(faceTempIndex[0]);
cookTexCoord.append(faceTempIndex[1]);
cookNormal.append(faceTempIndex[2]);
// The vertex just before the one we're adding
int j = (i - 1) * 3;
cookVertex.append(faceTempIndex[j]);
cookTexCoord.append(faceTempIndex[j+1]);
cookNormal.append(faceTempIndex[j+2]);
// The vertex we're adding
j = i * 3;
cookVertex.append(faceTempIndex[j]);
cookTexCoord.append(faceTempIndex[j+1]);
cookNormal.append(faceTempIndex[j+2]);
// Update the index array to contain the three vertices we just added
currentTriList->cpuIndex.append(cookVertex.size() - 3, cookVertex.size() - 2, cookVertex.size() - 1);
}
faceTempIndex.fastClear();
}
// Read until the end of the line
while (ti.hasMore() && (ti.read().type() != Token::NEWLINE));
}
}
debugPrintf("Creating TriLists\n");
// Copy geometry
const int N = cookVertex.size();
part.geometry.vertexArray.resize(N);
for (int i = 0; i < N; ++i) {
part.geometry.vertexArray[i] = rawVertex[cookVertex[i]];
}
// Optional normals
if (rawNormal.size() > 0) {
part.geometry.normalArray.resize(N);
for (int i = 0; i < N; ++i) {
part.geometry.normalArray[i] = rawNormal[cookNormal[i]];
}
}
// Optional texcoords
if (rawTexCoord.size() > 0) {
part.texCoordArray.resize(N);
for (int i = 0; i < N; ++i) {
part.texCoordArray[i] = rawTexCoord[cookTexCoord[i]];
}
}
// Create trilists
for (Table<std::string, TriListSpec*>::Iterator it = groupTable.begin(); it.hasMore(); ++it) {
TriListSpec* s = it->value;
Material::Ref material;
if (materialLibrary.containsKey(s->materialName)) {
material = materialLibrary[s->materialName];
} else {
material = Material::createDiffuse(Color3::white() * 0.8f);
debugPrintf("Warning: unrecognized material: %s\n", s->materialName.c_str());
}
Part::TriList::Ref triList = part.newTriList(material);
triList->twoSided = false;
triList->indexArray = s->cpuIndex;
}
groupTable.deleteValues();
groupTable.clear();
debugPrintf("Done loading. %d vertices, %d faces, %d frames\n\n", cookVertex.size(), numTris, N);
loadTimer.after("Loading");
}