Rename Fluid class to sreFluid
Eliminate unnecessary shaders when shadow mapping or HDR is disabled

When certain rendering options, such as shadow mapping and HDR
rendering, are disabled (as is the case for OPENGL_ES2), eliminate
unused code and do not load shaders that will not be used. The
shader lists used when initializing shaders before a lighting pass
during multi-pass rendering is also optimized.

Overall, this optimization should improve performance a little
because of slightly faster code and reduced GPU memory usage
(unused shaders), apart from a reduction in binary code size.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Delay caching of geometry scissors by one frame

Delay the caching of geometry scissors by one frame after the
frustum becomes stationary. This avoids the overhead of storing
scissors in the geometry scissors caches when the frustum is
continuously changing (as commonly happens).

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Split off preprocessing functions from geometry.cpp into preprocess.cpp

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Implement global texture detail setting, and improve texture handling

Add global texture detail setting, which can automatically reduce
the size of used textures, either by ommitting the largest compressed
mipmap levels, or for uncompressed textures by generating a downscaled
texture if no mipmaps are defined. The mipmap generation code from
texgenpack is used for this purpose, which allows for future
flexibility.

Although functional, the texture data structures and handling still
need redesign in the future, possibly borrowing from texgenpack's
texture handling.

This commit also moves some inline general functions like min/max
from sre_bounds.h to sreVectorMath.h.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Fix missing install of sreVectorMath.h

The required header file sreVectorMath.h was previously not
installed, while it is included from sre.h (the only other
header file required for using the library). It is now
installed together with sre.h.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Fix OpenGL compilation by removing stray newlines in sre.cpp.
Improve handling of NPOT textures, and update textures used

Detect non-power-of-2 texture capabilities of the hardware,
and limit the number of mipmaps to one when necessary.

Streamline the texture loading functions somewhat.

A previously missing small transparent texture in demo7
(when run with OpenGL) has been added.

The non-power-of-two beachball texture has been renamed and
multiple mipmaps provided for platforms that support it.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Fix compilation on OpenGL ES-2.0, and tweak NPOT support

Support for mipmapped compressed NPOT textures is enabled for
OpenGL, even though it might not be a good idea generally since
the compressed texture mipmaps will have non-multiple-of-four
dimensions.

Unsurpisingly, this combination doesn't work on the OpenGL ES 2.0
Mali-400 platform, so it is disabled. But a non-mipmapped
compressed texture with a height that is not a multiple of four
seems to work.
Reshuffle texture files

Some texture files are added, providing both ETC1 (in .ktx format)
and DXT1 (in .dds) format versions for all textures. One is renamed.
Some unused ones are deleted.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Create texture creation functions and use them for player sphere

Create functions to create simple checkboard or stripe textures
using selected colors.

A striped texture is used on the player (control object) spere,
giving a much better sense of movement.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Split off bounding volumes and RNG from sre.h and add sreRNG class

Split off bounding volume class defintions into their own header
file (sreBoundingVolume.h). This part is usable without including
sre.h.

Similarly, split off the random number generators class definitions
into sreRandom.h. This is also usable without including sre.h. The
sreDefaultRNG class has been renamed sreCMWCRNG, while the
sreGenericRNG class has been renamed sreRNG. This changes the API
for the random number generator from the one used in SRE v0.1.
The RNG module maintains a default RNG, which is preinitialized
with a standard sreCMWCRNG at program startup. This is also the
default RNG used by other parts of the SRE library (currently
one function in the Color class). It is now possible to change
the default RNG to any user defined one.

The header files sreBoundingVolume.h and sreRandom.h are now installed
together with sre.h.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Optimize the random number generator

Optimize general random generator function RandomInt(n), limiting
bias to a controlled amount.

Fix RandomFloat(float range) to not unnecessarily loose precision
during calculation.

Add comments for the functions in the class header and add new
high precision functions.

The improvements still have to be properly tested and validated.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Provide highly optimized rewrite of random number generator class

The random number generator class has been rewritten to be highly
optimized and comprehensive. A new "empirical" strategy to obtain
random integers in a non-power-of-two range has been added which
provides improved performance. The module has several parameters
configurable at compile-time.

The integer range random number functions have been fairly well
tested. The set of floating point random number functions has
been extended with versions with different levels of precision
(at the cost of execution time) and attention has been paid to
maximizing the precision of the floating point values returned.
The floating point functions have yet to be properly validated.

Although currently included in SRE, where it does not serve a
critical function, the RNG module essentially has no dependencies
and can be used seperately. Its optimized implementation could
benefit software like libfgen which would need some work to adopt
the new algorithms.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Modify RNG function call in demo8 to be compatible with new interface
Provide a testing and validating program for the RNG

A testing and validation program for the random number generator
module is provided. It does performance tests and validates
the random number functions that have an integer range by
comparing the standard deviation of generated numbers to the
one expected statistically. The CMWC RNG, although fast and
simple, seems to be robust with regard to the statistical
distribution of the random numbers, even with a small state size.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Add textual output functions to Vector-based classes

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Change window title when using OpenGL X11 back-end
Update demo4 and add demo4b

Update demo4 (a navigable highly detailed Earth model) to work better with
the current version of the library. Add demo4b which provides a
choreographed view of a spinning Earth as well as close-up terrain
flyovers, without user control.

The required detailed earth surface color, specularity, night color, and
elevation map textures, which have very large file size, are not provided
in this repository, so demo4/4b are not functional as provided. However,
it is possible to change the code (demo4.cpp) to use different textures,
and texture size and other parameters are configurable, which means demo4
should be be adaptable to other combinations of color and elevation map
textures (with optional specularity and dark side textures) that are laid
out in a longitude/latitude configuration, such as different satellite-
based data sets of the Earth or other planets or moons, or artificially
generated ones.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
Add support for single-component textures (uncompressed)

Loading of uncompressed single-component (which can be described
as grayscale, red-only, or luminance) textures from a PNG file is
now supported, including uploading to video memory. This should bring
performance improvement when single component textures are used.
Support for single-component texture compression formats still has
to be completed.

Also add support for the loading into system memory, but not
uploading to video memory, of 16-bit color component textures. This
is utilized in demo4(b) to allow for an elevation map with higher
precision (which is used to generate the terrain mesh, and not
directly used on the GPU).

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>