From OSG Programming Tutorial Chapter 2 Section 4
Osgviewer: viewerbase
Class description:It is the basic class of view and also the parent class of osgviewer: compositeviewer and osgviewer: viewer. Class inheritance diagram: because it is the parent class of osgviewer: viewer, its methods are generally provided to osgviewer: viewer, and are very important.
Class method:
Viewerbase () viewerbase (const viewerbase & VB)
Description: constructor. The second constructor creates a viewerbase from a known viewerbase.
Parameters
Void setstats (OSG: stats * stats)
Note: Set status events, including the response of some events. Note the difference between the status and stateset. This refers to the status of the response. And some status settings during rendering.
Parameters
OSG: stats * getstats () const
Note: To obtain the set status class, the returned value is the status class pointer.
Virtual bool readconfiguration (const STD: string & filename) = 0 virtual bool isrealized () const = 0 virtual void realize () = 0
Note: The above three functions are pure virtual functions and will be implemented in sub-classes. This is determined by the C ++ mechanism. For details, refer to osgviewer: viewer and osgviewer :: in the compositviewer subclass.
Virtual void setthreadingmodel (threadingmodel)
Description: sets the thread mode.
Parameters
Threadingmodel getthreadingmodel () const
Description: gets the thread mode. The returned value is the current thread mode.
Virtual threadingmodel suggestbestthreadingmodel ()
Note: The best thread mode is recommended based on the features of the current scenario. The returned value is the thread mode.
Virtual void setupthreading () Description: Creates a corresponding thread mode for each thread.
Bool arethreadsrunning () const indicates whether all threads are running. True is returned if all operations are performed. Otherwise, false is returned.
Virtual void stopthreading ()
Indicates that the thread is stopped.
Virtual void startthreading ()
Note: start thread running.
Void setendbarrierposition (barrierposition bp)
Note: The End Time is before or after the buffer is switched.
Parameters
Barrierposition getendbarrierposition () const
Note: the position at the end is generally set by the individual. The return value is the position value, which is beforeswapbuffers or afterswapbuffers. Void setdone (bool done) Description: Specifies whether the rendering is complete. If it is set to true, the program ends.
Parameters
Bool done () const
Note: The current rendering status is returned. If no exit is returned, the true state is returned.
Void seteventvisitor (osgga: eventvisitor * eventvisitor)
Description: sets the event traversal device. The event traversal tool can access events.
Parameters
Osgga: eventvisitor * geteventvisitor () const
Note: Get the event accesser. The returned value is the event accessor.
Void setkeyeventsetsdone (INT key)
Note: Set a key. When you click this key, setdone (true) is displayed, which means the program will exit. Note: After setting, the program will not exit as before by pressing ESC.
Parameters
Int getkeyeventsetsdone () const
Note: You can obtain the set hot key that will exit when you press it. The default value is the ESC key. The return value is the compilation of the key. For example, the space is 0x20.
Void setquiteventsetsdone (bool flag)
Note: When set to true, the program exits when it receives the quit_application message. Otherwise, it will be ignored.
Parameters
Bool getquiteventsetsdone () const
Indicates whether the exit ID of a program is set.
Void setupdatevisitor (osgutil: updatevisitor * updatevisitor)
Description: sets the update accessors. [Visitor] is a very important concept.
Parameters
Osgutil: updatevisitor * getupdatevisitor () const
Note: Get the updated accessors. The return value is the pointer to the pointer.
Void setupdateoperations (OSG: operationqueue * operations)
Description: sets an operation sequence.
Parameters
OSG: operationqueue * getupdateoperations () const
Returns a pointer to the operation sequence.
Void addupdateoperation (OSG: Operation * Operation)
Note: add an update operation.
Parameters
Void removeupdateoperation (OSG: Operation * Operation)
Note: remove an update operation.
Parameters
Void setrealizeoperation (OSG: Operation * op)
Note: Set an implementation operation.
Parameters
OSG: Operation * getrealizeoperation ()
Note: Get an implementation operation. The return value is the pointer of the operation.
Void checkwindowstatus ()
Note: The check window status is a series of internal check operations. For example, check whether the window size is 0. If the window size is 0, exit.
Virtual void frame (double simulationtime = use_reference_time) Description: draws a frame.
Parameters
Virtual int run () = 0 virtual
Void advance (double simulationtime = use_reference_time) = 0
Virtual void eventtraversal () = 0
Virtual void updatetraversal () = 0
Virtual void renderingtraversals ()
Virtual void getcameras (cameras & cameras, bool onlyactive = true) = 0
Virtual void getcontexts (contexts & contexts, bool onlyvalid = true) = 0
Virtual void getwindows (Windows & windows, bool onlyvalid = true) = 0
Virtual void getallthreads (threads & threads, bool onlyactive = true) = 0
Virtual void getoperationthreads (operationthreads & threads, bool onlyactive = true) = 0
Virtual void getscenes (scenes & scenes, bool onlyvalid = true) = 0
Virtual void getviews (Views & Views, bool onlyvalid = true) = 0
Virtual double elapsedtime () = 0 virtual OSG: framestamp * getviewerframestamp () = 0
Virtual void getusage (OSG: applicationusage & usage) const = 0
Note: The above are virtual functions and will be implemented in sub-classes. osgviewer: viewer and osgviewer: compositeviewer are specific classes.