FreeWRL / FreeX3D 4.3.0
RenderFuncs.h
1/*
2
3
4Proximity sensor macro.
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_SCENEGRAPH_RENDERFUNCS_H__
29#define __FREEWRL_SCENEGRAPH_RENDERFUNCS_H__
30
31void enableGlobalShader(s_shader_capabilities_t *);
32void resetGlobalShader(void);
33void finishedWithGlobalShader(void);
34
35/* trat: test if a ratio is reasonable */
36#define TRAT(a) ((a) > 0 && ((a) < gglobal()->RenderFuncs.hitPointDist || gglobal()->RenderFuncs.hitPointDist < 0))
37
38/* structure for rayhits */
39struct currayhit {
40 struct X3D_Node *hitNode; /* What node hit at that distance? */
41 GLDOUBLE modelMatrix[16]; /* What the matrices were at that node */
42 GLDOUBLE projMatrix[16];
43 GLDOUBLE justModel[16]; //view taken off, so transfroms from geometry-local to World
44};
45
46void get_current_ray(struct point_XYZ* p1, struct point_XYZ* p2);
47extern struct point_XYZ r1, r2; /* in VRMLC.pm */
48
49
50/* function protos */
51void render_node(struct X3D_Node *node);
52
53struct X3D_Anchor *AnchorsAnchor();
54void setAnchorsAnchor(struct X3D_Anchor* anchor);
55
56void clearLightTable();
57int nextlight(void);
58void projectorTable_clear();
59
60void setLightState(GLint light, int status);
61void setLightType(GLint light, int type);
62//JAS void saveLightState2(int *ls);
63//JAS void restoreLightState2(int ls);
64void setLightChangedFlag(GLint light);
65void fwglLightfv (int light, int pname, GLfloat *params);
66void fwglLightf (int light, int pname, GLfloat param);
67void initializeLightTables(void);
68void sendAttribToGPU(int myType, int mySize, int xtype, int normalized, int stride, float *pointer, int, char*, int);
69void sendArraysToGPU (int mode, int first, int count);
70void sendBindBufferToGPU (GLenum target, GLuint buffer,char *, int);
71void sendElementsToGPU (int mode, int count, unsigned short *indices);
72void render_hier(struct X3D_Node *p, int rwhat);
73void sendLightInfo (s_shader_capabilities_t *me);
74void restoreGlobalShader();
75
76
77typedef struct ivec4 {int X; int Y; int W; int H;} ivec4;
78typedef struct ivec2 {int X; int Y;} ivec2;
79void pushviewport(Stack *vpstack, ivec4 vp);
80void popviewport(Stack *vpstack);
81void setcurrentviewport(Stack *_vpstack);
82int currentviewportvisible(Stack *vpstack);
83
84typedef struct usehit {
85 struct X3D_Node *node;
86 double mvm[16];
87 void *userdata;
88} usehit;
89void usehit_add(struct X3D_Node *node, double *modelviewmatrix);
90void usehit_add2(struct X3D_Node *node, double *modelviewmatrix, void *userdata);
91usehit * usehit_next(struct X3D_Node *node, usehit* lasthit);
92void usehit_clear();
93void usehitB_add(struct X3D_Node *node, double *modelviewmatrix);
94void usehitB_add2(struct X3D_Node *node, double *modelviewmatrix, void *userdata);
95usehit * usehitB_next(struct X3D_Node *node, usehit* lasthit);
96Stack *getUseHitBStack();
97void usehitB_clear();
98bool setupShaderB();
99#endif /* __FREEWRL_SCENEGRAPH_RENDERFUNCS_H__ */