Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members 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:

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)
void reset_lights ()
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 standard directional light sources. More...

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

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

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

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

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

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

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

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

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

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

void define_adv_light (int n, const float *color, const float *position, float constant, float linear, float quad, float *spotdir, float fallstart, float fallend, int spoton)
routines to deal with advanced positional light sources. More...

void activate_adv_light (int n, int turnon)
routines to deal with advanced positional light sources. More...

void highlight_adv_light (int, int)
routines to deal with advanced positional light sources. More...

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

const float * adv_light_pos (int n) const
routines to deal with advanced positional light sources. More...

const float * adv_light_pos_default (int n) const
routines to deal with advanced positional light sources. More...

const float * adv_light_color (int n) const
routines to deal with advanced positional light sources. More...

const float * adv_light_color_default (int n) const
routines to deal with advanced positional light sources. More...

void adv_light_attenuation (int n, float constant, float linear, float quad)
routines to deal with advanced positional light sources. More...

void adv_light_get_attenuation (int n, float &constant, float &linear, float &quad) const
routines to deal with advanced positional light sources. More...

void adv_light_spotlight (int n, float *spotdir, float fallstart, float fallend, int spoton)
routines to deal with advanced positional light sources. More...

const float * adv_light_get_spotlight (int n, float &fallstart, float &fallend, int &spoton) const
routines to deal with advanced positional light sources. More...

int adv_light_active (int n) const
routines to deal with advanced positional light sources. More...

int adv_light_highlighted (int) const
routines to deal with advanced positional 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...

int get_category_item (int cat_id, int item)
routines to get/set color properties. 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...

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

void set_colorscale_params (float min, float mid, float max, int reverse, int posterize)
Color scale management methods. More...

void set_colorscale_method (int index)
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...

void colorscale_params (float *mid, float *min, float *max, int *reverse, int *posterize) const
color scale methods. More...

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

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

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

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

int colorscale_type (int index)
routines to get/set color properties. 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 88 of file Scene.h.


Constructor & Destructor Documentation

Scene::Scene ( void )

constructor.

Definition at line 284 of file Scene.C.

References NameList< int >::add_name, ResizeArray< const char * >::append, ResizeArray< ColorScale >::append, BEGREGCLRS, colScaleMenuNames, 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 329 of file Scene.C.

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


Member Function Documentation

void Scene::activate_adv_light ( int n,
int turnon
)

routines to deal with advanced positional light sources.

Definition at line 440 of file Scene.C.

References DISP_LIGHTS, and n.

Referenced by reset_lights, and text_cmd_point_light.

void Scene::activate_light ( int n,
int turnon
)

routines to deal with standard directional light sources.

Definition at line 375 of file Scene.C.

References DISP_LIGHTS, and n.

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 214 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 218 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_from_selection_list, VMDApp::molecule_new, VMDApp::molecule_rename, and Stage::Stage.

int Scene::adv_light_active ( int n ) const [inline]

routines to deal with advanced positional light sources.

Definition at line 208 of file Scene.h.

References n.

Referenced by text_cmd_point_light.

void Scene::adv_light_attenuation ( int n,
float constant,
float linear,
float quad
)

routines to deal with advanced positional light sources.

Definition at line 474 of file Scene.C.

References DISP_LIGHTS, and n.

Referenced by text_cmd_point_light.

const float * Scene::adv_light_color ( int n ) const

routines to deal with advanced positional light sources.

Definition at line 464 of file Scene.C.

References DISP_LIGHTS, n, and NULL.

const float * Scene::adv_light_color_default ( int n ) const

routines to deal with advanced positional light sources.

Definition at line 469 of file Scene.C.

References def_light_color, DISP_LIGHTS, n, and NULL.

void Scene::adv_light_get_attenuation ( int n,
float & constant,
float & linear,
float & quad
) const

routines to deal with advanced positional light sources.

Definition at line 482 of file Scene.C.

References DISP_LIGHTS, and n.

Referenced by text_cmd_point_light.

const float * Scene::adv_light_get_spotlight ( int n,
float & fallstart,
float & fallend,
int & spoton
) const

routines to deal with advanced positional light sources.

Definition at line 500 of file Scene.C.

References DISP_LIGHTS, n, and NULL.

int Scene::adv_light_highlighted ( int ) const [inline]

routines to deal with advanced positional light sources.

Definition at line 209 of file Scene.h.

Referenced by text_cmd_point_light.

const float * Scene::adv_light_pos ( int n ) const

routines to deal with advanced positional light sources.

Definition at line 454 of file Scene.C.

References DISP_LIGHTS, n, and NULL.

Referenced by text_cmd_point_light.

const float * Scene::adv_light_pos_default ( int n ) const

routines to deal with advanced positional light sources.

Definition at line 459 of file Scene.C.

References def_adv_light_pos, DISP_LIGHTS, n, and NULL.

Referenced by text_cmd_point_light.

void Scene::adv_light_spotlight ( int n,
float * spotdir,
float fallstart,
float fallend,
int spoton
)

routines to deal with advanced positional light sources.

Definition at line 490 of file Scene.C.

References DISP_LIGHTS, and n.

int Scene::background_mode ( void )

Definition at line 342 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 244 of file Scene.h.

References NameList::typecode.

Referenced by VMDApp::color_add_item, VMDApp::color_category_item, VMDApp::color_change_name, VMDApp::color_change_namelist, 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 261 of file Scene.h.

References NameList::data.

Referenced by VMDApp::color_change_name, VMDApp::color_change_namelist, 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 258 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 267 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 264 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 243 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 254 of file Scene.h.

References n.

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 252 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 249 of file Scene.h.

References n, and 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 253 of file Scene.h.

References n.

Referenced by MoleculeGraphics::add_spheretube, VMDApp::color_value, draw, ColorscaleLumaChart::draw, ColorscaleImage::draw, filedraw, VolumeTexture::generateColorScaleTexture, hill_reilly_ring_colorscale, nearest_index, and DispCmdPointArray::putdata.

int Scene::colorscale_method ( ) const [inline]

routines to get/set color properties.

Definition at line 306 of file Scene.h.

Referenced by VMDApp::colorscale_method_current.

const char* Scene::colorscale_method_menuname ( int n ) const [inline]

routines to get/set color properties.

Definition at line 312 of file Scene.h.

References n.

Referenced by VMDApp::colorscale_method_menuname.

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

routines to get/set color properties.

Definition at line 309 of file Scene.h.

References n.

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

void Scene::colorscale_params ( float * mid,
float * min,
float * max,
int * reverse,
int * posterize
) const [inline]

color scale methods.

Definition at line 299 of file Scene.h.

Referenced by VMDApp::colorscale_params.

int Scene::colorscale_type ( int index )

routines to get/set color properties.

Definition at line 865 of file Scene.C.

References num_scalemethods, and SCALE_TYPE_TABULATED.

void Scene::define_adv_light ( int n,
const float * color,
const float * position,
float constant,
float linear,
float quad,
float * spotdir,
float fallstart,
float fallend,
int spoton
)

routines to deal with advanced positional light sources.

Definition at line 418 of file Scene.C.

References DISP_LIGHTS, and n.

Referenced by reset_lights.

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

routines to deal with standard directional light sources.

Definition at line 364 of file Scene.C.

References DISP_LIGHTS, and n.

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 571 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, VRJugglerScene::draw, FreeVRScene::draw, CaveScene::draw, and VMDApp::VMDupdate.

void Scene::draw_finished ( )

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

Reimplemented in VRJugglerScene.

Definition at line 747 of file Scene.C.

Referenced by VRJugglerScene::draw_finished, and VMDApp::VMDupdate.

int Scene::filedraw ( FileRenderer * ,
const char * ,
)

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 691 of file Scene.C.

References DisplayColor::color_id, color_value, DISP_LIGHTS, FileRenderer::do_activate_adv_light, FileRenderer::do_activate_light, FileRenderer::do_define_adv_light, FileRenderer::do_define_light, Displayable::draw, FileRenderer::open_file, FileRenderer::prepare3D, DisplayDevice::render_done, root, FileRenderer::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 236 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 892 of file Scene.C.

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

Referenced by VMDApp::get_colorscale_colors.

void Scene::highlight_adv_light ( int ,
int
) [inline]

routines to deal with advanced positional light sources.

Definition at line 196 of file Scene.h.

Referenced by text_cmd_point_light.

void Scene::highlight_light ( int ,
int
) [inline]

routines to deal with standard directional light sources.

Definition at line 178 of file Scene.h.

Referenced by VMDApp::light_highlight.

int Scene::light_active ( int n ) const [inline]

routines to deal with standard directional light sources.

Definition at line 185 of file Scene.h.

References n.

Referenced by text_cmd_light.

const float * Scene::light_color ( int n ) const

routines to deal with standard directional light sources.

Definition at line 407 of file Scene.C.

References DISP_LIGHTS, n, and NULL.

const float * Scene::light_color_default ( int n ) const

routines to deal with standard directional light sources.

Definition at line 412 of file Scene.C.

References def_light_color, DISP_LIGHTS, n, and NULL.

int Scene::light_highlighted ( int ) const [inline]

routines to deal with standard directional light sources.

Definition at line 186 of file Scene.h.

Referenced by text_cmd_light.

const float * Scene::light_pos ( int n ) const

routines to deal with standard directional light sources.

Definition at line 397 of file Scene.C.

References DISP_LIGHTS, n, and NULL.

Referenced by text_cmd_light.

const float * Scene::light_pos_default ( int n ) const

routines to deal with standard directional light sources.

Definition at line 402 of file Scene.C.

References def_light_pos, DISP_LIGHTS, n, and NULL.

Referenced by text_cmd_light.

void Scene::move_adv_light ( int n,
const float *
)

routines to deal with advanced positional light sources.

Definition at line 447 of file Scene.C.

References DISP_LIGHTS, and n.

Referenced by text_cmd_point_light.

void Scene::move_light ( int n,
const float *
)

routines to deal with standard directional light sources.

Definition at line 391 of file Scene.C.

References DISP_LIGHTS, and n.

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 872 of file Scene.C.

References BEGREGCLRS, color_value, n, 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 242 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 255 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 247 of file Scene.h.

References MAXCOLORS.

int Scene::num_colorscale_methods ( ) const [inline]

routines to get/set color properties.

Definition at line 308 of file Scene.h.

References ResizeArray::num.

Referenced by VMDApp::colorscale_method_index, VMDApp::colorscale_method_menuname, 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 248 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 532 of file Scene.C.

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

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

void Scene::reset_lights ( )

Definition at line 509 of file Scene.C.

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

Referenced by Scene.

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

routines to deal with standard directional light sources.

Definition at line 382 of file Scene.C.

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

Referenced by VMDApp::light_rotate.

void Scene::set_background_mode ( int mode )

Change background drawing mode.

Definition at line 336 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 225 of file Scene.h.

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

Referenced by VMDApp::color_change_name, and VMDApp::color_change_namelist.

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

routines to get/set color properties.

Definition at line 230 of file Scene.h.

References Displayable::color_rgb_changed, and n.

Referenced by VMDApp::color_change_rgb, VMDApp::color_change_rgblist, 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 905 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 index ) [inline]

routines to get/set color properties.

Definition at line 283 of file Scene.h.

Referenced by VMDApp::colorscale_setmethod.

void Scene::set_colorscale_params ( float min,
float mid,
float max,
int reverse,
int posterize
) [inline]

Color scale management methods.

Definition at line 276 of file Scene.h.

Referenced by VMDApp::colorscale_setparams.


Member Data Documentation

Displayable Scene::root

The documentation for this class was generated from the following files:
Generated on Wed Nov 19 02:49:04 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /