Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

S5scene.h

Go to the documentation of this file.
00001 // ///////////////////  ***********************  \\\\\\\\\\\\\\\\\\\\ \\
00002 //
00003 //  This file is part of the Sector 5, 3D graphic game.
00004 //  Copyright (C) 2000-2002 by PC John. All rights reserved.
00005 //
00006 //  This game is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU Lesser General Public License
00008 //  version 2.1 as published by the Free Software Foundation. See the
00009 //  file LICENSE.LGPL at the root directory of the distribution for
00010 //  more details.
00011 //
00012 //  If you want to use Sector 5 code for applications not compatible 
00013 //  with the LGPL license, please contact PC John at pcjohn@email.cz.
00014 //
00015 // \\\\\\\\\\\\\\\\\\\  ***********************  //////////////////// //
00016 
00017 
00018 #ifndef S5_SCENE_H_INCLUDED_
00019 #define S5_SCENE_H_INCLUDED_
00020 
00021 
00022 #include <Inventor/nodes/SoGroup.h>
00023 #include <assert.h>
00024 
00025 class SoSceneManager;
00026 class S5camera;
00027 class S5object;
00028 class S5input;
00029 
00030 
00031 class S5scene
00032 {
00033 public:
00034 
00035   enum TextureQuality {
00036     TEXTURE_OFF = 0, 
00037     TEXTURE_POINT_SAMPLE = 1, 
00038     TEXTURE_NORMAL = 2
00039   };
00040 
00041         static void init();
00042   static void done();
00043 
00044         static void loadDefaultScene();
00045   static void loadScene(const char *);
00046   static void clearScene();
00047 
00048   static TextureQuality getTextureQuality()  { return textureQuality; }
00049   static void setTextureQuality(TextureQuality q);
00050   static bool isTexturesOff()  { return textureQuality == TEXTURE_OFF; }
00051 
00052   static bool insertObject(S5object *object)  { assert(getSceneGraph()->isOfType(SoGroup::getClassTypeId())); insertObject(object, (SoGroup*)getSceneGraph()); }
00053   static bool insertObject(S5object *object, SoGroup *sceneRoot);
00054 
00055   static bool insertObjectSomewhere(S5object *object, float sceneRadius, int attempts = 10)  { assert(getSceneGraph()->isOfType(SoGroup::getClassTypeId())); insertObjectSomewhere(object, (SoGroup*)getSceneGraph(), sceneRadius, attempts); }
00056   static bool insertObjectSomewhere(S5object *object, SoGroup *sceneRoot, float sceneRadius, int attempts = 10);
00057 
00058   static bool positionObjectSomewhere(S5object *object, float sceneRadius, int attempts = 10);
00059 
00060   
00061   static void addCamera(S5camera *camera);
00062   static void insertCamera(S5camera *camera, int index);
00063   static void removeCamera(S5camera *camera);
00064   static void removeAllCameras();
00065   static SoGroup* getCamerasGroup()  { return camerasGroup; };
00066 
00067   static SoNode* getSceneGraph()  { return sceneGraph; };
00068   static void setSceneGraph(SoNode *node);
00069 
00070 
00071   typedef enum { RUNNING, STARTING, PAUSED } RunningState;
00072   static bool getRunningState()  { return runningState != PAUSED; };
00073   static void setRunningState(const bool run);
00074   static RunningState getRunningStateInternal()  { return runningState; };
00075 
00076 
00077   static SoSceneManager* getSceneManager()  { return sceneManager; };
00078   static S5input* getUserInput()  { return userInput; };
00079 
00080   static bool timeTick(SbTime deltaTime);
00081 
00082 protected:
00083 
00084   static SoSceneManager *sceneManager;
00085 
00086   static SoGroup *internalSceneGraphRoot;
00087   static SoGroup *camerasGroup; 
00088   static SoNode *sceneGraph;
00089 
00090         static S5input *userInput;
00091 
00092   static RunningState runningState;
00093   static int startingCountdown;
00094 
00095   static TextureQuality textureQuality;
00096 
00097   static void constructHidenScene();
00098   static void timeTickSensorCB(void *data, SoSensor *sensor);
00099   static void updateComplexity();
00100 
00101 };
00102 
00103 
00104 #endif /* S5_SCENE_H_INCLUDED_ */

Generated on Sun Feb 17 21:42:34 2002 for Sector 5 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001