FreeWRL/FreeX3D
3.0.0
Main Page
Related Pages
Data Structures
Files
File List
CFieldDecls.h
1
/*
2
3
4
This is a common base class for FieldDeclarations on PROTOs and Scripts
5
6
*/
7
8
/****************************************************************************
9
This file is part of the FreeWRL/FreeX3D Distribution.
10
11
Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
12
13
FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
14
it under the terms of the GNU Lesser Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
FreeWRL/FreeX3D is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
25
****************************************************************************/
26
27
28
#ifndef __FREEWRL_FIELD_DECLS_H__
29
#define __FREEWRL_FIELD_DECLS_H__
30
31
/*for fixed fields built into nodes (vs dynamic fields - see ShaderFieldDecl)*/
32
struct
FieldDecl
33
{
34
indexT PKWmode;
/* PKW_initializeOnly PKW_inputOutput, PKW_inputOnly, PKW_outputOnly */
35
indexT fieldType;
/* field type ,eg FIELDTYPE_MFInt32 */
36
indexT lexerNameIndex;
/* field "name" (its lexer-index) */
37
indexT JSparamNameIndex;
/* JSparamname - has index unique with fieldType */
38
int
shaderVariableID;
/* glGetUniformLocation() cast to int. dug9_2014 Q. could this be moved to ShaderFieldDecl? */
39
};
40
41
/* Constructor and destructor */
42
/* ************************** */
43
44
struct
FieldDecl
* newFieldDecl(indexT, indexT, indexT,
int
,
int
);
45
#define deleteFieldDecl(me) \
46
FREE_IF_NZ(me)
47
48
/* Copies */
49
#define fieldDecl_copy(me) \
50
newFieldDecl((me)->PKWmode, (me)->fieldType, (me)->lexerNameIndex, \
51
(me)->JSparamNameIndex, (me)->shaderVariableID)
52
53
/* Accessors */
54
/* ********* */
55
56
#define fieldDecl_getType(me) \
57
((me)->fieldType)
58
#define fieldDecl_getAccessType(me) \
59
((me)->PKWmode)
60
#define fieldDecl_getShaderScriptIndex(me) \
61
((me)->JSparamNameIndex)
62
#define fieldDecl_getIndexName(me) \
63
((me)->lexerNameIndex)
64
#define fieldDecl_getshaderVariableID(me) \
65
(GLint) ((me)->shaderVariableID)
66
67
#define fieldDecl_setshaderVariableID(me,varid) \
68
((me)->shaderVariableID) = (GLint) (varid)
69
70
#define fieldDecl_getShaderScriptName(me) \
71
(JSparamnames[fieldDecl_getShaderScriptIndex(me)].name)
72
73
#define fieldDecl_getStringName(lex, me) \
74
lexer_stringUser_fieldName(lex, fieldDecl_getIndexName(me), \
75
fieldDecl_getAccessType(me))
76
77
/* Other members */
78
/* ************* */
79
80
/* Check if this is a given field */
81
#define fieldDecl_isField(me, nam, mod) \
82
((me)->lexerNameIndex==(nam) && (me)->PKWmode==(mod))
83
84
85
#endif
/* __FREEWRL_FIELD_DECLS_H__ */
FieldDecl
Definition:
CFieldDecls.h:32
src
lib
vrml_parser
CFieldDecls.h
Generated on Thu Dec 14 2017 12:14:45 for FreeWRL/FreeX3D by
1.8.6