Clean up some duplication
[factor/jcg.git] / extra / 4DNav / camera / camera-docs.factor
blob422148aebe8d0b55c3ec4b26471ed099c241606e
1 ! Copyright (C) 2008 Jean-François Bigot.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel ;
4 IN: 4DNav.camera
6 HELP: camera-eye
7 { $values
8     
9      { "point" null }
11 { $description "return the position of the camera" } ;
13 HELP: camera-focus
14 { $values
15     
16      { "point" null }
18 { $description "return the point the camera looks at" } ;
20 HELP: camera-up
21 { $values
22     
23      { "dirvec" null }
25 { $description "In order to precise the roling position of camera give an upward vector" } ;
27 HELP: do-look-at
28 { $values
29      { "camera" null }
31 { $description "Word to use in replacement of gl-look-at when using a camera" } ;
33 ARTICLE: "4DNav.camera" "4DNav.camera"
34 { $vocab-link "4DNav.camera" }
35 "\n"
36 "A camera is defined by:"
37 { $list
38 { "a position (" { $link camera-eye } ")" }
39 { "a focus direction (" { $link camera-focus } ")\n" }
40 { "an attitude information (" { $link camera-up } ")\n" }
42 "\nUse " { $link do-look-at } " in opengl statement in placement of gl-look-at"
43 "\n\n"
44 "A camera is a " { $vocab-link "4DNav.turtle" } " object. Its a special vocab to handle mouvements of a 3D object:"
45 { $list
46 { "To define a camera"
48     $unchecked-example
49     
50 "VAR: my-camera"
51 ": init-my-camera ( -- )"
52 "    <turtle> >my-camera"
53 "    [ my-camera> >self"
54 "      reset-turtle "
55 "    ] with-scope ;"
56 } }
57 { "To move it"
59     $unchecked-example
61 "    [ my-camera> >self"
62 "      45 pitch-up "
63 "      5 step-turtle" 
64 "    ] with-scope "
65 } }
66 { "or"
68     $unchecked-example
70 "    [ my-camera> >self"
71 "      5 strafe-left"
72 "    ] with-scope "
76 "to use it in an opengl statement"
78     $unchecked-example
79   "my-camera> do-look-at"
88 ABOUT: "4DNav.camera"