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);
55void projectorTable_clear();
56
57void sendAttribToGPU(int myType, int mySize, int xtype, int normalized, int stride, void *pointer, int, char*, int);
58void sendArraysToGPU (int mode, int first, int count);
59void sendBindBufferToGPU (GLenum target, GLuint buffer,char *, int);
60void sendElementsToGPU (int mode, int count, int *indices);
61void sendElementsToGPU0 (int mode, int count, int type, void *indices);
62void saveElementsForGPU0(int mode, int count, int type, void* indices);
63void render_hier(struct X3D_Node *p, int rwhat);
64void render_hier2(struct X3D_Node* g, int rwhat);
65void restoreGlobalShader();
66
67
68typedef struct ivec4 {int X; int Y; int W; int H;} ivec4;
69typedef struct ivec2 {int X; int Y;} ivec2;
70void pushviewport(Stack *vpstack, ivec4 vp);
71void popviewport(Stack *vpstack);
72void setcurrentviewport(Stack *_vpstack);
73int currentviewportvisible(Stack *vpstack);
74
75typedef struct usehit {
76 struct X3D_Node *node;
77 double mvm[16];
78 double extra[16];
79 int ivalue;
80 void *userdata;
81} usehit;
82void usehit_add(struct X3D_Node *node, double *modelviewmatrix);
83void usehit_add2(struct X3D_Node *node, double *modelviewmatrix, void *userdata);
84usehit * usehit_next(struct X3D_Node *node, usehit* lasthit);
85void usehit_clear();
86void usehitB_add(struct X3D_Node *node, double *modelviewmatrix);
87void usehitB_add2(struct X3D_Node *node, double *modelviewmatrix, void *userdata);
88usehit * usehitB_next(struct X3D_Node *node, usehit* lasthit);
89Stack *getUseHitBStack();
90void usehitB_clear();
91int setupShaderB();
92//we 'render' bounding boxes, so each geom does setExtent / union of extents on render_ pass
93void push_group_extent_default();
94void pop_group_extent();
95void push_group_extent_default();
96float * peek_group_extent();
97void union_group_extent(float *e6);
98struct BBoxFields {
99 struct SFVec3f bboxCenter;
100 struct SFVec3f bboxSize;
101 int visible;
102 int bboxDisplay;
103
104};
105void prep_BBox(struct BBoxFields *bfields);
106void fin_BBox(struct X3D_Node *node, struct BBoxFields *bfields, int transtype);
107//transform-type grouping nodes need to convert children's bounding box into parent coordinate system _extent
108void push_transform_local(double *mat);
109void push_transform_local_identity();
110void pop_transform_local();
111double * peek_transform_local();
112void reset_transform_local(double *mat);
113void multiply_transform_local(double *mat);
114struct X3D_Node* get_executionContext();
115void push_executionContext(struct X3D_Node* broto);
116void pop_executionContext();
117#endif /* __FREEWRL_SCENEGRAPH_RENDERFUNCS_H__ */