scg3  0.6
Renderer.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright 2014 Volker Ahlers
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24 
25 #ifndef RENDERER_H_
26 #define RENDERER_H_
27 
28 #include <memory>
29 #include <string>
30 #include "scg_glm.h"
31 #include "scg_internals.h"
32 
33 namespace scg {
34 
35 
36 struct FrameBufferSize;
37 class Camera;
38 class Node;
39 class Viewer;
40 
41 
45 class Renderer {
46 
47 public:
48 
52  Renderer();
53 
57  virtual ~Renderer() = 0;
58 
66  virtual void initViewer(Viewer* viewer, FrameBufferSize* frameBufferSize) = 0;
67 
71  virtual void initRenderState();
72 
76  void destroyScene();
77 
81  NodeSP getScene();
82 
86  void setScene(NodeSP scene);
87 
92 
96  void setCamera(CameraSP camera);
97 
103  void setLighting(bool isLightingEnabled);
104 
105 
109  bool isLightingEnabled() const;
110 
111 
115  void setGlobalAmbientLight(const glm::vec4& globalAmbientLight);
116 
120  virtual std::string getInfo();
121 
125  virtual void render() = 0;
126 
127 protected:
128 
133 
134 };
135 
136 
137 } /* namespace scg */
138 
139 #endif /* RENDERER_H_ */
virtual std::string getInfo()
NodeSP scene_
Definition: Renderer.h:130
virtual void initRenderState()
CameraSP camera_
Definition: Renderer.h:131
Base class for all cameras (composite node, abstract).
Definition: Camera.h:51
Local header file for GLM OpenGL Mathematics library.
NodeSP getScene()
virtual ~Renderer()=0
Central viewer managing window, controllers, animations, and main loop.
Definition: Viewer.h:108
Frame buffer size, to be set by renderer in Renderer::initViewer(), called by Viewer::init().
Definition: Viewer.h:90
virtual void render()=0
virtual void initViewer(Viewer *viewer, FrameBufferSize *frameBufferSize)=0
Viewer * viewer_
Definition: Renderer.h:129
void setLighting(bool isLightingEnabled)
bool isLightingEnabled() const
RenderStateUP renderState_
Definition: Renderer.h:132
void setScene(NodeSP scene)
CameraSP getCamera()
The central render state that collects information about the current shader, transformations,...
Definition: RenderState.h:107
Definition: Animation.h:28
void destroyScene()
void setGlobalAmbientLight(const glm::vec4 &globalAmbientLight)
Internal definitions required by most classes.
void setCamera(CameraSP camera)
Base class for all nodes (composite pattern, abstract).
Definition: Node.h:47
Base class for all renderers (abstract).
Definition: Renderer.h:45