Matrices added

-Added GSmath that implements Vector classes and Matrix4f class for
graphics. It has members for initializing specific matrices (like
scaling, translation or projection) as well as overloads for matrix
math.
-GL1 matrices replaced with the ones implemented now. They also renamed
as they didn't make sense (wtf is transformation? GL has only model,
view and projection matrices).
-If using extern math functions (like random) they should probably work
using ma_scalar. So fixed that in move_functions.cpp. Doesn't change
anything as now ma_scalar == cs_scalar == double.
-All parameters in d3d_ functions are now gs_scalar - even angle and
aspect ratio. This is done for consistency as well as the fact that they
are used in matrices which are also gs_scalar (so no benefit and only
requires as cast).
-Started porting GL3 d3d_ functions. Right now segfaults.
-Added an extension for general purpose matrices. It implements
templated matrices as well most used matrix functions (like inversion).
Works on any size matrix.
Also easy to use - "matrix<int> a(3,3,5), b(3,3,2); matrix<int> c =
a*b;"
Or "matrix<char> c(5,5,'a'); draw_text(10,10,a.print());"

Doesn't work now because EDL doesn't allow classes. Should work with new
parser.
Fixes segfault and GL1 fixes

-Fixed segfault that was caused by copy() inside matrix members.
-It now sends matrices to GL correctly (in both GL1 and GL3). Turns out
I have to transpose them when loading, because GL is column-major while
C++ is row-major.
-Fixes orthographic projection and GL3 renders now.

Lots of debug printf's in there as well for now.
Fixes GL1 batcher and GL3 matrices

-Added the same check in GL1 batcher as in the others, that would stop
the game from breaking when _end() is called after _begin() without any
vertices.
-Fixed GL3 transformations and made projection functions flush the
batcher. This fixes segfaults in minecraft example (because without
flushing it the GL3 batcher broke).
-Fixed draw_getpixel() functions in GL3 (again). They didn't flush the
batcher (again). This was also seen as a bug in minecraft example.
Fixes for Minecraft and Mario

-Fixed more matrix math functions.
-Fixed model draw function which was still using glTranslate.
-Removed all the debug printing.
-Final matrix multiplication is done just before drawing and loading
matrices are also done just before that. On one side this reduces the
useless calls in d3d_ functions. On the other, sometimes a hundred draw
calls are made before a transformation. So there will have to be a check
here to know when to update and when not to update.

In my benchmarks the current GL3 with matrices are 70FPS faster in
Minecraft example (920FPS vs 850FPS), but is slower in Mario examples
because it updates on every draw call. Will add a check and see where it
gets us.
Scoped matrices and remade GL1 to use them

-Now all matrices are in enigma:: namespace, so that it doesn't clutter
the global one (or the user one).
-Added a "transformation_update" bool which tells when to update
matrices. This gives about 50FPS in Mario example. This is needed
because the update happens before the drawing and the drawing usually
happens a lot between transformation functions.
-GL1 is also using the custom matrices now. But the speedup here is a
lot less inconsistent. With the glFunctions Mario goes up to 1100FPS,
while with these changes it goes to 970FPS. So I am not sure if these
changes should be kept. In example like Minecraft, there is a speed
boost though. Additional tests should be conducted.

Maybe the math functions can be faster? We could implement them using
SSE and that shouldn't break compatiblity as everyone since Pentium3 has
them. But doesn't the compiler already does that? Should probably check.
Boosted matrix functions

-Added specific matrix functions, so things like rotateX/Y/Z which makes
a specific matrix taking into account that other axis are zero.
-Translate and Scale are now using expanded form taking into account
that they are very specific. This greatly reduces the multiplication
overhead.

These two optimizations boosted Mario example in GL3 from 800 to 990FPS
(a 190FPS increase!). I will do the same for GL1 now.
Boosted GL1

-Remade GL1 transformation functions to use the new optimized matrix
functions.

This increases Mario example FPS from 940 to 1190 - thats 20% boost. The
current method in Master (using only GL matrix functions) give 1140FPS,
so the overall boost is much smaller, only about 4%. In examples like
Minecraft, there is no real difference between the old GL1 and this one.
So it's guranteed to be at least as fast, but often times faster (if
using a lot of transformation functions).
GL3 now use shaders.. Finally!

-GL3 now uses shaders for rendering. Shader code for now is in
GL3shader.cpp. The framerate is a lot lower now though, and that is
mostly because of the glGet functions which cause pipeline to stall.
They will be removed, but I have to remake the shader struct for that.

Shader for now is also very simple. I will have to update it to have
lights (missing now), fog, blending and so on.

The whole FFP is gone now. In examples like Minecraft there is only 8
deprecated calls per frame (instead of 8000) and they are to the
glColor4ubv for some reason. I will remove every single on of those
deprecated function calls that lie here and there. But the grunt work is
done.
Fixes and improvements for GL3

-Fixed cases when texture coordinates are provided, but no texture is
actually used. Like when calling d3d_model_block with texture == -1.
This is something that needs to be fixed DX as well I suppose, as this
was more of GL context fix than anything else.
-Uniform and Attribute locations are queried only after linking the
program and not every frame. This greatly increases speed.
-Divided the shaders to now we have a prefix for fragment and vertex
shaders. These prefixes will be added to all user shaders, so users have
access to built-in variables like transformation matrices, texture
coordinates and other things.
-The shader now has branches which checks if texturing is enabled, color
is enabled or if both is disabled, then render using bound color.
Branches are usually something to fear in shaders, but that is usually
the case when branching can change per fragment. As the branching
arguments are uniforms (so constant for every drawing), then this
doesn't happen and at least in newer hardware like the 660ti I have, it
doesn't reduce speed in any way. "Proper" way is to create several
shaders for this, but the basic default shaders we will provide might as
well be slower. It's up to the user to make them faster if needed.
-Removed more deprecated function calls like glColor4ubv. This reduces
per-frame deprecated functions to 0 in Minecraft example, but there are
some still in functions like d3d_begin(). I will remove them later.
-Fixed get_texture. It was returning -1 when the return type was
unsigned (so it was A BIG number). As that is then used in
glBindTexture, then it actually doesn't make sense to be -1 anyway (as
glBindTexture also takes unsigned type) and so binding to 0 is actually
to "unbind" a texture. In reality, by GL standard, it binds a (0,0,0,1)
(a black) 1x1 texture.
-Fixes and light framework

-Renamed Matrix4f to Matrix, because it actually uses gs_scalar (which
can be either float or double). Maybe should rename it to Matrix4GS...
Did the same with Vector.
-Added Matrix3 because it is needed for normal matrix.
-Implemented normaMatrix.
-Added normal attribute to shaders.
-Fixed InitRotateX/Y/ZTransform and in turn it fixed
d3d_transform_set_x/y/z_rotation.
-Added framework for lights. Basically rewrote the whole GLd3d.cpp.
-Shader now have basics for per-vertex lighting
(ambient-diffuse-specular variant which was in FFP).
-Added error check in glsl_get_uniform_location.
Fixes and added broken lights

-Lights and their parameters are now sent to shaders.
-Fixed normalMatrix... maybe it was correct before, but I just wasted
like 4h on that thing, so I hope I at least did something.
-Normals are now passed to shaders.
-Started to wrap shader loading in OPENGL3Std to use GL3Shader.h
functions. This would make it less harder to port and allows a more
standartised way to print errors.
-Wrote a lot more for the 3d light structure, so the updates are faster
and number correct.

Lights are only partly working. I tried to fix them for many hours and
had only limited success. Right now they seem to work in the cubes
benchmark, seem broken in Minecraft (I added lights to that example for
testing) and in Mario example they only work on Yoshi for some reason.
Custom shaders now work and cleanup

-Added "bound_shader" identificator, so uniforms and attributes can be
set for the used (bound) shader instead of the default one all the time.
This allows custom shaders to work and I already tested some of them
(water, normal mapping, distortions etc.).
-Cleaned up shader loading - Now it uses GL3shader.h functions. This
means more consistent use, easier debugging (as the debugging functions
are inside the GL3shader.h functions) and no code duplication. This will
also make porting easier.
-Added some new functions glsl_ functions like glsl_shader_load_string()
which allows creating a shader from string. This is used to create the
project shaders at runtime.
-Most glsl_ functions are cleaner and have better debugging
capabilities.
Merge pull request #642 from enigma-dev/free_GL3_from_FFP

Free gl3 from ffp