16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 05:49:19 +02:00

Merge branch 'tmj-dev' into dev

This commit is contained in:
milek7
2017-12-25 18:27:10 +01:00
65 changed files with 5288 additions and 4558 deletions

View File

@@ -15,13 +15,6 @@ http://mozilla.org/MPL/2.0/.
#include "GL/glew.h"
#include "ResourceManager.h"
enum class resource_state {
none,
loading,
good,
failed
};
struct opengl_texture {
static DDSURFACEDESC2 deserialize_ddsd(std::istream&);
static DDCOLORKEY deserialize_ddck(std::istream&);
@@ -79,7 +72,6 @@ private:
};
typedef int texture_handle;
int const null_handle = 0;
class texture_manager {
@@ -89,13 +81,16 @@ public:
void
assign_units( GLint const Helper, GLint const Shadows, GLint const Normals, GLint const Diffuse );
// activates specified texture unit
void
unit( GLint const Textureunit );
// creates texture object out of data stored in specified file
texture_handle
create( std::string Filename, bool const Loadnow = true );
// binds specified texture to specified texture unit
void
bind( std::size_t const Unit, texture_handle const Texture );
// provides direct access to specified texture object
opengl_texture &
texture( texture_handle const Texture ) const { return *(m_textures[ Texture ].first); }
// performs a resource sweep
@@ -109,7 +104,7 @@ private:
// types:
typedef std::pair<
opengl_texture *,
std::chrono::steady_clock::time_point > texturetimepoint_pair;
resource_timestamp > texturetimepoint_pair;
typedef std::vector< texturetimepoint_pair > texturetimepointpair_sequence;
@@ -187,7 +182,7 @@ downsample( std::size_t const Width, std::size_t const Height, char *Imagedata )
(*sampler)[idx]
+ ( *( sampler + 1 ) )[idx]
+ ( *( sampler + Width ) )[idx]
+ (*( sampler + Width + 1 ))[idx] );
+ ( *( sampler + Width + 1 ))[idx] );
color[ idx ] = component /= 4;
}
*destination++ = color;