1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_STATE_LIGHTING_H
|
---|
8 | #define CR_STATE_LIGHTING_H
|
---|
9 |
|
---|
10 | #include "state/cr_statetypes.h"
|
---|
11 |
|
---|
12 | #include <iprt/cdefs.h>
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | extern "C" {
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | typedef struct {
|
---|
19 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
20 | CRbitvalue enable[CR_MAX_BITARRAY];
|
---|
21 | CRbitvalue ambient[CR_MAX_BITARRAY];
|
---|
22 | CRbitvalue diffuse[CR_MAX_BITARRAY];
|
---|
23 | CRbitvalue specular[CR_MAX_BITARRAY];
|
---|
24 | CRbitvalue position[CR_MAX_BITARRAY];
|
---|
25 | CRbitvalue attenuation[CR_MAX_BITARRAY];
|
---|
26 | CRbitvalue spot[CR_MAX_BITARRAY];
|
---|
27 | } CRLightBits;
|
---|
28 |
|
---|
29 | typedef struct {
|
---|
30 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
31 | CRbitvalue shadeModel[CR_MAX_BITARRAY];
|
---|
32 | CRbitvalue colorMaterial[CR_MAX_BITARRAY];
|
---|
33 | CRbitvalue lightModel[CR_MAX_BITARRAY];
|
---|
34 | CRbitvalue material[CR_MAX_BITARRAY];
|
---|
35 | CRbitvalue enable[CR_MAX_BITARRAY];
|
---|
36 | CRLightBits *light;
|
---|
37 | } CRLightingBits;
|
---|
38 |
|
---|
39 | typedef struct {
|
---|
40 | GLboolean enable;
|
---|
41 | GLcolorf ambient;
|
---|
42 | GLcolorf diffuse;
|
---|
43 | GLcolorf specular;
|
---|
44 | GLvectorf position;
|
---|
45 | GLvectorf objPosition;
|
---|
46 | GLfloat constantAttenuation;
|
---|
47 | GLfloat linearAttenuation;
|
---|
48 | GLfloat quadraticAttenuation;
|
---|
49 | GLvectorf spotDirection;
|
---|
50 | GLfloat spotExponent;
|
---|
51 | GLfloat spotCutoff;
|
---|
52 | } CRLight;
|
---|
53 |
|
---|
54 | typedef struct {
|
---|
55 | GLboolean lighting;
|
---|
56 | GLboolean colorMaterial;
|
---|
57 | GLenum shadeModel;
|
---|
58 | GLenum colorMaterialMode;
|
---|
59 | GLenum colorMaterialFace;
|
---|
60 | GLcolorf ambient[2]; /* material front/back */
|
---|
61 | GLcolorf diffuse[2]; /* material front/back */
|
---|
62 | GLcolorf specular[2]; /* material front/back */
|
---|
63 | GLcolorf emission[2]; /* material front/back */
|
---|
64 | GLfloat shininess[2]; /* material front/back */
|
---|
65 | GLint indexes[2][3]; /* material front/back amb/diff/spec */
|
---|
66 | GLcolorf lightModelAmbient;
|
---|
67 | GLboolean lightModelLocalViewer;
|
---|
68 | GLboolean lightModelTwoSide;
|
---|
69 | #if defined(CR_EXT_separate_specular_color) || defined(CR_OPENGL_VERSION_1_2)
|
---|
70 | GLenum lightModelColorControlEXT; /* CR_EXT_separate_specular_color */
|
---|
71 | #endif
|
---|
72 | GLboolean colorSumEXT; /* CR_EXT_secondary_color */
|
---|
73 | CRLight *light;
|
---|
74 | } CRLightingState;
|
---|
75 |
|
---|
76 | DECLEXPORT(void) crStateLightingInitBits (CRLightingBits *l);
|
---|
77 | DECLEXPORT(void) crStateLightingDestroyBits (CRLightingBits *l);
|
---|
78 | DECLEXPORT(void) crStateLightingInit (CRContext *ctx);
|
---|
79 | DECLEXPORT(void) crStateLightingDestroy (CRContext *ctx);
|
---|
80 |
|
---|
81 | DECLEXPORT(void) crStateLightingDiff(CRLightingBits *bb, CRbitvalue *bitID,
|
---|
82 | CRContext *fromCtx, CRContext *toCtx);
|
---|
83 | DECLEXPORT(void) crStateLightingSwitch(CRLightingBits *bb, CRbitvalue *bitID,
|
---|
84 | CRContext *fromCtx, CRContext *toCtx);
|
---|
85 |
|
---|
86 | DECLEXPORT(void) crStateColorMaterialRecover( void );
|
---|
87 |
|
---|
88 | #ifdef __cplusplus
|
---|
89 | }
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | #endif /* CR_STATE_LIGHTING_H */
|
---|