예제 #1
0
void Triangles::draw3D(Time time, View3DSettings & viewSettings)
{
    double z = viewSettings.zFromT(time);

    // Drawing
    glBegin(GL_TRIANGLES);
    for(unsigned int i=0; i<triangles_.size(); ++i)
    {
        glVertex3d(viewSettings.xFromX2D(triangles_[i].a[0]), viewSettings.yFromY2D(triangles_[i].a[1]), z);
        glVertex3d(viewSettings.xFromX2D(triangles_[i].b[0]), viewSettings.yFromY2D(triangles_[i].b[1]), z);
        glVertex3d(viewSettings.xFromX2D(triangles_[i].c[0]), viewSettings.yFromY2D(triangles_[i].c[1]), z);
    }
    glEnd();
}
예제 #2
0
void InbetweenVertex::drawRaw3D(View3DSettings & viewSettings)
{
    double eps = 1e-5;

    int k = 5; // number of samples per frame
    double t1 = beforeTime().floatTime();
    double t2 = afterTime().floatTime();
    double dt = 1 / (double) k;

    int lineWidth = 3;
    glLineWidth(lineWidth);
    glBegin(GL_LINE_STRIP);
    for(double t=t1; t<t2+eps; t+=dt)
    {
        Eigen::Vector2d p = pos(Time(t));
        double x = viewSettings.xFromX2D(p[0]);
        double y = viewSettings.yFromY2D(p[1]);
        double z = viewSettings.zFromT(t);
        glVertex3d(x,y,z);
    }
    glEnd();

    glLineWidth(1);
}