GxScene Class Reference

Manages a graphics "scene" for a window object. More...

#include <gfx/gxscene.h>

Inheritance diagram for GxScene:

Inheritance graph
[legend]
Collaboration diagram for GxScene:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 GxScene (nub::soft_ref< Gfx::Canvas > canvas, rutz::shared_ptr< nub::scheduler > sched)
 Construct with a canvas in which to draw.
virtual ~GxScene () throw ()
 Virtual no-throw destructor.
void undraw ()
 Undraw the scene from the canvas.
void render ()
 "Bare-bones rendering"
void fullRender ()
 "Full-featured rendering"
void clearscreen ()
 "Bare-bones clearscreen"
void fullClearscreen ()
 "Full-featured clearscreen"
void setVisibility (bool val)
 Change the global visibility.
const nub::ref< GxCamera > & getCamera () const
 Get the camera used to view the scene.
void setCamera (const nub::ref< GxCamera > &cam)
 Set the camera to be used to view the scene.
void setDrawable (const nub::ref< GxNode > &node)
 Get the drawable object currently being viewed.
void reshape (int width, int height)
 To be called when the associated window is resized.
void setHold (bool val)
 Whether to retain current contents when something new is drawn.
void allowRefresh (bool allow)
 Whether the scene should be refreshed when something changes.
void animate (unsigned int framesPerSecond)
 Redraw the scene at a given frame rate.
void destroy ()
nub::uid id () const throw ()
rutz::fstring real_typename () const
 Returns the typename of the full object.
virtual rutz::fstring obj_typename () const
 Returns the (apparent) typename of the full object.
rutz::fstring unique_name () const
 Returns a short string describing the object by its typename and id.
void * operator new (size_t bytes)
void operator delete (void *space, size_t bytes)
void mark_as_volatile () throw ()
 Mark this object as a volatile (unshareable) object.
void incr_ref_count () const throw ()
 Increment the object's reference count.
void decr_ref_count () const throw ()
 Decrement the object's reference count.
void decr_ref_count_no_delete () const throw ()
 Decrement the object's reference count, but don't delete it.
bool is_shared () const throw ()
 Returns true if no external client has sole ownership of the object.
bool is_unshared () const throw ()
 Returns true if there is a sole external owner of the object.
bool is_not_shareable () const throw ()
ref_counts * get_counts () const throw ()
 Returns the object's reference count manager.
int dbg_ref_count () const throw ()
 FOR TEST/DEBUG ONLY! Returns the object's (strong) reference count.
int dbg_weak_ref_count () const throw ()
 FOR TEST/DEBUG ONLY! Returns the object's weak reference count.


Detailed Description

Manages a graphics "scene" for a window object.

Definition at line 55 of file gxscene.h.


Member Function Documentation

void GxScene::render (  ) 

"Bare-bones rendering"

Only render the current object; the caller is expected to take care of clearing the color buffer first and flushing the graphics stream afterwards.

Definition at line 79 of file gxscene.cc.

References setVisibility().

Referenced by fullRender().

void GxScene::fullRender (  ) 

"Full-featured rendering"

First clears the color buffer, then renders the current object, then flushes the graphics stream and swaps buffers if necessary.

Definition at line 102 of file gxscene.cc.

References render().

Referenced by GxScene(), and setCamera().

void GxScene::clearscreen (  ) 

"Bare-bones clearscreen"

Clears the color buffer and set the current object to empty, but don't flush the graphics stream.

Definition at line 129 of file gxscene.cc.

References GxEmptyNode::make(), and setDrawable().

Referenced by fullClearscreen().

void GxScene::fullClearscreen (  ) 

"Full-featured clearscreen"

Clears the color buffer, set the current object to empty, and flush the graphics stream.

Definition at line 138 of file gxscene.cc.

References clearscreen().

Referenced by setVisibility().

void GxScene::setVisibility ( bool  val  ) 

Change the global visibility.

Which determines whether anything will be displayed by a "redraw" command, or by remap events sent to the screen window.

Definition at line 145 of file gxscene.cc.

References fullClearscreen().

Referenced by render().

nub::uid nub::object::id (  )  const throw () [inherited]

Returns the unique id for this object. The unique id will always be strictly positive; zero is always an invalid unique id.

Definition at line 62 of file object.cc.

rutz::fstring nub::object::real_typename (  )  const [inherited]

Returns the typename of the full object.

The result is a demangled version of typeid(*this).name(), which should very closely resemble the way the object was declared in source code.

Definition at line 67 of file object.cc.

References rutz::demangled_name().

Referenced by nub::object::obj_typename().

rutz::fstring nub::object::obj_typename (  )  const [virtual, inherited]

Returns the (apparent) typename of the full object.

The default implementation just returns real_typename(). However, certain kinds of objects -- e.g., proxy objects -- might usefully choose to have obj_typename() return something besides the real_typename(), in order to masquerade as a different type of object.

Reimplemented in io::proxy< C >, io::const_proxy< C >, MtxObj, and TrialMemFuncEvent.

Definition at line 73 of file object.cc.

References nub::object::real_typename().

Referenced by io::legacy_reader::read_root(), and nub::object::unique_name().

void * nub::ref_counted::operator new ( size_t  bytes  )  [inherited]

Class-specific operator new; protected to ensure that clients use factory functions.

Definition at line 157 of file refcounted.cc.

void nub::ref_counted::operator delete ( void *  space,
size_t  bytes 
) [inherited]

Class-specific operator delete; private since deletion should only happen in ref_counted::decr_ref_count.

Definition at line 163 of file refcounted.cc.

void nub::ref_counted::incr_ref_count (  )  const throw () [inherited]

Increment the object's reference count.

This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 207 of file refcounted.cc.

References nub::ref_counts::acquire_strong().

Referenced by GxEmptyNode::make().

void nub::ref_counted::decr_ref_count (  )  const throw () [inherited]

Decrement the object's reference count.

If this causes the reference count to fall to zero or below, the pointee and the pointer will be destroyed by a call to 'delete this'. This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 212 of file refcounted.cc.

References nub::ref_counts::release_strong().

void nub::ref_counted::decr_ref_count_no_delete (  )  const throw () [inherited]

Decrement the object's reference count, but don't delete it.

Unlike decr_ref_count(), the object will NOT be delete'd if the reference count falls to zero. This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 221 of file refcounted.cc.

References nub::ref_counts::release_strong_no_delete().

bool nub::ref_counted::is_shared (  )  const throw () [inherited]

Returns true if no external client has sole ownership of the object.

This may occur if either (1) the reference count is greater than one, or (2) the object is_not_shareable(), meaning that the object itself is the only "owner".

Definition at line 226 of file refcounted.cc.

References rutz::mutex_atomic_int::atomic_get(), nub::ref_counted::is_not_shareable(), and nub::ref_counts::m_strong.

Referenced by nub::ref_counted::is_unshared().

bool nub::ref_counted::is_unshared (  )  const throw () [inherited]

Returns true if there is a sole external owner of the object.

This occurs if the reference count is one or less and the object is shareable.

Definition at line 236 of file refcounted.cc.

References nub::ref_counted::is_shared().

bool nub::ref_counted::is_not_shareable (  )  const throw () [inherited]

Returns true if the object is not shareable for any reason. This could be because its lifespan is volatile (such as objects representing on-screen windows that can be dismissed by the user). The default is for objects to be shareable; objects can declare themselves as unshareable by calling mark_as_volatile().

Definition at line 242 of file refcounted.cc.

References nub::ref_counts::m_volatile.

Referenced by nub::ref_counted::is_shared().


The documentation for this class was generated from the following files:

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:55:04 2008 by Doxygen version 1.5.5.