Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Scene Class Reference

Contains lists of Displayable objects and draws them to a DisplayDevice. More...

#include <Scene.h>

Inheritance diagram for Scene:

CaveScene FreeVRScene List of all members.

Public Methods

 Scene (void)
 constructor. More...

virtual ~Scene (void)
 destructor. More...

void set_background_mode (int mode)
 Change background drawing mode. More...

int background_mode (void)
virtual int prepare ()
 prepare all registered Displayables return whether we need an update or not. More...

virtual void draw (DisplayDevice *)
 draw the scene to the given DisplayDevice, can change display states XXX note, this method should really be a 'const' method since it is run concurrently by several processes that share memory, but we can't actually write it that way since the locking routines do indeed write to lock variables. The code in draw() should be written as though it were a const method however. More...

int filedraw (FileRenderer *, const char *, DisplayDevice *)
 draw the scene to a file in a given format, trying to match the view of the given DisplayDevice as closely as possible returns TRUE if successful, FALSE if not There are no stereo output formats; if there are, then things will become somewhat more difficult. More...

void draw_finished ()
 perform any post-drawing cleanup, reset state caching variables, etc. More...

void define_light (int n, const float *color, const float *position)
 routines to deal with light sources. More...

void activate_light (int n, int turnon)
 routines to deal with light sources. More...

void highlight_light (int, int)
 routines to deal with light sources. More...

void rotate_light (int n, float theta, char axis)
 routines to deal with light sources. More...

void move_light (int n, const float *)
 routines to deal with light sources. More...

const float * light_pos (int n) const
 routines to deal with light sources. More...

const float * light_pos_default (int n) const
 routines to deal with light sources. More...

const float * light_color (int n) const
 routines to deal with light sources. More...

const float * light_color_default (int n) const
 routines to deal with light sources. More...

void reset_lights ()
 routines to deal with light sources. More...

int light_active (int n) const
 routines to deal with light sources. More...

int light_highlighted (int) const
 routines to deal with light sources. More...

int add_color_category (const char *catname)
 routines to get/set color properties. More...

int add_color_item (int cat_id, const char *name, int init_color)
 routines to get/set color properties. More...

void set_category_item (int cat_id, int item, int color)
 change color properties These return void because there is _no_ error checking. More...

void set_color_value (int n, const float *rgb)
 routines to get/set color properties. More...

void set_colorscale_value (float min, float mid, float max)
 routines to get/set color properties. More...

void set_colorscale_method (int method)
 routines to get/set color properties. More...

int get_category_item (int cat_id, int item)
 routines to get/set color properties. More...

int get_colorscale_colors (int whichScale, float min[3], float mid[3], float max[3])
 Store the color scale colors in the given arrays. More...

int set_colorscale_colors (int whichScale, const float min[3], const float mid[3], const float max[3])
 Set the color scale colors from the given arrays. More...

int num_categories () const
 query color information; all const methods that assume valid inputs. More...

const char * category_name (int cat) const
 routines to get/set color properties. More...

int category_index (const char *catname) const
 routines to get/set color properties. More...

int num_colors () const
 routines to get/set color properties. More...

int num_regular_colors () const
 routines to get/set color properties. More...

const char * color_name (int n) const
 routines to get/set color properties. More...

int color_index (const char *name) const
 return index of color; returns -1 if name is not a valid color name. More...

const float * color_value (int n) const
 routines to get/set color properties. More...

const float * color_default_value (int n) const
 routines to get/set color properties. More...

int num_category_items (int cat) const
 routines to get/set color properties. More...

const char * category_item_name (int cat, int item) const
 routines to get/set color properties. More...

int category_item_index (int cat, const char *item) const
 routines to get/set color properties. More...

int category_item_value (int cat, const char *item) const
 routines to get/set color properties. More...

int category_item_value (int cat, int item) const
 routines to get/set color properties. More...

void colorscale_value (float *mid, float *min, float *max) const
 color scale methods. More...

int num_colorscale_methods () const
 routines to get/set color properties. More...

int colorscale_method () const
 routines to get/set color properties. More...

const char * colorscale_method_name (int n) const
 routines to get/set color properties. More...

int nearest_index (float r, float g, float b) const
 nearest_index: deprecated but needed by ImportGraphicsPlugin and MoleculeRaster3D for now. More...


Public Attributes

Displayable root
 The top level Displayable, parent of all other displayables in the scene. public for now since Scene replicates essentially the entire interface of Displayable. More...


Detailed Description

Contains lists of Displayable objects and draws them to a DisplayDevice.

Definition at line 85 of file Scene.h.


Constructor & Destructor Documentation

Scene::Scene void   
 

constructor.

Definition at line 137 of file Scene.C.

References NameList< int >::add_name, ResizeArray< ColorScale >::append, defColorNames, num_scalemethods, REGBLACK, REGBLUE2, REGCLRS, REGWHITE, reset_lights, root, set_background_mode, and set_color_value.

Scene::~Scene void    [virtual]
 

destructor.

Definition at line 176 of file Scene.C.

References NameList< NameList< int > * >::data, and NameList< NameList< int > * >::num.


Member Function Documentation

void Scene::activate_light int    n,
int    turnon
 

routines to deal with light sources.

Definition at line 219 of file Scene.C.

References DISP_LIGHTS.

Referenced by VMDApp::light_on, and reset_lights.

int Scene::add_color_category const char *    catname [inline]
 

routines to get/set color properties.

Definition at line 168 of file Scene.h.

References NameList::add_name, and NameList::typecode.

Referenced by Axes::Axes, VMDApp::color_add_item, DisplayColor::DisplayColor, FPS::FPS, GeometryList::GeometryList, MoleculeList::init_colors, and Stage::Stage.

int Scene::add_color_item int    cat_id,
const char *    name,
int    init_color
[inline]
 

routines to get/set color properties.

Definition at line 172 of file Scene.h.

References NameList::add_name, and NameList::data.

Referenced by MoleculeList::add_color_names, Axes::Axes, VMDApp::color_add_item, DisplayColor::DisplayColor, FPS::FPS, GeometryList::GeometryList, MoleculeList::init_colors, VMDApp::molecule_rename, and Stage::Stage.

int Scene::background_mode void   
 

Definition at line 189 of file Scene.C.

Referenced by text_cmd_display.

int Scene::category_index const char *    catname const [inline]
 

routines to get/set color properties.

Definition at line 215 of file Scene.h.

References NameList::typecode.

Referenced by VMDApp::color_add_item, VMDApp::color_category_item, VMDApp::color_changename, VMDApp::color_get_from_name, VMDApp::color_mapping, DisplayColor::DisplayColor, DrawMolItem::do_color_changed, DrawMolItem::do_color_rgb_changed, FPS::FPS, and VMDApp::num_color_category_items.

int Scene::category_item_index int    cat,
const char *    item
const [inline]
 

routines to get/set color properties.

Definition at line 232 of file Scene.h.

References NameList::data.

Referenced by VMDApp::color_changename, VMDApp::color_get_from_name, VMDApp::color_mapping, VMDApp::color_set_restype, Stage::do_color_changed, and GeometryList::do_color_changed.

const char* Scene::category_item_name int    cat,
int    item
const [inline]
 

routines to get/set color properties.

Definition at line 229 of file Scene.h.

References NameList::data.

Referenced by VMDApp::color_category_item, and VMDApp::color_set_restype.

int Scene::category_item_value int    cat,
int    item
const [inline]
 

routines to get/set color properties.

Definition at line 238 of file Scene.h.

References NameList::data.

int Scene::category_item_value int    cat,
const char *    item
const [inline]
 

routines to get/set color properties.

Definition at line 235 of file Scene.h.

References NameList::data.

Referenced by VMDApp::color_mapping, Stage::do_color_changed, DisplayColor::do_color_changed, GeometryList::do_color_changed, FPS::do_color_changed, Axes::do_color_changed, DrawMolItem::do_color_rgb_changed, and AtomColor::find.

const char* Scene::category_name int    cat const [inline]
 

routines to get/set color properties.

Definition at line 214 of file Scene.h.

References NameList::name.

Referenced by VMDApp::color_category.

const float* Scene::color_default_value int    n const [inline]
 

routines to get/set color properties.

Definition at line 225 of file Scene.h.

Referenced by VMDApp::color_default_value.

int Scene::color_index const char *    name const [inline]
 

return index of color; returns -1 if name is not a valid color name.

Definition at line 223 of file Scene.h.

References NameList::typecode.

Referenced by VMDApp::color_add_item, VMDApp::color_index, and MoleculeList::init_colors.

const char* Scene::color_name int    n const [inline]
 

routines to get/set color properties.

Definition at line 220 of file Scene.h.

References NameList::name.

Referenced by VMDApp::color_mapping, VMDApp::color_name, and GraphicsFltkMenu::GraphicsFltkMenu.

const float* Scene::color_value int    n const [inline]
 

routines to get/set color properties.

Definition at line 224 of file Scene.h.

Referenced by VMDApp::color_value, draw, ColorscaleImage::draw, filedraw, VolumeTexture::generateColorScaleTexture, and nearest_index.

int Scene::colorscale_method   const [inline]
 

routines to get/set color properties.

Definition at line 247 of file Scene.h.

Referenced by VMDApp::colorscale_method_current.

const char* Scene::colorscale_method_name int    n const [inline]
 

routines to get/set color properties.

Definition at line 248 of file Scene.h.

Referenced by VMDApp::colorscale_method_index, VMDApp::colorscale_method_name, VMDApp::colorscale_setmethod, and VMDApp::set_colorscale_colors.

void Scene::colorscale_value float *    mid,
float *    min,
float *    max
const [inline]
 

color scale methods.

Definition at line 243 of file Scene.h.

Referenced by VMDApp::colorscale_info.

void Scene::define_light int    n,
const float *    color,
const float *    position
 

routines to deal with light sources.

Definition at line 207 of file Scene.C.

References DISP_LIGHTS.

Referenced by reset_lights.

void Scene::draw DisplayDevice   [virtual]
 

draw the scene to the given DisplayDevice, can change display states XXX note, this method should really be a 'const' method since it is run concurrently by several processes that share memory, but we can't actually write it that way since the locking routines do indeed write to lock variables. The code in draw() should be written as though it were a const method however.

Reimplemented in CaveScene.

Definition at line 308 of file Scene.C.

References DisplayColor::color_id, color_value, DISP_LIGHTS, DisplayDevice::do_activate_light, DisplayDevice::do_define_light, Displayable::draw, DisplayDevice::forced_stereo_draws, DisplayDevice::is_renderer_process, DisplayDevice::left, DisplayDevice::normal, DisplayDevice::prepare3D, DisplayDevice::prepareOpaque, DisplayDevice::prepareTrans, DisplayDevice::render_done, DisplayDevice::right, root, DisplayDevice::set_backgradient, DisplayDevice::set_background, DisplayDevice::set_background_mode, DisplayDevice::stereo_mode, DisplayDevice::update, and DisplayDevice::use_colors.

Referenced by cave_renderer, FreeVRScene::draw, CaveScene::draw, freevr_renderer, and VMDApp::VMDupdate.

void Scene::draw_finished  
 

perform any post-drawing cleanup, reset state caching variables, etc.

Definition at line 451 of file Scene.C.

Referenced by VMDApp::VMDupdate.

int Scene::filedraw FileRenderer  ,
const char *   ,
DisplayDevice  
 

draw the scene to a file in a given format, trying to match the view of the given DisplayDevice as closely as possible returns TRUE if successful, FALSE if not There are no stereo output formats; if there are, then things will become somewhat more difficult.

Definition at line 413 of file Scene.C.

References DisplayColor::color_id, color_value, DISP_LIGHTS, FileRenderer::do_activate_light, FileRenderer::do_define_light, Displayable::draw, FileRenderer::prepare3D, DisplayDevice::render_done, root, DisplayDevice::set_backgradient, FileRenderer::set_background, FileRenderer::update, and DisplayDevice::use_colors.

Referenced by FileRenderList::render.

int Scene::get_category_item int    cat_id,
int    item
[inline]
 

routines to get/set color properties.

Definition at line 199 of file Scene.h.

References NameList::data.

Referenced by VMDApp::color_get_from_name.

int Scene::get_colorscale_colors int    whichScale,
float    min[3],
float    mid[3],
float    max[3]
 

Store the color scale colors in the given arrays.

Definition at line 549 of file Scene.C.

References ColorScale::max, ColorScale::mid, ColorScale::min, and ResizeArray< ColorScale >::num.

Referenced by VMDApp::get_colorscale_colors.

void Scene::highlight_light int   ,
int   
[inline]
 

routines to deal with light sources.

Definition at line 154 of file Scene.h.

Referenced by VMDApp::light_highlight.

int Scene::light_active int    n const [inline]
 

routines to deal with light sources.

Definition at line 162 of file Scene.h.

Referenced by text_cmd_light.

const float * Scene::light_color int    n const
 

routines to deal with light sources.

Definition at line 250 of file Scene.C.

References DISP_LIGHTS, and NULL.

const float * Scene::light_color_default int    n const
 

routines to deal with light sources.

Definition at line 255 of file Scene.C.

References def_light_color, DISP_LIGHTS, and NULL.

int Scene::light_highlighted int    const [inline]
 

routines to deal with light sources.

Definition at line 163 of file Scene.h.

Referenced by text_cmd_light.

const float * Scene::light_pos int    n const
 

routines to deal with light sources.

Definition at line 240 of file Scene.C.

References DISP_LIGHTS, and NULL.

Referenced by text_cmd_light.

const float * Scene::light_pos_default int    n const
 

routines to deal with light sources.

Definition at line 245 of file Scene.C.

References def_light_pos, DISP_LIGHTS, and NULL.

Referenced by text_cmd_light.

void Scene::move_light int    n,
const float *   
 

routines to deal with light sources.

Definition at line 234 of file Scene.C.

References DISP_LIGHTS.

Referenced by VMDApp::light_move.

int Scene::nearest_index float    r,
float    g,
float    b
const
 

nearest_index: deprecated but needed by ImportGraphicsPlugin and MoleculeRaster3D for now.

Definition at line 529 of file Scene.C.

References BEGREGCLRS, color_value, and REGCLRS.

Referenced by AtomColor::find, and MolFilePlugin::read_rawgraphics.

int Scene::num_categories   const [inline]
 

query color information; all const methods that assume valid inputs.

Definition at line 213 of file Scene.h.

References NameList::num.

Referenced by VMDApp::num_color_categories.

int Scene::num_category_items int    cat const [inline]
 

routines to get/set color properties.

Definition at line 226 of file Scene.h.

References NameList::data.

Referenced by MoleculeList::add_color_names, and VMDApp::num_color_category_items.

int Scene::num_colors   const [inline]
 

routines to get/set color properties.

Definition at line 218 of file Scene.h.

References MAXCOLORS.

int Scene::num_colorscale_methods   const [inline]
 

routines to get/set color properties.

Definition at line 246 of file Scene.h.

References ResizeArray::num.

Referenced by VMDApp::colorscale_method_index, VMDApp::colorscale_method_name, VMDApp::colorscale_setmethod, and VMDApp::num_colorscale_methods.

int Scene::num_regular_colors   const [inline]
 

routines to get/set color properties.

Definition at line 219 of file Scene.h.

References REGCLRS.

int Scene::prepare   [virtual]
 

prepare all registered Displayables return whether we need an update or not.

Reimplemented in CaveScene.

Definition at line 269 of file Scene.C.

References DisplayColor::clear_changed, DisplayColor::color_changed, DisplayColor::color_id, Displayable::draw_prepare, and root.

Referenced by FreeVRScene::prepare, CaveScene::prepare, and VMDApp::VMDupdate.

void Scene::reset_lights  
 

routines to deal with light sources.

Definition at line 260 of file Scene.C.

References activate_light, def_light_color, def_light_on, def_light_pos, define_light, and DISP_LIGHTS.

Referenced by Scene.

void Scene::rotate_light int    n,
float    theta,
char    axis
 

routines to deal with light sources.

Definition at line 226 of file Scene.C.

References DISP_LIGHTS, mat, Matrix4::multpoint3d, and Matrix4::rot.

Referenced by VMDApp::light_rotate.

void Scene::set_background_mode int    mode
 

Change background drawing mode.

Definition at line 183 of file Scene.C.

Referenced by VMDApp::display_set_background_mode, and Scene.

void Scene::set_category_item int    cat_id,
int    item,
int    color
[inline]
 

change color properties These return void because there is _no_ error checking.

Definition at line 178 of file Scene.h.

References Displayable::color_changed, NameList::data, and NameList::set_data.

Referenced by VMDApp::color_changename.

void Scene::set_color_value int    n,
const float *    rgb
[inline]
 

routines to get/set color properties.

Definition at line 183 of file Scene.h.

References Displayable::color_rgb_changed.

Referenced by VMDApp::color_changevalue, and Scene.

int Scene::set_colorscale_colors int    whichScale,
const float    min[3],
const float    mid[3],
const float    max[3]
 

Set the color scale colors from the given arrays.

Definition at line 562 of file Scene.C.

References ColorScale::max, ColorScale::mid, ColorScale::min, and ResizeArray< ColorScale >::num.

Referenced by VMDApp::set_colorscale_colors.

void Scene::set_colorscale_method int    method [inline]
 

routines to get/set color properties.

Definition at line 191 of file Scene.h.

Referenced by VMDApp::colorscale_setmethod.

void Scene::set_colorscale_value float    min,
float    mid,
float    max
[inline]
 

routines to get/set color properties.

Definition at line 187 of file Scene.h.

Referenced by VMDApp::colorscale_setvalues.


Member Data Documentation

Displayable Scene::root
 

The top level Displayable, parent of all other displayables in the scene. public for now since Scene replicates essentially the entire interface of Displayable.

Definition at line 144 of file Scene.h.

Referenced by VMDApp::color_set_restype, VMDApp::display_titlescreen, draw, filedraw, VMDApp::molecule_new, prepare, Scene, VMDApp::scene_resetview, VMDApp::scene_rotate_by, VMDApp::scene_rotate_to, VMDApp::scene_scale_by, VMDApp::scene_scale_to, VMDApp::scene_translate_by, VMDApp::scene_translate_to, and VMDApp::VMDinit.


The documentation for this class was generated from the following files:
Generated on Sat Jul 19 01:28:25 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002