00001
00002
00003
00004
00005
00006
00007
00008
00009
00015 #ifndef SCENE_H
00016 #define SCENE_H
00017
00018 #include <adsobase.h>
00019 #include <GL/gl.h>
00020 #include <GL/glu.h>
00021 #include <SDL/SDL.h>
00022 #include <adsotexture.h>
00023 #include <adsosurf.h>
00024 #include "camera.h"
00025 #include "photon.h"
00026
00027 #define SCENE_MAX_PTOBJECTS 32
00028 #define SCENE_MAX_SURFACEOBJECTS 32
00029
00030 struct Star {
00031 v3f pos;
00032 float light;
00033 };
00034
00039 class Scene {
00040 Object *PTObjects[SCENE_MAX_PTOBJECTS];
00041 Object *surfaceObjects[SCENE_MAX_SURFACEOBJECTS];
00042 int ptoCount, soCount;
00043
00044 void shadowSetup();
00045 void generateStars();
00046 void drawShadows();
00047 public:
00048 AdsoTexture *groundTex;
00049 AdsoTexture *earthTex;
00050 AdsoTexture *sunTex;
00051 AdsoHierSurf *hs;
00052
00053 int draw_shadows;
00054 int draw_far_objects;
00055 int draw_vehicle;
00056 int draw_surface;
00057
00058 Camera eye;
00059
00060 int starCount;
00061 Star *stars;
00062
00063 v3f earthV1, earthV2, earthV3, earthV4, sunPos;
00064
00065 float farObjectDistance;
00066
00067 GLuint groundTI;
00068 GLuint earthTI;
00069 GLuint shadowTI;
00070 GLuint photonTI;
00071
00072 int ground_shadows;
00073 GLubyte *shadowMap;
00074 int shadowMapDim;
00075 float shadowMapSize;
00076 float subShadowSize;
00077 int clearShadow1X, clearShadow1Y, clearShadow1Dim, clearShadow1;
00078 int clearShadow2X, clearShadow2Y, clearShadow2Dim, clearShadow2;
00079
00080
00081 v3f lightPos;
00082
00083 void addPTObject(Object *o);
00084 void addSurfaceObject(Object *o);
00085 void init();
00086 void draw();
00087
00088 Scene();
00089 };
00090
00091 extern Scene scene;
00092
00093 #endif
00094