[go: up one dir, main page]

File: cg.h

package info (click to toggle)
coin3 3.1.3-2.2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 48,368 kB
  • sloc: cpp: 314,329; ansic: 15,927; sh: 13,635; makefile: 8,772; perl: 2,149; lex: 1,302; lisp: 1,247; yacc: 184; xml: 175; sed: 68
file content (205 lines) | stat: -rw-r--r-- 5,845 bytes parent folder | download | duplicates (2)
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#ifndef COIN_GLUE_CG_H
#define COIN_GLUE_CG_H

/**************************************************************************\
 *
 *  This file is part of the Coin 3D visualization library.
 *  Copyright (C) by Kongsberg Oil & Gas Technologies.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  ("GPL") version 2 as published by the Free Software Foundation.
 *  See the file LICENSE.GPL at the root directory of this source
 *  distribution for additional information about the GNU GPL.
 *
 *  For using Coin with software that can not be combined with the GNU
 *  GPL, and for taking advantage of the additional benefits of our
 *  support services, please contact Kongsberg Oil & Gas Technologies
 *  about acquiring a Coin Professional Edition License.
 *
 *  See http://www.coin3d.org/ for more information.
 *
 *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
 *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
 *
\**************************************************************************/

#ifndef COIN_INTERNAL
#error this is a private header file
#endif

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#if 0 /* to get proper auto-indentation in emacs */
}
#endif /* emacs indentation */

#if !defined(HAVE_DYNAMIC_LINKING) && defined(HAVE_CGLIB)

/* FIXME: static linking with Cg library has not been tested
   yet. 20050125 mortene.*/

#define CGLIB_RUNTIME_LINKING 0

#include <Cg/cg.h>
#include <Cg/cgGL.h>

#else /* HAVE_DYNAMIC_LINKING || !HAVE_CGLIB */

#define CGLIB_RUNTIME_LINKING 1

/*
   We need some Cg structs and defines, so set them up here for
   runtime linking support, as we want to avoid including
   Cg/<whatever>.h.
*/

/* typedef struct _CGprogram * CGprogram; XXX */
typedef void * CGprogram;
typedef void * CGeffect;
typedef void * CGtechnique;
typedef void * CGpass;

/* typedef struct _CGcontext * CGcontext; XXX */
typedef void * CGcontext;

/* typedef struct _CGparameter *CGparameter; XXX */
typedef void * CGparameter;

typedef enum {
  CG_PROFILE_ARBVP1 = 6150,
  CG_PROFILE_ARBFP1 = 7000,
  CG_GENERIC = 7002
} CGprofile;

typedef enum {
  CG_NO_ERROR = 0
} CGerror;

typedef enum {
  CG_SOURCE = 4112
} CGenum;

typedef enum {
  CG_GL_MATRIX_IDENTITY = 0,
  CG_GL_MATRIX_TRANSPOSE = 1,
  CG_GL_MATRIX_INVERSE = 2,
  CG_GL_MATRIX_INVERSE_TRANSPOSE = 3,

  CG_GL_MODELVIEW_MATRIX = 4,
  CG_GL_PROJECTION_MATRIX = 5,
  CG_GL_TEXTURE_MATRIX = 6,
  CG_GL_MODELVIEW_PROJECTION_MATRIX = 7,

  CG_GL_VERTEX = 8,
  CG_GL_FRAGMENT = 9
} CGGLenum;

typedef enum {
  CG_UNKNOWN_TYPE = 0,
  CG_STRUCT = 1,
  CG_ARRAY = 2,

  CG_FLOAT = 1045,
  CG_FLOAT1 = 1091,
  CG_FLOAT2 = 1046,
  CG_FLOAT3 = 1047,
  CG_FLOAT4 = 1048,
  CG_FLOAT2x2 = 1054,
  CG_FLOAT3x3 = 1059,
  CG_FLOAT4x4 = 1064,
  CG_SAMPLER1D = 1065,
  CG_SAMPLER2D = 1066,
  CG_SAMPLER3D = 1067,
  CG_SAMPLERRECT = 1068,
  CG_SAMPLERCUBE = 1069,
  CG_INT = 1093,
  CG_INT1 = 1094
} CGtype;

typedef int CGbool;
typedef void (* CGerrorCallbackFunc)(void);

#endif /* HAVE_DYNAMIC_LINKING */

int cc_cgglue_available(void);

CGcontext glue_cgCreateContext(void);
void glue_cgDestroyContext(CGcontext);
CGbool glue_cgIsContext(CGcontext);
const char * glue_cgGetLastListing(CGcontext);

CGprogram glue_cgCreateProgram(CGcontext, CGenum, const char *, CGprofile,
                               const char *, const char **);
void glue_cgDestroyProgram(CGprogram);
CGbool glue_cgIsProgram(CGprogram);


const char * glue_cgGetProfileString(CGprofile);

CGerror glue_cgGetError(void);
const char * glue_cgGetErrorString(CGerror);
void glue_cgSetErrorCallback(CGerrorCallbackFunc);

CGbool glue_cgIsParameter(CGparameter);
CGtype glue_cgGetParameterType(CGparameter);
CGparameter glue_cgGetNamedParameter(CGprogram, const char *);

const char * glue_cgGetTypeString(CGtype);

CGbool glue_cgGLIsProfileSupported(CGprofile);
void glue_cgGLEnableProfile(CGprofile);
void glue_cgGLDisableProfile(CGprofile);
CGprofile glue_cgGLGetLatestProfile(CGGLenum);

void glue_cgGLLoadProgram(CGprogram);
void glue_cgGLBindProgram(CGprogram);

void glue_cgGLSetParameter1f(CGparameter, float);
void glue_cgGLSetParameter2f(CGparameter, float, float);
void glue_cgGLSetParameter3f(CGparameter, float, float, float);
void glue_cgGLSetParameter4f(CGparameter, float, float, float, float);
void glue_cgGLSetStateMatrixParameter(CGparameter, CGGLenum, CGGLenum);

void glue_cgGLSetParameterArray1f(CGparameter, long, long, const float *);
void glue_cgGLSetParameterArray2f(CGparameter, long, long, const float *);
void glue_cgGLSetParameterArray3f(CGparameter, long, long, const float *);
void glue_cgGLSetParameterArray4f(CGparameter, long, long, const float *);

void glue_cgGLSetMatrixParameterfc(CGparameter, const float *);
void glue_cgGLSetMatrixParameterArrayfc(CGparameter, long, long, const float *);

int glue_cgGetArrayDimension(CGparameter);
int glue_cgGetArraySize(CGparameter, int);

/* texture parameters */
void glue_cgGLSetManageTextureParameters(CGcontext, CGbool);

/* CgFx */
int glue_cgglue_cgfx_available();
CGeffect glue_cgCreateEffect(CGcontext, const char *, const char **);
CGprogram glue_cgCreateProgramFromEffect(CGeffect, CGprofile, const char * entry, const char ** args);
void glue_cgDestroyEffect(CGeffect);
CGbool glue_cgIsEffect(CGeffect);
void glue_cgGLRegisterStates(CGcontext);

CGtechnique glue_cgGetFirstTechnique(CGeffect);
CGtechnique glue_cgGetNextTechnique(CGtechnique);
CGbool glue_cgValidateTechnique(CGtechnique);

CGpass glue_cgGetFirstPass(CGtechnique);
CGpass glue_cgGetNextPass(CGpass);
void glue_cgSetPassState(CGpass);
void glue_cgResetPassState(CGpass);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* !COIN_GLUE_CG_H */