Subversion Repositories gelsvn

Rev

Rev 647 | Rev 662 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 647 Rev 657
Line 22... Line 22...
22
using namespace CGLA;
22
using namespace CGLA;
23
using namespace HMesh;
23
using namespace HMesh;
24
using namespace std;
24
using namespace std;
25
using namespace Geometry;
25
using namespace Geometry;
26
namespace GLGraphics
26
namespace GLGraphics
27
{
-
 
28
    void draw_ball() {
-
 
29
        static TriMesh mesh;
-
 
30
        if(mesh.geometry.no_vertices()==0)
-
 
31
        {
-
 
32
            GLfloat sphere_verts[] = {0.91358,0,0,-0.91358,0,0,0,0.91358,0,0,-0.91358,0,0,0,0.91358,0,0,-0.91358,0.54321,-0.54321,0.54321,0.54321,0.54321,-0.54321,-0.54321,0.54321,0.54321,-0.54321,-0.54321,-0.54321,0.54321,0.54321,0.54321,-0.54321,0.54321,-0.54321,-0.54321,-0.54321,0.54321,0.54321,-0.54321,-0.54321,0.444444,0,0.814815,0,-0.814815,0.444444,0.814815,-0.444444,0,0.444444,0,-0.814815,0,0.814815,-0.444444,0.814815,0.444444,0,-0.444444,0,0.814815,0,0.814815,0.444444,-0.814815,0.444444,0,-0.444444,0,-0.814815,0,-0.814815,-0.444444,-0.814815,-0.444444,0,0,0.444444,0.814815,0.814815,0,0.444444,0.444444,0.814815,0,0,0.444444,-0.814815,-0.814815,0,-0.444444,-0.444444,0.814815,0,0,-0.444444,0.814815,-0.814815,0,0.444444,-0.444444,-0.814815,0,0,-0.444444,-0.814815,0.814815,0,-0.444444,0.444444,-0.814815,0};
27
{    
33
            GLuint sphere_indices[] = {28,11,15,27,5,15,33,7,15,33,13,16,35,4,16,38,7,16,38,14,17,37,1,17,28,7,17,37,14,18,36,6,18,30,8,18,30,12,19,32,3,19,29,8,19,29,11,20,28,1,20,37,8,20,34,13,21,33,5,21,27,9,21,27,11,22,29,3,22,32,9,22,32,12,23,31,2,23,34,9,23,31,12,24,30,6,24,36,10,24,36,14,25,38,4,25,35,10,25,35,13,26,34,2,26,31,10,26,22,9,27,21,5,27,15,11,27,15,7,28,17,1,28,20,11,28,20,8,29,19,3,29,22,11,29,19,8,30,18,6,30,24,12,30,24,10,31,26,2,31,23,12,31,23,9,32,22,3,32,19,12,32,16,7,33,15,5,33,21,13,33,21,9,34,23,2,34,26,13,34,26,10,35,25,4,35,16,13,35,25,10,36,24,6,36,18,14,36,18,8,37,20,1,37,17,14,37,17,7,38,16,4,38,25,14,38};
-
 
34
            
-
 
35
            for(int i=0;i<38;++i) {
-
 
36
                int idx0 = 3*i;
-
 
37
                mesh.geometry.add_vertex(Vec3f(sphere_verts[idx0],sphere_verts[idx0+1],sphere_verts[idx0+2]));
-
 
38
            }
-
 
39
            for(int i=0;i<72;++i) {
-
 
40
                int idx0 = 3*i;
-
 
41
                mesh.geometry.add_face(Vec3i(sphere_indices[idx0]-1,sphere_indices[idx0+1]-1,sphere_indices[idx0+2]-1));
-
 
42
            }
-
 
43
            mesh.compute_normals();
-
 
44
        }
-
 
45
        draw(mesh);
-
 
46
    }
-
 
47
    
-
 
48
    GLuint get_noise_texture_id()
28
    GLuint get_noise_texture_id()
49
    {
29
    {
50
        static GLuint texname=0;
30
        static GLuint texname=0;
51
        static bool was_here = false;
31
        static bool was_here = false;
52
        
32