git-svn-id: svn://db.shs.com.ru/libs@42 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -134,10 +134,12 @@ inline double urand(const double & scale = 1.) {return ((double)rand() / RAND_MA
|
||||
// return [0, 1]
|
||||
inline double uprand(const double & scale = 1.) {return ((double)rand() / RAND_MAX) * scale;}
|
||||
QString readCharsUntilNull(QDataStream & s);
|
||||
QString findFile(const QString & file, const QStringList & pathes);
|
||||
inline QColor operator *(const QColor & c, double v) {return QColor(c.red() * v, c.green() * v, c.blue() * v, c.alpha() * v);}
|
||||
inline QColor operator /(const QColor & c, double v) {return QColor(c.red() / v, c.green() / v, c.blue() / v, c.alpha() / v);}
|
||||
|
||||
inline void qglColor(const QColor & c) {glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());}
|
||||
void qglMultMatrix(const QMatrix4x4 & m);
|
||||
inline void glActiveTextureChannel(int channel) {glActiveTexture(GL_TEXTURE0 + channel); glClientActiveTexture(GL_TEXTURE0 + channel);}
|
||||
inline void glResetAllTransforms() {glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity();}
|
||||
inline void glClearError() {int c = 100; while (glGetError() != GL_NO_ERROR && --c > 0) glGetError();}
|
||||
@@ -227,12 +229,16 @@ class GLTextureManager;
|
||||
|
||||
class GLTextureManagerBase {
|
||||
public:
|
||||
static GLuint loadTexture(const QString & path, bool ownership = true);
|
||||
static GLuint loadTexture(const QImage & image, bool ownership = true);
|
||||
int textureID(const QString & path) {return tex_ids[path];}
|
||||
static void addSearchPath(const QString & path) {search_pathes << path;}
|
||||
static QStringList searchPathes() {return search_pathes;}
|
||||
static GLuint loadTexture(const QString & path, bool ownership = true, bool bump = false);
|
||||
static GLuint loadTexture(const QImage & image, bool ownership = true, bool bump = false);
|
||||
int textureID(const QString & path, bool bump = false) {return tex_ids[bump ? 1 : 0][path];}
|
||||
|
||||
protected:
|
||||
QMap<QString, GLuint> tex_ids;
|
||||
static void convertToNormal(QImage & im);
|
||||
static QStringList search_pathes;
|
||||
QMap<QString, GLuint> tex_ids[2];
|
||||
|
||||
};
|
||||
|
||||
@@ -335,6 +341,7 @@ struct Map {
|
||||
struct Material {
|
||||
enum LightModel {Phong = 0, CookTorrance = 1, Minnaert = 2, Strauss = 3, OrenNayar = 4};
|
||||
Material();
|
||||
QString name;
|
||||
void apply();
|
||||
void loadTextures(GLTextureManagerBase * tm = 0);
|
||||
QColor color_diffuse;
|
||||
|
||||
Reference in New Issue
Block a user