Best way to draw a cube with smooth edges? Bezier, download .3ds or something else?

I need to make a cube with smooth corners and smooth edges in C ++ with OpenGL. As far as I know, I have three options: Bezier curves (is it possible, is it possible?), A cube with cylinders for edges and a sphere for corners, or a load of 0.3 cube.

Any ideas?

+6
source share
2 answers

You can simulate a cube with smooth lighting by specifying normals directly from the center (simulating an 8-angle sphere). It completely depends on what exactly you are trying to do. Using the above method can be quite good.

( ), . , , , .

, . , , , , :)

+2

pseduocode:

 mesh rounded_cube(int size, int edge_radius)
 {
     mesh result = sphere(edge_radius)
     vertex octants[] = result.verteces()
     for each v in octants
     {
         if (v.x != 0.0)
            v.x = size * ( v.x/abs(v.x) );
         if (v.y != 0.0)
            v.y = size * ( v.y/abs(v.y) );
         if (v.z != 0.0)
            v.z = size * ( v.z/abs(v.z) );
     }

     for i in result.vertices().size()
     {
         result.vertex[i] += octants[i]
     }

     return result;

 }
+4

All Articles