WhirlyGlobe  1.1
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 
00029 @class SceneRendererES1;
00030 
00035 @protocol SceneRendererDelegate
00036 
00037 @optional
00040 - (void)lightingSetup:(SceneRendererES1 *)sceneRenderer;
00041 
00043 - (void)preFrame:(SceneRendererES1 *)sceneRenderer;
00044 
00046 - (void)postFrame:(SceneRendererES1 *)sceneRenderer;
00047 @end
00048 
00050 static const unsigned int RenderFrameCount = 25;
00051 
00057 @interface SceneRendererES1 : NSObject <ESRenderer>
00058 {
00060         EAGLContext *context;
00061 
00063         WhirlyGlobe::GlobeScene *scene;
00065         WhirlyGlobeView *view;
00066 
00068     GLint framebufferWidth;
00070     GLint framebufferHeight;
00071 
00073     GLuint defaultFramebuffer;
00075     GLuint colorRenderbuffer;
00077     GLuint depthRenderbuffer;   
00078         
00080         float framesPerSec;
00081         unsigned int frameCount;
00082         NSDate *frameCountStart;
00083         
00085         unsigned int numDrawables;
00086     
00088     id<SceneRendererDelegate> delegate;
00089 
00091     WhirlyGlobe::RGBAColor clearColor;
00092 }
00093 
00094 @property (nonatomic,assign) WhirlyGlobe::GlobeScene *scene;
00095 @property (nonatomic,assign) WhirlyGlobeView *view;
00096 
00097 @property (nonatomic,readonly) GLint framebufferWidth,framebufferHeight;
00098 
00099 @property (nonatomic,readonly) float framesPerSec;
00100 @property (nonatomic,readonly) unsigned int numDrawables;
00101 
00102 @property (nonatomic,assign) id<SceneRendererDelegate> delegate;
00103 
00106 - (void) render:(CFTimeInterval)duration;
00107 
00109 - (BOOL) resizeFromLayer:(CAEAGLLayer *)layer;
00110 
00112 - (void) setClearColor:(UIColor *)color;
00113 
00116 - (void)useContext;
00117 
00118 @end