00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __X3DBACKGROUNDNODE_H__
00030 #define __X3DBACKGROUNDNODE_H__
00031
00032 #include "X3DBindableNode.h"
00033 #include "H3DDisplayListObject.h"
00034 #include "MFFloat.h"
00035 #include "MFColor.h"
00036 #include "SFMatrix4f.h"
00037
00038 namespace H3D {
00039
00123 class H3DAPI_API X3DBackgroundNode :
00124 public X3DBindableNode {
00125 public:
00126
00127 typedef H3DDisplayListObject::DisplayList DisplayList;
00128
00130 X3DBackgroundNode( Inst< SFSetBind > _set_bind = 0,
00131 Inst< SFNode > _metadata = 0,
00132 Inst< SFTime > _bindTime = 0,
00133 Inst< SFBool > _isBound = 0,
00134 Inst< DisplayList > _displayList = 0,
00135 Inst< MFFloat > _groundAngle = 0,
00136 Inst< MFColor > _groundColor = 0,
00137 Inst< MFFloat > _skyAngle = 0,
00138 Inst< MFColor > _skyColor = 0 );
00139
00141 static inline X3DBackgroundNode *getActive() {
00142 return static_cast< X3DBackgroundNode * >
00143 ( X3DBindableNode::getActive( "X3DBackgroundNode" ) );
00144 }
00145
00146 #ifdef USE_HAPTICS
00148 virtual void traverseSG( TraverseInfo &ti ) {
00149 X3DBindableNode::traverseSG( ti );
00150 if( localToGlobal->getValue() != ti.getAccForwardMatrix() ) {
00151 localToGlobal->setValue( ti.getAccForwardMatrix() );
00152 }
00153 }
00154 #endif
00155
00159 virtual void renderBackground() {
00160 render_enabled = true;
00161 displayList->callList();
00162 render_enabled = false;
00163 }
00164
00167 virtual RGB glClearColor() {
00168 if( skyColor->size() > 0 )
00169 return skyColor->getValueByIndex( 0 );
00170 else
00171 return RGB( 0, 0, 0 );
00172 }
00173
00177 virtual void render();
00178
00180 auto_ptr< DisplayList > displayList;
00181
00190 auto_ptr< MFFloat > groundAngle;
00191
00192
00207 auto_ptr< MFColor > groundColor;
00208
00219 auto_ptr< MFFloat > skyAngle;
00220
00235 auto_ptr< MFColor > skyColor;
00236
00238 static H3DNodeDatabase database;
00239 protected:
00240 auto_ptr< SFMatrix4f > localToGlobal;
00241 bool render_enabled;
00242 };
00243 }
00244
00245 #endif
00246