User Tools

Site Tools


render_configs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

render_configs [2016/10/31 22:48] (current)
47.200.224.152 created
Line 1: Line 1:
 +===== Render Configs =====
  
 +<code C>
 +setvar myVariable 11235
 +setvar screenWidth $myVariable * 8
 +
 +enum imageType { GL_UNSIGNED_BYTE }
 +
 +renderconfig "​DeferredRenderer"​
 +path "​path1"​
 +path "​path2"​
 +program ""​
 +vertshader "​filename"​
 +fragshader "​filename"​
 +vertattrib 0 "​vtxPosition"​
 +vertattrib <​index>​ "​name"​
 +fbo GL_COLOR_ATTACHMENT0 GL_FLOAT GL_RGBA (texture "​name"​ | renderbuffer <<​imageType>>​ | cube_(pos|neg)_(x|y|z) "​name"​)
 +texture name "​name"​ width 256 height 256 components 3 type GL_UNSIGNED_BYTE
 +loadtexture name "​name"​ filename "​filename"​
 +uniformlist "​uniformListName"​
 +uniform_mat4 "​uniformName"​ <m11> <m12> <m13> <m14> ... <m41> <m42> <m43> <m44>
 +uniform_vec3 "​uniformName"​ <x> <y> <z>
 +uniform_mtl "​uniformName"​ "​materialPropertyName"​ uniformType
 +sampler "​samplerObjectName"​ ((GL_WRAP_S|GL_WRAP_T|GL_WRAP_R|...) (PARAMVALUE) ...)
 +
 +pass <​index>​
 +bindfbo "​fboname"​
 +bindtexture "​shaderVariable"​ "​textureName"​ ""​
 +zonly 1
 +useuniforms "​uniformlist"​
 +
 +pass <​index>​
 +# optional
 +zonly 0
 +
 +</​code>​
 +
 +==== VertexAttribInfo ====
 +
 +<code C++>
 +struct VertexAttribInfo
 +{
 +    int index;
 +    string name;
 +};
 +</​code>​
 +
 +**Render Configuration Syntax:**
 +
 +<​code>​
 +vertattrib <​index>​ <​name>​
 +</​code>​
 +
 +==== ProgramInfo ====
 +
 +<code C++>
 +struct ProgramInfo
 +{
 +    string name;
 +    string vertShader;
 +    string fragShader;
 +    vector<​VertexAttribInfo>​ vertexAttribs;​
 +};
 +</​code>​
 +
 +**Render Configuration Syntax:**
 +
 +<​code>​
 +program <​name>​
 +vertshader <​vertShader>​
 +fragshader <​fragShader>​
 +</​code>​
 +
 +==== AttachmentInfo ====
 +
 +<code C++>
 +struct AttachmentInfo
 +{
 +    string attachment; // "​COLOR_ATTACHMENT0",​ "​COLOR_ATTACHMENT1",​ "​DEPTH_ATTACHMENT"​
 +    string type;   // "​GL_UNSIGNED_BYTE",​ ...
 +    string renderbuffer;​
 +    string texture;
 +    string target;
 +};
 +</​code>​
 +
 +==== FrambufferInfo ====
 +
 +<code C++>
 +struct FramebufferInfo
 +{
 +    string name;
 +    // attachment, renderbuffer
 +    vector<​tuple<​GLenum,​ string>>​ renderbuffers;​
 +    // attachment, target, texture, level
 +    vector<​tuple<​GLenum,​ GLenum, string, int>> textures;
 +};
 +</​code>​
 +
 +<​code>​
 +fbo "​name"​
 +fbo attach GL_RENDERBUFFER (GL_COLOR_ATTACHMENTn | GL_DEPTH_ATTACHMENT) "​name"​
 +fbo attach GL_TEXTURE_2D GL_(COLOR|DEPTH)_ATTACHMENT "​name"​ [level = 0]
 +fbo attach GL_TEXTURE_CUBE_MAP_(POSITIVE|NEGATIVE)_(X|Y|Z) "​name"​ [level = 0]
 +</​code>​
 +==== PassInfo ====
 +
 +<code C++>
 +struct PassInfo
 +{
 +    int index;
 +    string fboName;
 +    string program;
 +    vector<​enum>​ enables;
 +    vector<​string>​ uniformLists;​
 +    vector<​tuple<​string,​string,​string>>​ textures; // uniformName,​ textureObj, samplerObj
 +};
 +</​code>​
 +
 +==== RenderConfigInfo ====
 +
 +//​RenderConfigInfo//​ is used to set up the entire rendering pipeline. It bridges the scene graph with the rendering engine. It tells the Fluxions engine how exactly a rendered image should be produced with OpenGL. It can be used to decide whether to quick render a depth pass with //zonly//. It can be used to decide whether to render the scene graph with //drawsg// or a full screen quad instead. The //width// and //height// may be specified. If they are 0, then the default screen width and height are used instead.
 +
 +<code C++>
 +struct RenderConfigInfo
 +{
 +    string name;
 +    ProgramInfo program;
 +    FramebufferInfo fbo;
 +    vector<​PassInfo>​ passes;
 +    int zonly;
 +    int drawsg;
 +    int width;
 +    int height;
 +};
 +</​code>​
 +
 +**Render Configuration Syntax:**
 +
 +<​code>​
 +renderconfig <​name>​
 +glEnable <​enum>​
 +</​code>​
 +==== SamplerInfo ====
 +<code C++>
 +struct SamplerInfo
 +{
 +    string name;
 +    vector<​pair<​enum,​ enum>>​ parameters;
 +};
 +</​code>​
 +
 +**Render Configuration Syntax:**
 +
 +<​code>​
 +sampler <​name>​
 +sampler <​param>​ <param value>
 +</​code>​
 +
 +==== TextureInfo ====
 +<code C++>
 +struct TextureInfo
 +{
 +    string name;
 +    enum target;
 +    vector<​string>​ files;
 +    int components;
 +    enum format;
 +    enum internalformat;​
 +    int width;
 +    int height;
 +    bool generateMipmap;​
 +};
 +</​code>​
 +
 +**Render Configuration Syntax:**
 +
 +<​code>​
 +texture <​name>​
 +texture <​target>​ <​filename>​
 +texture <​level>​ <​internalformat>​ <​width>​ <​height>​ <​format>​ <​type>​
 +texture generateMipmap
 +</​code>​
 +
 +| //​internalformat//​ | GL_RGB[A], GL_DEPTH_COMPONENT,​ GL_DEPTH_STENCIL |
 +| //​format// ​        | GL_UNSIGNED_BYTE,​ GL_DEPTH_COMPONENT16,​ GL_DEPTH_COMPONENT24,​ GL_DEPTH_COMPONENT_32F |
 +==== RenderbufferInfo ====
 +<code C++>
 +struct RenderbufferInfo
 +{
 +    int width;
 +    int height;
 +    enum format;
 +};
 +</​code>​
 +
 +==== Renderer ====
 +
 +<code C++>
 +struct Renderer
 +{
 +    map<​string,​ RenderConfigInfo>​ renderConfigs;​
 +    map<​string,​ UniformLists>​ uniformLists;​
 +    map<​string,​ TextureInfo>​ textures;
 +    map<​string,​ SamplerInfo>​ samplers;
 +};
 +</​code>​
 +
 +To tell the renderer what to render, use the render command
 +
 +<​code>​
 +render <​renderconfig 1>
 +render <​renderconfig 2>
 +</​code>​
render_configs.txt ยท Last modified: 2016/10/31 22:48 by 47.200.224.152