50 #include "NormalRenderer.hh"
54 #include <ACG/GL/ShaderCache.hh>
67 _shader->
addDefine(
"SG_REQUEST_NORMALOS");
72 _code->push_back(
"#ifdef SG_INPUT_NORMALOS");
73 _code->push_back(
"outFragment = vec4(normalize(SG_INPUT_NORMALOS) * 0.5 + vec3(0.5, 0.5, 0.5),1.0);");
74 _code->push_back(
"#endif ");
85 NormalRenderer::NormalRenderer()
91 NormalRenderer::~NormalRenderer()
96 void NormalRenderer::initializePlugin()
102 std::vector<ACG::ShaderModifier*> modifiers;
103 modifiers.push_back(&NormalFragmentModifier::instance);
125 QString NormalRenderer::checkOpenGL()
128 return QString(
"Insufficient OpenGL Version! OpenGL 3.2 or higher required");
132 missing +=
"GL_ARB_vertex_buffer_object extension missing\n";
136 missing +=
"GL_ARB_vertex_program extension missing\n";
142 #if QT_VERSION < 0x050000
virtual void renderObject(ACG::RenderObject *_obj, GLSL::Program *_prog=0, bool _constRenderStates=false, const std::vector< unsigned int > *_shaderModifiers=0)
Render one renderobject.
void addDefine(const QString &_define)
Add one define.
std::vector< ACG::RenderObject * > sortedObjects_
sorted list of renderobjects without overlay objects (sorted in rendering order)
static unsigned int registerModifier(ShaderModifier *_modifier)
Shader modifiers have to be registered before they can be used. They also must remain allocated for t...
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
bool openGLVersion(const int _major, const int _minor)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
bool checkExtensionSupported(const std::string &_extension)
virtual QString dumpCurrentRenderObjectsToString(ACG::RenderObject **_list=0, bool _outputShaders=false, std::vector< ACG::ShaderModifier * > *_modifiers=0)
Outputs the current render objects to the string.
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
void modifyVertexIO(ACG::ShaderGenerator *_shader)
Add your own inputs/outputs to the vertex shader.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
static void setShaderDir(QString _dir)
virtual void finishRenderingPipeline(bool _drawOverlay=true)
Draw overlay objects and reset OpenGL state.
void modifyFragmentEndCode(QStringList *_code)
Append code the the fragment shader.
virtual void prepareRenderingPipeline(ACG::GLState *_glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode *_scenegraphRoot)
Prepares renderer and OpenGL for any draw-related calls including.
int getNumRenderObjects() const
Get the number of collected render objects (not including overlay objects or gl4.2 line objects) ...
QString renderObjectsInfo(bool _outputShaderInfo)
Return a qstring of the current render objects.