本文整理汇总了C++中TTime::Tick方法的典型用法代码示例。如果您正苦于以下问题:C++ TTime::Tick方法的具体用法?C++ TTime::Tick怎么用?C++ TTime::Tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTime
的用法示例。
在下文中一共展示了TTime::Tick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_scene
static void draw_scene(GLFWwindow* window, double tt)
{
balu_time.Tick();
if (balu_time.ShowFPS())
{
char buf[1000];
sprintf_s(buf, "1 - Nearest 2 - Billenear %7.1f FPS", balu_time.GetFPS());
glfwSetWindowTitle(window, buf);
}
cam->UpdateView();
CheckGLError();
{
//render->Set.ClearColor(0, 0, 1);
render->Clear(1, 1);
render->Set.Projection(perspective_matrix);
render->Set.ModelView(cam->GetView());
TMatrix<float, 4> inv_mvp;
inv_mvp = perspective_matrix*cam->GetView();
inv_mvp.Invert();
{
render->Blend.Enable(false);
render->Set.Color(1, 1, 0.7);
//DrawVolumesLines();
render->Set.Color(0.3, 0.9, 0.2, 0.7);
//DrawVolumes();
}
//render->Clear(1, 1);
render->Set.Projection(TMatrix<float, 4>::GetIdentity());
render->Set.ModelView(TMatrix<float, 4>::GetIdentity());
if (true)
{
float pixel_size_x = 2.0 / (viewport_width);
float pixel_size_y = 2.0 / (viewport_height);
//float size = 0.9;
//float step = 0.002;
//render->Set.PointSize(1);
//render->Set.PointSmooth(true);
//glBegin(GL_POINTS);
//#pragma omp parallel for
for (int x = 1; x < viewport_width-1; x += 1)
{
//break;
for (int y = 1 ; y < viewport_height-1; y += 1)
{
float i = x*pixel_size_x - 1;
float j = y*pixel_size_y - 1;
TVec4 v0(i, j, 0, 1);
TVec4 v1(i, j, 1, 1);
v0 = inv_mvp*v0;
v1 = inv_mvp*v1;
TRay<float, 3> ray;
ray.pos = v0.GetHomogen();
ray.dir = v1.GetHomogen() - ray.pos;
ray.dir.Normalize();
//ray.dir = -ray.dir;
//render->Set.Color(0, 0, 1, 1);
//TVec3 color(0, 0, 1);
TVec<unsigned char, 4> color(0, 0, 1);
color = TVec<unsigned char, 4>(0, 0.2 * 255, 0.2 * 255, 255);
for (int k = 0; k < volumes.size(); k++)
{
//float t, t0, t1, t2, t3;
//TVec3 n, n0, n1;
//bool c0 = volumes[k]->CollideWith(ray);
//bool c1 = volumes[k]->CollideWith(ray, t, n);
//bool c2 = volumes[k]->CollideWith(ray, t0, n0, t1, n1);
//bool c3 = volumes[k]->CollideWith(ray, t2, t3);
TRayCollisionInfo<float, 3> info, info2;
//bool c2 = volumes[k]->RayCollide(ray);
//bool c1 = volumes[k]->RayCollide(ray, info);
//bool c1 = volumes[k]->SegmentCollide(TSegment<float, 3>(ray.pos, ray.pos + ray.dir * 1000));
//bool c1 = volumes[k]->SegmentCollide(TSegment<float, 3>(ray.pos + ray.dir * 40, ray.pos));
//bool c1 = volumes[k]->SegmentCollide(TSegment<float, 3>(ray.pos, ray.pos + ray.dir * 30), info);
//bool c1 = volumes[k]->LineCollide(TLine<float, 3>(ray.pos + ray.dir * 40, ray.pos));
bool c1 = volumes[k]->LineCollide(TLine<float, 3>(ray.pos, ray.pos + ray.dir * 40), info);
//assert(c0 == c1);
//if (c2)
//{
// color = TVec<unsigned char, 4>(1*255, 1*255, 0, 255);
//}else
// color = TVec<unsigned char, 4>(0, 0.2*255, 0, 255);
//.........这里部分代码省略.........