File: rtshadow.h

package info (click to toggle)
glut 3.7-14
  • links: PTS
  • area: main
  • in suites: woody
  • size: 12,556 kB
  • ctags: 45,170
  • sloc: ansic: 148,716; makefile: 35,208; ada: 2,062; yacc: 473; fortran: 290; lex: 131; csh: 51; sed: 49; sh: 33
file content (182 lines) | stat: -rw-r--r-- 4,174 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#ifndef __rtshadow_h__
#define __rtshadow_h__

/* Copyright (c) Mark J. Kilgard, 1997, 1998. */

/* This program is freely distributable without licensing fees and is
   provided without guarantee or warrantee expressed or implied.  This
   program is -not- in the public domain. */

/* Real-time Shadowing library, Version 0.96 */

#if defined(_WIN32)

/* Try to avoid including <windows.h> to avoid name space
   pollution, but Win32's <GL/gl.h> needs APIENTRY and
   WINGDIAPI defined properly. */
# if 0
#  define  WIN32_LEAN_AND_MEAN
#  include <windows.h>
# else
   /* This is from Win32's <windef.h> */
#  ifndef APIENTRY
#   if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#    define APIENTRY    __stdcall
#   else
#    define APIENTRY
#   endif
#  endif
#  ifndef CALLBACK
    /* This is from Win32's <winnt.h> */
#   if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
#    define CALLBACK __stdcall
#   else
#    define CALLBACK
#   endif
#  endif
   /* This is from Win32's <wingdi.h> and <winnt.h> */
#  ifndef WINGDIAPI
#   define WINGDIAPI __declspec(dllimport)
#  endif
   /* XXX This is from Win32's <ctype.h> */
#  ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#   define _WCHAR_T_DEFINED
#  endif
# endif

#pragma warning (disable:4244)	/* Disable bogus conversion warnings. */
#pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */

#endif

#include <GL/gl.h>
#include <GL/glu.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
  RTS_ERROR_OUT_OF_MEMORY,
  RTS_WARNING_EYE_IN_SHADOW,
  RTS_WARNING_LIGHT_TOO_CLOSE
};

typedef enum {
  RTS_OFF,
  RTS_SHINING,
  RTS_SHINING_AND_CASTING
} RTSlightState;

typedef enum {
  RTS_NOT_SHADOWING,
  RTS_SHADOWING
} RTSobjectState;

typedef enum {
  RTS_NO_SHADOWS,
  RTS_USE_SHADOWS,
  RTS_USE_SHADOWS_NO_OVERLAP
} RTSmode;

typedef struct RTSscene RTSscene;
typedef struct RTSlight RTSlight;
typedef struct RTSobject RTSobject;

typedef void (*RTSerrorHandler)(int error, char *message);
typedef void (*RTSrenderSceneFunc)(GLenum castingLight, void *sceneData, RTSscene *scene);

extern RTSscene *rtsCreateScene(
  GLfloat eyePos[3],
  GLbitfield usableStencilBits,
  RTSrenderSceneFunc func,
  void *sceneData);
extern RTSlight *rtsCreateLight(
  GLenum glLight,
  GLfloat lightPos[3],
  GLfloat radius);
extern RTSobject *rtsCreateObject(
  GLfloat objectPos[3],
  GLfloat maxRadius,
  void (*renderObject) (void *objectData),
  void *objectData,
  int feedbackBufferSizeGuess);

extern void rtsAddLightToScene(
  RTSscene * scene,
  RTSlight * light);
extern void rtsAddObjectToLight(
  RTSlight * light,
  RTSobject * object);

extern void rtsRemoveLightFromScene(
  RTSscene * scene,
  RTSlight * light);
extern void rtsRemoveObjectFromLight(
  RTSlight * light,
  RTSobject * object);

extern void rtsSetLightState(
  RTSlight * light,
  RTSlightState state);
extern void rtsSetObjectState(
  RTSobject * object,
  RTSobjectState state);

extern void rtsUpdateEyePos(
  RTSscene * scene,
  GLfloat eyePos[3]);
extern void rtsUpdateUsableStencilBits(
  RTSscene * scene,
  GLbitfield usableStencilBits);

extern void rtsUpdateLightPos(
  RTSlight * light,
  GLfloat lightPos[3]);
extern void rtsUpdateLightRadius(
  RTSlight * light,
  GLfloat lightRadius);

extern void rtsUpdateObjectPos(
  RTSobject * object,
  GLfloat objectPos[3]);
extern void rtsUpdateObjectShape(
  RTSobject * object);
extern void rtsUpdateObjectMaxRadius(
  RTSobject * object,
  GLfloat maxRadius);

extern void rtsFreeScene(
  RTSscene * scene);
extern void rtsFreeLight(
  RTSlight * light);
extern void rtsFreeObject(
  RTSobject * object);

extern int rtsTriviallyOutsideShadowVolume(
  RTSscene * scene,
  GLfloat objectPos[3],
  GLfloat maxRadius);

extern void rtsRenderScene(
  RTSscene * scene,
  RTSmode mode);

extern void rtsRenderSilhouette(
  RTSscene * scene,
  RTSlight * light,
  RTSobject * object);

extern RTSerrorHandler rtsSetErrorHandler(
  RTSerrorHandler handler);

extern void rtsStencilRenderingInvariantHack(
  RTSscene * scene,
  GLboolean enableHack);

#ifdef __cplusplus
}

#endif
#endif /* __rtshadow_h__ */