Commits

Sebastien Mondet  committed 430c0e1

webpdb: draw a “unit” sphere

  • Participants
  • Parent commits 04dce34

Comments (0)

Files changed (1)

   if gl##getError() <> gl##_NO_ERROR
   then error "WebGL error"
 
+module Data = struct
+
+  let sphere_vertices = [|
+    0.723600; -0.525720; -0.447215;
+    0.262869; -0.809012; -0.525738;
+    0.425323; -0.309011; -0.850654;
+    -0.162456; -0.499995; -0.850654;
+    0.425323; -0.309011; -0.850654;
+    0.262869; -0.809012; -0.525738;
+    0.262869; -0.809012; -0.525738;
+    -0.276385; -0.850640; -0.447215;
+    -0.162456; -0.499995; -0.850654;
+    0.425323; -0.309011; -0.850654;
+    -0.162456; -0.499995; -0.850654;
+    0.000000; 0.000000; -1.000000;
+    0.425323; -0.309011; -0.850654;
+    0.850648; 0.000000; -0.525736;
+    0.723600; -0.525720; -0.447215;
+    0.850648; 0.000000; -0.525736;
+    0.425323; -0.309011; -0.850654;
+    0.425323; 0.309011; -0.850654;
+    0.425323; 0.309011; -0.850654;
+    0.723600; 0.525720; -0.447215;
+    0.850648; 0.000000; -0.525736;
+    0.425323; 0.309011; -0.850654;
+    0.425323; -0.309011; -0.850654;
+    0.000000; 0.000000; -1.000000;
+    -0.276385; -0.850640; -0.447215;
+    -0.688189; -0.499997; -0.525736;
+    -0.162456; -0.499995; -0.850654;
+    -0.525730; 0.000000; -0.850652;
+    -0.162456; -0.499995; -0.850654;
+    -0.688189; -0.499997; -0.525736;
+    -0.688189; -0.499997; -0.525736;
+    -0.894425; 0.000000; -0.447215;
+    -0.525730; 0.000000; -0.850652;
+    -0.162456; -0.499995; -0.850654;
+    -0.525730; 0.000000; -0.850652;
+    0.000000; 0.000000; -1.000000;
+    -0.894425; 0.000000; -0.447215;
+    -0.688189; 0.499997; -0.525736;
+    -0.525730; 0.000000; -0.850652;
+    -0.162456; 0.499995; -0.850654;
+    -0.525730; 0.000000; -0.850652;
+    -0.688189; 0.499997; -0.525736;
+    -0.688189; 0.499997; -0.525736;
+    -0.276385; 0.850640; -0.447215;
+    -0.162456; 0.499995; -0.850654;
+    -0.525730; 0.000000; -0.850652;
+    -0.162456; 0.499995; -0.850654;
+    0.000000; 0.000000; -1.000000;
+    -0.276385; 0.850640; -0.447215;
+    0.262869; 0.809012; -0.525738;
+    -0.162456; 0.499995; -0.850654;
+    0.425323; 0.309011; -0.850654;
+    -0.162456; 0.499995; -0.850654;
+    0.262869; 0.809012; -0.525738;
+    0.262869; 0.809012; -0.525738;
+    0.723600; 0.525720; -0.447215;
+    0.425323; 0.309011; -0.850654;
+    -0.162456; 0.499995; -0.850654;
+    0.425323; 0.309011; -0.850654;
+    0.000000; 0.000000; -1.000000;
+    0.850648; 0.000000; -0.525736;
+    0.951058; -0.309013; 0.000000;
+    0.723600; -0.525720; -0.447215;
+    0.951058; -0.309013; 0.000000;
+    0.850648; 0.000000; -0.525736;
+    0.951058; 0.309013; 0.000000;
+    0.951058; 0.309013; 0.000000;
+    0.894425; 0.000000; 0.447215;
+    0.951058; -0.309013; 0.000000;
+    0.723600; 0.525720; -0.447215;
+    0.951058; 0.309013; 0.000000;
+    0.850648; 0.000000; -0.525736;
+    0.262869; -0.809012; -0.525738;
+    0.000000; -1.000000; 0.000000;
+    -0.276385; -0.850640; -0.447215;
+    0.000000; -1.000000; 0.000000;
+    0.262869; -0.809012; -0.525738;
+    0.587786; -0.809017; 0.000000;
+    0.587786; -0.809017; 0.000000;
+    0.276385; -0.850640; 0.447215;
+    0.000000; -1.000000; 0.000000;
+    0.723600; -0.525720; -0.447215;
+    0.587786; -0.809017; 0.000000;
+    0.262869; -0.809012; -0.525738;
+    -0.688189; -0.499997; -0.525736;
+    -0.951058; -0.309013; 0.000000;
+    -0.894425; 0.000000; -0.447215;
+    -0.951058; -0.309013; 0.000000;
+    -0.688189; -0.499997; -0.525736;
+    -0.587786; -0.809017; 0.000000;
+    -0.587786; -0.809017; 0.000000;
+    -0.723600; -0.525720; 0.447215;
+    -0.951058; -0.309013; 0.000000;
+    -0.276385; -0.850640; -0.447215;
+    -0.587786; -0.809017; 0.000000;
+    -0.688189; -0.499997; -0.525736;
+    -0.688189; 0.499997; -0.525736;
+    -0.587786; 0.809017; 0.000000;
+    -0.276385; 0.850640; -0.447215;
+    -0.587786; 0.809017; 0.000000;
+    -0.688189; 0.499997; -0.525736;
+    -0.951058; 0.309013; 0.000000;
+    -0.951058; 0.309013; 0.000000;
+    -0.723600; 0.525720; 0.447215;
+    -0.587786; 0.809017; 0.000000;
+    -0.894425; 0.000000; -0.447215;
+    -0.951058; 0.309013; 0.000000;
+    -0.688189; 0.499997; -0.525736;
+    0.262869; 0.809012; -0.525738;
+    0.587786; 0.809017; 0.000000;
+    0.723600; 0.525720; -0.447215;
+    0.587786; 0.809017; 0.000000;
+    0.262869; 0.809012; -0.525738;
+    0.000000; 1.000000; 0.000000;
+    0.000000; 1.000000; 0.000000;
+    0.276385; 0.850640; 0.447215;
+    0.587786; 0.809017; 0.000000;
+    -0.276385; 0.850640; -0.447215;
+    0.000000; 1.000000; 0.000000;
+    0.262869; 0.809012; -0.525738;
+    0.894425; 0.000000; 0.447215;
+    0.688189; -0.499997; 0.525736;
+    0.951058; -0.309013; 0.000000;
+    0.587786; -0.809017; 0.000000;
+    0.951058; -0.309013; 0.000000;
+    0.688189; -0.499997; 0.525736;
+    0.688189; -0.499997; 0.525736;
+    0.276385; -0.850640; 0.447215;
+    0.587786; -0.809017; 0.000000;
+    0.951058; -0.309013; 0.000000;
+    0.587786; -0.809017; 0.000000;
+    0.723600; -0.525720; -0.447215;
+    0.276385; -0.850640; 0.447215;
+    -0.262869; -0.809012; 0.525738;
+    0.000000; -1.000000; 0.000000;
+    -0.587786; -0.809017; 0.000000;
+    0.000000; -1.000000; 0.000000;
+    -0.262869; -0.809012; 0.525738;
+    -0.262869; -0.809012; 0.525738;
+    -0.723600; -0.525720; 0.447215;
+    -0.587786; -0.809017; 0.000000;
+    0.000000; -1.000000; 0.000000;
+    -0.587786; -0.809017; 0.000000;
+    -0.276385; -0.850640; -0.447215;
+    -0.723600; -0.525720; 0.447215;
+    -0.850648; 0.000000; 0.525736;
+    -0.951058; -0.309013; 0.000000;
+    -0.951058; 0.309013; 0.000000;
+    -0.951058; -0.309013; 0.000000;
+    -0.850648; 0.000000; 0.525736;
+    -0.850648; 0.000000; 0.525736;
+    -0.723600; 0.525720; 0.447215;
+    -0.951058; 0.309013; 0.000000;
+    -0.951058; -0.309013; 0.000000;
+    -0.951058; 0.309013; 0.000000;
+    -0.894425; 0.000000; -0.447215;
+    -0.723600; 0.525720; 0.447215;
+    -0.262869; 0.809012; 0.525738;
+    -0.587786; 0.809017; 0.000000;
+    0.000000; 1.000000; 0.000000;
+    -0.587786; 0.809017; 0.000000;
+    -0.262869; 0.809012; 0.525738;
+    -0.262869; 0.809012; 0.525738;
+    0.276385; 0.850640; 0.447215;
+    0.000000; 1.000000; 0.000000;
+    -0.587786; 0.809017; 0.000000;
+    0.000000; 1.000000; 0.000000;
+    -0.276385; 0.850640; -0.447215;
+    0.276385; 0.850640; 0.447215;
+    0.688189; 0.499997; 0.525736;
+    0.587786; 0.809017; 0.000000;
+    0.951058; 0.309013; 0.000000;
+    0.587786; 0.809017; 0.000000;
+    0.688189; 0.499997; 0.525736;
+    0.688189; 0.499997; 0.525736;
+    0.894425; 0.000000; 0.447215;
+    0.951058; 0.309013; 0.000000;
+    0.587786; 0.809017; 0.000000;
+    0.951058; 0.309013; 0.000000;
+    0.723600; 0.525720; -0.447215;
+    0.688189; -0.499997; 0.525736;
+    0.162456; -0.499995; 0.850654;
+    0.276385; -0.850640; 0.447215;
+    0.162456; -0.499995; 0.850654;
+    0.688189; -0.499997; 0.525736;
+    0.525730; 0.000000; 0.850652;
+    0.525730; 0.000000; 0.850652;
+    0.000000; 0.000000; 1.000000;
+    0.162456; -0.499995; 0.850654;
+    0.894425; 0.000000; 0.447215;
+    0.525730; 0.000000; 0.850652;
+    0.688189; -0.499997; 0.525736;
+    -0.262869; -0.809012; 0.525738;
+    -0.425323; -0.309011; 0.850654;
+    -0.723600; -0.525720; 0.447215;
+    -0.425323; -0.309011; 0.850654;
+    -0.262869; -0.809012; 0.525738;
+    0.162456; -0.499995; 0.850654;
+    0.162456; -0.499995; 0.850654;
+    0.000000; 0.000000; 1.000000;
+    -0.425323; -0.309011; 0.850654;
+    0.276385; -0.850640; 0.447215;
+    0.162456; -0.499995; 0.850654;
+    -0.262869; -0.809012; 0.525738;
+    -0.850648; 0.000000; 0.525736;
+    -0.425323; 0.309011; 0.850654;
+    -0.723600; 0.525720; 0.447215;
+    -0.425323; 0.309011; 0.850654;
+    -0.850648; 0.000000; 0.525736;
+    -0.425323; -0.309011; 0.850654;
+    -0.425323; -0.309011; 0.850654;
+    0.000000; 0.000000; 1.000000;
+    -0.425323; 0.309011; 0.850654;
+    -0.723600; -0.525720; 0.447215;
+    -0.425323; -0.309011; 0.850654;
+    -0.850648; 0.000000; 0.525736;
+    -0.262869; 0.809012; 0.525738;
+    0.162456; 0.499995; 0.850654;
+    0.276385; 0.850640; 0.447215;
+    0.162456; 0.499995; 0.850654;
+    -0.262869; 0.809012; 0.525738;
+    -0.425323; 0.309011; 0.850654;
+    -0.425323; 0.309011; 0.850654;
+    0.000000; 0.000000; 1.000000;
+    0.162456; 0.499995; 0.850654;
+    -0.723600; 0.525720; 0.447215;
+    -0.425323; 0.309011; 0.850654;
+    -0.262869; 0.809012; 0.525738;
+    0.688189; 0.499997; 0.525736;
+    0.525730; 0.000000; 0.850652;
+    0.894425; 0.000000; 0.447215;
+    0.525730; 0.000000; 0.850652;
+    0.688189; 0.499997; 0.525736;
+    0.162456; 0.499995; 0.850654;
+    0.162456; 0.499995; 0.850654;
+    0.000000; 0.000000; 1.000000;
+    0.525730; 0.000000; 0.850652;
+    0.276385; 0.850640; 0.447215;
+    0.162456; 0.499995; 0.850654;
+    0.688189; 0.499997; 0.525736;
+  |]
+
+
+end
 module Renderer = struct
 
 
       fetch_model  "http://www.pdb.org/pdb/files/4IS8.pdb"
       >>= fun _ ->
       let pos =
-        Renderer.float32array [|
-          0.; 0.; 0.;
-          0.; 1.; 0.;
-          0.; 0.; 1.;
-          1.; 0.; 0.;
-          0.; 1.; 0.;
-          1.; 0.; 1.;
-          1.; 0.; 0.;
-          0.; 1.; 0.;
-          1.; 0.; 1.;
-        |] in
+        Renderer.float32array Data.sphere_vertices in
       let norm =
-        Renderer.float32array [|
-          0.; 0.; 0.;
-          0.; 1.; 0.;
-          0.; 0.; 1.;
-          1.; 0.; 0.;
-          0.; 1.; 0.;
-          1.; 0.; 1.;
-          1.; 0.; 0.;
-          0.; 1.; 0.;
-          1.; 0.; 1.;
-        |] in
+        Renderer.float32array Data.sphere_vertices in
       Renderer.start (pos, norm)
     end
     (fun exn -> error "uncaught exception: %s" (Printexc.to_string exn)));