Xah Lee, 2007-12, 2008-03
This page contains some tips on using the POV-Ray with the Emacs text editor. (If you are not familiar with them, see Introduction to POV-Ray and Emacs Tutorial.)
To have syntax coloring, get this pov-mode: pov-mode-3.1.tar.gz, currently maintained by Marco Pessotto.
This mode features customizable syntax coloring, keyword completion, keyword documentation lookup, template insertions, integrated rendering and image viewing commands.
To complete a keyword, type “Esc TAB” (or “Alt+x pov-complete-word”).
To look up documentation of the keyword the cursor is on, type “Ctrl+c Ctrl+c Ctrl+h” (or “Alt+x pov-keyword-help”).
To open the “include” file the cursor is on, type “Ctrl+c Ctrl+c i” (or “Alt+x pov-open-include-file”).
To render the current scene file, use the menu “Render”, or type “Ctrl+c Ctrl+c r”.
The pov-mode provides several shortcuts for rendering at different qualities. Here's a table:
| Shortcut | Command Name | Meaning |
|---|---|---|
| Ctrl+c Ctrl+c r | pov-tool-bar-command-render | default quality |
| Ctrl+c Ctrl+c 1 | pov-menu-render-test | test quality |
| Ctrl+c Ctrl+c 2 | pov-menu-render-low | low quality |
| Ctrl+c Ctrl+c 3 | pov-menu-render-mid | midium quality |
| Ctrl+c Ctrl+c 4 | pov-menu-render-high | high quality |
| Ctrl+c Ctrl+c 5 | pov-menu-render-highest | highest quality |
To view the rendered image corresponding to the current scene file, type “Ctrl+c Ctrl+c v” (or “M+x pov-menu-internal-viewer”) or use the menu “View”.
To view the rendered image in a external image viewer (such as Gimp), type “Ctrl+c Ctrl+c e” (or “M+x pov-menu-external-viewer”). You can customize pov-mode to setup what application you want to use as the external viewer (see Customization section below).
To see the rendering stats, type “Ctrl+c Ctrl+c l” (or “Alt+x pov-show-render-output”).
The pov-mode supports emacs's graphical customization interface. To enter customization, type “Alt+x customize-group RET pov RET”. Then, a graphical user interface with buttons will show up that lets you change default values. Move your cursor to the field you want to change, type the new value, then click the button “Set for Current Session” or “Save for Future Sessions”. Then, you can close the buffer (or click “Finish” to close the buffer). If you save for furture session, emacs will automatically insert code to your emacs init file (usually at “~/.emacs”).
Here's a example of setting the command for “High quality render”.
pov-mode supports insertion of template files through the menu.
For legal reasons, the template files are not bundled with pov-mode. You can download the over 200 templates files (inc files, and templates for color, lighting, shape, transformation ...etc) by Christoph Hormann, here: http://www.imagico.de/imenu/povray-imenu-3.6.tar.gz or povray-imenu-3.6.tar.gz.
To install the templates, unzip and untar the file, then place the folder at the location inside pov-mode's folder, then restart emacs. Then, you will see a menu “Insert” after opening a POV-Ray file.
above: The “Insert” menu in pov-mode.
You can turn on the CUA mode, under the menu “Options‣C-x/C-c/C-v Cut and Paste (CUA)”. Also, turn on “Options‣Paren Match Highlighting”, then select “Options‣Save Options”.
The CUA mode will activate the shortcuts Ctrl+x for cut, Ctrl+c for copy, Ctrl+v for paste. Also, it will highlight when a region of a text is selected. And, when a text is selected, typing or pressing the Delete key will delete the selection. These are standard conventions.
You can define a function key for any of the pov-mode's commands or menu. For example, if you want F8 to be “Render‣Test quality” and F9 to be “Render‣Medium quality”, put the following in your “~/.emacs” file.
(setq pov-mode-hook 'my-pov-mode-hook) (defun my-pov-mode-hook () "Hook for pov-mode" (define-key pov-mode-map (kbd "<F8>") 'pov-menu-render-test) (define-key pov-mode-map (kbd "<F9>") 'pov-menu-render-mid) )
For detail on setting up keyboard shortcuts with other modifier keys, see How To Define Your Own Emacs Keyboard Shortcuts.
To find out the command name for a menu item, type “Ctrl+h b”, then pull the menu with the mouse.
Page created: 2006-12. © 2006 by Xah Lee.