WhirlyGlobe  1.2
A 3D interactive globe toolkit for iOS
/Users/sjg/iPhone/WhirlyGlobe/WhirlyGlobeSrc/WhirlyGlobeLib/include/SceneRendererES1.h
00001 /*
00002  *  SceneRendererES1.h
00003  *  WhirlyGlobeLib
00004  *
00005  *  Created by Steve Gifford on 1/13/11.
00006  *  Copyright 2011 mousebird consulting
00007  *
00008  *  Licensed under the Apache License, Version 2.0 (the "License");
00009  *  you may not use this file except in compliance with the License.
00010  *  You may obtain a copy of the License at
00011  *  http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  *  Unless required by applicable law or agreed to in writing, software
00014  *  distributed under the License is distributed on an "AS IS" BASIS,
00015  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  *  See the License for the specific language governing permissions and
00017  *  limitations under the License.
00018  *
00019  */
00020 
00021 #import "ESRenderer.h"
00022 
00023 #import <OpenGLES/ES1/gl.h>
00024 #import <OpenGLES/ES1/glext.h>
00025 
00026 #import "GlobeView.h"
00027 #import "GlobeScene.h"
00028 
00030 @class SceneRendererES1;
00032 
00036 @interface RendererFrameInfo : NSObject
00037 {
00039     SceneRendererES1 *sceneRenderer;
00040     
00042     WhirlyGlobeView *globeView;
00043     
00045     WhirlyGlobe::GlobeScene *scene;
00046     
00048     Vector3f eyeVec;
00049 
00051     float frameLen;
00052     
00054     NSTimeInterval currentTime;
00055 }
00056 
00057 @property (nonatomic,assign) SceneRendererES1 *sceneRenderer;
00058 @property (nonatomic,assign) WhirlyGlobeView *globeView;
00059 @property (nonatomic,assign) WhirlyGlobe::GlobeScene *scene;
00060 @property (nonatomic,assign) float frameLen;
00061 @property (nonatomic,assign) NSTimeInterval currentTime;
00062 @property (nonatomic,assign) Vector3f eyeVec;
00063 
00064 @end
00065 
00070 @protocol SceneRendererDelegate
00071 
00072 @optional
00075 - (void)lightingSetup:(SceneRendererES1 *)sceneRenderer;
00076 
00078 - (void)preFrame:(SceneRendererES1 *)sceneRenderer;
00079 
00081 - (void)postFrame:(SceneRendererES1 *)sceneRenderer;
00082 @end
00083 
00085 static const unsigned int RenderFrameCount = 25;
00086 
00092 @interface SceneRendererES1 : NSObject <ESRenderer>
00093 {
00095         EAGLContext *context;
00096 
00098         WhirlyGlobe::GlobeScene *scene;
00100         WhirlyGlobeView *view;
00101 
00103     GLint framebufferWidth;
00105     GLint framebufferHeight;
00106 
00108     GLuint defaultFramebuffer;
00110     GLuint colorRenderbuffer;
00112     GLuint depthRenderbuffer;   
00113         
00115         float framesPerSec;
00116         unsigned int frameCount;
00117         NSDate *frameCountStart;
00118         
00120         unsigned int numDrawables;
00121     
00123     id<SceneRendererDelegate> delegate;
00124 
00126     WhirlyGlobe::RGBAColor clearColor;
00127 }
00128 
00129 @property (nonatomic,assign) WhirlyGlobe::GlobeScene *scene;
00130 @property (nonatomic,assign) WhirlyGlobeView *view;
00131 
00132 @property (nonatomic,readonly) GLint framebufferWidth,framebufferHeight;
00133 
00134 @property (nonatomic,readonly) float framesPerSec;
00135 @property (nonatomic,readonly) unsigned int numDrawables;
00136 
00137 @property (nonatomic,assign) id<SceneRendererDelegate> delegate;
00138 
00141 - (void) render:(CFTimeInterval)duration;
00142 
00144 - (BOOL) resizeFromLayer:(CAEAGLLayer *)layer;
00145 
00147 - (void) setClearColor:(UIColor *)color;
00148 
00151 - (void)useContext;
00152 
00153 @end