summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/Plugins/RenderingEngines/OpenGL/NXOpenGLMaterial.h
blob: 03f2f1f1c178a79407c88e1fa6e86ef3e390ac32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2008 Nanorex, Inc.  See LICENSE file for details.

#ifndef NX_OPENGLMATERIAL_H
#define NX_OPENGLMATERIAL_H

/* CLASS: NXOpenGLMaterial */
/**
 * Lightweight OpenGL material information for use in class NXAtomRenderData
 */
struct NXOpenGLMaterial {
    GLenum face;
    GLfloat ambient[4];
    GLfloat diffuse[4];
    GLfloat specular[4];
    GLfloat emission[4];
    GLfloat shininess;
    
    NXOpenGLMaterial(GLenum whichFace = GL_FRONT) {
        face = whichFace;
        ambient[0] = -1.0f;
        diffuse[0] = -1.0f;
        specular[0] = -1.0f;
        emission[0] = -1.0f;
        shininess = 35.0;
    };
    
    ~NXOpenGLMaterial() {}
    
    bool invalid(void) const {
        return ((face != GL_FRONT &&
                 face != GL_BACK &&
                 face != GL_FRONT_AND_BACK) ||
                ambient[0] < 0.0 ||
                diffuse[0] < 0.0 ||
                specular[0] < 0.0 ||
                emission[0] < 0.0);
    }
    
    bool valid(void) const { return !invalid(); }
};


#endif // NX_OPENGLMATERIAL_H