diff --git a/08/3dscalemat.png b/08/3dscalemat.png deleted file mode 100644 index acc8b91..0000000 Binary files a/08/3dscalemat.png and /dev/null differ diff --git a/08/3dtransmat.png b/08/3dtransmat.png index 1e0518e..b9a4123 100644 Binary files a/08/3dtransmat.png and b/08/3dtransmat.png differ diff --git a/08/README.md b/08/README.md index fd77884..990e75f 100644 --- a/08/README.md +++ b/08/README.md @@ -2,11 +2,9 @@ ### Translate -![](translate.jpg) - In the previous chapter we learned how to make some shapes - the trick to moving those shapes is to move the coordinate system itself. We can achieve that by simply adding a vector to the ```st``` variable that contains the location of each fragment. This causes the whole space coordinate system to move. -![](translate-space.jpg) +![](translate.jpg) This is easier to see than to explain, so to see for yourself: @@ -22,7 +20,7 @@ Now try the following exercise: To rotate objects we also need to move the entire space system. For that we are going to use a [matrix](http://en.wikipedia.org/wiki/Matrix_%28mathematics%29). A matrix is an organized set of numbers in columns and rows. Vectors are multiplied by matrices following a precise set of rules in order to modify the values of the vector in a particular way. -![](matrixes.png) +[![Wikipedia entry for Matrix (mathematics) ](matrixes.png)](https://en.wikipedia.org/wiki/Matrix) GLSL has native support for two, three and four dimensional matrices: [```mat2```](../glossary/index.html#mat2.md) (2x2), [```mat3```](../glossary/index.html#mat3.md) (3x3) and [```mat4```](../glossary/index.html#mat4.md) (4x4). GLSL also supports matrix multiplication (```*```) and a matrix specific function ([```matrixCompMult()```](../glossary/index.html#matrixCompMult.md)). @@ -32,9 +30,9 @@ Based on how matrices behave it's possible to construct matrices to produce spec More interestingly, we can use a matrix to rotate the coordinate system: -![](2drotmat.png) +![](rotmat.png) -Take a look at the following code for a function that constructs a 2D rotation matrix. This function follows the above [formula](http://en.wikipedia.org/wiki/Rotation_matrix) to rotate the coordinates around the ```vec2(0.0)``` point. +Take a look at the following code for a function that constructs a 2D rotation matrix. This function follows the above [formula](http://en.wikipedia.org/wiki/Rotation_matrix) for two dimentional vectors to rotate the coordinates around the ```vec2(0.0)``` point. ```glsl mat2 rotate2d(float _angle){ @@ -47,7 +45,7 @@ According to the way we've been drawing shapes, this is not exactly what we want ![](rotate.jpg) -That will looks like the following code: +That looks like the following code:
@@ -63,7 +61,7 @@ Try the following exercises: We've seen how matrices are used to translate and rotate objects in space. (Or more precisely to transform the coordinate system to rotate and move the objects.) If you've used 3D modeling software or the push and pop matrix functions in Processing, you will know that matrices can also be used to scale the size of an object. -![](3dscalemat.png) +![](scale.png) Following the previous formula, we can figure out how to make a 2D scaling matrix: @@ -98,4 +96,4 @@ The following code is an interesting opportunity to use matrix operations in GLS As you can see we are treating colors as vectors by multiplying them with matrices. In that way we “move” the values around. -In this chapter we have learn about how to use matrix transformation to move, rotate and scale vectors. This will be esential to compose shapes like the once we learn to do in the previus chapter. On our next step we will apply all what we have learn to make beatiful procedural patterns. You will find that coding repetition and variation can be an exciting practice. +In this chapter we've learned how to use matrix transformations to move, rotate and scale vectors. These transformations will be essential for making compositions out of the shapes we learned about in the previous chapter. In the next chapter we'll apply all we've learned to make beautiful procedural patterns. You will find that coding repetition and variation can be an exciting practice. diff --git a/08/rotmat.png b/08/rotmat.png new file mode 100644 index 0000000..2d05324 Binary files /dev/null and b/08/rotmat.png differ diff --git a/08/scale.png b/08/scale.png new file mode 100644 index 0000000..5180c1c Binary files /dev/null and b/08/scale.png differ diff --git a/08/translate-space.jpg b/08/translate-space.jpg deleted file mode 100644 index d1105bb..0000000 Binary files a/08/translate-space.jpg and /dev/null differ diff --git a/08/translate.jpg b/08/translate.jpg index 6e3b6da..26d78f9 100644 Binary files a/08/translate.jpg and b/08/translate.jpg differ diff --git a/glossary/GL_ES.md b/glossary/GL_ES.md index e69de29..9a4fbeb 100644 --- a/glossary/GL_ES.md +++ b/glossary/GL_ES.md @@ -0,0 +1,9 @@ +## GL_ES + +### Declaration / Example + +### Parameters + +### Description + +### See Also diff --git a/glossary/README.md b/glossary/README.md index d870410..f0fadb5 100644 --- a/glossary/README.md +++ b/glossary/README.md @@ -2,6 +2,61 @@ ## By theme +* TYPES + +[void](index.html#void.md) +[bool](index.html#bool.md) +[int](index.html#int.md) +[float](index.html#float.md) +[bvec2](index.html#bvec2.md) +[bvec3](index.html#bvec3.md) +[bvec4](index.html#bvec4.md) +[ivec2](index.html#ivec2.md) +[ivec3](index.html#ivec3.md) +[ivec4](index.html#ivec4.md) +[vec2](index.html#vec2.md) +[vec3](index.html#vec3.md) +[vec4](index.html#vec4.md) +[mat2](index.html#mat2.md) +[mat3](index.html#mat3.md) +[mat4](index.html#mat4.md) +[sampler2D](index.html#sampler2D.md) +[samplerCube](index.html#samplerCube.md) +[struct](index.html#struct.md) + +* QUALIFIERS + +[attribute](index.html#attribute.md) +[const](index.html#const.md) +[uniform](index.html#uniform.md) +[varying](index.html#varying.md) +[precision](index.html#precision.md) +[highp](index.html#highp.md) +[mediump](index.html#mediump.md) +[lowp](index.html#lowp.md) +[in](index.html#in.md) +[out](index.html#out.md) +[inout](index.html#inout.md) + +* BUILT-IN VARIABLES + +[gl_Position](index.html#gl_Position.md) +[gl_PointSize](index.html#gl_PointSize.md) +[gl_PointCoord](index.hmtl#gl_PointCoord.md) +[gl_FrontFacing](index.html#gl_FrontFacing.md) +[gl_FragCoord](index.html#gl_FragCoord.md) +[gl_FragColor](index.html#gl_FragColor.md) + +* BUILT-IN CONSTANTS + +[gl_MaxVertexAttribs](index.html#gl_MaxVertexAttribs.md) +[gl_MaxVaryingVectors](index.html#gl_MaxVaryingVectors.md) +[gl_MaxVertexTextureImageUnits](index.html#gl_MaxVertexTextureImageUnits.md) +[gl_MaxCombinedTextureImageUnits](index.html#gl_MaxCombinedTextureImageUnits.md) +[gl_MaxTextureImageUnits](index.html#gl_MaxTextureImageUnits.md) +[gl_MaxFragmentUniformVectors](index.html#gl_MaxFragmentUniformVectors.md) +[gl_MaxDrawBuffers](index.html#gl_MaxDrawBuffers.md) + * ANGLE & TRIGONOMETRY FUNCTIONS [radians()](index.html#radians.md) @@ -80,17 +135,28 @@ [any()](index.html#any.md) [asin()](index.html#asin.md) [atan()](index.html#atan.md) +[attribute](index.html#attribute.md) + +* B + +[bool](index.html#bool.md) +[bvec2](index.html#bvec2.md) +[bvec3](index.html#bvec3.md) +[bvec4](index.html#bvec4.md) * C [ceil()](index.html#ceil.md) [clamp()](index.html#clamp.md) +[const](index.html#const.md) [cos()](index.html#cos.md) [cross()](index.html#cross.md) * D [degrees()](index.html#degrees.md) +[dFdx()](index.html#dFdx.md) +[dFdy()](index.html#dFdy.md) [distance()](index.html#distance.md) [dot()](index.html#dot.md) @@ -103,6 +169,7 @@ * F [faceforward()](index.html#faceforward.md) +[float](index.html#float.md) [floor()](index.html#floor.md) [fract()](index.html#fract.md) @@ -110,10 +177,33 @@ [greaterThan()](index.html#greaterThan.md) [greaterThanEqual()](index.html#greaterThanEqual.md) +[gl_FragColor](index.html#gl_FragColor.md) +[gl_FragCoord](index.html#gl_FragCoord.md) +[gl_FrontFacing](index.html#gl_FrontFacing.md) +[gl_PointCoord](index.hmtl#gl_PointCoord.md) +[gl_PointSize](index.html#gl_PointSize.md) +[gl_Position](index.html#gl_Position.md) +[gl_MaxCombinedTextureImageUnits](index.html#gl_MaxCombinedTextureImageUnits.md) +[gl_MaxDrawBuffers](index.html#gl_MaxDrawBuffers.md) +[gl_MaxFragmentUniformVectors](index.html#gl_MaxFragmentUniformVectors.md) +[gl_MaxVaryingVectors](index.html#gl_MaxVaryingVectors.md) +[gl_MaxVertexAttribs](index.html#gl_MaxVertexAttribs.md) +[gl_MaxVertexTextureImageUnits](index.html#gl_MaxVertexTextureImageUnits.md) +[gl_MaxTextureImageUnits](index.html#gl_MaxTextureImageUnits.md) + +* H + +[highp](index.html#highp.md) * I +[in](index.html#in.md) +[inout](index.html#inout.md) +[int](index.html#int.md) [inversesqrt()](index.html#inversesqrt.md) +[ivec2](index.html#ivec2.md) +[ivec3](index.html#ivec3.md) +[ivec4](index.html#ivec4.md) * L @@ -122,11 +212,16 @@ [lessThanEqual()](index.html#lessThanEqual.md) [log()](index.html#log.md) [log2()](index.html#log2.md) +[lowp](index.html#lowp.md) * M [matrixCompMult()](index.html#matrixCompMult.md) +[mat2](index.html#mat2.md) +[mat3](index.html#mat3.md) +[mat4](index.html#mat4.md) [max()](index.html#max.md) +[mediump](index.html#mediump.md) [min()](index.html#min.md) [mix()](index.html#mix.md) [mod()](index.html#mod.md) @@ -137,8 +232,13 @@ [not()](index.html#not.md) [notEqual()](index.html#notEqual.md) +* O + +[out](index.html#out.md) + * P +[precision](index.html#precision.md) [pow()](index.html#pow.md) * R @@ -149,14 +249,29 @@ * S +[sampler2D](index.html#sampler2D.md) +[samplerCube](index.html#samplerCube.md) [sign()](index.html#sign.md) [sin()](index.html#sin.md) [smoothstep()](index.html#smoothstep.md) [sqrt()](index.html#sqrt.md) [step()](index.html#step.md) +[struct](index.html#struct.md) * T [tan()](index.html#tan.md) [texture2D()](index.html#texture2D.md) [textureCube()](index.html#textureCube.md) + +* U + +[uniform](index.html#uniform.md) + +* V + +[varying](index.html#varying.md) +[vec2](index.html#vec2.md) +[vec3](index.html#vec3.md) +[vec4](index.html#vec4.md) +[void](index.html#void.md) diff --git a/glossary/attribute.md b/glossary/attribute.md index e69de29..19a3990 100644 --- a/glossary/attribute.md +++ b/glossary/attribute.md @@ -0,0 +1,15 @@ +## Attribute +Vertex attribute data. + +### Example +```glsl +attribute vec4 v_color; +``` + +### Description +```attribute``` read-only variables containing data shared from WebGL/OpenGL environment to the vertex shader. + +Because the vertex shader is executed one time for each vertex, attributes are specify per vertex data typically with information such as: space position, color, normal direction and texture coordinates of a vertex. + +### See Also +[const](index.html#const.md), [uniform](index.html#uniform.md), [varying](index.html#varying.md), [Chapter 03: Uniforms](.../03/) \ No newline at end of file diff --git a/glossary/bool.md b/glossary/bool.md index e69de29..e8fff33 100644 --- a/glossary/bool.md +++ b/glossary/bool.md @@ -0,0 +1,15 @@ +## Bool +Boolean variable type + +### Declaration +```glsl +bool aBool = true; +bool bBool = bool(aInt); +bool cBool = bool(aFloat); +``` + +### Description +```bool``` data type is either true or false. + +### See Also +[void](index.html#void.md), [bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [struct](index.html#struct.md) \ No newline at end of file diff --git a/glossary/bvec2.md b/glossary/bvec2.md index e69de29..023456f 100644 --- a/glossary/bvec2.md +++ b/glossary/bvec2.md @@ -0,0 +1,21 @@ +## Bvec2 +2 dimentional boolean vector + +### Declaration +```glsl +bvec2 aBvec2 = bvec2(true, true); +bvec2 bBvec2 = bvec2(true); + +bvec2 cBvec2 = bvec2(aBvec3); +bvec2 dBvec2 = bvec2(aBvec3.x, aBvec3.y); +``` + +### Description +```bvec2``` is a boolean vectors with two components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) diff --git a/glossary/bvec3.md b/glossary/bvec3.md index e69de29..ffc2f95 100644 --- a/glossary/bvec3.md +++ b/glossary/bvec3.md @@ -0,0 +1,25 @@ +## Bvec3 +3 dimentional boolean vector + +### Declaration +```glsl +vec3 aBvec3 = bvec3(true, true, true); +vec3 bBvec3 = bvec3(true); + +vec3 cBvec3 = bvec3(aBvec4); +vec3 dBvec3 = bvec3(aBvec4.x, aBvec4.y, aBvec4.z); + +vec3 eBvec3 = bvec3(aBvec2, aBool); +vec3 fBvec3 = bvec3(aBvec2.x, aBvec2.y, aBool); +``` + +### Description +```bvec3``` is a boolean vectors with three components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. +- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) diff --git a/glossary/bvec4.md b/glossary/bvec4.md index e69de29..36d38d9 100644 --- a/glossary/bvec4.md +++ b/glossary/bvec4.md @@ -0,0 +1,21 @@ +## Bvec4 +4 dimentional boolean vector + +### Declaration +```glsl +vec4 aBvec4 = bvec4(true, true, true, true); +vec4 bBvec4 = bvec4(true); + +vec4 cBvec4 = bvec4(aBvec2, aBool, aBvec3); +vec4 dBvec4 = bvec4(aBvec2.x, aBvec2.y, aBool, aBvec3.x); +``` + +### Description +```bvec4``` is a boolean vectors with four components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a combination of vectors and scalars. The respective values are used to initialize the components. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) diff --git a/glossary/const.md b/glossary/const.md index e69de29..3d5d77a 100644 --- a/glossary/const.md +++ b/glossary/const.md @@ -0,0 +1,13 @@ +## Const +Constant qualifier + +### Example +```glsl +const float PI = 3.14159265359; +``` + +### Description +```const``` qualifier can be applied to the declaration of any variable to specify that its value will not be changed. + +### See also +[attribute](index.html#attribute.md), [uniform](index.html#uniform.md), [varying](index.html#varying.md) \ No newline at end of file diff --git a/glossary/dFdx.md b/glossary/dFdx.md index e69de29..8ed7d2d 100644 --- a/glossary/dFdx.md +++ b/glossary/dFdx.md @@ -0,0 +1,16 @@ +## DFdx +Return the partial derivative of an argument with respect to x + +### Declaration +```glsl +genType dFdx(float x); +``` + +### Parameters +```p``` specifies the expression of which to take the partial derivative. + +### Description +Available only in the fragment shader, ```dFdx``` return the partial derivative of expression ```p``` in ```x```. Deviatives are calculated using local differencing. Expressions that imply higher order derivatives such as ```dFdx(dFdx(n))``` have undefined results, as do mixed-order derivatives such as ```dFdx(dFdy(n))```. It is assumed that the expression ```p``` is continuous and therefore, expressions evaluated via non-uniform control flow may be undefined. + +### See Also +[dFdy()](index.html#dFdy.md) \ No newline at end of file diff --git a/glossary/dFdy.md b/glossary/dFdy.md index e69de29..b1c0571 100644 --- a/glossary/dFdy.md +++ b/glossary/dFdy.md @@ -0,0 +1,16 @@ +## DFdy +Return the partial derivative of an argument with respect to y + +### Declaration +```glsl +genType dFdy(float y); +``` + +### Parameters +```p``` specifies the expression of which to take the partial derivative. + +### Description +Available only in the fragment shader, ```dFdy``` return the partial derivative of expression ```p``` in ```y```. Deviatives are calculated using local differencing. Expressions that imply higher order derivatives such as ```dFdy(dFdy(n))``` have undefined results, as do mixed-order derivatives such as ```dFdy(dFdx(n))```. It is assumed that the expression ```p``` is continuous and therefore, expressions evaluated via non-uniform control flow may be undefined. + +### See Also +[dFdx()](index.html#dFdx.md) \ No newline at end of file diff --git a/glossary/faceforward.md b/glossary/faceforward.md index 1622e79..adc4e31 100644 --- a/glossary/faceforward.md +++ b/glossary/faceforward.md @@ -20,5 +20,4 @@ vec4 faceforward(vec4 N, vec4 I, vec4 Nref) ```faceforward()``` orients a vector to point away from a surface as defined by its normal. ```If dot(Nref, I) < 0``` faceforward returns ```N```, otherwise it returns ```-N```. ### See Also - [reflect()](index.html#reflect.md), [refract()](index.html#refract.md) \ No newline at end of file diff --git a/glossary/float.md b/glossary/float.md index e69de29..2fa479c 100644 --- a/glossary/float.md +++ b/glossary/float.md @@ -0,0 +1,15 @@ +## Float +Floating-point variable type + +### Declaration +```glsl +float aFloat = 1.0; +float bFloat = float(aBool); +float cFloat = float(aInt); +``` + +### Description +```float``` is used for floating point values. + +### See Also +[void](index.html#void.md), [bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [struct](index.html#struct.md) \ No newline at end of file diff --git a/glossary/gl_FragColor.md b/glossary/gl_FragColor.md index e69de29..a68c426 100644 --- a/glossary/gl_FragColor.md +++ b/glossary/gl_FragColor.md @@ -0,0 +1,9 @@ +## Gl_FragColor + +### Declaration / Example + +### Parameters + +### Description + +### See Also diff --git a/glossary/gl_FragCoord.md b/glossary/gl_FragCoord.md new file mode 100644 index 0000000..e4b5b8f --- /dev/null +++ b/glossary/gl_FragCoord.md @@ -0,0 +1,9 @@ +## G_FragCoord + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_FrontFacing.md b/glossary/gl_FrontFacing.md new file mode 100644 index 0000000..10d0fbc --- /dev/null +++ b/glossary/gl_FrontFacing.md @@ -0,0 +1,9 @@ +## Gl_FrontFacing + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxCombinedTextureImageUnits.md b/glossary/gl_MaxCombinedTextureImageUnits.md new file mode 100644 index 0000000..1441068 --- /dev/null +++ b/glossary/gl_MaxCombinedTextureImageUnits.md @@ -0,0 +1,9 @@ +## Gl_MaxCombinedTextureImages + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxDrawBuffers.md b/glossary/gl_MaxDrawBuffers.md new file mode 100644 index 0000000..ce9c2f6 --- /dev/null +++ b/glossary/gl_MaxDrawBuffers.md @@ -0,0 +1,9 @@ +## Gl_MaxDrawBuffers + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxFragmentUniformVectors.md b/glossary/gl_MaxFragmentUniformVectors.md new file mode 100644 index 0000000..6c53e1d --- /dev/null +++ b/glossary/gl_MaxFragmentUniformVectors.md @@ -0,0 +1,9 @@ +## Gl_MaxFragmentUniformVectors + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxTextureImageUnits.md b/glossary/gl_MaxTextureImageUnits.md new file mode 100644 index 0000000..cef4274 --- /dev/null +++ b/glossary/gl_MaxTextureImageUnits.md @@ -0,0 +1,9 @@ +## Gl_MaxTextureImageUnits + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxVaryingVectors.md b/glossary/gl_MaxVaryingVectors.md new file mode 100644 index 0000000..ce55e01 --- /dev/null +++ b/glossary/gl_MaxVaryingVectors.md @@ -0,0 +1,9 @@ +## Gl_MaxVaryingVectors + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxVertexAttribs.md b/glossary/gl_MaxVertexAttribs.md new file mode 100644 index 0000000..f9ed58d --- /dev/null +++ b/glossary/gl_MaxVertexAttribs.md @@ -0,0 +1,9 @@ +## Gl_MaxVertexAttrbis + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_MaxVertexTextureImageUnits.md b/glossary/gl_MaxVertexTextureImageUnits.md new file mode 100644 index 0000000..6e665af --- /dev/null +++ b/glossary/gl_MaxVertexTextureImageUnits.md @@ -0,0 +1,9 @@ +## Gl_MaxVertexTextureImageUnits + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_PointCoord.md b/glossary/gl_PointCoord.md new file mode 100644 index 0000000..ed280da --- /dev/null +++ b/glossary/gl_PointCoord.md @@ -0,0 +1,9 @@ +## Gl_PointCoord + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_PointSize.md b/glossary/gl_PointSize.md new file mode 100644 index 0000000..af47b5d --- /dev/null +++ b/glossary/gl_PointSize.md @@ -0,0 +1,9 @@ +## Gl_PointSize + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/gl_Position.md b/glossary/gl_Position.md new file mode 100644 index 0000000..7724015 --- /dev/null +++ b/glossary/gl_Position.md @@ -0,0 +1,9 @@ +## Gl_Position + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/highp.md b/glossary/highp.md index e69de29..21c004e 100644 --- a/glossary/highp.md +++ b/glossary/highp.md @@ -0,0 +1,9 @@ +## Highp + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/in.md b/glossary/in.md index e69de29..9f60041 100644 --- a/glossary/in.md +++ b/glossary/in.md @@ -0,0 +1,9 @@ +## In + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/inout.md b/glossary/inout.md index e69de29..c6b5205 100644 --- a/glossary/inout.md +++ b/glossary/inout.md @@ -0,0 +1,9 @@ +## Inout + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/int.md b/glossary/int.md index e69de29..02c9391 100644 --- a/glossary/int.md +++ b/glossary/int.md @@ -0,0 +1,15 @@ +## Int +Integer data type + +### Declaration +```glsl +int aInt = 42; +int bInt = int(aBool); +int cInt = int(aFloat); +``` + +### Description +```int``` is used for integer values. + +### See Also +[void](index.html#void.md), [bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md) \ No newline at end of file diff --git a/glossary/ivec2.md b/glossary/ivec2.md index e69de29..1e81485 100644 --- a/glossary/ivec2.md +++ b/glossary/ivec2.md @@ -0,0 +1,21 @@ +## Ivec2 +2 dimentional integer vector + +### Declaration +```glsl +bvec2 aIvec2 = ivec2(1, 1); +bvec2 bIvec2 = ivec2(1); + +bvec2 cIvec2 = ivec2(aIvec3); +bvec2 dIvec2 = ivec2(aIvec3.x, aIvec3.y); +``` + +### Description +```ivec2``` is a integer vectors with two components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/ivec3.md b/glossary/ivec3.md index e69de29..8b50b07 100644 --- a/glossary/ivec3.md +++ b/glossary/ivec3.md @@ -0,0 +1,25 @@ +## Ivec3 +3 dimentional integer vector + +### Declaration +```glsl +vec3 aIvec3 = ivec3(1, 1, 1); +vec3 bIvec3 = ivec3(1); + +vec3 cIvec3 = ivec3(aIvec4); +vec3 dIvec3 = ivec3(aIvec4.x, aIvec4.y, aIvec4.z); + +vec3 eIvec3 = ivec3(aIvec2, aInt); +vec3 fIvec3 = ivec3(aIvec2.x, aIvec2.y, aInt); +``` + +### Description +```ivec3``` is a integer vectors with three components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. +- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/ivec4.md b/glossary/ivec4.md index e69de29..30e2cca 100644 --- a/glossary/ivec4.md +++ b/glossary/ivec4.md @@ -0,0 +1,21 @@ +## Ivec4 +4 dimentional integer vector + +### Declaration +```glsl +vec4 aIvec4 = ivec4(1, 1, 1, 1); +vec4 bIvec4 = ivec4(1); + +vec4 cIvec4 = ivec4(aIvec2, aInteger, aIvec3); +vec4 dIvec4 = ivec4(aIvec2.x, aIvec2.y, aInt, aIvec3.x); +``` + +### Description +```ivec4``` is a integer vectors with four components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/lowp.md b/glossary/lowp.md index e69de29..23c6e29 100644 --- a/glossary/lowp.md +++ b/glossary/lowp.md @@ -0,0 +1,9 @@ +## Lowp + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/main.md b/glossary/main.md index e69de29..974fa90 100644 --- a/glossary/main.md +++ b/glossary/main.md @@ -0,0 +1,9 @@ +## Main + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/mediump.md b/glossary/mediump.md index e69de29..1129e2f 100644 --- a/glossary/mediump.md +++ b/glossary/mediump.md @@ -0,0 +1,9 @@ +## Mediump + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/out.md b/glossary/out.md index e69de29..54c833f 100644 --- a/glossary/out.md +++ b/glossary/out.md @@ -0,0 +1,9 @@ +## Out + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/precision.md b/glossary/precision.md index e69de29..0343239 100644 --- a/glossary/precision.md +++ b/glossary/precision.md @@ -0,0 +1,9 @@ +## Precision + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/return.md b/glossary/return.md index e69de29..e252b86 100644 --- a/glossary/return.md +++ b/glossary/return.md @@ -0,0 +1,9 @@ +## Return + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/sampler2D.md b/glossary/sampler2D.md new file mode 100644 index 0000000..76c7110 --- /dev/null +++ b/glossary/sampler2D.md @@ -0,0 +1,9 @@ +## Sampler2D + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/samplerCube.md b/glossary/samplerCube.md new file mode 100644 index 0000000..46c9505 --- /dev/null +++ b/glossary/samplerCube.md @@ -0,0 +1,9 @@ +## SamplerCube + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/struct.md b/glossary/struct.md new file mode 100644 index 0000000..2782bfc --- /dev/null +++ b/glossary/struct.md @@ -0,0 +1,20 @@ +## Struct +Structure variable type + +### Example +```glsl +struct matStruct { + vec4 ambientColor; + vec4 diffuseColor; + vec4 specularColor; + float specularExponent; +} newMaterial; + +newMaterial = matStruct(vec4(0.1, 0.1, 0.1, 1.0), + vec4(1.0, 0.0, 0.0, 1.0), + vec4(0.7, 0.7, 0.7, 1.0), + 50.0); +``` + +### Description +```struct``` declare a custom data structures based on standard types. A constructor for the structure with the same name is created automatically. The declaration of a variable (in this case "newMaterial") is optional. \ No newline at end of file diff --git a/glossary/uniform.md b/glossary/uniform.md index 04b48b9..1f88d12 100644 --- a/glossary/uniform.md +++ b/glossary/uniform.md @@ -1,4 +1,10 @@ ## Uniform -### See +### Declaration / Example + +### Parameters + +### Description + +### See Also [Chapter 03: Uniforms](../05/) \ No newline at end of file diff --git a/glossary/varying.md b/glossary/varying.md index e69de29..0a8da52 100644 --- a/glossary/varying.md +++ b/glossary/varying.md @@ -0,0 +1,9 @@ +## Varying + +### Declaration / Example + +### Parameters + +### Description + +### See Also \ No newline at end of file diff --git a/glossary/vec2.md b/glossary/vec2.md index e69de29..7321c84 100644 --- a/glossary/vec2.md +++ b/glossary/vec2.md @@ -0,0 +1,21 @@ +## Vec2 +2 dimentional float point vector + +### Declaration +```glsl +vec2 aVec2 = vec2(1.0, 1.0); +vec2 bVec2 = vec2(1.0); + +vec2 cVec2 = vec2(aVec3); +vec2 dVec2 = vec2(aVec3.x, aVec3.y); +``` + +### Description +```vec2``` is a float point vectors with two components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/vec3.md b/glossary/vec3.md index e69de29..c1129c9 100644 --- a/glossary/vec3.md +++ b/glossary/vec3.md @@ -0,0 +1,25 @@ +## Vec3 +3 dimentional floating point vector + +### Declaration +```glsl +vec3 aVec3 = vec3(1.0, 1.0, 1.0); +vec3 bVec3 = vec3(1.0); + +vec3 cVec3 = vec3(aVec4); +vec3 dVec3 = vec3(aVec4.x, aVec4.y, aVec4.z); + +vec3 eVec3 = vec3(aVec2, aFloat); +vec3 fVec3 = vec3(aVec2.x, aVec2.y, aFloat); +``` + +### Description +```bvec3``` is a floating point vectors with three components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a vector of higher dimension. The respective values are used to initialize the components. +- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/vec4.md b/glossary/vec4.md index e69de29..feed872 100644 --- a/glossary/vec4.md +++ b/glossary/vec4.md @@ -0,0 +1,21 @@ +## Vec4 +4 dimentional floating point vector + +### Declaration +```glsl +vec4 aBvec4 = bvec4(true, true, true, true); +vec4 bBvec4 = bvec4(true); + +vec4 cBvec4 = bvec4(aBvec2, aBool, aBvec3); +vec4 dBvec4 = bvec4(aBvec2.x, aBvec2.y, aBool, aBvec3.x); +``` + +### Description +```bvec4``` is a floating point vectors with four components. Can be initialize by: + +- Providing a scalar value for each component. +- Providing one scalar value. This value is used for all components. +- Providing a combination of vectors and scalars. The respective values are used to initialize the components. The arguments of the constructor must have at least as many components as the vector that is initialized. + +### See Also +[bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md), [bvec2](index.html#bvec2.md), [bvec3](index.html#bvec3.md), [bvec4](index.html#bvec4.md), [ivec2](index.html#ivec2.md), [ivec3](index.html#ivec3.md), [ivec4](index.html#ivec4.md), [vec2](index.html#vec2.md), [vec3](index.html#vec3.md), [vec4](index.html#vec4.md), [mat2](index.html#mat2.md), [mat3](index.html#mat3.md), [mat4](index.html#mat4.md) \ No newline at end of file diff --git a/glossary/void.md b/glossary/void.md index e69de29..ba426ef 100644 --- a/glossary/void.md +++ b/glossary/void.md @@ -0,0 +1,14 @@ +## Void + +### Declaration +```glsl +void main(void); +int aFunction(void); +void bFunction(float); +``` + +### Description +```void``` is used when a function have no parameters or when a function does not return a value. + +### See Also +[void](index.html#void.md), [bool](index.html#bool.md), [int](index.html#int.md), [float](index.html#float.md) \ No newline at end of file