本文整理汇总了C++中Time::AsFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ Time::AsFloat方法的具体用法?C++ Time::AsFloat怎么用?C++ Time::AsFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::AsFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Voxelizer
void Voxelizer()
{
std::cout << "Loading Model . . . ";
// auto model = LoadObjModuleFromFile("data/sponza/sponza.obj");
// auto model = LoadObjModuleFromFile("data/leather_chair/leather_chair.obj");
auto model = LoadObjModuleFromFile("data/primitives/box.obj");
std::cout << "DONE" << std::endl;
std::cout << "Rasterizing . . . ";
RasterData raster;
raster.voxelSize = voxelSize;
RasterizeModel(&raster, *model, Matrix44f(zero));
std::cout << "DONE" << std::endl;
std::cout << "Generating Sparce Map . . . ";
SparceMap<SparceMapData, sparceMapSize> sparceMap;
for (auto fragment : raster.fragments)
SparceTreeInsertPoint(&sparceMap, sparceMapBox, fragment.position, sparceMapLevels);
std::cout << "DONE" << std::endl;
Vector3f center = Vector3f(zero);
float dist = 10.0f;
if (!raster.fragments.empty())
{
for (auto fragment : raster.fragments)
center = center + fragment.position;
center = center * (1.0f / raster.fragments.size());
dist = 0.0f;
for (auto fragment : raster.fragments)
dist = Max(dist, Distance(center, fragment.position));
}
ProtoGL protoGL;
protoGL.Initialize(ProtoGLDesc());
OrbitalCamera camera(protoGL.GetCanvas());
camera.SetPerspective(1.4f, 1.0f, sparceMapDimension * 2.0f);
camera.SetCamera(center, Quaternionf(zero), dist * 2.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
TimeCounter counter;
while (protoGL.Update())
{
Time deltaTime = counter.GetElapsed();
camera.Update(deltaTime);
camera.CommitToGL();
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Time time = GetTime();
Matrix44f objectTM = ToMatrix44(QuaternionAxisAngle(Vector3f(0.0f, 1.0f, 0.0f), time.AsFloat()*0.15f));
raster.fragments.clear();
SparceTreeClearData(&sparceMap);
RasterizeModel(&raster, *model, objectTM);
for (auto fragment : raster.fragments)
SparceTreeInsertPoint(&sparceMap, sparceMapBox, fragment.position, sparceMapLevels);
glPushMatrix();
glMultMatrixf(&objectTM[0]);
DrawModel(*model);
glPopMatrix();
DrawSparceMap(sparceMap, sparceMapBox);
protoGL.Swap();
}
}