From adfa666208bbf720e0dd33602661384b146e5268 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 19 Feb 2012 17:46:50 +0100 Subject: FBO example added --- samples/OpenGL/framebuffer/Makefile | 5 + samples/OpenGL/framebuffer/minimalfbo.c | 217 +++++++++++++++++++++ .../texture_distortion_glsl.c | 2 +- samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 2 + samples/OpenGL/x11argb_opengl_glsl/Makefile | 2 + .../x11argb_opengl_glsl/x11argb_opengl_glsl.c | 2 +- 6 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 samples/OpenGL/framebuffer/Makefile create mode 100644 samples/OpenGL/framebuffer/minimalfbo.c diff --git a/samples/OpenGL/framebuffer/Makefile b/samples/OpenGL/framebuffer/Makefile new file mode 100644 index 0000000..60077c0 --- /dev/null +++ b/samples/OpenGL/framebuffer/Makefile @@ -0,0 +1,5 @@ +OBJS = minimalfbo.o + +minimalfbo: $(OBJS) + $(CC) -o minimalfbo $(OBJS) -lm -lGL -lGLU -lGLEW -lglut + diff --git a/samples/OpenGL/framebuffer/minimalfbo.c b/samples/OpenGL/framebuffer/minimalfbo.c new file mode 100644 index 0000000..f61d9de --- /dev/null +++ b/samples/OpenGL/framebuffer/minimalfbo.c @@ -0,0 +1,217 @@ +#include +#include + +#include +#include +#include + +void init(); +void reshape(int width, int height); +void display(); + +int const fbo_width = 512; +int const fbo_height = 512; + +GLuint fb, color, depth; + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow("FBO test"); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutIdleFunc(glutPostRedisplay); + + glewInit(); + + init(); + glutMainLoop(); + + return 0; +} + +void CHECK_FRAMEBUFFER_STATUS() +{ + GLenum status; + status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + switch(status) { + case GL_FRAMEBUFFER_COMPLETE: + break; + + case GL_FRAMEBUFFER_UNSUPPORTED: + /* choose different formats */ + break; + + default: + /* programming error; will fail on all hardware */ + fputs("Framebuffer Error\n", stderr); + exit(-1); + } +} + +float const light_dir[]={1,1,1,0}; +float const light_color[]={1,0.95,0.9,1}; + +void init() +{ + glGenFramebuffers(1, &fb); + glGenTextures(1, &color); + glGenRenderbuffers(1, &depth); + + glBindFramebuffer(GL_FRAMEBUFFER, fb); + + glBindTexture(GL_TEXTURE_2D, color); + glTexImage2D( GL_TEXTURE_2D, + 0, + GL_RGBA, + fbo_width, fbo_height, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0); + + glBindRenderbuffer(GL_RENDERBUFFER, depth); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, fbo_width, fbo_height); + glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); + + CHECK_FRAMEBUFFER_STATUS(); +} + +void reshape(int width, int height) +{ + glutPostRedisplay(); +} + +void prepare() +{ + static float a=0, b=0, c=0; + + glBindTexture(GL_TEXTURE_2D, 0); + glEnable(GL_TEXTURE_2D); + glBindFramebuffer(GL_FRAMEBUFFER, fb); + + glViewport(0,0, fbo_width, fbo_height); + + glClearColor(1,1,1,0); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, 1, 1, 10); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + + glEnable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + + glLightfv(GL_LIGHT0, GL_POSITION, light_dir); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); + + glTranslatef(0,0,-5); + + glRotatef(a, 1, 0, 0); + glRotatef(b, 0, 1, 0); + glRotatef(c, 0, 0, 1); + + glutSolidTeapot(0.75); + + a=fmod(a+0.1, 360.); + b=fmod(b+0.5, 360.); + c=fmod(c+0.25, 360.); +} + +void final() +{ + static float a=0, b=0, c=0; + + const int win_width = glutGet(GLUT_WINDOW_WIDTH); + const int win_height = glutGet(GLUT_WINDOW_HEIGHT); + const float aspect = (float)win_width/(float)win_height; + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + glViewport(0,0, win_width, win_height); + + glClearColor(1.,1.,1.,0.); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, aspect, 1, 10); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0,0,-5); + + glRotatef(b, 0, 1, 0); + + b=fmod(b+0.5, 360.); + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, color); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glDisable(GL_LIGHTING); + + float cube[][5]= + { + {-1, -1, -1, 0, 0}, + { 1, -1, -1, 1, 0}, + { 1, 1, -1, 1, 1}, + {-1, 1, -1, 0, 1}, + + {-1, -1, 1, -1, 0}, + { 1, -1, 1, 0, 0}, + { 1, 1, 1, 0, 1}, + {-1, 1, 1, -1, 1}, + }; + unsigned int faces[]= + { + 0, 1, 2, 3, + 1, 5, 6, 2, + 5, 4, 7, 6, + 4, 0, 3, 7, + 3, 2, 6, 7, + 4, 5, 1, 0 + }; + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glVertexPointer(3, GL_FLOAT, 5*sizeof(float), &cube[0][0]); + glTexCoordPointer(2, GL_FLOAT, 5*sizeof(float), &cube[0][3]); + + glCullFace(GL_BACK); + glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); + + glCullFace(GL_FRONT); + glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + +} + +void display() +{ + prepare(); + final(); + + glutSwapBuffers(); +} + diff --git a/samples/OpenGL/texture_distortion_glsl/texture_distortion_glsl.c b/samples/OpenGL/texture_distortion_glsl/texture_distortion_glsl.c index 7742746..437dd92 100644 --- a/samples/OpenGL/texture_distortion_glsl/texture_distortion_glsl.c +++ b/samples/OpenGL/texture_distortion_glsl/texture_distortion_glsl.c @@ -43,7 +43,7 @@ static const GLchar *fragment_shader_source = " float ts = gl_TexCoord[0].s;\n" " vec2 mod_texcoord = gl_TexCoord[0].st*vec2(1., 2.) + vec2(0, -0.5 + 0.5*sin(T + 1.5*ts*pi));\n" " if( mod_texcoord.t < 0. || mod_texcoord.t > 1. ) { discard; }\n" -" gl_FragColor = -texture2D(texCMYK, mod_texcoord) + texture2D(texRGB, gl_TexCoord[0].st);\n" +" gl_FragColor.rgb = -texture2D(texCMYK, mod_texcoord).xyz + texture2D(texRGB, gl_TexCoord[0].st).xyz;\n" "}\n\0"; GLuint shaderFragment = 0; diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index 8eaddf8..7a073fb 100644 --- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c +++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c @@ -423,8 +423,10 @@ static void redrawTheWindow() glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); +#if 0 glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif glLightfv(GL_LIGHT0, GL_POSITION, light0_dir); glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color); diff --git a/samples/OpenGL/x11argb_opengl_glsl/Makefile b/samples/OpenGL/x11argb_opengl_glsl/Makefile index 6c234cb..e32b597 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/Makefile +++ b/samples/OpenGL/x11argb_opengl_glsl/Makefile @@ -1,3 +1,5 @@ +CC=pcc + x11argb_opengl_glsl: x11argb_opengl_glsl.c Makefile $(CC) -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c index 643c0ca..d918f0b 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c +++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c @@ -62,7 +62,7 @@ static const GLchar *fragment_shader_source = " vec2 mod_texcoord = gl_TexCoord[0].st*vec2(1., 2.) + vec2(0, -0.5 + 0.5*sin(T + 1.5*ts*pi));\n" " if( mod_texcoord.t < 0. || mod_texcoord.t > 1. ) { discard; }\n" " gl_FragColor = -texture2D(texCMYK, mod_texcoord) + texture2D(texRGB, gl_TexCoord[0].st);\n" -" gl_FragColor.a = -0.5;\n" +" gl_FragColor.a = 1.;\n" "}\n\0"; GLuint shaderFragment = 0; -- cgit v1.2.3 From a25742b3a8878d23175f56b5cfa1753c18164550 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 19 Feb 2012 17:48:24 +0100 Subject: renamed FBO example directory --- samples/OpenGL/framebuffer/Makefile | 5 - samples/OpenGL/framebuffer/minimalfbo.c | 217 -------------------------------- samples/OpenGL/minimalfbo/Makefile | 5 + samples/OpenGL/minimalfbo/minimalfbo.c | 211 +++++++++++++++++++++++++++++++ 4 files changed, 216 insertions(+), 222 deletions(-) delete mode 100644 samples/OpenGL/framebuffer/Makefile delete mode 100644 samples/OpenGL/framebuffer/minimalfbo.c create mode 100644 samples/OpenGL/minimalfbo/Makefile create mode 100644 samples/OpenGL/minimalfbo/minimalfbo.c diff --git a/samples/OpenGL/framebuffer/Makefile b/samples/OpenGL/framebuffer/Makefile deleted file mode 100644 index 60077c0..0000000 --- a/samples/OpenGL/framebuffer/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OBJS = minimalfbo.o - -minimalfbo: $(OBJS) - $(CC) -o minimalfbo $(OBJS) -lm -lGL -lGLU -lGLEW -lglut - diff --git a/samples/OpenGL/framebuffer/minimalfbo.c b/samples/OpenGL/framebuffer/minimalfbo.c deleted file mode 100644 index f61d9de..0000000 --- a/samples/OpenGL/framebuffer/minimalfbo.c +++ /dev/null @@ -1,217 +0,0 @@ -#include -#include - -#include -#include -#include - -void init(); -void reshape(int width, int height); -void display(); - -int const fbo_width = 512; -int const fbo_height = 512; - -GLuint fb, color, depth; - -int main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); - - glutCreateWindow("FBO test"); - glutDisplayFunc(display); - glutReshapeFunc(reshape); - glutIdleFunc(glutPostRedisplay); - - glewInit(); - - init(); - glutMainLoop(); - - return 0; -} - -void CHECK_FRAMEBUFFER_STATUS() -{ - GLenum status; - status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); - switch(status) { - case GL_FRAMEBUFFER_COMPLETE: - break; - - case GL_FRAMEBUFFER_UNSUPPORTED: - /* choose different formats */ - break; - - default: - /* programming error; will fail on all hardware */ - fputs("Framebuffer Error\n", stderr); - exit(-1); - } -} - -float const light_dir[]={1,1,1,0}; -float const light_color[]={1,0.95,0.9,1}; - -void init() -{ - glGenFramebuffers(1, &fb); - glGenTextures(1, &color); - glGenRenderbuffers(1, &depth); - - glBindFramebuffer(GL_FRAMEBUFFER, fb); - - glBindTexture(GL_TEXTURE_2D, color); - glTexImage2D( GL_TEXTURE_2D, - 0, - GL_RGBA, - fbo_width, fbo_height, - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - NULL); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0); - - glBindRenderbuffer(GL_RENDERBUFFER, depth); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, fbo_width, fbo_height); - glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); - - CHECK_FRAMEBUFFER_STATUS(); -} - -void reshape(int width, int height) -{ - glutPostRedisplay(); -} - -void prepare() -{ - static float a=0, b=0, c=0; - - glBindTexture(GL_TEXTURE_2D, 0); - glEnable(GL_TEXTURE_2D); - glBindFramebuffer(GL_FRAMEBUFFER, fb); - - glViewport(0,0, fbo_width, fbo_height); - - glClearColor(1,1,1,0); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45, 1, 1, 10); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); - - glEnable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); - - glLightfv(GL_LIGHT0, GL_POSITION, light_dir); - glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); - - glTranslatef(0,0,-5); - - glRotatef(a, 1, 0, 0); - glRotatef(b, 0, 1, 0); - glRotatef(c, 0, 0, 1); - - glutSolidTeapot(0.75); - - a=fmod(a+0.1, 360.); - b=fmod(b+0.5, 360.); - c=fmod(c+0.25, 360.); -} - -void final() -{ - static float a=0, b=0, c=0; - - const int win_width = glutGet(GLUT_WINDOW_WIDTH); - const int win_height = glutGet(GLUT_WINDOW_HEIGHT); - const float aspect = (float)win_width/(float)win_height; - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - glViewport(0,0, win_width, win_height); - - glClearColor(1.,1.,1.,0.); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45, aspect, 1, 10); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0,0,-5); - - glRotatef(b, 0, 1, 0); - - b=fmod(b+0.5, 360.); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, color); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_CULL_FACE); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glDisable(GL_LIGHTING); - - float cube[][5]= - { - {-1, -1, -1, 0, 0}, - { 1, -1, -1, 1, 0}, - { 1, 1, -1, 1, 1}, - {-1, 1, -1, 0, 1}, - - {-1, -1, 1, -1, 0}, - { 1, -1, 1, 0, 0}, - { 1, 1, 1, 0, 1}, - {-1, 1, 1, -1, 1}, - }; - unsigned int faces[]= - { - 0, 1, 2, 3, - 1, 5, 6, 2, - 5, 4, 7, 6, - 4, 0, 3, 7, - 3, 2, 6, 7, - 4, 5, 1, 0 - }; - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glVertexPointer(3, GL_FLOAT, 5*sizeof(float), &cube[0][0]); - glTexCoordPointer(2, GL_FLOAT, 5*sizeof(float), &cube[0][3]); - - glCullFace(GL_BACK); - glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); - - glCullFace(GL_FRONT); - glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); - - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - -} - -void display() -{ - prepare(); - final(); - - glutSwapBuffers(); -} - diff --git a/samples/OpenGL/minimalfbo/Makefile b/samples/OpenGL/minimalfbo/Makefile new file mode 100644 index 0000000..60077c0 --- /dev/null +++ b/samples/OpenGL/minimalfbo/Makefile @@ -0,0 +1,5 @@ +OBJS = minimalfbo.o + +minimalfbo: $(OBJS) + $(CC) -o minimalfbo $(OBJS) -lm -lGL -lGLU -lGLEW -lglut + diff --git a/samples/OpenGL/minimalfbo/minimalfbo.c b/samples/OpenGL/minimalfbo/minimalfbo.c new file mode 100644 index 0000000..87b74de --- /dev/null +++ b/samples/OpenGL/minimalfbo/minimalfbo.c @@ -0,0 +1,211 @@ +#include +#include + +#include +#include +#include + +void init(); +void reshape(int width, int height); +void display(); + +int const fbo_width = 512; +int const fbo_height = 512; + +GLuint fb, color, depth; + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow("FBO test"); + glutDisplayFunc(display); + glutIdleFunc(glutPostRedisplay); + + glewInit(); + + init(); + glutMainLoop(); + + return 0; +} + +void CHECK_FRAMEBUFFER_STATUS() +{ + GLenum status; + status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + switch(status) { + case GL_FRAMEBUFFER_COMPLETE: + break; + + case GL_FRAMEBUFFER_UNSUPPORTED: + /* choose different formats */ + break; + + default: + /* programming error; will fail on all hardware */ + fputs("Framebuffer Error\n", stderr); + exit(-1); + } +} + +float const light_dir[]={1,1,1,0}; +float const light_color[]={1,0.95,0.9,1}; + +void init() +{ + glGenFramebuffers(1, &fb); + glGenTextures(1, &color); + glGenRenderbuffers(1, &depth); + + glBindFramebuffer(GL_FRAMEBUFFER, fb); + + glBindTexture(GL_TEXTURE_2D, color); + glTexImage2D( GL_TEXTURE_2D, + 0, + GL_RGBA, + fbo_width, fbo_height, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0); + + glBindRenderbuffer(GL_RENDERBUFFER, depth); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, fbo_width, fbo_height); + glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); + + CHECK_FRAMEBUFFER_STATUS(); +} + +void prepare() +{ + static float a=0, b=0, c=0; + + glBindTexture(GL_TEXTURE_2D, 0); + glEnable(GL_TEXTURE_2D); + glBindFramebuffer(GL_FRAMEBUFFER, fb); + + glViewport(0,0, fbo_width, fbo_height); + + glClearColor(1,1,1,0); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, 1, 1, 10); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + + glEnable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + + glLightfv(GL_LIGHT0, GL_POSITION, light_dir); + glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); + + glTranslatef(0,0,-5); + + glRotatef(a, 1, 0, 0); + glRotatef(b, 0, 1, 0); + glRotatef(c, 0, 0, 1); + + glutSolidTeapot(0.75); + + a=fmod(a+0.1, 360.); + b=fmod(b+0.5, 360.); + c=fmod(c+0.25, 360.); +} + +void final() +{ + static float a=0, b=0, c=0; + + const int win_width = glutGet(GLUT_WINDOW_WIDTH); + const int win_height = glutGet(GLUT_WINDOW_HEIGHT); + const float aspect = (float)win_width/(float)win_height; + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + glViewport(0,0, win_width, win_height); + + glClearColor(1.,1.,1.,0.); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, aspect, 1, 10); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0,0,-5); + + glRotatef(b, 0, 1, 0); + + b=fmod(b+0.5, 360.); + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, color); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glDisable(GL_LIGHTING); + + float cube[][5]= + { + {-1, -1, -1, 0, 0}, + { 1, -1, -1, 1, 0}, + { 1, 1, -1, 1, 1}, + {-1, 1, -1, 0, 1}, + + {-1, -1, 1, -1, 0}, + { 1, -1, 1, 0, 0}, + { 1, 1, 1, 0, 1}, + {-1, 1, 1, -1, 1}, + }; + unsigned int faces[]= + { + 0, 1, 2, 3, + 1, 5, 6, 2, + 5, 4, 7, 6, + 4, 0, 3, 7, + 3, 2, 6, 7, + 4, 5, 1, 0 + }; + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glVertexPointer(3, GL_FLOAT, 5*sizeof(float), &cube[0][0]); + glTexCoordPointer(2, GL_FLOAT, 5*sizeof(float), &cube[0][3]); + + glCullFace(GL_BACK); + glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); + + glCullFace(GL_FRONT); + glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, faces); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + +} + +void display() +{ + prepare(); + final(); + + glutSwapBuffers(); +} + -- cgit v1.2.3 From 91925ccf445f27ba98a1292e77cda208cbf86551 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 19 Feb 2012 17:50:25 +0100 Subject: removed reshape forward declaration in minimalfbo --- samples/OpenGL/minimalfbo/minimalfbo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/OpenGL/minimalfbo/minimalfbo.c b/samples/OpenGL/minimalfbo/minimalfbo.c index 87b74de..6aa7abb 100644 --- a/samples/OpenGL/minimalfbo/minimalfbo.c +++ b/samples/OpenGL/minimalfbo/minimalfbo.c @@ -6,7 +6,6 @@ #include void init(); -void reshape(int width, int height); void display(); int const fbo_width = 512; -- cgit v1.2.3 From 623fc8c73de35bef0785f09bae8a3f607f8ed087 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 27 Apr 2012 20:43:08 +0200 Subject: qt_terr - a simple quadtree based terrain renderer with LOD --- samples/OpenGL/qt_terr/Makefile | 7 + samples/OpenGL/qt_terr/main.cpp | 582 ++++++++++++++++++++++++++++ samples/OpenGL/qt_terr/mountains.png | Bin 0 -> 9265856 bytes samples/OpenGL/qt_terr/mountains.ter | Bin 0 -> 526424 bytes samples/OpenGL/qt_terr/mountains.tgw | Bin 0 -> 3128 bytes samples/OpenGL/qt_terr/quad.cpp | 140 +++++++ samples/OpenGL/qt_terr/quad.h | 49 +++ samples/OpenGL/qt_terr/readme.txt | 14 + samples/OpenGL/qt_terr/terragen.cpp | 138 +++++++ samples/OpenGL/qt_terr/terragen.h | 6 + samples/OpenGL/qt_terr/terrain.cpp | 43 ++ samples/OpenGL/qt_terr/terrain.h | 26 ++ samples/OpenGL/qt_terr/vecmath.cpp | 39 ++ samples/OpenGL/qt_terr/vecmath.h | 16 + samples/OpenGL/x11argb_opengl_glsl/Makefile | 2 - 15 files changed, 1060 insertions(+), 2 deletions(-) create mode 100644 samples/OpenGL/qt_terr/Makefile create mode 100644 samples/OpenGL/qt_terr/main.cpp create mode 100644 samples/OpenGL/qt_terr/mountains.png create mode 100644 samples/OpenGL/qt_terr/mountains.ter create mode 100644 samples/OpenGL/qt_terr/mountains.tgw create mode 100644 samples/OpenGL/qt_terr/quad.cpp create mode 100644 samples/OpenGL/qt_terr/quad.h create mode 100644 samples/OpenGL/qt_terr/readme.txt create mode 100644 samples/OpenGL/qt_terr/terragen.cpp create mode 100644 samples/OpenGL/qt_terr/terragen.h create mode 100644 samples/OpenGL/qt_terr/terrain.cpp create mode 100644 samples/OpenGL/qt_terr/terrain.h create mode 100644 samples/OpenGL/qt_terr/vecmath.cpp create mode 100644 samples/OpenGL/qt_terr/vecmath.h diff --git a/samples/OpenGL/qt_terr/Makefile b/samples/OpenGL/qt_terr/Makefile new file mode 100644 index 0000000..1f9c52b --- /dev/null +++ b/samples/OpenGL/qt_terr/Makefile @@ -0,0 +1,7 @@ +CC = gcc +CPP = g++ +OBJS += main.o quad.o terragen.o terrain.o vecmath.o + +qt_terr: $(OBJS) + $(CPP) -o qt_terr $(OBJS) -lm -lGL -lGLU -lGLEW -lglut -lIL -lILU -lILUT + diff --git a/samples/OpenGL/qt_terr/main.cpp b/samples/OpenGL/qt_terr/main.cpp new file mode 100644 index 0000000..64c4327 --- /dev/null +++ b/samples/OpenGL/qt_terr/main.cpp @@ -0,0 +1,582 @@ +#include +#include +#include +#include +#include + +#include + +#define ILUT_USE_OPENGL 1 + +#include +#include +#include +#include +#include + +using namespace std; + +#include "vecmath.h" +#include "terragen.h" +#include "terrain.h" + +Terrain Q; + +double const water_level=-1.0; + +void reshape(int width, int height); +void display(); +void keyboard(unsigned char key, int x, int y); + +double frand() +{ + return (double)rand()/(double)RAND_MAX; +} + +struct RGB +{ + GLubyte r, g, b; +}; + +int width, height, levels; +int iMaxLOD; +int iMaxCull=7; +double t, k, l; +double scale[3]; +double scale_dim; +double fov=1.414/2; +//double fov=0.1; +double near_clip=1; +double far_clip=100000; + +void assign_elevations(Terrain *pT, double *buffer, int width, int height, double t, double k, + int left=-1, int bottom=-1, int right=-1, int top=-1); + +GLuint texID; + +void idle() +{ + glutPostRedisplay(); +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE); + glutCreateWindow("Terrain"); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutIdleFunc(idle); + + glewInit(); + + if(argc<2) + return -1; + + std::string terrain_filename(argv[1]); + + double *buffer=NULL; + read_terrain(terrain_filename.c_str(), &buffer, &width, &height, scale); + levels = max(width, height); + levels = log(levels)/log(2); + scale_dim=sqrt(pow(scale[0]*width, 2)+pow(scale[1]*height, 2)+scale[2]*scale[2]); + + iMaxLOD=levels; + + ilInit(); + iluInit(); + ilutInit(); + ilutRenderer(ILUT_OPENGL); + + std::string img_filename( terrain_filename ); + img_filename.replace(img_filename.length()-5, 4, ".png"); + + texID=ilutGLLoadImage(img_filename.c_str()); + glBindTexture(GL_TEXTURE_2D, texID); + + int x, y; + double min_v = 0, max_v = 0; + for(y = 0; y < height; y++) + { + for( x = 0; x < width; x++) + { + min_v = min( buffer[ y*width + x ], min_v ); + max_v = max( buffer[ y*width + x ], max_v ); + } + } + +#if 0 + RGB *img_buffer = new RGB[width*height]; + t=min_v; + k=255.0/(double)(max_v-min_v); + l=1.0/(double)(max_v-min_v); + for(y=0; y=water_level) + { + rgb->r=rgb->g=rgb->b=(*value-t)*k; + } + else + { + rgb->r=rgb->g=0.5*(*value-t)*k+75; + rgb->b=(*value-t)*k+128; + } + + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glBindTexture(GL_TEXTURE_RECTANGLE_NV, 1); + glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img_buffer); + + delete[] img_buffer; +#endif + + assign_elevations(&Q, buffer, width, height, 0, 1); + + delete[] buffer; + + glEnable(GL_CULL_FACE); + glClearColor(0.7, 0.8, 1.0, 1.0); + + glutMainLoop(); + + return 0; +}; + +void assign_elevations(Terrain *pT, double *buffer, int width, int height, double t, double k, + int left, int bottom, int right, int top) +{ + if(left == -1) + left=0; + if(bottom == -1) + bottom=0; + if(right == -1) + right=width-1; + if(top == -1) + top=height-1; + +// WTF, a no-op macro, why?! +// BTW, I wrote that, whatever I was planning, I didn't finish it +// -- Wolfgang +#define PEL(d) (d) + + pT->z[0][0]=( buffer[ PEL(left+bottom*width) ] -t )*k; + pT->z[0][1]=( buffer[ PEL(right+bottom*width) ] -t )*k; + pT->z[1][1]=( buffer[ PEL(right+top*width) ] -t )*k; + pT->z[1][0]=( buffer[ PEL(left+top*width) ] -t )*k; + + pT->z_mean=( + pT->z[0][0]+ + pT->z[0][1]+ + pT->z[1][1]+ + pT->z[1][0])*0.25; + + if(pT->is_split()) + { + assign_elevations((Terrain*)pT->quads[0][0], buffer, width, height, t, k, + left, bottom, left+(right-left)/2, bottom+(top-bottom)/2); + + assign_elevations((Terrain*)pT->quads[0][1], buffer, width, height, t, k, + left+(right-left)/2, bottom, right, bottom+(top-bottom)/2); + + assign_elevations((Terrain*)pT->quads[1][1], buffer, width, height, t, k, + left+(right-left)/2, bottom+(top-bottom)/2, right, top); + + assign_elevations((Terrain*)pT->quads[1][0], buffer, width, height, t, k, + left, bottom+(top-bottom)/2, left+(right-left)/2, top); + } +} + +double view_dot; + +void reshape(int width, int height) +{ + glViewport(0,0,width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + double aspect=(double)width/(double)height; + + double x=near_clip*fov; + double y=x/aspect; + + double RIGHT_UPPER[3]={x, y, near_clip}; + double cam_view[3]={0,0,1}; + normalize(RIGHT_UPPER, RIGHT_UPPER); + view_dot=DOT(cam_view, RIGHT_UPPER); + + glFrustum(-x, x, -y, y, near_clip, far_clip); + glMatrixMode(GL_MODELVIEW); +} + +bool bDrawQuads=true; +bool bFill=true; +bool bLOD=true; +bool bFrustumCulling=true; +bool bContinuous=true; +bool bAnimation=true; +bool bPaused=false; + +enum Camera{follow, bird_view}; +int eCam; + +void keyboard(unsigned char key, int x, int y) +{ + switch(key) + { + case ' ': + bAnimation=!bAnimation; + break; + + case 'Q': + case 'q': + exit(0); + break; + + case 'F': + case 'f': + bFill=!bFill; + break; + + case 'H': + case 'h': + bFrustumCulling=!bFrustumCulling; + break; + + case 'L': + case 'l': + bLOD=!bLOD; + break; + + case 'V': + case 'v': + eCam++; + if(eCam>bird_view) + eCam = 0; + break; + + case 'C': + case 'c': + bContinuous=!bContinuous; + break; + + case 'p': + case 'P': + bPaused=!bPaused; + break; + + case 's': + case 'S': + ilutGLScreenie(); + + case '+': + if(iMaxLOD0) + iMaxLOD--; + break; + } + glutPostRedisplay(); +} + +void draw_quad(Terrain *pQ, int LOD=0, double z1=0, double z2=0, double z3=0, double z4=0); + +GLdouble cam_pos[3];//={68.0f*scale[0], 44.0f*scale[1], 47.7*scale[2]*0.5}; +double cam_la[3]; +double cam_vec[3]; +double cam_vec_n0[3]; + +#define PI 3.141512 + +double modelview_matrix[16]; +double projection_matrix[16]; +GLint viewport[4]={0,0,1,1}; + +void display() +{ + static double alpha=0; + static double beta=0; + + if(bAnimation) + { + alpha+=0.0025*PI; + beta+=0.001*PI; + + if(alpha>2*PI) + alpha=0; + + if(beta>2*PI) + beta=0; + } + + double dx=(1+cos(alpha))*0.5; + double dy=(1+sin(alpha))*0.5; + + double dz=(1+sin(beta))*0.5; + + cam_pos[0]=dx*width*scale[0]; + cam_pos[1]=dy*height*scale[1]; + cam_pos[2]=max(dz*scale[2]*width*3, (20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean)*scale[2]); + //cam_pos[2]=(20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean)*scale[2]; + + cam_la[0]=width*scale[0]*0.5; + cam_la[1]=height*scale[1]*0.5; + cam_la[2]=9.6*scale[2]*0.5; + + cam_vec[0]=cam_la[0]-cam_pos[0]; + cam_vec[1]=cam_la[1]-cam_pos[1]; + cam_vec[2]=cam_la[2]-cam_pos[2]; + + normalize(cam_vec_n0, cam_vec); + + normalize(cam_vec, cam_vec); + + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + glLoadIdentity(); + gluLookAt( cam_pos[0], cam_pos[1], cam_pos[2], + cam_la[0], cam_la[1], cam_la[2], + 0,0,1); + glScalef(1,1,0.5); + glGetDoublev(GL_MODELVIEW_MATRIX, modelview_matrix); + glGetDoublev(GL_PROJECTION_MATRIX, projection_matrix); + glGetIntegerv(GL_VIEWPORT, viewport); + + switch(eCam) + { + case follow: + break; + + case bird_view: + glLoadIdentity(); + gluLookAt( width*scale[0]*0.5, height*scale[1]*0.5, scale[2]*500, + cam_la[0], cam_la[1], cam_la[2], + 0,1,0); + //glScalef(1,1,0.5); + break; + } + //glTranslatef(-0.5, -0.5, -5); + + glEnable(GL_DEPTH_TEST); + /* + if(bDrawTerrain) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glEnable(GL_TEXTURE_RECTANGLE_NV); + glBegin(GL_QUADS); + glColor3f(1,1,1); + glTexCoord2i(0,0); + glVertex2f(0,0); + glTexCoord2i(width,0); + glVertex2f(1,0); + glTexCoord2i(width, height); + glVertex2f(1,1); + glTexCoord2i(0,height); + glVertex2f(0,1); + glEnd(); + }*/ + + glColor3f(1,0,0); + glPointSize(5); + glBegin(GL_POINTS); + glVertex3dv(cam_pos); + glEnd(); + + if(bDrawQuads) + { + glColor3f(1,1,1); + glDisable(GL_TEXTURE_RECTANGLE_NV); + glEnable(GL_TEXTURE_2D); + glPolygonMode(GL_FRONT_AND_BACK, bFill?GL_FILL:GL_LINE); + glBegin(GL_QUADS); + draw_quad(&Q); + glEnd(); + } + + glutSwapBuffers(); +} + +bool in_view(double a[3]) +{ + GLdouble winx, winy, winz; + + gluProject(a[0], a[1], a[2], modelview_matrix, projection_matrix, viewport, &winx, &winy, &winz); + if( winx>=viewport[0] && winx<=viewport[2] && + winy>=viewport[1] && winy<=viewport[3] ) + return true; + + return false; +} + +void draw_quad(Terrain *pT, int LOD, double z1, double z2, double z3, double z4) +{ + bool bRefine=true; + bool bInFront=true; + + double Q[3]={pT->x_mid*width*scale[0], pT->y_mid*height*scale[1], pT->z_mean*scale[2]}; + double Q1[3]={pT->x1*width*scale[0], pT->y1*height*scale[1], pT->z[0][0]*scale[2]}; + double Q2[3]={pT->x2*width*scale[0], pT->y1*height*scale[1], pT->z[0][1]*scale[2]}; + double Q3[3]={pT->x2*width*scale[0], pT->y2*height*scale[1], pT->z[1][1]*scale[2]}; + double Q4[3]={pT->x1*width*scale[0], pT->y2*height*scale[1], pT->z[1][0]*scale[2]}; + double Qt[3]; + + double dir[3]; + SUB(dir, Q, cam_pos); + double dot=DOT(dir, cam_vec); + + double l_n[4]; + double dir_n[3]; + + /* + SUB(dir_n, Q1, cam_pos); + l_n[0]=length(dir_n); + + SUB(dir_n, Q2, cam_pos); + l_n[1]=length(dir_n); + + SUB(dir_n, Q3, cam_pos); + l_n[2]=length(dir_n); + + SUB(dir_n, Q4, cam_pos); + l_n[3]=length(dir_n); + */ + + //if(l_n[0]0) + { + for(int i=0; i<4; i++) + { + lod_scale[i]=(d_lod-l_n[i])/(d_lod-d_lod_plus_1); + + lod_scale[i]=min(lod_scale[i], 1.0); + lod_scale[i]=max(lod_scale[i], 0.0); + + one_minus_lod_scale[i]=1.0-lod_scale[i]; + } + } + + if(bLOD) + { + bRefine = sz > k; + } + + if(bFrustumCulling&&LODis_split() && LODquads[0][0], LOD+1, + Q1[2], Z1, Q[2], Z4); + + draw_quad( pT->quads[0][1], LOD+1, + Z1, Q2[2], Z2, Q[2]); + + draw_quad( pT->quads[1][1], LOD+1, + Q[2], Z2, Q3[2], Z3); + + draw_quad( pT->quads[1][0], LOD+1, + Z4, Q[2], Z3, Q4[2]); + } + else// if(bInFront) + { + Q1[2]=Q1[2]*lod_scale[0] + z1*one_minus_lod_scale[0]; + Q2[2]=Q2[2]*lod_scale[1] + z2*one_minus_lod_scale[1]; + Q3[2]=Q3[2]*lod_scale[2] + z3*one_minus_lod_scale[2]; + Q4[2]=Q4[2]*lod_scale[3] + z4*one_minus_lod_scale[3]; + +#define LUM(v) glColor3f(v,v,v) + + if(bClipped) + glColor3f(1,0,0); + else + glColor3f(1,1,1); + //LUM(one_minus_lod_scale[0]); + glTexCoord2f(pT->x1, pT->y1); + glVertex3dv(Q1); + + //LUM(one_minus_lod_scale[1]); + glTexCoord2f(pT->x2, pT->y1); + glVertex3dv(Q2); + + //LUM(one_minus_lod_scale[2]); + glTexCoord2f(pT->x2, pT->y2); + glVertex3dv(Q3); + + //LUM(one_minus_lod_scale[3]); + glTexCoord2f(pT->x1, pT->y2); + glVertex3dv(Q4); + } + } +} diff --git a/samples/OpenGL/qt_terr/mountains.png b/samples/OpenGL/qt_terr/mountains.png new file mode 100644 index 0000000..77e87c5 Binary files /dev/null and b/samples/OpenGL/qt_terr/mountains.png differ diff --git a/samples/OpenGL/qt_terr/mountains.ter b/samples/OpenGL/qt_terr/mountains.ter new file mode 100644 index 0000000..5f48ff0 Binary files /dev/null and b/samples/OpenGL/qt_terr/mountains.ter differ diff --git a/samples/OpenGL/qt_terr/mountains.tgw b/samples/OpenGL/qt_terr/mountains.tgw new file mode 100644 index 0000000..5162265 Binary files /dev/null and b/samples/OpenGL/qt_terr/mountains.tgw differ diff --git a/samples/OpenGL/qt_terr/quad.cpp b/samples/OpenGL/qt_terr/quad.cpp new file mode 100644 index 0000000..e57bcfa --- /dev/null +++ b/samples/OpenGL/qt_terr/quad.cpp @@ -0,0 +1,140 @@ +#include +#include "quad.h" + +Quad::Quad() : + V(new std::vector) +{ + quads[0][0] = + quads[0][1] = + quads[1][0] = + quads[1][1] = 0; + + unsigned int V_old_size = V->size(); + unsigned int V_new_size = V_old_size + 9; + V->resize(V_new_size, 0.); + + v1_offset = V_new_size - 3*3; + v2_offset = V_new_size - 2*3; + v_mid_offset = V_new_size - 1*3; + + set_range(0., 1., 0., 1.); +} + +Quad::Quad( std::vector * const V_) : + V(V_) +{ + quads[0][0] = + quads[0][1] = + quads[1][0] = + quads[1][1] = 0; + + unsigned int V_old_size = V->size(); + unsigned int V_new_size = V_old_size + 9; + V->resize(V_new_size, 0.); + + v1_offset = V_new_size - 3*3; + v2_offset = V_new_size - 2*3; + v_mid_offset = V_new_size - 1*3; + + set_range(0., 1., 0., 1.); +} + +Quad::Quad(Quad &q) : + V(new std::vector) +{ + operator= (q); +} + +Quad::~Quad() +{ + if(is_split()) + { + delete quads[0][0]; + delete quads[0][1]; + delete quads[1][0]; + delete quads[1][1]; + } +} + +Quad& Quad::operator=(Quad &q) +{ + *x1() = *q.x1(); + *x2() = *q.x2(); + *y1() = *q.y1(); + *y2() = *q.y2(); + + if( q.is_split() ) + { + split(); + quads[0][0] = q.quads[0][0]; + quads[0][1] = q.quads[0][1]; + quads[1][0] = q.quads[1][0]; + quads[1][1] = q.quads[1][1]; + } + + return *this; +} + +void Quad::split() +{ + if(is_split()) + return; + + quads[0][0] = new Quad(V); + quads[0][1] = new Quad(V); + quads[1][0] = new Quad(V); + quads[1][1] = new Quad(V); + + quads[0][0]->set_range( *x1(), *x_mid(), *y1(), *y_mid() ); + quads[0][1]->set_range( *x_mid(), *x2(), *y1(), *y_mid() ); + quads[1][0]->set_range( *x1(), *x_mid(), *y_mid(), *y2() ); + quads[1][1]->set_range( *x_mid(), *x2(), *y_mid(), *y2() ); +} + +bool Quad::is_split() +{ + return quads[0][0] && + quads[0][1] && + quads[1][0] && + quads[1][1]; +} + +void Quad::set_range(double nx1, double nx2, double ny1, double ny2) +{ + *x1() = nx1; + *x2() = nx2; + *y1() = ny1; + *y2() = ny2; + *x_mid() = ( *x1() + *x2() )*0.5f; + *y_mid() = ( *y1() + *y2() )*0.5f; + +} + +void Quad::track_down(double x, double y, int levels) +{ + if(levels>0) + { + int a = ( x < *x_mid() ) ? 0 : 1; + int b = ( y < *y_mid() ) ? 0 : 1; + + if( !is_split() ) + split(); + + quads[b][a]->track_down(x, y, levels-1); + } +} + +Quad *Quad::get_at(double x, double y, int max_level, int level) +{ + if(!is_split()) + return this; + + /*if(max_level>-1 && level>=max_level) + return this;*/ + + int a = ( x < *x_mid() ) ? 0 : 1; + int b = ( y < *y_mid() ) ? 0 : 1; + + return quads[b][a]->get_at(x, y, max_level, level+1); +} + diff --git a/samples/OpenGL/qt_terr/quad.h b/samples/OpenGL/qt_terr/quad.h new file mode 100644 index 0000000..1c6549a --- /dev/null +++ b/samples/OpenGL/qt_terr/quad.h @@ -0,0 +1,49 @@ +#ifndef QUAD_H +#define QUAD_H + +#include + +class Quad +{ +public: +// double x1,x2, x_mid; +// double y1,y2, y_mid; + + unsigned int v1_offset; + unsigned int v2_offset; + unsigned int v_mid_offset; + + double *x1() { return &(*V)[v1_offset + 0]; } + double *y1() { return &(*V)[v1_offset + 1]; } + double *z1() { return &(*V)[v1_offset + 2]; } + + double *x2() { return &(*V)[v2_offset + 0]; } + double *y2() { return &(*V)[v2_offset + 1]; } + double *z2() { return &(*V)[v2_offset + 2]; } + + double *x_mid() { return &(*V)[v_mid_offset + 0]; } + double *y_mid() { return &(*V)[v_mid_offset + 1]; } + double *z_mid() { return &(*V)[v_mid_offset + 2]; } + + Quad *quads[2][2]; + +public: + Quad(); + Quad(Quad &q); + ~Quad(); + Quad& operator=(Quad &q); + + virtual void split(); + virtual bool is_split(); + + virtual void track_down(double x, double y, int levels); + virtual Quad *get_at(double x, double y, int max_level=0, int level=0); + +protected: + virtual void set_range(double nx1, double nx2, double ny1, double ny2); + + Quad(std::vector*); + std::vector * const V; +}; + +#endif//QUAD_H diff --git a/samples/OpenGL/qt_terr/readme.txt b/samples/OpenGL/qt_terr/readme.txt new file mode 100644 index 0000000..cb2b065 --- /dev/null +++ b/samples/OpenGL/qt_terr/readme.txt @@ -0,0 +1,14 @@ +Extract all into a single directory + +Execute with +# terrain .ter + +Key mapping: +[V] Change camera mode +[H] Frustum Culling on/off +[L] Level of Detail triangle reduction on/off +[F] Polygonfilling/Wireframe on/off +[+] increase max. Level of Detail +[-] decrease max. Level of Detail +[S] Screenshot + pause/restart animation \ No newline at end of file diff --git a/samples/OpenGL/qt_terr/terragen.cpp b/samples/OpenGL/qt_terr/terragen.cpp new file mode 100644 index 0000000..3b922a4 --- /dev/null +++ b/samples/OpenGL/qt_terr/terragen.cpp @@ -0,0 +1,138 @@ +#include +#include +#include +#include + +#include "terragen.h" + +// Some custom types and helper macros that +// allow for a portable file to number variable +// read procedure + +typedef uint8_t DUET[2]; +typedef uint8_t QUARTET[4]; +typedef uint8_t OCTET[8]; + +#define DUET_TO_NUMBER(duet) ((duet[0]|duet[1]<<8)) +#define QUARTET_TO_NUMBER(quartet) ((quartet[0])|(quartet[1]<<8)|(quartet[2]<<16)|(quartet[3]<<24)) + +int read_terrain(char *filename, double **pbuffer, int *width, int *height, double *scale) +// [in] filename: path to the file to be read in +// [out] pbuffer: address of new allocated data buffer +// [out] width: width of the terrain +// [out] heigt: height of the terrain +// [out] return value: 0 if read in successfully 1 otherwise +{ + FILE *file=fopen(filename, "rb"); + if(!file) + return -1; + + OCTET octet; + QUARTET quartet; + QUARTET quartet_marker; + DUET duet; + + fread(octet, 8, 1, file); + if(memcmp(octet, "TERRAGEN", 8)) + return -1; + + fread(octet, 8, 1, file); + if(memcmp(octet, "TERRAIN ", 8)) + return -1; + + fread(quartet, 4, 1, file); + if(memcmp(quartet, "SIZE", 4)) + return -1; + fread(duet, 2, 1, file); + fseek(file, 2, SEEK_CUR); + int size=DUET_TO_NUMBER(duet); + + int xpts=0, ypts=0; + do + { + fread(quartet_marker, 4, 1, file); + + if(memcmp(quartet_marker, "XPTS", 4)==0) + { + fread(duet, 2, 1, file); + fseek(file, 2, SEEK_CUR); + xpts=DUET_TO_NUMBER(duet); + continue; + } + + if(memcmp(quartet_marker, "YPTS", 4)==0) + { + fread(duet, 2, 1, file); + fseek(file, 2, SEEK_CUR); + ypts=DUET_TO_NUMBER(duet); + continue; + } + + // I'm going to ignore the other segments so long + // so we can leave the quartet marker test to the + // while condition + //if(strcmp(quartet_marker, "SIZE")) // Ignore SIZE + // fseek(file, 4, SEEK_CUR); + + if(memcmp(quartet_marker, "SCAL", 4)==0&&scale) // Ignore SCAL + { + float fscale[3]; + fread(&(fscale[0]), 4, 1, file); + fread(&(fscale[1]), 4, 1, file); + fread(&(fscale[2]), 4, 1, file); + scale[0]=fscale[0]; + scale[1]=fscale[1]; + scale[2]=fscale[2]; + } + + //if(strcmp(quartet_marker, "CRAD")) // Ignore CRAD + // fseek(file, 4, SEEK_CUR); + + //if(strcmp(quartet_marker, "CRVM")) // Ignore CRVM + // fseek(file, 4, SEEK_CUR); + + }while(memcmp(quartet_marker, "ALTW", 4)); + + int16_t height_scale, base_height; + fread(duet, 2, 1, file); + height_scale = DUET_TO_NUMBER(duet); + fread(duet, 2, 1, file); + base_height = DUET_TO_NUMBER(duet); + + if(xpts==0&&ypts==0) + { + xpts=size+1; + ypts=size+1; + } + + *width=xpts; + *height=ypts; + + // The caller of this function is responsible + // to free the memory consumed by buffer + DUET *buffer=new DUET[xpts*ypts]; + fread(buffer, 2, xpts*ypts, file); + + *pbuffer=new double[xpts*ypts]; + for(int y=0; y(base_height+elev*height_scale/65536); + } + } + delete[] buffer; + + // a last test, the next we read should be "EOF ", since currently the Terragen + // file format says, that "ALTW" must be the last segment of a file + // however it's no problem for _us_ if we've no "EOF " here, because it doesn't matter + fread(quartet, 4, 1, file); + if(memcmp(quartet, "EOF ", 4)) + printf("read terrain file with \"EOF \" at the end\n"); + + fclose(file); + return 0; +} diff --git a/samples/OpenGL/qt_terr/terragen.h b/samples/OpenGL/qt_terr/terragen.h new file mode 100644 index 0000000..5037a08 --- /dev/null +++ b/samples/OpenGL/qt_terr/terragen.h @@ -0,0 +1,6 @@ +#ifndef TERRAGEN_H +#define TERRAGEN_H + +int read_terrain(char *filename, double **pbuffer, int *width, int *height, double *scale); + +#endif/*TERRAGEN*/ \ No newline at end of file diff --git a/samples/OpenGL/qt_terr/terrain.cpp b/samples/OpenGL/qt_terr/terrain.cpp new file mode 100644 index 0000000..d08d345 --- /dev/null +++ b/samples/OpenGL/qt_terr/terrain.cpp @@ -0,0 +1,43 @@ +#include "terrain.h" + +Terrain::Terrain() +{ + z_mean=0.0; +} + +void Terrain::split() +{ + if(is_split()) + return; + + quads[0][0] = new Terrain(V); + quads[0][1] = new Terrain(V); + quads[1][0] = new Terrain(V); + quads[1][1] = new Terrain(V); + + quads[0][0]->set_range(x1, x_mid, y1, y_mid); + quads[0][1]->set_range(x_mid, x2, y1, y_mid); + quads[1][0]->set_range(x1, x_mid, y_mid, y2); + quads[1][1]->set_range(x_mid, x2, y_mid, y2); +} + +void Terrain::track_down(double x, double y, double nz, int levels) +{ + if(levels>0) + { + int a=(xtrack_down(x, y, nz, levels-1); + } + else + { + z[0][0]= + z[0][1]= + z[1][1]= + z[1][0]=z_mean=nz; + } +} diff --git a/samples/OpenGL/qt_terr/terrain.h b/samples/OpenGL/qt_terr/terrain.h new file mode 100644 index 0000000..0197380 --- /dev/null +++ b/samples/OpenGL/qt_terr/terrain.h @@ -0,0 +1,26 @@ +#ifndef TERRAIN_H +#define TERRAIN_H + +#include "quad.h" + +#include + +class Terrain : public Quad +{ +public: + double * const z_mean() { + + }; + double z[2][2]; + +public: + Terrain(); + + virtual void split(); + virtual void track_down(double x, double y, double nz, int levels); + +/*protected: + virtual void set_range(double nx1, double nx2, double ny1, double ny2);*/ +}; + +#endif/*TERRAIN_H*/ diff --git a/samples/OpenGL/qt_terr/vecmath.cpp b/samples/OpenGL/qt_terr/vecmath.cpp new file mode 100644 index 0000000..ff4230c --- /dev/null +++ b/samples/OpenGL/qt_terr/vecmath.cpp @@ -0,0 +1,39 @@ +#include +#include "vecmath.h" + +double DOT(double a[3], double b[3]) +{ + return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]; +} + +void ADD(double out[3], double a[3], double b[3]) +{ + out[0]=a[0]+b[0]; + out[1]=a[1]+b[1]; + out[2]=a[2]+b[2]; +} + +void SUB(double out[3], double a[3], double b[3]) +{ + out[0]=a[0]-b[0]; + out[1]=a[1]-b[1]; + out[2]=a[2]-b[2]; +} + +void SCALE(double out[3], double v[3], double scalar) +{ + out[0]=v[0]*scalar; + out[1]=v[1]*scalar; + out[2]=v[2]*scalar; +} + +double length(double v[3]) +{ + return (double)sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); +} + +void normalize(double out[3], double in[3]) +{ + double k=1.0f/length(in); + SCALE(out, in, k); +} \ No newline at end of file diff --git a/samples/OpenGL/qt_terr/vecmath.h b/samples/OpenGL/qt_terr/vecmath.h new file mode 100644 index 0000000..0c27eff --- /dev/null +++ b/samples/OpenGL/qt_terr/vecmath.h @@ -0,0 +1,16 @@ +#ifndef VECMATH_H +#define VECMATH_H + +double DOT(double a[3], double b[3]); + +void ADD(double out[3], double a[3], double b[3]); + +void SUB(double out[3], double a[3], double b[3]); + +void SCALE(double out[3], double v[3], double scalar); + +double length(double v[3]); + +void normalize(double out[3], double in[3]); + +#endif/*VECMATH_H*/ diff --git a/samples/OpenGL/x11argb_opengl_glsl/Makefile b/samples/OpenGL/x11argb_opengl_glsl/Makefile index e32b597..6c234cb 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/Makefile +++ b/samples/OpenGL/x11argb_opengl_glsl/Makefile @@ -1,5 +1,3 @@ -CC=pcc - x11argb_opengl_glsl: x11argb_opengl_glsl.c Makefile $(CC) -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm -- cgit v1.2.3 From 2442c23c78fbe205cbebbe2f26d8a20eecbb1347 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 12 May 2013 02:05:08 +0200 Subject: commit of new sample 'frustum' --- samples/OpenGL/frustum/Makefile | 5 + samples/OpenGL/frustum/frustum.c | 326 +++++++++++++++++++++ samples/OpenGL/strand_illumination/.gitignore | 1 + samples/OpenGL/strand_illumination/CMakeLists.txt | 0 samples/OpenGL/strand_illumination/strand.fs.glsl | 0 samples/OpenGL/strand_illumination/strand.vs.glsl | 0 .../strand_illumination/strand_illumination.c | 56 ++++ samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 2 + samples/OpenGL/x11argb_opengl_glsl/Makefile | 2 +- 9 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 samples/OpenGL/frustum/Makefile create mode 100644 samples/OpenGL/frustum/frustum.c create mode 100644 samples/OpenGL/strand_illumination/.gitignore create mode 100644 samples/OpenGL/strand_illumination/CMakeLists.txt create mode 100644 samples/OpenGL/strand_illumination/strand.fs.glsl create mode 100644 samples/OpenGL/strand_illumination/strand.vs.glsl create mode 100644 samples/OpenGL/strand_illumination/strand_illumination.c diff --git a/samples/OpenGL/frustum/Makefile b/samples/OpenGL/frustum/Makefile new file mode 100644 index 0000000..24968ec --- /dev/null +++ b/samples/OpenGL/frustum/Makefile @@ -0,0 +1,5 @@ +CFLAGS = -std=c99 + +frustum: frustum.o + $(CC) -o frustum frustum.o -lGL -lGLU -lglut -lm + diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c new file mode 100644 index 0000000..dd9c42c --- /dev/null +++ b/samples/OpenGL/frustum/frustum.c @@ -0,0 +1,326 @@ +#include +#include +#include + +#include + +#include +#include +#include +#include + +/* == basic Q^3 vector math functions == */ + +void crossproduct( + double ax, double ay, double az, + double bx, double by, double bz, + double *rx, double *ry, double *rz ) +{ + *rx = ay*bz - az*by; + *ry = az*bx - ax*bz; + *rz = ax*by - ay*bx; +} + +void crossproduct_v( + double const * const a, + double const * const b, + double * const c ) +{ + crossproduct( + a[0], a[1], a[2], + b[0], b[1], b[2], + c, c+1, c+2 ); +} + +double scalarproduct( + double ax, double ay, double az, + double bx, double by, double bz ) +{ + return ax*bx + ay*by + az*bz; +} + +double scalarproduct_v( + double const * const a, + double const * const b ) +{ + return scalarproduct( + a[0], a[1], a[2], + b[0], b[1], b[2] ); +} + +double length( + double ax, double ay, double az ) +{ + return sqrt( + scalarproduct( + ax, ay, az, + ax, ay, az ) ); +} + +double length_v( double const * const a ) +{ + return sqrt( scalarproduct_v(a, a) ); +} + +double normalize( + double *x, double *y, double *z) +{ + double const k = 1./length(*x, *y, *z); + + *x *= k; + *y *= k; + *z *= k; +} + +double normalize_v( double *a ) +{ + double const k = 1./length_v(a); + a[0] *= k; + a[1] *= k; + a[2] *= k; +} + +/* == annotation drawing functions == */ + +void draw_strokestring(void *font, float const size, char const *string) +{ + glPushMatrix(); + float const scale = size * 0.01; /* GLUT character base size is 100 units */ + glScalef(scale, scale, scale); + + char const *c = string; + for(; c && *c; c++) { + glutStrokeCharacter(font, *c); + } + glPopMatrix(); +} + +void draw_arrow( + float ax, float ay, float az, + float bx, float by, float bz, + float ah, float bh, + char const * const annotation, + float annot_size ) +{ + int i; + + GLdouble mv[16]; + glGetDoublev(GL_MODELVIEW_MATRIX, mv); + + /* We're assuming the modelview RS part is (isotropically scaled) + * orthonormal, so the inverse is the transpose. + * The local view direction vector is the 3rd column of the matrix; + * assuming the view direction to be the normal on the arrows tangent + * space taking the cross product of this with the arrow direction + * yields the binormal to be used as the orthonormal base to the + * arrow direction to be used for drawing the arrowheads */ + + double d[3] = { + bx - ax, + by - ay, + bz - az + }; + normalize_v(d); + + double n[3] = { mv[2], mv[6], mv[10] }; + { + double const s = scalarproduct_v(d,n); + for(int i = 0; i < 3; i++) + n[i] -= d[i]*s; + } + normalize_v(n); + + double b[3]; + crossproduct_v(n, d, b); + + GLfloat const pos[][3] = { + {ax, ay, az}, + {bx, by, bz}, + { ax + (0.866*d[0] + 0.5*b[0])*ah, + ay + (0.866*d[1] + 0.5*b[1])*ah, + az + (0.866*d[2] + 0.5*b[2])*ah }, + { ax + (0.866*d[0] - 0.5*b[0])*ah, + ay + (0.866*d[1] - 0.5*b[1])*ah, + az + (0.866*d[2] - 0.5*b[2])*ah }, + { bx + (-0.866*d[0] + 0.5*b[0])*bh, + by + (-0.866*d[1] + 0.5*b[1])*bh, + bz + (-0.866*d[2] + 0.5*b[2])*bh }, + { bx + (-0.866*d[0] - 0.5*b[0])*bh, + by + (-0.866*d[1] - 0.5*b[1])*bh, + bz + (-0.866*d[2] - 0.5*b[2])*bh } + }; + GLushort const idx[][2] = { + {0, 1}, + {0, 2}, {0, 3}, + {1, 4}, {1, 5} + }; + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, pos); + + glDrawElements(GL_LINES, 2*5, GL_UNSIGNED_SHORT, idx); + glDisableClientState(GL_VERTEX_ARRAY); + + if(annotation) { + float w = 0; + for(char const *c = annotation; *c; c++) + w += glutStrokeWidth(GLUT_STROKE_ROMAN, *c); + w *= annot_size / 100.; + + float tx = (ax + bx - w*d[0])/2.; + float ty = (ay + by - w*d[1])/2.; + float tz = (az + bz - w*d[2])/2.; + + GLdouble r[16] = { + d[0], d[1], d[2], 0, + b[0], b[1], b[2], 0, + n[0], n[1], n[2], 0, + 0, 0, 0, 1 + }; + glPushMatrix(); + glTranslatef(tx, ty, tz); + glMultMatrixd(r); + glTranslatef(0, annot_size*0.1, 0); + draw_strokestring(GLUT_STROKE_ROMAN, annot_size, annotation); + glPopMatrix(); + } +} + +void draw_frustum( + float l, float r, float b, float t, + float n, float f ) +{ + GLfloat const kf = f/n; + GLfloat const pos[][3] = { + {0,0,0}, + {l, b, -n}, + {r, b, -n}, + {r, t, -n}, + {l, t, -n}, + {kf*l, kf*b, -f}, + {kf*r, kf*b, -f}, + {kf*r, kf*t, -f}, + {kf*l, kf*t, -f} + }; + GLushort const idx_tip[][2] = { + {0, 1}, + {0, 2}, + {0, 3}, + {0, 4} + }; + GLushort const idx_vol[][2] = { + {1, 5}, {2, 6}, {3, 7}, {4, 8}, + {1, 2}, {2, 3}, {3, 4}, {4, 1}, + {5, 6}, {6, 7}, {7, 8}, {8, 5} + }; + + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, pos); + + glLineWidth(1); + glLineStipple(2, 0xf3cf); + glEnable(GL_LINE_STIPPLE); + glDrawElements(GL_LINES, 2*4, GL_UNSIGNED_SHORT, idx_tip); + + glLineWidth(2); + glLineStipple(1, 0xffff); + glDisable(GL_LINE_STIPPLE); + glDrawElements(GL_LINES, 2*4*3, GL_UNSIGNED_SHORT, idx_vol); + + glLineWidth(1); + glDisableClientState(GL_VERTEX_ARRAY); +} + +/* == scene drawing code == */ + +void display_observer(void) +{ + static float alpha = 0; + + int const win_width = glutGet(GLUT_WINDOW_WIDTH); + int const win_height = glutGet(GLUT_WINDOW_HEIGHT); + float const win_aspect = (float)win_width / (float)win_height; + + glViewport(0, 0, win_width, win_height); + glClearColor(1., 1., 1., 1.); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +#ifdef USE_ORTHO + glOrtho(-10*win_aspect, 10*win_aspect, -10, 10, 0, 100); +#else + gluPerspective(35, win_aspect, 1, 50); +#endif + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + if(1) { + glTranslatef(0, 0, -5); + glRotatef(30, 1, 0, 0); + glRotatef(alpha, 0, 1, 0); + glTranslatef(0, 0, 2.5); + } else { + gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); + } + + float const l = -0.5, + r = 0.5, + b = -0.5, + t = 0.5, + n = 1, + f = 4; + + glEnable(GL_MULTISAMPLE); + + glColor3f(0.,0.,0.); + draw_frustum(l, r, b, t, n, f); + + glLineWidth(1); + draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near", 0.075); + + draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0, "left", 0.075); + draw_arrow(0, 0, -n, r, 0, -n, 0, 0.1, "right", 0.075); + draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0, "bottom", 0.075); + draw_arrow(0, 0, -n, 0, t, -n, 0, 0.1, "top", 0.075); + + glutSwapBuffers(); + + alpha = fmodf(alpha + 0.1, 360); + glutPostRedisplay(); +} + +void display_frustum_view(void) +{ + int const win_width = glutGet(GLUT_WINDOW_WIDTH); + int const win_height = glutGet(GLUT_WINDOW_HEIGHT); + float const win_aspect = (float)win_width / (float)win_height; + + glViewport(0, 0, win_width, win_height); + glClearColor(0.3, 0.3, 0.6, 1.); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glutSwapBuffers(); +} + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE); + + glutCreateWindow("Observer"); + glutDisplayFunc(display_observer); + + glutCreateWindow("Frustum View"); + glutDisplayFunc(display_frustum_view); + + glutMainLoop(); + return 0; +} diff --git a/samples/OpenGL/strand_illumination/.gitignore b/samples/OpenGL/strand_illumination/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/samples/OpenGL/strand_illumination/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/samples/OpenGL/strand_illumination/CMakeLists.txt b/samples/OpenGL/strand_illumination/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/samples/OpenGL/strand_illumination/strand.fs.glsl b/samples/OpenGL/strand_illumination/strand.fs.glsl new file mode 100644 index 0000000..e69de29 diff --git a/samples/OpenGL/strand_illumination/strand.vs.glsl b/samples/OpenGL/strand_illumination/strand.vs.glsl new file mode 100644 index 0000000..e69de29 diff --git a/samples/OpenGL/strand_illumination/strand_illumination.c b/samples/OpenGL/strand_illumination/strand_illumination.c new file mode 100644 index 0000000..08ca7fa --- /dev/null +++ b/samples/OpenGL/strand_illumination/strand_illumination.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +typedef enum { + si_NoError = 0, + si_ResourceNotFound = 1, +} si_Error_t; + +struct { + GLuint prog; + GLuint vs; + GLuint fs; + + GLuint a_position; + GLuint a_direction; + + GLuint u_mv; + GLuint u_normal: + GLuint u_proj; + + GLuint u_lightpos; +} strandshader; + +si_Error_t loadStrandShader(void) +{ +} + +si_Error_t loadGLresources(void) +{ + loadStrandShader(); +} + +void display(void) +{ +} + +int main(int argc, char argv[]) +{ + si_Error_t err = si_NoError; + + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); + glutCreateWindow("Illuminated Strands"); + glutDisplayFunc(display); + + if( (err = loadGLResources()) != si_NoError ) { + return -err; + } + + glutMainLoop(); + + return 0; +} + diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index 7a073fb..1c1e2e0 100644 --- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c +++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c @@ -470,7 +470,9 @@ int main(int argc, char *argv[]) createTheRenderContext(); while (updateTheMessageQueue()) { + #if 0 redrawTheWindow(); + #endif } return 0; diff --git a/samples/OpenGL/x11argb_opengl_glsl/Makefile b/samples/OpenGL/x11argb_opengl_glsl/Makefile index 6c234cb..b59feea 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/Makefile +++ b/samples/OpenGL/x11argb_opengl_glsl/Makefile @@ -1,3 +1,3 @@ x11argb_opengl_glsl: x11argb_opengl_glsl.c Makefile - $(CC) -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm + clang -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm -- cgit v1.2.3 From 023bc0f9a7d34735aefac0d95608a210441147fc Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 12 May 2013 02:14:54 +0200 Subject: frustum view aspect now influences observer frustum drawing --- samples/OpenGL/frustum/frustum.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index dd9c42c..f74b6a5 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -9,6 +9,9 @@ #include #include +int window_view; +int window_observer; + /* == basic Q^3 vector math functions == */ void crossproduct( @@ -240,7 +243,7 @@ void draw_frustum( /* == scene drawing code == */ -void display_observer(void) +void display_observer(float frustum_aspect) { static float alpha = 0; @@ -271,8 +274,8 @@ void display_observer(void) gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); } - float const l = -0.5, - r = 0.5, + float const l = -0.5*frustum_aspect, + r = 0.5*frustum_aspect, b = -0.5, t = 0.5, n = 1, @@ -297,10 +300,8 @@ void display_observer(void) glutPostRedisplay(); } -void display_frustum_view(void) +void display_view(int const win_width, int const win_height) { - int const win_width = glutGet(GLUT_WINDOW_WIDTH); - int const win_height = glutGet(GLUT_WINDOW_HEIGHT); float const win_aspect = (float)win_width / (float)win_height; glViewport(0, 0, win_width, win_height); @@ -310,16 +311,28 @@ void display_frustum_view(void) glutSwapBuffers(); } +void display(void) +{ + glutSetWindow(window_view); + int const win_view_width = glutGet(GLUT_WINDOW_WIDTH); + int const win_view_height = glutGet(GLUT_WINDOW_HEIGHT); + float const win_view_aspect = (float)win_view_width / (float)win_view_height; + display_view(win_view_width, win_view_height); + + glutSetWindow(window_observer); + display_observer(win_view_aspect); +} + int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE); - glutCreateWindow("Observer"); - glutDisplayFunc(display_observer); + window_observer = glutCreateWindow("Observer"); + glutDisplayFunc(display); - glutCreateWindow("Frustum View"); - glutDisplayFunc(display_frustum_view); + window_view = glutCreateWindow("Frustum View"); + glutDisplayFunc(display); glutMainLoop(); return 0; -- cgit v1.2.3 From 9cbea9d27344e8bcfc0b6eae193fb1e4fd97c1c5 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 12 May 2013 03:21:47 +0200 Subject: frustum view aspect now influences observer frustum drawing --- samples/OpenGL/frustum/frustum.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index f74b6a5..493d2eb 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -125,6 +125,9 @@ void draw_arrow( }; normalize_v(d); + double r[3] = { mv[0], mv[4], mv[8] }; + int rev = scalarproduct_v(d, r) < 0.; + double n[3] = { mv[2], mv[6], mv[10] }; { double const s = scalarproduct_v(d,n); @@ -173,9 +176,9 @@ void draw_arrow( w += glutStrokeWidth(GLUT_STROKE_ROMAN, *c); w *= annot_size / 100.; - float tx = (ax + bx - w*d[0])/2.; - float ty = (ay + by - w*d[1])/2.; - float tz = (az + bz - w*d[2])/2.; + float tx = (ax + bx)/2.; + float ty = (ay + by)/2.; + float tz = (az + bz)/2.; GLdouble r[16] = { d[0], d[1], d[2], 0, @@ -186,7 +189,9 @@ void draw_arrow( glPushMatrix(); glTranslatef(tx, ty, tz); glMultMatrixd(r); - glTranslatef(0, annot_size*0.1, 0); + if(rev) + glScalef(-1, -1, 1); + glTranslatef(-w/2., annot_size*0.1, 0); draw_strokestring(GLUT_STROKE_ROMAN, annot_size, annotation); glPopMatrix(); } -- cgit v1.2.3 From 22d663cd3978b420aa90c7216973ecef012b2094 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Mon, 13 May 2013 00:57:42 +0200 Subject: added scene drawing to 'frustum' --- samples/OpenGL/frustum/frustum.c | 138 ++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 32 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index 493d2eb..35a946d 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -14,7 +14,7 @@ int window_observer; /* == basic Q^3 vector math functions == */ -void crossproduct( +static void crossproduct( double ax, double ay, double az, double bx, double by, double bz, double *rx, double *ry, double *rz ) @@ -24,7 +24,7 @@ void crossproduct( *rz = ax*by - ay*bx; } -void crossproduct_v( +static void crossproduct_v( double const * const a, double const * const b, double * const c ) @@ -35,14 +35,14 @@ void crossproduct_v( c, c+1, c+2 ); } -double scalarproduct( +static double scalarproduct( double ax, double ay, double az, double bx, double by, double bz ) { return ax*bx + ay*by + az*bz; } -double scalarproduct_v( +static double scalarproduct_v( double const * const a, double const * const b ) { @@ -51,7 +51,7 @@ double scalarproduct_v( b[0], b[1], b[2] ); } -double length( +static double length( double ax, double ay, double az ) { return sqrt( @@ -60,12 +60,12 @@ double length( ax, ay, az ) ); } -double length_v( double const * const a ) +static double length_v( double const * const a ) { return sqrt( scalarproduct_v(a, a) ); } -double normalize( +static double normalize( double *x, double *y, double *z) { double const k = 1./length(*x, *y, *z); @@ -75,7 +75,7 @@ double normalize( *z *= k; } -double normalize_v( double *a ) +static double normalize_v( double *a ) { double const k = 1./length_v(a); a[0] *= k; @@ -241,17 +241,80 @@ void draw_frustum( glLineStipple(1, 0xffff); glDisable(GL_LINE_STIPPLE); glDrawElements(GL_LINES, 2*4*3, GL_UNSIGNED_SHORT, idx_vol); + glDisableClientState(GL_VERTEX_ARRAY); glLineWidth(1); - glDisableClientState(GL_VERTEX_ARRAY); + draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near=1.0", 0.075); + draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0, "left", 0.075); + draw_arrow(0, 0, -n, r, 0, -n, 0, 0.1, "right", 0.075); + draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0, "bottom", 0.075); + draw_arrow(0, 0, -n, 0, t, -n, 0, 0.1, "top", 0.075); +} + +static void draw_grid1d( + float ax, float ay, float az, /* grid advance */ + float dx, float dy, float dz, /* grid direction */ + float l0, float l1, /* grid line range */ + int major, int begin, int end,/* major line modulus; grid begin, end */ + float or, float og, float ob /* origin line color r,g,b */ ) +{ } /* == scene drawing code == */ -void display_observer(float frustum_aspect) +#define N_LIGHTS 2 +struct { + GLfloat diffuse[3]; + GLfloat position[4]; +} light[N_LIGHTS] = { + { {255./255., 202./255., 99./255.}, {-1, 1, 1, 0} }, + { {30./255, 38./255., 82./255.}, { 0, 1, -0.4, 0} }, +}; + +void draw_scene(void) { - static float alpha = 0; + glPushMatrix(); + glTranslatef(0, 0, -2.5); + + for(int i = 0; i < N_LIGHTS; i++) { + glEnable( GL_LIGHT0 + i); + glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, light[i].diffuse); + glLightfv(GL_LIGHT0 + i, GL_POSITION, light[i].position); + } + + glEnable(GL_LIGHTING); + + glEnable(GL_COLOR_MATERIAL); + glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); + + glPushMatrix(); + glTranslatef(-0.75, 0, -0.5); + glRotatef(45, 0, 1, 0); + + glColor3f(0.9, 0.9, 0.9); + glutSolidTeapot(0.6); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(0.5, 0, 0.5); + glRotatef(45, 0, 1, 0); + + glColor3f(0.9, 0.9, 0.9); + glutSolidCube(0.6); + glPopMatrix(); + glPopMatrix(); +} + +/* == display functions == */ + +struct { + float left, right, bottom, top; + float near, far; +} frustum = {-1, 1, -1, 1, 1, 4}; + +void display_observer(float frustum_aspect) +{ int const win_width = glutGet(GLUT_WINDOW_WIDTH); int const win_height = glutGet(GLUT_WINDOW_HEIGHT); float const win_aspect = (float)win_width / (float)win_height; @@ -265,44 +328,37 @@ void display_observer(float frustum_aspect) #ifdef USE_ORTHO glOrtho(-10*win_aspect, 10*win_aspect, -10, 10, 0, 100); #else - gluPerspective(35, win_aspect, 1, 50); + gluPerspective(60, win_aspect, 1, 50); #endif glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(1) { glTranslatef(0, 0, -5); - glRotatef(30, 1, 0, 0); - glRotatef(alpha, 0, 1, 0); + glRotatef(15, 1, 0, 0); + glRotatef(-60, 0, 1, 0); glTranslatef(0, 0, 2.5); } else { gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); } - float const l = -0.5*frustum_aspect, - r = 0.5*frustum_aspect, - b = -0.5, - t = 0.5, - n = 1, - f = 4; - glEnable(GL_MULTISAMPLE); + glDisable(GL_LIGHTING); + glDepthMask(GL_TRUE); glColor3f(0.,0.,0.); - draw_frustum(l, r, b, t, n, f); - - glLineWidth(1); - draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near", 0.075); + draw_frustum( + frustum.left, + frustum.right, + frustum.bottom, + frustum.top, + frustum.near, + frustum.far ); - draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0, "left", 0.075); - draw_arrow(0, 0, -n, r, 0, -n, 0, 0.1, "right", 0.075); - draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0, "bottom", 0.075); - draw_arrow(0, 0, -n, 0, t, -n, 0, 0.1, "top", 0.075); + glEnable(GL_DEPTH_TEST); + draw_scene(); glutSwapBuffers(); - - alpha = fmodf(alpha + 0.1, 360); - glutPostRedisplay(); } void display_view(int const win_width, int const win_height) @@ -313,6 +369,24 @@ void display_view(int const win_width, int const win_height) glClearColor(0.3, 0.3, 0.6, 1.); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( + frustum.left, + frustum.right, + frustum.bottom, + frustum.top, + frustum.near, + frustum.far ); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_MULTISAMPLE); + + draw_scene(); + glutSwapBuffers(); } -- cgit v1.2.3 From 6ae3ddce77ff91c9b66f4f0c993ab85885dd5d14 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Mon, 13 May 2013 20:31:41 +0200 Subject: ... --- samples/OpenGL/frustum/frustum.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index 35a946d..b6ac75a 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -9,6 +9,15 @@ #include #include +#if defined(GLUT_MULTISAMPLE) && defined(GL_MULTISAMPLE) +#define OPTION_GLUT_MULTISAMPLE GLUT_MULTISAMPLE +#define OPTION_MULTISAMPLE 1 +#else +#define OPTION_GLUT_MULTISAMPLE 0 +#define OPTION_MULTISAMPLE 0 +#warning "multisample token(s) not available at compiletime" +#endif + int window_view; int window_observer; @@ -244,11 +253,11 @@ void draw_frustum( glDisableClientState(GL_VERTEX_ARRAY); glLineWidth(1); - draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near=1.0", 0.075); - draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0, "left", 0.075); - draw_arrow(0, 0, -n, r, 0, -n, 0, 0.1, "right", 0.075); - draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0, "bottom", 0.075); - draw_arrow(0, 0, -n, 0, t, -n, 0, 0.1, "top", 0.075); + draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near", 0.075); + draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0.0, "left", 0.075); + draw_arrow(0, 0, -n, r, 0, -n, 0.0, 0.1, "right", 0.075); + draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0.0, "bottom", 0.075); + draw_arrow(0, 0, -n, 0, t, -n, 0.0, 0.1, "top", 0.075); } static void draw_grid1d( @@ -342,7 +351,13 @@ void display_observer(float frustum_aspect) gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); } +#if OPTION_MULTISAMPLE glEnable(GL_MULTISAMPLE); +#endif + +#ifdef GL_DEPTH_CLAMP + glEnable(GL_DEPTH_CLAMP); +#endif glDisable(GL_LIGHTING); glDepthMask(GL_TRUE); @@ -364,6 +379,7 @@ void display_observer(float frustum_aspect) void display_view(int const win_width, int const win_height) { float const win_aspect = (float)win_width / (float)win_height; + frustum.left = -(frustum.right = win_aspect); glViewport(0, 0, win_width, win_height); glClearColor(0.3, 0.3, 0.6, 1.); @@ -383,7 +399,10 @@ void display_view(int const win_width, int const win_height) glLoadIdentity(); glEnable(GL_DEPTH_TEST); + +#if OPTION_MULTISAMPLE glEnable(GL_MULTISAMPLE); +#endif draw_scene(); @@ -405,7 +424,7 @@ void display(void) int main(int argc, char *argv[]) { glutInit(&argc, argv); - glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE); + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE | OPTION_GLUT_MULTISAMPLE); window_observer = glutCreateWindow("Observer"); glutDisplayFunc(display); -- cgit v1.2.3 From 12c48a05b2f5c51c61ff744f419bdd85a552612c Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Wed, 15 May 2013 09:19:18 +0200 Subject: 'frustum': changed annotation arrow placement, added far annotation arrows, added XY grid --- samples/OpenGL/frustum/frustum.c | 124 ++++++++++++++++++++++++++++++++++----- 1 file changed, 110 insertions(+), 14 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index b6ac75a..51efb7e 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -2,6 +2,8 @@ #include #include +#include + #include #include @@ -252,21 +254,97 @@ void draw_frustum( glDrawElements(GL_LINES, 2*4*3, GL_UNSIGNED_SHORT, idx_vol); glDisableClientState(GL_VERTEX_ARRAY); - glLineWidth(1); - draw_arrow(0, 0, 0, 0, 0, -n, 0.1, 0.1, "near", 0.075); - draw_arrow(l, 0, -n, 0, 0, -n, 0.1, 0.0, "left", 0.075); - draw_arrow(0, 0, -n, r, 0, -n, 0.0, 0.1, "right", 0.075); - draw_arrow(0, b, -n, 0, 0, -n, 0.1, 0.0, "bottom", 0.075); - draw_arrow(0, 0, -n, 0, t, -n, 0.0, 0.1, "top", 0.075); + glLineWidth(1.5); + + float const text_size = 0.15f; + + draw_arrow(l, 0, 0, 0, 0, 0, 0.1, 0.0, "left", text_size); + draw_arrow(0, 0, 0, r, 0, 0, 0.0, 0.1, "right", text_size); + draw_arrow(0, b, 0, 0, 0, 0, 0.1, 0.0, "bottom", text_size); + draw_arrow(0, 0, 0, 0, t, 0, 0.0, 0.1, "top", text_size); + + draw_arrow(r, 0, 0, r, 0, -n, 0.1, 0.1, "near", text_size); + draw_arrow(l, 0, 0, l, 0, -n, 0.1, 0.1, "near", text_size); + draw_arrow(0, t, 0, 0, t, -n, 0.1, 0.1, "near", text_size); + draw_arrow(0, b, 0, 0, b, -n, 0.1, 0.1, "near", text_size); + + draw_arrow(0, f*t/n, 0, 0, f*t/n, -f, 0.1, 0.1, "far", text_size); + draw_arrow(0, f*b/n, 0, 0, f*b/n, -f, 0.1, 0.1, "far", text_size); + draw_arrow(f*l/n, 0, 0, f*l/n, 0, -f, 0.1, 0.1, "far", text_size); + draw_arrow(f*r/n, 0, 0, f*r/n, 0, -f, 0.1, 0.1, "far", text_size); } static void draw_grid1d( - float ax, float ay, float az, /* grid advance */ - float dx, float dy, float dz, /* grid direction */ - float l0, float l1, /* grid line range */ - int major, int begin, int end,/* major line modulus; grid begin, end */ - float or, float og, float ob /* origin line color r,g,b */ ) + double ax, double ay, double az, /* grid advance */ + double dx, double dy, double dz, /* grid direction */ + float l0, float l1, /* grid line range */ + int major, int begin, int end, /* major line modulus; grid begin, end */ + float or, float og, float ob /* origin line color r,g,b */ ) { + if( begin > end ) { + int t = begin; + begin = end; + end = t; + } + unsigned int const N = end - begin + 1; + + GLfloat *pos = alloca(N*6 * sizeof(*pos)); + GLfloat *col = alloca(N*8 * sizeof(*col)); + + normalize(&dx, &dy, &dz); + + for(int i = begin; i <= end; i++) { + int const j = i - begin; + pos[j*6 + 0] = i*ax + l0*dx; + pos[j*6 + 1] = i*ay + l0*dy; + pos[j*6 + 2] = i*az + l0*dz; + pos[j*6 + 3] = i*ax + l1*dx; + pos[j*6 + 4] = i*ay + l1*dy; + pos[j*6 + 5] = i*az + l1*dz; + + GLfloat r,g,b,a; +#if 1 + if( !i ) { + r = or; + g = og; + b = ob; + a = 1.; + } else if( !(i % major) ) { + r = g = b = 0.3; + a = 0.5; + } else { + r = g = b = 0.5; + a = 0.33; + } +#else + r = 1.; + g = b = 0.; + a = 1.; +#endif + + col[j*8 + 0] = col[j*8 + 4] = r; + col[j*8 + 1] = col[j*8 + 5] = g; + col[j*8 + 2] = col[j*8 + 6] = b; + col[j*8 + 3] = col[j*8 + 7] = a; + } + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + glDisable(GL_LIGHTING); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, pos); + glColorPointer(4, GL_FLOAT, 0, col); + + glLineWidth(1); + glLineStipple(1, 0xffff); + glDisable(GL_LINE_STIPPLE); + + glDrawArrays(GL_LINES, 0, N*2); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); } /* == scene drawing code == */ @@ -329,7 +407,7 @@ void display_observer(float frustum_aspect) float const win_aspect = (float)win_width / (float)win_height; glViewport(0, 0, win_width, win_height); - glClearColor(1., 1., 1., 1.); + glClearColor(1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); @@ -343,9 +421,9 @@ void display_observer(float frustum_aspect) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(1) { - glTranslatef(0, 0, -5); + glTranslatef(0, 0, -10); glRotatef(15, 1, 0, 0); - glRotatef(-60, 0, 1, 0); + glRotatef(-15, 0, 1, 0); glTranslatef(0, 0, 2.5); } else { gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); @@ -373,6 +451,24 @@ void display_observer(float frustum_aspect) glEnable(GL_DEPTH_TEST); draw_scene(); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDepthMask(GL_FALSE); + draw_grid1d( + 0, 0.1, 0, + 1, 0, 0, + -5, 5, + 10, -50, 50, + 1, 0.3, 0.3 ); + draw_grid1d( + 0.1, 0, 0, + 0, 1, 0, + -5, 5, + 10, -50, 50, + 0.3, 1, 0.3 ); + glDepthMask(GL_TRUE); + glDisable(GL_BLEND); + glutSwapBuffers(); } -- cgit v1.2.3 From 4842cb28522a89c0a6d800139b934001484fadbe Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 26 Jul 2013 11:14:54 +0200 Subject: ... --- samples/OpenGL/frustum/frustum.c | 12 ++++++ samples/OpenGL/qt_terr/Makefile | 2 +- samples/OpenGL/qt_terr/main.cpp | 38 ++++++++---------- samples/OpenGL/qt_terr/quad.h | 2 +- samples/OpenGL/qt_terr/terragen.cpp | 2 +- samples/OpenGL/qt_terr/terragen.h | 4 +- samples/OpenGL/qt_terr/terrain.cpp | 29 ++++++-------- samples/OpenGL/qt_terr/terrain.h | 13 +++++-- .../x11argb_opengl_glsl/x11argb_opengl_glsl.c | 45 +++++++++++++++++++--- 9 files changed, 95 insertions(+), 52 deletions(-) diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index 51efb7e..c5732c8 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -11,6 +11,8 @@ #include #include +#include "linmath.h" + #if defined(GLUT_MULTISAMPLE) && defined(GL_MULTISAMPLE) #define OPTION_GLUT_MULTISAMPLE GLUT_MULTISAMPLE #define OPTION_MULTISAMPLE 1 @@ -208,6 +210,16 @@ void draw_arrow( } } +void draw_arc( + vec3 center, + vec3 a, vec3 b, + float ah, float bh, + char const * const annotation, + float annot_size ) +{ + a[0] = b[2]; +} + void draw_frustum( float l, float r, float b, float t, float n, float f ) diff --git a/samples/OpenGL/qt_terr/Makefile b/samples/OpenGL/qt_terr/Makefile index 1f9c52b..22ecad9 100644 --- a/samples/OpenGL/qt_terr/Makefile +++ b/samples/OpenGL/qt_terr/Makefile @@ -1,6 +1,6 @@ CC = gcc CPP = g++ -OBJS += main.o quad.o terragen.o terrain.o vecmath.o +OBJS += quad.o terragen.o terrain.o vecmath.o main.o qt_terr: $(OBJS) $(CPP) -o qt_terr $(OBJS) -lm -lGL -lGLU -lGLEW -lglut -lIL -lILU -lILUT diff --git a/samples/OpenGL/qt_terr/main.cpp b/samples/OpenGL/qt_terr/main.cpp index 64c4327..e8bf78e 100644 --- a/samples/OpenGL/qt_terr/main.cpp +++ b/samples/OpenGL/qt_terr/main.cpp @@ -20,7 +20,8 @@ using namespace std; #include "terragen.h" #include "terrain.h" -Terrain Q; +std::vector terraindata; +Terrain Q(&terraindata); double const water_level=-1.0; @@ -92,7 +93,7 @@ int main(int argc, char **argv) std::string img_filename( terrain_filename ); img_filename.replace(img_filename.length()-5, 4, ".png"); - texID=ilutGLLoadImage(img_filename.c_str()); + texID = ilutGLLoadImage((char*)img_filename.c_str()); glBindTexture(GL_TEXTURE_2D, texID); int x, y; @@ -174,12 +175,6 @@ void assign_elevations(Terrain *pT, double *buffer, int width, int height, doubl pT->z[1][1]=( buffer[ PEL(right+top*width) ] -t )*k; pT->z[1][0]=( buffer[ PEL(left+top*width) ] -t )*k; - pT->z_mean=( - pT->z[0][0]+ - pT->z[0][1]+ - pT->z[1][1]+ - pT->z[1][0])*0.25; - if(pT->is_split()) { assign_elevations((Terrain*)pT->quads[0][0], buffer, width, height, t, k, @@ -291,7 +286,7 @@ void keyboard(unsigned char key, int x, int y) glutPostRedisplay(); } -void draw_quad(Terrain *pQ, int LOD=0, double z1=0, double z2=0, double z3=0, double z4=0); +void draw_quad(Quad *pQ, int LOD=0, double z1=0, double z2=0, double z3=0, double z4=0); GLdouble cam_pos[3];//={68.0f*scale[0], 44.0f*scale[1], 47.7*scale[2]*0.5}; double cam_la[3]; @@ -328,8 +323,8 @@ void display() cam_pos[0]=dx*width*scale[0]; cam_pos[1]=dy*height*scale[1]; - cam_pos[2]=max(dz*scale[2]*width*3, (20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean)*scale[2]); - //cam_pos[2]=(20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean)*scale[2]; + cam_pos[2]=max(dz*scale[2]*width*3, (20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean())*scale[2]); + //cam_pos[2]=(20.0f+((Terrain*)Q.get_at(dx, dy))->z_mean())*scale[2]; cam_la[0]=width*scale[0]*0.5; cam_la[1]=height*scale[1]*0.5; @@ -420,16 +415,17 @@ bool in_view(double a[3]) return false; } -void draw_quad(Terrain *pT, int LOD, double z1, double z2, double z3, double z4) +void draw_quad(Quad *pQ, int LOD, double z1, double z2, double z3, double z4) { + Terrain *pT = dynamic_cast(pQ); bool bRefine=true; bool bInFront=true; - double Q[3]={pT->x_mid*width*scale[0], pT->y_mid*height*scale[1], pT->z_mean*scale[2]}; - double Q1[3]={pT->x1*width*scale[0], pT->y1*height*scale[1], pT->z[0][0]*scale[2]}; - double Q2[3]={pT->x2*width*scale[0], pT->y1*height*scale[1], pT->z[0][1]*scale[2]}; - double Q3[3]={pT->x2*width*scale[0], pT->y2*height*scale[1], pT->z[1][1]*scale[2]}; - double Q4[3]={pT->x1*width*scale[0], pT->y2*height*scale[1], pT->z[1][0]*scale[2]}; + double Q[3] ={(*pT->x_mid())*width*scale[0], (*pT->y_mid())*height*scale[1], (pT->z_mean())*scale[2]}; + double Q1[3]={(*pT->x1())*width*scale[0], (*pT->y1())*height*scale[1], (pT->z[0][0])*scale[2]}; + double Q2[3]={(*pT->x2())*width*scale[0], (*pT->y1())*height*scale[1], (pT->z[0][1])*scale[2]}; + double Q3[3]={(*pT->x2())*width*scale[0], (*pT->y2())*height*scale[1], (pT->z[1][1])*scale[2]}; + double Q4[3]={(*pT->x1())*width*scale[0], (*pT->y2())*height*scale[1], (pT->z[1][0])*scale[2]}; double Qt[3]; double dir[3]; @@ -563,19 +559,19 @@ void draw_quad(Terrain *pT, int LOD, double z1, double z2, double z3, double z4) else glColor3f(1,1,1); //LUM(one_minus_lod_scale[0]); - glTexCoord2f(pT->x1, pT->y1); + glTexCoord2f(*pT->x1(), *pT->y1()); glVertex3dv(Q1); //LUM(one_minus_lod_scale[1]); - glTexCoord2f(pT->x2, pT->y1); + glTexCoord2f(*pT->x2(), *pT->y1()); glVertex3dv(Q2); //LUM(one_minus_lod_scale[2]); - glTexCoord2f(pT->x2, pT->y2); + glTexCoord2f(*pT->x2(), *pT->y2()); glVertex3dv(Q3); //LUM(one_minus_lod_scale[3]); - glTexCoord2f(pT->x1, pT->y2); + glTexCoord2f(*pT->x1(), *pT->y2()); glVertex3dv(Q4); } } diff --git a/samples/OpenGL/qt_terr/quad.h b/samples/OpenGL/qt_terr/quad.h index 1c6549a..36850e6 100644 --- a/samples/OpenGL/qt_terr/quad.h +++ b/samples/OpenGL/qt_terr/quad.h @@ -39,9 +39,9 @@ public: virtual void track_down(double x, double y, int levels); virtual Quad *get_at(double x, double y, int max_level=0, int level=0); -protected: virtual void set_range(double nx1, double nx2, double ny1, double ny2); +protected: Quad(std::vector*); std::vector * const V; }; diff --git a/samples/OpenGL/qt_terr/terragen.cpp b/samples/OpenGL/qt_terr/terragen.cpp index 3b922a4..73c6eaa 100644 --- a/samples/OpenGL/qt_terr/terragen.cpp +++ b/samples/OpenGL/qt_terr/terragen.cpp @@ -16,7 +16,7 @@ typedef uint8_t OCTET[8]; #define DUET_TO_NUMBER(duet) ((duet[0]|duet[1]<<8)) #define QUARTET_TO_NUMBER(quartet) ((quartet[0])|(quartet[1]<<8)|(quartet[2]<<16)|(quartet[3]<<24)) -int read_terrain(char *filename, double **pbuffer, int *width, int *height, double *scale) +int read_terrain(char const *filename, double **pbuffer, int *width, int *height, double *scale) // [in] filename: path to the file to be read in // [out] pbuffer: address of new allocated data buffer // [out] width: width of the terrain diff --git a/samples/OpenGL/qt_terr/terragen.h b/samples/OpenGL/qt_terr/terragen.h index 5037a08..a63bc34 100644 --- a/samples/OpenGL/qt_terr/terragen.h +++ b/samples/OpenGL/qt_terr/terragen.h @@ -1,6 +1,6 @@ #ifndef TERRAGEN_H #define TERRAGEN_H -int read_terrain(char *filename, double **pbuffer, int *width, int *height, double *scale); +int read_terrain(char const *filename, double **pbuffer, int *width, int *height, double *scale); -#endif/*TERRAGEN*/ \ No newline at end of file +#endif/*TERRAGEN*/ diff --git a/samples/OpenGL/qt_terr/terrain.cpp b/samples/OpenGL/qt_terr/terrain.cpp index d08d345..e18efe4 100644 --- a/samples/OpenGL/qt_terr/terrain.cpp +++ b/samples/OpenGL/qt_terr/terrain.cpp @@ -1,10 +1,5 @@ #include "terrain.h" -Terrain::Terrain() -{ - z_mean=0.0; -} - void Terrain::split() { if(is_split()) @@ -15,29 +10,27 @@ void Terrain::split() quads[1][0] = new Terrain(V); quads[1][1] = new Terrain(V); - quads[0][0]->set_range(x1, x_mid, y1, y_mid); - quads[0][1]->set_range(x_mid, x2, y1, y_mid); - quads[1][0]->set_range(x1, x_mid, y_mid, y2); - quads[1][1]->set_range(x_mid, x2, y_mid, y2); + quads[0][0]->set_range(*x1(), *x_mid(), *y1(), *y_mid()); + quads[0][1]->set_range(*x_mid(), *x2(), *y1(), *y_mid()); + quads[1][0]->set_range(*x1(), *x_mid(), *y_mid(), *y2()); + quads[1][1]->set_range(*x_mid(), *x2(), *y_mid(), *y2()); } void Terrain::track_down(double x, double y, double nz, int levels) { - if(levels>0) - { - int a=(x 0 ) { + int a = ( x < *x_mid() ) ? 0 : 1; + int b = ( y < *y_mid() ) ? 0 : 1; - if(!is_split()) + if( !is_split() ) split(); - quads[b][a]->track_down(x, y, nz, levels-1); + dynamic_cast(quads[b][a])->track_down(x, y, nz, levels-1); } - else - { + else { z[0][0]= z[0][1]= z[1][1]= - z[1][0]=z_mean=nz; + z[1][0] = z_mean_ = nz; } } diff --git a/samples/OpenGL/qt_terr/terrain.h b/samples/OpenGL/qt_terr/terrain.h index 0197380..3382a4c 100644 --- a/samples/OpenGL/qt_terr/terrain.h +++ b/samples/OpenGL/qt_terr/terrain.h @@ -4,17 +4,24 @@ #include "quad.h" #include +#include class Terrain : public Quad { public: - double * const z_mean() { - + double z_mean_; + double z_mean() { + if( isnan(z_mean_) ) { + return z_mean_ = + ( z[0][0] + z[0][1] + + z[1][0] + z[1][1] ) / 4.; + } + return z_mean_; }; double z[2][2]; public: - Terrain(); + Terrain(std::vector* V_) : Quad(V_) { z_mean_ = NAN; } virtual void split(); virtual void track_down(double x, double y, double nz, int levels); diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c index d918f0b..3c5908b 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c +++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c @@ -311,16 +311,51 @@ static void createTheRenderContext() fatalError("OpenGL not supported by X server\n"); } - render_context = glXCreateNewContext(Xdisplay, fbconfig, GLX_RGBA_TYPE, 0, True); - if (!render_context) { - fatalError("Failed to create a GL context\n"); +#if USE_GLX_CREATE_CONTEXT_ATTRIB + #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 + #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 + render_context = NULL; + if( isExtensionSupported( glXQueryExtensionsString(Xdisplay, DefaultScreen(Xdisplay)), "GLX_ARB_create_context" ) ) { + typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*); + glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" ); + if( glXCreateContextAttribsARB ) { + int context_attribs[] = + { + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + GLX_CONTEXT_MINOR_VERSION_ARB, 0, + //GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + None + }; + + int (*oldHandler)(Display*, XErrorEvent*) = XSetErrorHandler(&ctxErrorHandler); + + render_context = glXCreateContextAttribsARB( Xdisplay, fbconfig, 0, True, context_attribs ); + + XSync( Xdisplay, False ); + XSetErrorHandler( oldHandler ); + + fputs("glXCreateContextAttribsARB failed", stderr); + } else { + fputs("glXCreateContextAttribsARB could not be retrieved", stderr); + } + } else { + fputs("glXCreateContextAttribsARB not supported", stderr); + } + + if(!render_context) + { +#else + { +#endif + render_context = glXCreateNewContext(Xdisplay, fbconfig, GLX_RGBA_TYPE, 0, True); + if (!render_context) { + fatalError("Failed to create a GL context\n"); + } } if (!glXMakeContextCurrent(Xdisplay, glX_window_handle, glX_window_handle, render_context)) { fatalError("glXMakeCurrent failed for window\n"); } - - glewInit(); } static int updateTheMessageQueue() -- cgit v1.2.3 From de232895ac390d09ed242deaadbccbe4812b15bd Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 26 Jul 2013 11:23:13 +0200 Subject: added glXCreateContextAttrib to x11argb_opengl_glsl example --- samples/OpenGL/x11argb_opengl_glsl/Makefile | 9 ++++- .../x11argb_opengl_glsl/x11argb_opengl_glsl.c | 39 ++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/samples/OpenGL/x11argb_opengl_glsl/Makefile b/samples/OpenGL/x11argb_opengl_glsl/Makefile index b59feea..62e3496 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/Makefile +++ b/samples/OpenGL/x11argb_opengl_glsl/Makefile @@ -1,3 +1,10 @@ +.PHONY: all + +all: x11argb_opengl_glsl x11argb_opengl_glsl3 + x11argb_opengl_glsl: x11argb_opengl_glsl.c Makefile - clang -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm + cc -std=c99 -g3 -o x11argb_opengl_glsl x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm + +x11argb_opengl_glsl3: x11argb_opengl_glsl.c Makefile + cc -std=c99 -g3 -o x11argb_opengl_glsl3 -D USE_GLX_CREATE_CONTEXT_ATTRIB x11argb_opengl_glsl.c -lX11 -lXrender -lGLEW -lm diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c index 3c5908b..b658f5c 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c +++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c @@ -130,6 +130,37 @@ static void fatalError(const char *why) exit(0x666); } +static int isExtensionSupported(const char *extList, const char *extension) +{ + + const char *start; + const char *where, *terminator; + + /* Extension names should not have spaces. */ + where = strchr(extension, ' '); + if ( where || *extension == '\0' ) + return 0; + + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + for ( start = extList; ; ) { + where = strstr( start, extension ); + + if ( !where ) + break; + + terminator = where + strlen( extension ); + + if ( where == start || *(where - 1) == ' ' ) + if ( *terminator == ' ' || *terminator == '\0' ) + return 1; + + start = terminator; + } + return 0; +} + static int Xscreen; static Atom del_atom; static Colormap cmap; @@ -304,6 +335,12 @@ static void createTheWindow() } } +static int ctxErrorHandler( Display *dpy, XErrorEvent *ev ) +{ + fputs("Error at context creation", stderr); + return 0; +} + static void createTheRenderContext() { int dummy; @@ -356,6 +393,8 @@ static void createTheRenderContext() if (!glXMakeContextCurrent(Xdisplay, glX_window_handle, glX_window_handle, render_context)) { fatalError("glXMakeCurrent failed for window\n"); } + + glewInit(); } static int updateTheMessageQueue() -- cgit v1.2.3 From 987f70c8e9b1bab87647d4ed20df79900d6c0c9e Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sat, 14 Sep 2013 15:59:51 +0200 Subject: X11 clobberable window added --- samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 10 ++ .../x11argb_opengl_glsl/x11argb_opengl_glsl.c | 14 ++ samples/X11/clobberme/Makefile | 3 + samples/X11/clobberme/clobberme.c | 171 +++++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 samples/X11/clobberme/Makefile create mode 100644 samples/X11/clobberme/clobberme.c diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index 1c1e2e0..723c6ae 100644 --- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c +++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c @@ -23,12 +23,16 @@ \_____/ FTB. ------------------------------------------------------------------------*/ +#define _GNU_SOURCE #include #include #include #include +#include +#include + #include #include #include @@ -461,7 +465,13 @@ static void redrawTheWindow() b = fmod(b+0.5, 360.); c = fmod(c+0.25, 360.); + struct timespec Ta, Tb; + + clock_gettime(CLOCK_MONOTONIC_RAW, &Ta); glXSwapBuffers(Xdisplay, glX_window_handle); + clock_gettime(CLOCK_MONOTONIC_RAW, &Tb); + + fprintf(stderr, "glXSwapBuffers returned after %f ms\n", 1e3*((double)Tb.tv_sec + 1e-6*(double)Tb.tv_nsec) - 1e3*((double)Ta.tv_sec + 1e-6*(double)Ta.tv_nsec)); } int main(int argc, char *argv[]) diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c index b658f5c..0852cbc 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c +++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c @@ -24,12 +24,17 @@ ------------------------------------------------------------------------*/ +#define _GNU_SOURCE + #include #include #include #include #include +#include +#include + #include #include #include @@ -571,7 +576,16 @@ static void redrawTheWindow(double T) draw_cube(); popModelview(); + struct timespec Ta, Tb; + + clock_gettime(CLOCK_MONOTONIC_RAW, &Ta); glXSwapBuffers(Xdisplay, glX_window_handle); + glXWaitGL(); + clock_gettime(CLOCK_MONOTONIC_RAW, &Tb); + + fprintf(stderr, "glXSwapBuffers + glXWaitGL returned after %f ms\n", + 1e3*( (double)Tb.tv_sec + 1e-9*(double)Tb.tv_nsec ) - + 1e3*( (double)Ta.tv_sec + 1e-9*(double)Ta.tv_nsec ) ); } static double getftime(void) { diff --git a/samples/X11/clobberme/Makefile b/samples/X11/clobberme/Makefile new file mode 100644 index 0000000..52dfca8 --- /dev/null +++ b/samples/X11/clobberme/Makefile @@ -0,0 +1,3 @@ +clobberme: clobberme.c Makefile + $(CC) -o clobberme -lX11 clobberme.c + diff --git a/samples/X11/clobberme/clobberme.c b/samples/X11/clobberme/clobberme.c new file mode 100644 index 0000000..ac58dc5 --- /dev/null +++ b/samples/X11/clobberme/clobberme.c @@ -0,0 +1,171 @@ +/*------------------------------------------------------------------------ + * A demonstration of a clobberable X11 window, i.e. a window that will + * assume the contents of whatever was visible above it, without clearing + * or tidying up itself. + * + * (c) 2013 by Wolfgang 'datenwolf' Draxinger + + * License agreement: This source code is provided "as is". You + * can use this source code however you want for your own personal + * use. If you give this source code to anybody else then you must + * leave this message in it. +------------------------------------------------------------------------*/ +#define _GNU_SOURCE + +#include +#include +#include +#include + +#include +#include + +#include +#include + +static void fatalError(const char *why) +{ + fprintf(stderr, "%s", why); + exit(0x666); +} + +static int Xscreen; +static Atom del_atom; +static Colormap cmap; +static Display *Xdisplay; +static Visual *Xvisual; +static Window Xroot, window_handle; +static int width, height; + +static Bool WaitForMapNotify(Display *d, XEvent *e, char *arg) +{ + return d && e && arg && (e->type == MapNotify) && (e->xmap.window == *(Window*)arg); +} + +static void createTheWindow() +{ + XEvent event; + int x,y, attr_mask; + XSizeHints hints; + XWMHints *startup_state; + XTextProperty textprop; + XSetWindowAttributes attr = {0,}; + static char *title = "FTB's little OpenGL example - ARGB extension by WXD"; + + Xdisplay = XOpenDisplay(NULL); + if (!Xdisplay) { + fatalError("Couldn't connect to X server\n"); + } + Xscreen = DefaultScreen(Xdisplay); + Xroot = RootWindow(Xdisplay, Xscreen); + Xvisual = DefaultVisual(Xdisplay, Xscreen); + + /* Create a colormap - only needed on some X clients, eg. IRIX */ + cmap = XCreateColormap(Xdisplay, Xroot, Xvisual, AllocNone); + + attr.colormap = cmap; + attr.background_pixmap = None; + attr.border_pixmap = None; + attr.border_pixel = 0; + attr.event_mask = + StructureNotifyMask | + EnterWindowMask | + LeaveWindowMask | + ExposureMask | + ButtonPressMask | + ButtonReleaseMask | + OwnerGrabButtonMask | + KeyPressMask | + KeyReleaseMask; + + attr_mask = 0 + // | CWBackPixmap + | CWColormap + // | CWBorderPixel + | CWEventMask ; + + width = DisplayWidth(Xdisplay, DefaultScreen(Xdisplay))/2; + height = DisplayHeight(Xdisplay, DefaultScreen(Xdisplay))/2; + x=width/2, y=height/2; + + window_handle = XCreateWindow( Xdisplay, + Xroot, + x, y, width, height, + 0, + CopyFromParent, + InputOutput, + Xvisual, + attr_mask, &attr); + + if( !window_handle ) { + fatalError("Couldn't create the window\n"); + } + + textprop.value = (unsigned char*)title; + textprop.encoding = XA_STRING; + textprop.format = 8; + textprop.nitems = strlen(title); + + hints.x = x; + hints.y = y; + hints.width = width; + hints.height = height; + hints.flags = USPosition|USSize; + + startup_state = XAllocWMHints(); + startup_state->initial_state = NormalState; + startup_state->flags = StateHint; + + XSetWMProperties(Xdisplay, window_handle,&textprop, &textprop, + NULL, 0, + &hints, + startup_state, + NULL); + + XFree(startup_state); + + XMapWindow(Xdisplay, window_handle); + XIfEvent(Xdisplay, &event, WaitForMapNotify, (char*)&window_handle); + + if ((del_atom = XInternAtom(Xdisplay, "WM_DELETE_WINDOW", 0)) != None) { + XSetWMProtocols(Xdisplay, window_handle, &del_atom, 1); + } +} + +static int updateTheMessageQueue() +{ + XEvent event; + XConfigureEvent *xc; + + while (XPending(Xdisplay)) + { + XNextEvent(Xdisplay, &event); + switch (event.type) + { + case ClientMessage: + if (event.xclient.data.l[0] == del_atom) + { + return 0; + } + break; + + case ConfigureNotify: + xc = &(event.xconfigure); + width = xc->width; + height = xc->height; + break; + } + } + return 1; +} + +int main(int argc, char *argv[]) +{ + createTheWindow(); + + while (updateTheMessageQueue()) { + } + + return 0; +} + -- cgit v1.2.3 From 5ff666091056c897f04bf14619df53034801382e Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sat, 14 Sep 2013 16:05:46 +0200 Subject: X11 clobberme window title --- samples/X11/clobberme/clobberme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/X11/clobberme/clobberme.c b/samples/X11/clobberme/clobberme.c index ac58dc5..3eb194a 100644 --- a/samples/X11/clobberme/clobberme.c +++ b/samples/X11/clobberme/clobberme.c @@ -50,7 +50,7 @@ static void createTheWindow() XWMHints *startup_state; XTextProperty textprop; XSetWindowAttributes attr = {0,}; - static char *title = "FTB's little OpenGL example - ARGB extension by WXD"; + static char *title = "A useless clobberable X11 window example by WXD"; Xdisplay = XOpenDisplay(NULL); if (!Xdisplay) { -- cgit v1.2.3 From adc7a12773fa9062ef74ecc33d75de046b533a34 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 15 Sep 2013 02:15:44 +0200 Subject: x11atomstuffer added --- samples/X11/x11atomstuffer/Makefile | 3 ++ samples/X11/x11atomstuffer/x11atomstuffer.c | 73 +++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 samples/X11/x11atomstuffer/Makefile create mode 100644 samples/X11/x11atomstuffer/x11atomstuffer.c diff --git a/samples/X11/x11atomstuffer/Makefile b/samples/X11/x11atomstuffer/Makefile new file mode 100644 index 0000000..cf1c234 --- /dev/null +++ b/samples/X11/x11atomstuffer/Makefile @@ -0,0 +1,3 @@ +x11atomstuffer: x11atomstuffer.c + $(CC) -o x11atomstuffer x11atomstuffer.c -lX11 + diff --git a/samples/X11/x11atomstuffer/x11atomstuffer.c b/samples/X11/x11atomstuffer/x11atomstuffer.c new file mode 100644 index 0000000..d2f338f --- /dev/null +++ b/samples/X11/x11atomstuffer/x11atomstuffer.c @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------ + * What happens if you stuff the X11 server with large and large amounts + * of atoms? When does it run out of memory? How is its performance + * impaired by this? This is a little program to experimenting with + * torturing the X11 server by overfeeding it with atoms. + * + * (c) 2013 datenwolf + * + * License agreement: This source code is provided "as is". You + * can use this source code however you want for your own personal + * use. If you give this source code to anybody else then you must + * leave this message in it. +------------------------------------------------------------------------*/ + +#include +#include +#include + +#include +#include + +#include +#include + +static int Xscreen; +static Display *Xdisplay; + +char const doitkey[] = "wastemyX11server"; + +int main(int argc, char *argv[]) +{ + unsigned int i; + + if( argc < 2 || strcmp(argv[1], doitkey) ) { + fprintf(stderr, +"***************** WARNING! *****************\n" +"\n" +"This program wastes serious resources of the\n" +"X11 server it is started on. Do not execute\n" +"this program on a production X11 session as\n" +"the allocated resources can not be reclaimed\n" +"without resetting or quiting the X11 server.\n" +"\n" +"To actually perform this, do the following:\n" +"\n" +"%s %s\n" +"\n" +"***************** WARNING! *****************\n", + argv[0], doitkey); + return 0; + } + + Xdisplay = XOpenDisplay(NULL); + if (!Xdisplay) { + fprintf(stderr, "Couldn't connect to X server\n"); + return -1; + } + Xscreen = DefaultScreen(Xdisplay); + + unsigned int r = getpid() ^ time(NULL); + + for(i=0; i < 0xffffffff; i++) { + char atomstr[33]; + snprintf(atomstr,32, "_wasted_0x%08x_0x%08x", r, i); + XInternAtom(Xdisplay, atomstr, False); + if( !(i % 0x00010000 ) ) { + fprintf(stderr, "%s\n", atomstr); + } + } + + return 0; +} + -- cgit v1.2.3 From edd45b2d961876fe2105a1a27fa53b7c2044ed5b Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 15 Sep 2013 02:57:12 +0200 Subject: type for counter changed to not overflow before loop conditional is reached --- samples/X11/x11atomstuffer/x11atomstuffer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/X11/x11atomstuffer/x11atomstuffer.c b/samples/X11/x11atomstuffer/x11atomstuffer.c index d2f338f..70ed425 100644 --- a/samples/X11/x11atomstuffer/x11atomstuffer.c +++ b/samples/X11/x11atomstuffer/x11atomstuffer.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,8 @@ char const doitkey[] = "wastemyX11server"; int main(int argc, char *argv[]) { - unsigned int i; + uint64_t i; + unsigned int r = getpid() ^ time(NULL); if( argc < 2 || strcmp(argv[1], doitkey) ) { fprintf(stderr, @@ -57,11 +59,9 @@ int main(int argc, char *argv[]) } Xscreen = DefaultScreen(Xdisplay); - unsigned int r = getpid() ^ time(NULL); - for(i=0; i < 0xffffffff; i++) { char atomstr[33]; - snprintf(atomstr,32, "_wasted_0x%08x_0x%08x", r, i); + snprintf(atomstr,32, "_wasted_0x%08x_0x%08x", r, (unsigned int)i); XInternAtom(Xdisplay, atomstr, False); if( !(i % 0x00010000 ) ) { fprintf(stderr, "%s\n", atomstr); -- cgit v1.2.3 From 270ca4e2f9f144e3d538a3d89e1141fcf7dfd689 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sun, 15 Sep 2013 02:59:07 +0200 Subject: reworded warning message --- samples/X11/x11atomstuffer/x11atomstuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/X11/x11atomstuffer/x11atomstuffer.c b/samples/X11/x11atomstuffer/x11atomstuffer.c index 70ed425..dfa86de 100644 --- a/samples/X11/x11atomstuffer/x11atomstuffer.c +++ b/samples/X11/x11atomstuffer/x11atomstuffer.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) "This program wastes serious resources of the\n" "X11 server it is started on. Do not execute\n" "this program on a production X11 session as\n" -"the allocated resources can not be reclaimed\n" +"the allocated atoms can not be freed/reused\n" "without resetting or quiting the X11 server.\n" "\n" "To actually perform this, do the following:\n" -- cgit v1.2.3 From dbfdab658eea6830a3ca5be205ed766aaa8ac6db Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 17 Sep 2013 12:42:48 +0200 Subject: added minimalvbo example --- samples/OpenGL/minimalvbo/.minimalvbo.c.swp | Bin 0 -> 20480 bytes samples/OpenGL/minimalvbo/Makefile | 5 + samples/OpenGL/minimalvbo/minimalvbo.c | 154 +++++++++++++++++++++++++ samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 4 +- 4 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 samples/OpenGL/minimalvbo/.minimalvbo.c.swp create mode 100644 samples/OpenGL/minimalvbo/Makefile create mode 100644 samples/OpenGL/minimalvbo/minimalvbo.c diff --git a/samples/OpenGL/minimalvbo/.minimalvbo.c.swp b/samples/OpenGL/minimalvbo/.minimalvbo.c.swp new file mode 100644 index 0000000..9ec9f9c Binary files /dev/null and b/samples/OpenGL/minimalvbo/.minimalvbo.c.swp differ diff --git a/samples/OpenGL/minimalvbo/Makefile b/samples/OpenGL/minimalvbo/Makefile new file mode 100644 index 0000000..0e6b724 --- /dev/null +++ b/samples/OpenGL/minimalvbo/Makefile @@ -0,0 +1,5 @@ +OBJS = minimalvbo.o + +minimalvbo: $(OBJS) + $(CC) -o minimalvbo $(OBJS) -lm -lGL -lGLU -lGLEW -lglut + diff --git a/samples/OpenGL/minimalvbo/minimalvbo.c b/samples/OpenGL/minimalvbo/minimalvbo.c new file mode 100644 index 0000000..3440c88 --- /dev/null +++ b/samples/OpenGL/minimalvbo/minimalvbo.c @@ -0,0 +1,154 @@ +#include +#include + +#include +#include +#include +#include + +void init(); +void display(); + +/* With the introduction of Buffer Objects, a somewhat questionable decision + * regarding the reuse of existing API was made. Specifically the reuse of the + * gl...Pointer functions to supply integers through their `data` parameter + * which is a pointer can lead to serious complications, should a compiler + * decide to implement augmented or tagged pointers. + * + * In many OpenGL tutorials, and even the reference documentation one can + * find that an iteger gets cast into a pointer. From the point of view of + * the C language standard and the interpretation of integers cast to pointer + * this practice should be strongly discouraged. The far better method + * is not to cast the offset integer value to a pointer, but to cast the + * gl...Pointer functions to a type signature that defines the `data` parameter + * to be an integer. To keep the size of the `data` parameter consistent + * use the C standard type `uintptr_t` which is guaranted to be large enough + * to hold the integer representation of a pointer. + * + * The same also goes for the glDraw...Elements functions. + * + * Also see http://stackoverflow.com/a/8284829/524368 + */ +void (*glfixVertexOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glVertexPointer; +void (*glfixTexCoordOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glTexCoordPointer; +void (*glfixDrawElementsOffset)(GLenum, GLsizei, GLenum, uintptr_t const) = (void*)glDrawElements; +/* Those three functions are part of OpenGL-1.1, hence in the OpenGL ABIs of + * all operating systems with OpenGL support and thus available as symbols + * of the interface library, without additional initialization. + * + * Don't use static const initialization for function pointer obtained + * through the OpenGL extension mechanism! + */ + +int main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); + + glutCreateWindow("Minimal VBO example"); + glutDisplayFunc(display); + glutIdleFunc(glutPostRedisplay); + + glewInit(); + init(); + + glutMainLoop(); + + return 0; +} + +GLuint vertexbufId; +GLuint elementbufId; + +void init() +{ + glGenBuffers(1, &vertexbufId); + glBindBuffer(GL_ARRAY_BUFFER, vertexbufId); + + float const cube[5*8]= + { /* X Y Z U V */ + -1, -1, -1, 0, 0, + 1, -1, -1, 1, 0, + 1, 1, -1, 1, 1, + -1, 1, -1, 0, 1, + + -1, -1, 1, -1, 0, + 1, -1, 1, 0, 0, + 1, 1, 1, 0, 1, + -1, 1, 1, -1, 1, + }; + + glBufferData(GL_ARRAY_BUFFER, 5*8*sizeof(float), cube, GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); + + + glGenBuffers(1, &elementbufId); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbufId); + + unsigned int faces[4*6]= + { + 0, 1, 2, 3, + 1, 5, 6, 2, + 5, 4, 7, 6, + 4, 0, 3, 7, + 3, 2, 6, 7, + 4, 5, 1, 0 + }; + + glBufferData(GL_ELEMENT_ARRAY_BUFFER, 4*6*sizeof(float), faces, GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); +} + +static float a = 0., b = 0., c = 0.; + +void display() +{ + int const win_width = glutGet(GLUT_WINDOW_WIDTH); + int const win_height = glutGet(GLUT_WINDOW_HEIGHT); + float const win_aspect = (float)win_width / (float) win_height; + + glClearColor(0.5, 0.5, 1., 1.); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glViewport(0, 0, win_width, win_height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-win_aspect, win_aspect, -1, 1, 1, 10); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0, 0, -3); + glRotatef(a += 1.00, 1, 0, 0); + glRotatef(b += 0.66, 0, 1, 0); + glRotatef(c += 0.33, 0, 0, 1); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glBindBuffer(GL_ARRAY_BUFFER, vertexbufId); + glfixVertexOffset( 3, GL_FLOAT, 5*sizeof(float), 0); + glfixTexCoordOffset(2, GL_FLOAT, 5*sizeof(float), 3); + /* After the data source of a Vertex Array has been set + * this setting stays persistent regardless of any other + * state changes. So we can unbind the VBO bufferId here + * without loosing the connection. We must not delete + * the VBO though. + */ + glBindBuffer(GL_ARRAY_BUFFER, 0), + + glColor4f(0., 0., 0., 1.), + + /* Just drawing a wireframe */ + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbufId); + glfixDrawElementsOffset(GL_QUADS, 24, GL_UNSIGNED_INT, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + glutSwapBuffers(); +} + diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index 723c6ae..092c202 100644 --- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c +++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c @@ -187,7 +187,7 @@ static void createTheWindow() KeyReleaseMask; attr_mask = - CWBackPixmap| + // CWBackPixmap| CWColormap| CWBorderPixel| CWEventMask; @@ -480,9 +480,7 @@ int main(int argc, char *argv[]) createTheRenderContext(); while (updateTheMessageQueue()) { - #if 0 redrawTheWindow(); - #endif } return 0; -- cgit v1.2.3 From df6769764552c5d655e24ce5f1df2632e1837310 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 17 Sep 2013 12:43:41 +0200 Subject: removed Vim swapfile accidently added in previous commit --- samples/OpenGL/minimalvbo/.minimalvbo.c.swp | Bin 20480 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 samples/OpenGL/minimalvbo/.minimalvbo.c.swp diff --git a/samples/OpenGL/minimalvbo/.minimalvbo.c.swp b/samples/OpenGL/minimalvbo/.minimalvbo.c.swp deleted file mode 100644 index 9ec9f9c..0000000 Binary files a/samples/OpenGL/minimalvbo/.minimalvbo.c.swp and /dev/null differ -- cgit v1.2.3 From 62c3c51d080c96fe526c84b9ceb80f0292a95561 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 17 Sep 2013 13:14:03 +0200 Subject: a bit more comment on func pointer typecasting in minimalvbo --- samples/OpenGL/minimalvbo/minimalvbo.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/samples/OpenGL/minimalvbo/minimalvbo.c b/samples/OpenGL/minimalvbo/minimalvbo.c index 3440c88..5ad253b 100644 --- a/samples/OpenGL/minimalvbo/minimalvbo.c +++ b/samples/OpenGL/minimalvbo/minimalvbo.c @@ -18,16 +18,25 @@ void display(); * In many OpenGL tutorials, and even the reference documentation one can * find that an iteger gets cast into a pointer. From the point of view of * the C language standard and the interpretation of integers cast to pointer - * this practice should be strongly discouraged. The far better method - * is not to cast the offset integer value to a pointer, but to cast the - * gl...Pointer functions to a type signature that defines the `data` parameter - * to be an integer. To keep the size of the `data` parameter consistent - * use the C standard type `uintptr_t` which is guaranted to be large enough - * to hold the integer representation of a pointer. + * this practice should be strongly discouraged. + * + * The far better method is not to cast the offset integer value to a pointer, + * but to cast the `gl...Pointer` functions to a type signature that defines + * the `data` parameter to be an integer. To keep the size of the `data` + * parameter consistent use the C standard type `uintptr_t` which is guaranted + * to be large enough to hold the integer representation of a pointer. * * The same also goes for the glDraw...Elements functions. * * Also see http://stackoverflow.com/a/8284829/524368 + * + * A Note to C++ folks reading this: In C++ you'd have to make a cast to the + * L-values type signature so that the compiler doesn't warn and/or error + * out. In C there's this nice property that a void pointer (`void*`) R-value + * can be legally assigned to any pointer type L-value. So because of lazyness + * and because this is messing with type signatures I simply cast to a `void*` + * which perfectly well assigned to the function pointer signatures instead + * of writing `= (void(*)(bla bla bla))...` (or doing a lot of typedefs). */ void (*glfixVertexOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glVertexPointer; void (*glfixTexCoordOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glTexCoordPointer; -- cgit v1.2.3 From 9410ac0867d560bbe0a475c44e2522dbcb2ac4db Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Tue, 17 Sep 2013 13:15:10 +0200 Subject: a bit more comment on func pointer typecasting in minimalvbo --- samples/OpenGL/minimalvbo/minimalvbo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/OpenGL/minimalvbo/minimalvbo.c b/samples/OpenGL/minimalvbo/minimalvbo.c index 5ad253b..5be8f31 100644 --- a/samples/OpenGL/minimalvbo/minimalvbo.c +++ b/samples/OpenGL/minimalvbo/minimalvbo.c @@ -34,9 +34,9 @@ void display(); * L-values type signature so that the compiler doesn't warn and/or error * out. In C there's this nice property that a void pointer (`void*`) R-value * can be legally assigned to any pointer type L-value. So because of lazyness - * and because this is messing with type signatures I simply cast to a `void*` - * which perfectly well assigned to the function pointer signatures instead - * of writing `= (void(*)(bla bla bla))...` (or doing a lot of typedefs). + * and because this is messing with type signatures anyway we simply cast to + * a `void*` which perfectly well assignes to the function pointer signatures + * instead of writing `= (void(*)(bla bla bla))...` (or doing a lot of typedefs). */ void (*glfixVertexOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glVertexPointer; void (*glfixTexCoordOffset)(GLint, GLenum, GLsizei, uintptr_t const) = (void*)glTexCoordPointer; -- cgit v1.2.3 From 482f37cd2811b91b2892a8f001f5be8f8caec204 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Thu, 30 Jan 2014 14:57:02 +0100 Subject: added pocketwatch --- samples/OpenGL/pocketwatch/Makefile | 3 + samples/OpenGL/pocketwatch/pocketwatch.cpp | 155 ++ samples/OpenGL/pocketwatch/uhr.cpp | 2630 ++++++++++++++++++++++++++++ samples/OpenGL/pocketwatch/uhr.h | 88 + 4 files changed, 2876 insertions(+) create mode 100644 samples/OpenGL/pocketwatch/Makefile create mode 100644 samples/OpenGL/pocketwatch/pocketwatch.cpp create mode 100644 samples/OpenGL/pocketwatch/uhr.cpp create mode 100644 samples/OpenGL/pocketwatch/uhr.h diff --git a/samples/OpenGL/pocketwatch/Makefile b/samples/OpenGL/pocketwatch/Makefile new file mode 100644 index 0000000..ef8dda5 --- /dev/null +++ b/samples/OpenGL/pocketwatch/Makefile @@ -0,0 +1,3 @@ +pocketwatch: pocketwatch.cpp uhr.cpp uhr.h + $(CXX) -o pocketwatch pocketwatch.cpp uhr.cpp uhr.h -lGL -lGLU -lglut + diff --git a/samples/OpenGL/pocketwatch/pocketwatch.cpp b/samples/OpenGL/pocketwatch/pocketwatch.cpp new file mode 100644 index 0000000..e04ad0e --- /dev/null +++ b/samples/OpenGL/pocketwatch/pocketwatch.cpp @@ -0,0 +1,155 @@ +#include +#include +#include + +#include "uhr.h" + +using namespace uhr; + +void init(); +void reshape(int width, int height); +void display(); +void idle(); + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH); + + glutCreateWindow("PocketWatch"); + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutIdleFunc(idle); + init(); + + glutMainLoop(); + + return 0; +}; + +void init() +{ + glEnable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); +} + +float light_position[]={-0.5,0.5,1,0}; + +void reshape(int width, int height) +{ + glViewport(0,0,width,height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, (float)width/(float)height, 1, 10); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void draw_object(C3DObject const *obj); +void draw_object_rot_z(C3DObject const *obj, float rot); + +void display() +{ + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + glLoadIdentity(); + glTranslatef(0,0,-4); + + + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + draw_object(&object_gehaeuse); + draw_object(&object_boden); + draw_object(&object_ziffernblatt); + draw_object(&object_sekziffernblatt); + + time_t now=time(NULL); + tm tm_time=*localtime(&now); + + draw_object_rot_z(&object_stundenzeiger, (tm_time.tm_min/60.0f+tm_time.tm_hour)*720.0f/24.0f); + draw_object_rot_z(&object_minutenzeiger, (tm_time.tm_min+tm_time.tm_sec/60.0f)*360.0f/60.0f); + draw_object_rot_z(&object_sekundenzeiger, tm_time.tm_sec*360.0f/60.0f); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + draw_object(&object_deckel); + + glutSwapBuffers(); +} + +void idle() +{ + glutPostRedisplay(); +} + +void draw_object(C3DObject const *obj) +{ + glPushMatrix(); + glMultMatrixf(obj->matrix); + + float tmp[4]; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, obj->material); + + memcpy(tmp, obj->material+4, sizeof(float)*3); + tmp[3]=1.0f; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, tmp); + + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, obj->material[7]); + + for(int i=0; i<4; i++)tmp[i]=obj->material[i]*obj->material[8]; + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, tmp); + + glBegin(GL_TRIANGLES); + for(int f=0; f<*obj->nFaces; f++) + { + for(int v=0; v<3; v++) + { + int i=obj->faces[f][v]; + glNormal3fv(obj->verticies[i][1]); + glVertex3fv(obj->verticies[i][0]); + } + } + glEnd(); + + glPopMatrix(); +} + +void draw_object_rot_z(C3DObject const *obj, float rot) +{ + glPushMatrix(); + glMultMatrixf(obj->matrix); + glRotatef(rot,0,0,-1); + + float tmp[4]; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, obj->material); + + memcpy(tmp, obj->material+4, sizeof(float)*3); + tmp[3]=1.0f; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, tmp); + + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, obj->material[7]); + + for(int i=0; i<4; i++)tmp[i]=obj->material[i]*obj->material[8]; + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, tmp); + + glBegin(GL_TRIANGLES); + for(int f=0; f<*obj->nFaces; f++) + { + for(int v=0; v<3; v++) + { + int i=obj->faces[f][v]; + glNormal3fv(obj->verticies[i][1]); + glVertex3fv(obj->verticies[i][0]); + } + } + glEnd(); + + glPopMatrix(); +} diff --git a/samples/OpenGL/pocketwatch/uhr.cpp b/samples/OpenGL/pocketwatch/uhr.cpp new file mode 100644 index 0000000..417d902 --- /dev/null +++ b/samples/OpenGL/pocketwatch/uhr.cpp @@ -0,0 +1,2630 @@ +/**********************************************\ + uhr.cpp generated by the Blender to C script +\**********************************************/ + +#include "uhr.h" +namespace uhr +{ +/* */ +/* */ +float const verticies_boden[][2][3]= +{{{0.144795f,0.828108f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.840314f,-0.001383f,-0.000080f},{0.000092f,0.000519f,-0.999969f}}, +{{0.643116f,0.541017f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.000347f,-0.840746f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.001211f,0.840746f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.827676f,-0.145227f,0.000080f},{0.000092f,0.000000f,-1.000000f}}, +{{-0.790741f,0.286820f,0.000080f},{-0.000031f,0.000000f,-1.000000f}}, +{{-0.728928f,0.419698f,0.000080f},{-0.000061f,0.000061f,-1.000000f}}, +{{-0.827314f,-0.147207f,-0.000080f},{0.000092f,0.000000f,-1.000000f}}, +{{-0.789189f,-0.288557f,-0.000080f},{0.000092f,0.000031f,-1.000000f}}, +{{0.728065f,-0.419698f,0.000080f},{0.000092f,-0.000031f,-1.000000f}}, +{{0.539392f,0.644549f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.789877f,-0.286820f,0.000080f},{0.000092f,-0.000031f,-1.000000f}}, +{{-0.288716f,0.789776f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.727286f,0.421047f,0.000080f},{0.000000f,0.000793f,-0.999969f}}, +{{-0.727099f,-0.421139f,-0.000080f},{0.000061f,-0.000336f,-0.999969f}}, +{{-0.643980f,-0.541018f,0.000080f},{0.000000f,-0.000977f,-0.999969f}}, +{{0.420615f,-0.727718f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.644981f,0.539824f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.419266f,0.728496f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.146329f,-0.827838f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.540256f,-0.644549f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.420130f,-0.728497f,0.000080f},{0.000031f,0.000366f,-0.999969f}}, +{{0.287852f,-0.789776f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.828540f,0.145227f,0.000080f},{0.000031f,0.000549f,-0.999969f}}, +{{0.788325f,0.288556f,-0.000080f},{-0.000061f,-0.000275f,-0.999969f}}, +{{0.827405f,0.146761f,0.000080f},{-0.000031f,-0.000458f,-0.999969f}}, +{{0.540585f,-0.643548f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.286388f,-0.789704f,-0.000080f},{0.000275f,0.002655f,-0.999969f}}, +{{0.840314f,0.000779f,0.000080f},{0.000031f,0.000000f,-1.000000f}}, +{{-0.145659f,-0.828108f,0.000080f},{0.000244f,-0.002960f,-0.999969f}}, +{{0.644117f,-0.539824f,0.000080f},{0.000061f,-0.000092f,-1.000000f}}, +{{-0.147193f,0.827837f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.541449f,0.643548f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.421479f,0.727718f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +{{0.286388f,0.790309f,0.000080f},{0.000000f,0.000000f,-1.000000f}}, +}; +int const faces_boden[][3]= +{{4,0,32}, +{32,0,35}, +{13,32,35}, +{13,35,19}, +{34,13,19}, +{34,19,11}, +{33,34,11}, +{33,11,2}, +{18,33,2}, +{18,2,14}, +{7,18,14}, +{7,14,25}, +{6,7,25}, +{6,25,26}, +{24,6,26}, +{24,26,29}, +{1,24,29}, +{1,29,5}, +{8,1,5}, +{8,5,12}, +{9,8,12}, +{9,12,10}, +{15,9,10}, +{15,10,31}, +{16,15,31}, +{16,31,27}, +{21,16,27}, +{21,27,17}, +{22,21,17}, +{22,17,23}, +{28,22,23}, +{30,28,23}, +{30,23,20}, +{30,20,3}, +}; +int const nFaces_boden=34; +float const matrix_boden[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +-0.000006f,0.000000f,0.025000f,1.000000f, +}; +float const material_boden[]={ +0.500000f,0.500000f,0.500000f,1.000000f,0.413669f,0.413669f,0.413669f,17.000000f,0.000000f,}; +struct C3DObject const object_boden={verticies_boden, faces_boden, &nFaces_boden, matrix_boden, material_boden}; +/* */ + +/* */ +float const verticies_deckel[][2][3]= +{{{-0.000643f,0.000000f,0.033938f},{0.000000f,0.000000f,1.000000f}}, +{{0.584273f,0.000000f,0.011500f},{0.083834f,0.000000f,0.996460f}}, +{{0.180102f,-0.556284f,0.011500f},{0.025880f,-0.079714f,0.996460f}}, +{{-0.473848f,-0.343800f,0.011500f},{-0.067812f,-0.049257f,0.996460f}}, +{{-0.473848f,0.343800f,0.011500f},{-0.067812f,0.049257f,0.996460f}}, +{{0.180102f,0.556284f,0.011500f},{0.025880f,0.079714f,0.996460f}}, +{{0.253140f,0.781077f,-0.014948f},{0.045747f,0.140873f,0.988952f}}, +{{0.496914f,0.584913f,-0.007587f},{0.083743f,0.097385f,0.991699f}}, +{{0.303387f,0.000000f,0.028220f},{0.038453f,0.000000f,0.999237f}}, +{{0.401888f,0.292456f,0.018077f},{0.055666f,0.040437f,0.997620f}}, +{{0.093305f,0.289147f,0.028220f},{0.011872f,0.036561f,0.999237f}}, +{{0.709399f,0.292457f,-0.007587f},{0.118503f,0.049562f,0.991699f}}, +{{0.820634f,0.000000f,-0.014949f},{0.148106f,0.000000f,0.988952f}}, +{{-0.665069f,0.482728f,-0.014948f},{-0.119816f,0.087039f,0.988952f}}, +{{-0.403178f,0.653951f,-0.007587f},{-0.066713f,0.109745f,0.991699f}}, +{{-0.154398f,0.473202f,0.018077f},{-0.021241f,0.065462f,0.997620f}}, +{{-0.246607f,0.178701f,0.028220f},{-0.031098f,0.022584f,0.999237f}}, +{{-0.059376f,0.765660f,-0.007587f},{-0.010498f,0.127995f,0.991699f}}, +{{-0.665069f,-0.482728f,-0.014948f},{-0.119816f,-0.087039f,0.988952f}}, +{{-0.746980f,-0.180746f,-0.007587f},{-0.125004f,-0.029542f,0.991699f}}, +{{-0.498199f,0.000000f,0.018077f},{-0.068819f,0.000000f,0.997620f}}, +{{-0.246607f,-0.178701f,0.028220f},{-0.031098f,-0.022584f,0.999237f}}, +{{-0.746980f,0.180746f,-0.007587f},{-0.125004f,0.029542f,0.991699f}}, +{{0.253140f,-0.781077f,-0.014948f},{0.045747f,-0.140873f,0.988952f}}, +{{-0.059376f,-0.765660f,-0.007587f},{-0.010498f,-0.127995f,0.991699f}}, +{{-0.154398f,-0.473202f,0.018077f},{-0.021241f,-0.065462f,0.997620f}}, +{{0.093305f,-0.289147f,0.028220f},{0.011872f,-0.036561f,0.999237f}}, +{{-0.403178f,-0.653951f,-0.007587f},{-0.066713f,-0.109745f,0.991699f}}, +{{0.709399f,-0.292457f,-0.007587f},{0.118503f,-0.049562f,0.991699f}}, +{{0.401888f,-0.292456f,0.018077f},{0.055666f,-0.040437f,0.997620f}}, +{{0.496914f,-0.584913f,-0.007587f},{0.083743f,-0.097385f,0.991699f}}, +{{0.638841f,-0.577712f,-0.021281f},{0.122898f,-0.109806f,0.986297f}}, +{{0.532503f,-0.690061f,-0.022999f},{0.104129f,-0.135044f,0.985321f}}, +{{0.218718f,-0.675136f,-0.000618f},{0.034730f,-0.106876f,0.993652f}}, +{{0.378914f,-0.690061f,-0.010181f},{0.065645f,-0.119175f,0.990692f}}, +{{0.342736f,-0.577711f,0.003431f},{0.052553f,-0.087374f,0.994781f}}, +{{0.410495f,-0.791353f,-0.026469f},{0.083468f,-0.160192f,0.983520f}}, +{{0.282709f,-0.872084f,-0.031217f},{0.060610f,-0.186621f,0.980529f}}, +{{0.294630f,-0.429660f,0.016423f},{0.041414f,-0.060030f,0.997314f}}, +{{0.250165f,-0.293810f,0.024591f},{0.032624f,-0.038057f,0.998718f}}, +{{0.138029f,-0.426796f,0.021175f},{0.018464f,-0.056825f,0.998199f}}, +{{0.448121f,0.000000f,0.021175f},{0.059755f,0.000000f,0.998199f}}, +{{0.356292f,-0.147741f,0.024591f},{0.046266f,-0.019257f,0.998718f}}, +{{0.499235f,-0.148051f,0.016423f},{0.069887f,-0.020844f,0.997314f}}, +{{0.046785f,-0.145969f,0.032502f},{0.005799f,-0.017853f,0.999817f}}, +{{0.200964f,-0.146475f,0.030121f},{0.025391f,-0.018433f,0.999481f}}, +{{0.152839f,0.000000f,0.032502f},{0.018769f,0.000000f,0.999817f}}, +{{0.654907f,-0.148051f,0.003431f},{0.099338f,-0.022950f,0.994781f}}, +{{0.772937f,-0.147741f,-0.010181f},{0.133641f,-0.025605f,0.990692f}}, +{{0.709241f,0.000000f,-0.000618f},{0.112369f,0.000000f,0.993652f}}, +{{0.820398f,-0.293811f,-0.022999f},{0.160619f,-0.057314f,0.985321f}}, +{{0.746408f,-0.429661f,-0.021282f},{0.142430f,-0.082949f,0.986297f}}, +{{0.916322f,0.000000f,-0.031217f},{0.196204f,0.000000f,0.980560f}}, +{{0.879030f,-0.146476f,-0.026469f},{0.178137f,-0.029878f,0.983520f}}, +{{-0.352473f,-0.786706f,-0.021281f},{-0.066469f,-0.150822f,0.986297f}}, +{{-0.492182f,-0.720290f,-0.022999f},{-0.096255f,-0.140782f,0.985321f}}, +{{-0.574949f,-0.417253f,-0.000618f},{-0.090915f,-0.066042f,0.993652f}}, +{{-0.539642f,-0.574219f,-0.010181f},{-0.093051f,-0.099277f,0.990692f}}, +{{-0.443971f,-0.505094f,0.003431f},{-0.066866f,-0.076968f,0.994781f}}, +{{-0.626217f,-0.635556f,-0.026469f},{-0.126560f,-0.128880f,0.983520f}}, +{{-0.742484f,-0.538972f,-0.031217f},{-0.158727f,-0.115329f,0.980529f}}, +{{-0.318031f,-0.413592f,0.016423f},{-0.044282f,-0.057955f,0.997314f}}, +{{-0.202570f,-0.329323f,0.024591f},{-0.026093f,-0.042787f,0.998718f}}, +{{-0.363699f,-0.263772f,0.021175f},{-0.048341f,-0.035127f,0.998199f}}, +{{-0.030856f,-0.385118f,0.024591f},{-0.004028f,-0.049959f,0.998718f}}, +{{0.013020f,-0.521159f,0.016423f},{0.001740f,-0.072909f,0.997314f}}, +{{-0.124812f,-0.090213f,0.032502f},{-0.015198f,-0.011017f,0.999817f}}, +{{-0.077651f,-0.237001f,0.030121f},{-0.009674f,-0.029847f,0.999481f}}, +{{0.061123f,-0.669211f,0.003431f},{0.008850f,-0.101596f,0.994781f}}, +{{0.097891f,-0.781369f,-0.010181f},{0.016907f,-0.135014f,0.990692f}}, +{{-0.026365f,-0.871646f,-0.022999f},{-0.004883f,-0.170476f,0.985321f}}, +{{-0.178430f,-0.843257f,-0.021281f},{-0.034852f,-0.161077f,0.986297f}}, +{{0.131878f,-0.881880f,-0.026469f},{0.026612f,-0.178655f,0.983520f}}, +{{-0.857568f,0.091499f,-0.021281f},{-0.163976f,0.016602f,0.986297f}}, +{{-0.837577f,0.244893f,-0.022999f},{-0.163640f,0.048036f,0.985321f}}, +{{-0.574949f,0.417253f,-0.000618f},{-0.090915f,0.066042f,0.993652f}}, +{{-0.713321f,0.335169f,-0.010181f},{-0.123173f,0.057802f,0.990692f}}, +{{-0.618015f,0.265542f,0.003431f},{-0.093875f,0.039796f,0.994781f}}, +{{-0.798410f,0.398551f,-0.026469f},{-0.161687f,0.080538f,0.983520f}}, +{{-0.742484f,0.538972f,-0.031217f},{-0.158727f,0.115329f,0.980529f}}, +{{-0.492074f,0.174042f,0.016423f},{-0.068789f,0.024201f,0.997314f}}, +{{-0.376249f,0.090275f,0.024591f},{-0.048769f,0.011597f,0.998718f}}, +{{-0.363699f,0.263772f,0.021175f},{-0.048341f,0.035127f,0.998199f}}, +{{-0.376249f,-0.090275f,0.024591f},{-0.048769f,-0.011597f,0.998718f}}, +{{-0.492074f,-0.174042f,0.016423f},{-0.068789f,-0.024201f,0.997314f}}, +{{-0.124812f,0.090213f,0.032502f},{-0.015198f,0.011017f,0.999817f}}, +{{-0.249843f,0.000000f,0.030121f},{-0.031373f,0.000000f,0.999481f}}, +{{-0.618015f,-0.265542f,0.003431f},{-0.093875f,-0.039796f,0.994781f}}, +{{-0.713321f,-0.335169f,-0.010181f},{-0.123173f,-0.057802f,0.990692f}}, +{{-0.837577f,-0.244893f,-0.022999f},{-0.163640f,-0.048036f,0.985321f}}, +{{-0.857568f,-0.091499f,-0.021281f},{-0.163976f,-0.016602f,0.986297f}}, +{{-0.798410f,-0.398551f,-0.026469f},{-0.161687f,-0.080538f,0.983520f}}, +{{-0.178430f,0.843257f,-0.021281f},{-0.034852f,0.161077f,0.986297f}}, +{{-0.026365f,0.871646f,-0.022999f},{-0.004883f,0.170476f,0.985321f}}, +{{0.218718f,0.675136f,-0.000618f},{0.034730f,0.106876f,0.993652f}}, +{{0.097891f,0.781369f,-0.010181f},{0.016907f,0.135014f,0.990692f}}, +{{0.061123f,0.669211f,0.003431f},{0.008850f,0.101596f,0.994781f}}, +{{0.131878f,0.881880f,-0.026469f},{0.026612f,0.178655f,0.983520f}}, +{{0.282709f,0.872084f,-0.031217f},{0.060610f,0.186621f,0.980529f}}, +{{0.013020f,0.521159f,0.016423f},{0.001740f,0.072909f,0.997314f}}, +{{-0.030856f,0.385118f,0.024591f},{-0.004028f,0.049959f,0.998718f}}, +{{0.138029f,0.426796f,0.021175f},{0.018464f,0.056825f,0.998199f}}, +{{-0.202570f,0.329323f,0.024591f},{-0.026093f,0.042787f,0.998718f}}, +{{-0.318031f,0.413592f,0.016423f},{-0.044282f,0.057955f,0.997314f}}, +{{0.046785f,0.145969f,0.032502f},{0.005799f,0.017853f,0.999817f}}, +{{-0.077651f,0.237001f,0.030121f},{-0.009674f,0.029847f,0.999481f}}, +{{-0.443971f,0.505094f,0.003431f},{-0.066866f,0.076968f,0.994781f}}, +{{-0.539642f,0.574219f,-0.010181f},{-0.093051f,0.099277f,0.990692f}}, +{{-0.492182f,0.720290f,-0.022999f},{-0.096255f,0.140782f,0.985321f}}, +{{-0.352473f,0.786706f,-0.021281f},{-0.066469f,0.150822f,0.986297f}}, +{{-0.626217f,0.635556f,-0.026469f},{-0.126560f,0.128880f,0.983520f}}, +{{0.746408f,0.429661f,-0.021282f},{0.142430f,0.082949f,0.986297f}}, +{{0.820398f,0.293811f,-0.022999f},{0.160619f,0.057314f,0.985321f}}, +{{0.772937f,0.147741f,-0.010181f},{0.133641f,0.025605f,0.990692f}}, +{{0.654907f,0.148051f,0.003431f},{0.099338f,0.022950f,0.994781f}}, +{{0.879030f,0.146476f,-0.026469f},{0.178137f,0.029878f,0.983520f}}, +{{0.499235f,0.148051f,0.016423f},{0.069887f,0.020844f,0.997314f}}, +{{0.356292f,0.147741f,0.024591f},{0.046266f,0.019257f,0.998718f}}, +{{0.250165f,0.293810f,0.024591f},{0.032624f,0.038057f,0.998718f}}, +{{0.294630f,0.429660f,0.016423f},{0.041414f,0.060030f,0.997314f}}, +{{0.200964f,0.146475f,0.030121f},{0.025391f,0.018433f,0.999481f}}, +{{0.342736f,0.577711f,0.003431f},{0.052553f,0.087374f,0.994781f}}, +{{0.378914f,0.690061f,-0.010181f},{0.065645f,0.119175f,0.990692f}}, +{{0.532503f,0.690061f,-0.022999f},{0.104129f,0.135044f,0.985321f}}, +{{0.638841f,0.577712f,-0.021281f},{0.122898f,0.109806f,0.986297f}}, +{{0.410495f,0.791353f,-0.026469f},{0.083468f,0.160192f,0.983520f}}, +{{0.455461f,0.444591f,0.006882f},{0.068270f,0.066195f,0.995453f}}, +{{0.563133f,0.296394f,0.006882f},{0.084048f,0.044465f,0.995453f}}, +{{0.611286f,0.444591f,-0.006123f},{0.101657f,0.073855f,0.992065f}}, +{{-0.282533f,0.571164f,0.006882f},{-0.041841f,0.085391f,0.995453f}}, +{{-0.108318f,0.627771f,0.006882f},{-0.016327f,0.093692f,0.995453f}}, +{{-0.234382f,0.719362f,-0.006123f},{-0.038820f,0.119480f,0.992065f}}, +{{-0.630963f,-0.091590f,0.006882f},{-0.094150f,-0.013398f,0.995453f}}, +{{-0.630963f,0.091590f,0.006882f},{-0.094150f,0.013398f,0.995453f}}, +{{-0.757028f,0.000000f,-0.006123f},{-0.125645f,0.000000f,0.992065f}}, +{{-0.108318f,-0.627771f,0.006882f},{-0.016327f,-0.093692f,0.995453f}}, +{{-0.282533f,-0.571164f,0.006882f},{-0.041841f,-0.085391f,0.995453f}}, +{{-0.234382f,-0.719362f,-0.006123f},{-0.038820f,-0.119480f,0.992065f}}, +{{0.563133f,-0.296394f,0.006882f},{0.084048f,-0.044465f,0.995453f}}, +{{0.455461f,-0.444591f,0.006882f},{0.068270f,-0.066195f,0.995453f}}, +{{0.611286f,-0.444591f,-0.006123f},{0.101657f,-0.073855f,0.992065f}}, +{{0.630476f,-0.679229f,-0.033938f},{-0.124821f,0.136570f,-0.982727f}}, +{{0.822930f,-0.427503f,-0.033938f},{-0.164922f,0.084841f,-0.982635f}}, +{{0.915072f,-0.146261f,-0.033938f},{-0.202979f,0.030885f,-0.978668f}}, +{{0.926398f,-0.031009f,-0.033938f},{-0.205481f,0.019074f,-0.978454f}}, +{{-0.451606f,-0.810121f,-0.033938f},{0.091311f,0.160924f,-0.982727f}}, +{{-0.732406f,-0.569989f,-0.033938f},{-0.155004f,-0.136204f,0.978454f}}, +{{-0.152730f,-0.915369f,-0.033938f},{0.029725f,0.183050f,-0.982635f}}, +{{-0.111993f,-0.920470f,-0.033938f},{0.020692f,0.183874f,-0.982727f}}, +{{0.143220f,-0.916094f,-0.033938f},{-0.033326f,0.202612f,-0.978668f}}, +{{0.256324f,-0.891253f,-0.033938f},{-0.045320f,0.201331f,-0.978454f}}, +{{-0.918208f,0.138224f,-0.033938f},{-0.183294f,0.028291f,0.982635f}}, +{{-0.910470f,0.178545f,-0.033938f},{-0.181249f,0.037111f,0.982727f}}, +{{-0.827444f,0.419911f,-0.033938f},{-0.182379f,0.094302f,0.978668f}}, +{{-0.768868f,0.519803f,-0.033938f},{-0.177465f,0.105319f,0.978454f}}, +{{-0.918208f,-0.138224f,-0.033938f},{-0.183294f,-0.028291f,0.982635f}}, +{{-0.910470f,-0.178545f,-0.033938f},{-0.181249f,-0.037111f,0.982727f}}, +{{-0.152730f,0.915369f,-0.033938f},{-0.029725f,0.183050f,0.982635f}}, +{{-0.111993f,0.920470f,-0.033938f},{-0.020692f,0.183874f,0.982727f}}, +{{0.143220f,0.916094f,-0.033938f},{0.033326f,0.202612f,0.978668f}}, +{{-0.415651f,0.829939f,-0.033938f},{-0.083529f,0.165563f,0.982635f}}, +{{-0.451606f,0.810121f,-0.033938f},{-0.091311f,0.160924f,0.982727f}}, +{{-0.732406f,0.569989f,-0.033938f},{-0.155004f,0.136204f,0.978454f}}, +{{0.840371f,0.390332f,-0.033938f},{-0.168462f,-0.076510f,-0.982727f}}, +{{0.926398f,0.031009f,-0.033938f},{-0.205481f,-0.019074f,-0.978454f}}, +{{0.915072f,0.146261f,-0.033938f},{-0.202979f,-0.030885f,-0.978668f}}, +{{0.660436f,0.651157f,-0.033938f},{0.131626f,0.130619f,0.982635f}}, +{{0.630476f,0.679229f,-0.033938f},{0.124821f,0.136570f,0.982727f}}, +{{0.315324f,0.872084f,-0.033938f},{0.081637f,0.189520f,0.978454f}}, +{{0.421429f,0.825700f,-0.033938f},{0.092105f,0.183508f,0.978668f}}, +{{0.761101f,-0.529614f,-0.033938f},{-0.147801f,0.102817f,-0.983642f}}, +{{-0.268952f,-0.888119f,-0.033938f},{0.052095f,0.172338f,-0.983642f}}, +{{-0.305609f,-0.876208f,-0.033938f},{0.059145f,0.170049f,-0.983642f}}, +{{-0.928206f,-0.019273f,-0.033938f},{-0.180029f,-0.003693f,0.983642f}}, +{{-0.268952f,0.888119f,-0.033938f},{-0.052095f,0.172338f,0.983642f}}, +{{-0.305609f,0.876208f,-0.033938f},{-0.059145f,0.170049f,0.983642f}}, +{{0.738444f,0.560799f,-0.033938f},{-0.143468f,-0.108798f,-0.983642f}}, +{{0.489585f,0.785813f,-0.033938f},{0.104007f,0.161840f,0.981292f}}, +{{0.286382f,0.883387f,-0.033938f},{0.068972f,0.212287f,0.974761f}}, +{{0.548083f,0.747538f,-0.033938f},{0.112369f,0.156285f,0.981292f}}, +{{0.822930f,0.427503f,-0.033938f},{-0.164922f,-0.084841f,-0.982635f}}, +{{0.761101f,0.529614f,-0.033938f},{-0.147801f,-0.102817f,-0.983642f}}, +{{-0.655505f,0.656568f,-0.033938f},{-0.146062f,0.144292f,0.978668f}}, +{{0.256324f,0.891253f,-0.033938f},{0.045320f,0.201331f,0.978454f}}, +{{-0.005185f,0.927304f,-0.033938f},{0.000946f,0.192480f,0.981292f}}, +{{-0.827444f,-0.419911f,-0.033938f},{-0.182379f,-0.094302f,0.978668f}}, +{{-0.859137f,-0.347584f,-0.033938f},{-0.179266f,-0.069765f,0.981292f}}, +{{-0.752099f,-0.545958f,-0.033938f},{-0.180578f,-0.131199f,0.974761f}}, +{{-0.768868f,-0.519803f,-0.033938f},{-0.177465f,-0.105319f,0.978454f}}, +{{-0.752099f,0.545958f,-0.033938f},{-0.180578f,0.131199f,0.974761f}}, +{{-0.883965f,0.282234f,-0.033938f},{-0.182775f,0.060396f,0.981292f}}, +{{-0.928206f,0.019273f,-0.033938f},{-0.180029f,0.003693f,0.983642f}}, +{{0.064636f,-0.923886f,-0.033938f},{-0.010956f,0.192053f,-0.981292f}}, +{{-0.655505f,-0.656568f,-0.033938f},{-0.146062f,-0.144292f,0.978668f}}, +{{-0.542032f,-0.752869f,-0.033938f},{0.113926f,0.155156f,-0.981292f}}, +{{-0.415651f,-0.829939f,-0.033938f},{0.083529f,0.165563f,-0.982635f}}, +{{0.898200f,-0.223401f,-0.033938f},{-0.186041f,0.048891f,-0.981292f}}, +{{0.928206f,0.000000f,-0.033938f},{-0.223182f,0.000000f,-0.974761f}}, +{{0.840371f,-0.390332f,-0.033938f},{-0.168462f,0.076510f,-0.982727f}}, +{{0.421429f,-0.825700f,-0.033938f},{-0.092105f,0.183508f,-0.978668f}}, +{{0.489585f,-0.785813f,-0.033938f},{-0.104007f,0.161840f,-0.981292f}}, +{{0.286382f,-0.883387f,-0.033938f},{-0.068972f,0.212287f,-0.974761f}}, +{{0.315324f,-0.872084f,-0.033938f},{-0.081637f,0.189520f,-0.978454f}}, +{{0.548083f,-0.747538f,-0.033938f},{-0.112369f,0.156285f,-0.981292f}}, +{{0.660436f,-0.651157f,-0.033938f},{-0.131626f,0.130619f,-0.982635f}}, +{{0.738444f,-0.560799f,-0.033938f},{-0.143468f,0.108798f,-0.983642f}}, +{{0.879874f,-0.290867f,-0.033938f},{-0.183355f,0.058565f,-0.981292f}}, +{{-0.596509f,-0.709062f,-0.033938f},{0.121769f,0.148930f,-0.981292f}}, +{{-0.005185f,-0.927304f,-0.033938f},{-0.000946f,0.192480f,-0.981292f}}, +{{-0.859137f,0.347584f,-0.033938f},{-0.179266f,0.069765f,0.981292f}}, +{{-0.883965f,-0.282234f,-0.033938f},{-0.182775f,-0.060396f,0.981292f}}, +{{0.064636f,0.923886f,-0.033938f},{0.010956f,0.192053f,0.981292f}}, +{{-0.596509f,0.709062f,-0.033938f},{-0.121769f,0.148930f,0.981292f}}, +{{-0.542032f,0.752869f,-0.033938f},{-0.113926f,0.155156f,0.981292f}}, +{{0.898200f,0.223401f,-0.033938f},{-0.186041f,-0.048891f,-0.981292f}}, +{{0.879874f,0.290867f,-0.033938f},{-0.183355f,-0.058565f,-0.981292f}}, +}; +int const faces_deckel[][3]= +{{138,139,140}, +{135,136,137}, +{132,133,134}, +{129,130,131}, +{126,127,128}, +{122,123,125}, +{117,118,120}, +{112,113,115}, +{107,108,110}, +{100,102,105}, +{93,95,97}, +{88,89,91}, +{81,83,86}, +{74,76,78}, +{69,70,72}, +{62,64,67}, +{55,57,59}, +{48,50,53}, +{39,42,45}, +{32,34,36}, +{33,34,35}, +{38,39,40}, +{41,42,43}, +{44,45,46}, +{47,48,49}, +{56,57,58}, +{61,62,63}, +{40,64,65}, +{66,67,44}, +{68,69,33}, +{75,76,77}, +{80,81,82}, +{63,83,84}, +{85,86,66}, +{87,88,56}, +{94,95,96}, +{99,100,101}, +{82,102,103}, +{104,105,85}, +{106,107,75}, +{49,113,114}, +{116,117,41}, +{101,118,119}, +{46,120,104}, +{121,122,94}, +{119,126,121}, +{114,127,116}, +{124,128,111}, +{103,129,106}, +{96,130,99}, +{109,131,92}, +{84,132,87}, +{77,133,80}, +{90,134,73}, +{65,135,68}, +{58,136,61}, +{71,137,54}, +{43,138,47}, +{35,139,38}, +{51,140,31}, +{28,140,51}, +{30,31,140}, +{30,139,35}, +{29,38,139}, +{2,35,38}, +{29,138,43}, +{28,47,138}, +{1,43,47}, +{24,137,71}, +{27,54,137}, +{27,136,58}, +{25,61,136}, +{3,58,61}, +{25,135,65}, +{24,68,135}, +{2,65,68}, +{19,134,90}, +{22,73,134}, +{22,133,77}, +{20,80,133}, +{4,77,80}, +{20,132,84}, +{19,87,132}, +{3,84,87}, +{14,131,109}, +{17,92,131}, +{17,130,96}, +{15,99,130}, +{5,96,99}, +{15,129,103}, +{14,106,129}, +{4,103,106}, +{7,128,124}, +{11,111,128}, +{11,127,114}, +{9,116,127}, +{1,114,116}, +{9,126,119}, +{7,121,126}, +{5,119,121}, +{6,125,98}, +{7,124,123}, +{7,122,121}, +{6,94,122}, +{5,121,94}, +{8,120,46}, +{10,104,120}, +{0,46,104}, +{10,118,101}, +{9,119,118}, +{5,101,119}, +{9,117,116}, +{8,41,117}, +{1,116,41}, +{12,52,115}, +{12,113,49}, +{11,114,113}, +{1,49,114}, +{11,112,111}, +{13,110,79}, +{14,109,108}, +{14,107,106}, +{13,75,107}, +{4,106,75}, +{10,105,104}, +{16,85,105}, +{0,104,85}, +{16,102,82}, +{15,103,102}, +{4,82,103}, +{15,100,99}, +{10,101,100}, +{5,99,101}, +{6,98,97}, +{6,95,94}, +{17,96,95}, +{5,94,96}, +{17,93,92}, +{18,91,60}, +{19,90,89}, +{19,88,87}, +{18,56,88}, +{3,87,56}, +{16,86,85}, +{21,66,86}, +{0,85,66}, +{21,83,63}, +{20,84,83}, +{3,63,84}, +{20,81,80}, +{16,82,81}, +{4,80,82}, +{13,79,78}, +{13,76,75}, +{22,77,76}, +{4,75,77}, +{22,74,73}, +{23,72,37}, +{24,71,70}, +{24,69,68}, +{23,33,69}, +{2,68,33}, +{21,67,66}, +{26,44,67}, +{0,66,44}, +{26,64,40}, +{25,65,64}, +{2,40,65}, +{25,62,61}, +{21,63,62}, +{3,61,63}, +{18,60,59}, +{18,57,56}, +{27,58,57}, +{3,56,58}, +{27,55,54}, +{12,53,52}, +{28,51,50}, +{28,48,47}, +{12,49,48}, +{1,47,49}, +{26,45,44}, +{8,46,45}, +{0,44,46}, +{8,42,41}, +{29,43,42}, +{1,41,43}, +{29,39,38}, +{26,40,39}, +{2,38,40}, +{23,37,36}, +{23,34,33}, +{30,35,34}, +{2,33,35}, +{30,32,31}, +{30,34,32}, +{23,36,34}, +{29,42,39}, +{8,45,42}, +{26,39,45}, +{28,50,48}, +{12,48,53}, +{27,57,55}, +{18,59,57}, +{25,64,62}, +{26,67,64}, +{21,62,67}, +{24,70,69}, +{23,69,72}, +{22,76,74}, +{13,78,76}, +{20,83,81}, +{21,86,83}, +{16,81,86}, +{19,89,88}, +{18,88,91}, +{17,95,93}, +{6,97,95}, +{15,102,100}, +{16,105,102}, +{10,100,105}, +{14,108,107}, +{13,107,110}, +{11,113,112}, +{12,115,113}, +{9,118,117}, +{10,120,118}, +{8,117,120}, +{7,123,122}, +{6,122,125}, +{9,127,126}, +{11,128,127}, +{7,126,128}, +{15,130,129}, +{17,131,130}, +{14,129,131}, +{20,133,132}, +{22,134,133}, +{19,132,134}, +{25,136,135}, +{27,137,136}, +{24,135,137}, +{29,139,138}, +{30,140,139}, +{28,138,140}, +{32,31,204}, +{141,32,204}, +{37,36,199}, +{202,37,199}, +{142,51,50}, +{142,50,198}, +{143,53,52}, +{143,52,144}, +{55,54,195}, +{145,55,195}, +{193,59,60}, +{193,60,146}, +{147,71,70}, +{147,70,148}, +{149,72,37}, +{149,37,150}, +{151,73,74}, +{151,74,152}, +{153,78,79}, +{153,79,154}, +{89,90,155}, +{156,89,155}, +{60,91,185}, +{188,60,185}, +{157,92,93}, +{157,93,158}, +{159,97,98}, +{159,98,183}, +{108,109,160}, +{161,108,160}, +{79,110,182}, +{162,79,182}, +{112,111,180}, +{163,112,180}, +{52,115,165}, +{164,52,165}, +{123,124,166}, +{167,123,166}, +{98,125,169}, +{168,98,169}, +{205,31,51}, +{205,51,170}, +{54,71,171}, +{172,54,171}, +{173,90,73}, +{173,73,191}, +{109,92,174}, +{175,109,174}, +{111,124,176}, +{181,111,176}, +{169,125,177}, +{178,98,168}, +{179,123,167}, +{176,124,166}, +{165,115,214}, +{197,52,164}, +{215,112,163}, +{180,111,181}, +{182,110,212}, +{189,79,162}, +{213,108,161}, +{160,109,175}, +{211,97,159}, +{183,98,178}, +{158,93,184}, +{174,92,157}, +{185,91,186}, +{187,60,188}, +{210,89,156}, +{155,90,173}, +{209,78,153}, +{154,79,189}, +{152,74,190}, +{191,73,151}, +{192,72,149}, +{150,37,201}, +{148,70,208}, +{171,71,147}, +{193,59,207}, +{146,60,187}, +{194,55,145}, +{195,54,172}, +{196,53,143}, +{144,52,197}, +{198,50,206}, +{170,51,142}, +{199,36,200}, +{201,37,202}, +{203,32,141}, +{204,31,205}, +{36,32,203}, +{200,36,203}, +{206,50,53}, +{206,53,196}, +{59,55,194}, +{207,59,194}, +{208,70,72}, +{208,72,192}, +{190,74,78}, +{190,78,209}, +{91,89,210}, +{186,91,210}, +{184,93,97}, +{184,97,211}, +{110,108,213}, +{212,110,213}, +{115,112,215}, +{214,115,215}, +{125,123,179}, +{177,125,179}, +}; +int const nFaces_deckel=355; +float const matrix_deckel[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.000817f,0.000000f,0.079365f,1.000000f, +}; +float const material_deckel[]={ +0.0f,0.0f,0.0f,1.0f,0.517986f,0.517986f,0.517986f,128.0f,0.000000f,}; +struct C3DObject const object_deckel={verticies_deckel, faces_deckel, &nFaces_deckel, matrix_deckel, material_deckel}; +/* */ + +/* */ +float const verticies_gehaeuse[][2][3]= +{{{-0.000000f,1.033862f,0.013571f},{0.049898f,0.694449f,0.717795f}}, +{{-0.000000f,1.038830f,-0.004967f},{0.069124f,0.962004f,-0.264046f}}, +{{-0.000000f,1.025258f,-0.018539f},{0.017029f,0.237220f,-0.971282f}}, +{{-0.000000f,1.006720f,-0.013571f},{-0.051515f,-0.717185f,-0.694937f}}, +{{-0.000000f,1.001752f,0.004967f},{-0.069338f,-0.965056f,0.252663f}}, +{{-0.000000f,1.015323f,0.018539f},{-0.020081f,-0.279794f,0.959838f}}, +{{-0.045270f,1.018576f,0.018539f},{-0.031220f,-0.277963f,0.960051f}}, +{{-0.054513f,1.005669f,0.004967f},{-0.154027f,-0.953520f,0.258950f}}, +{{-0.051130f,1.010394f,-0.013571f},{-0.104923f,-0.703665f,-0.702719f}}, +{{-0.038503f,1.028025f,-0.018539f},{0.043672f,0.223426f,-0.973724f}}, +{{-0.029259f,1.040932f,-0.004967f},{0.132206f,0.954161f,-0.268410f}}, +{{-0.032642f,1.036208f,0.013571f},{0.102268f,0.679952f,0.726066f}}, +{{-0.062089f,1.043015f,0.013571f},{-0.213416f,-0.625813f,-0.750175f}}, +{{-0.055653f,1.047034f,-0.004967f},{-0.285104f,-0.916379f,0.280892f}}, +{{-0.073236f,1.036054f,-0.018539f},{0.080508f,0.183660f,-0.979675f}}, +{{-0.097255f,1.021056f,-0.013571f},{-0.217933f,-0.657094f,-0.721580f}}, +{{-0.103691f,1.017037f,0.004967f},{-0.328593f,-0.904233f,0.272622f}}, +{{-0.086108f,1.028017f,0.018539f},{-0.069887f,-0.266060f,0.961394f}}, +{{-0.118517f,1.042720f,0.018539f},{-0.118351f,-0.230445f,0.965850f}}, +{{-0.142718f,1.034743f,0.004967f},{-0.550462f,-0.785180f,0.283639f}}, +{{-0.133860f,1.037663f,-0.013571f},{-0.351756f,-0.561113f,-0.749260f}}, +{{-0.100801f,1.048560f,-0.018539f},{0.104312f,0.120365f,-0.987213f}}, +{{-0.076600f,1.056537f,-0.004967f},{0.485305f,0.819880f,-0.303690f}}, +{{-0.085458f,1.053617f,0.013571f},{0.335215f,0.507584f,0.793695f}}, +{{-0.100462f,1.066976f,0.013571f},{-0.440474f,-0.288522f,-0.850124f}}, +{{-0.090049f,1.068511f,-0.004967f},{-0.753807f,-0.564867f,0.335643f}}, +{{-0.118499f,1.064318f,-0.018539f},{0.105014f,0.047823f,-0.993316f}}, +{{-0.157362f,1.058589f,-0.013571f},{-0.510880f,-0.362712f,-0.779351f}}, +{{-0.167775f,1.057054f,0.004967f},{-0.818567f,-0.503647f,0.276131f}}, +{{-0.139325f,1.061248f,0.018539f},{-0.174383f,-0.148564f,0.973388f}}, +{{-0.146495f,1.081785f,0.018539f},{-0.207129f,0.000000f,0.978301f}}, +{{-0.176409f,1.081785f,0.004967f},{0.330485f,0.000000f,0.943785f}}, +{{-0.165460f,1.081785f,-0.013571f},{-0.606739f,0.000000f,-0.794885f}}, +{{-0.124597f,1.081785f,-0.018539f},{0.094638f,0.000000f,-0.995483f}}, +{{-0.094683f,1.081785f,-0.004967f},{-0.254250f,0.000000f,-0.967132f}}, +{{-0.105632f,1.081785f,0.013571f},{0.474441f,0.000000f,0.880276f}}, +{{-0.100462f,1.096595f,0.013571f},{-0.440474f,0.288522f,-0.850124f}}, +{{-0.090049f,1.095060f,-0.004967f},{-0.217689f,0.139500f,-0.965972f}}, +{{-0.118499f,1.099253f,-0.018539f},{0.105014f,-0.047823f,-0.993316f}}, +{{-0.157362f,1.104982f,-0.013571f},{-0.510880f,0.362712f,-0.779351f}}, +{{-0.167775f,1.106517f,0.004967f},{-0.278420f,0.182165f,-0.942991f}}, +{{-0.139325f,1.102324f,0.018539f},{-0.174383f,0.148564f,0.973388f}}, +{{-0.118517f,1.120851f,0.018539f},{-0.118351f,0.230445f,0.965850f}}, +{{-0.142718f,1.128828f,0.004967f},{-0.550462f,0.785180f,0.283639f}}, +{{-0.133860f,1.125908f,-0.013571f},{-0.351756f,0.561113f,-0.749260f}}, +{{-0.100801f,1.115011f,-0.018539f},{0.104312f,-0.120365f,-0.987213f}}, +{{-0.076600f,1.107034f,-0.004967f},{0.485305f,-0.819880f,-0.303690f}}, +{{-0.085458f,1.109954f,0.013571f},{0.335215f,-0.507584f,0.793695f}}, +{{-0.062089f,1.120556f,0.013571f},{-0.213416f,0.625813f,-0.750145f}}, +{{-0.055653f,1.116538f,-0.004967f},{-0.285104f,0.916379f,0.280892f}}, +{{-0.073236f,1.127517f,-0.018539f},{0.080508f,-0.183660f,-0.979675f}}, +{{-0.097255f,1.142515f,-0.013571f},{-0.217933f,0.657094f,-0.721580f}}, +{{-0.103691f,1.146534f,0.004967f},{-0.328593f,0.904233f,0.272622f}}, +{{-0.086108f,1.135555f,0.018539f},{-0.069887f,0.266060f,0.961394f}}, +{{-0.045269f,1.144995f,0.018539f},{-0.031220f,0.277963f,0.960051f}}, +{{-0.054513f,1.157902f,0.004967f},{-0.154027f,0.953520f,0.258950f}}, +{{-0.051130f,1.153177f,-0.013571f},{-0.104923f,0.703665f,-0.702719f}}, +{{-0.038503f,1.135546f,-0.018539f},{0.043672f,-0.223426f,-0.973724f}}, +{{-0.029259f,1.122639f,-0.004967f},{0.132206f,-0.954161f,-0.268410f}}, +{{-0.032642f,1.127363f,0.013571f},{0.102268f,-0.679952f,0.726066f}}, +{{0.000000f,1.129709f,0.013571f},{0.000000f,0.695303f,-0.718680f}}, +{{0.000000f,1.124741f,-0.004967f},{0.000000f,0.964324f,0.264687f}}, +{{0.000000f,1.138313f,-0.018539f},{0.000000f,-0.237251f,-0.971435f}}, +{{0.000000f,1.156851f,-0.013571f},{0.000000f,0.718162f,-0.695853f}}, +{{0.000000f,1.161819f,0.004967f},{0.000000f,0.967376f,0.253273f}}, +{{0.000000f,1.148247f,0.018539f},{0.000000f,0.279855f,0.960021f}}, +{{0.045270f,1.144995f,0.018539f},{0.031220f,0.277963f,0.960051f}}, +{{0.054513f,1.157902f,0.004967f},{0.154027f,0.953520f,0.258950f}}, +{{0.051130f,1.153177f,-0.013571f},{0.104923f,0.703665f,-0.702719f}}, +{{0.038503f,1.135546f,-0.018539f},{-0.043672f,-0.223426f,-0.973724f}}, +{{0.029259f,1.122639f,-0.004967f},{-0.132206f,-0.954161f,-0.268410f}}, +{{0.032642f,1.127363f,0.013571f},{-0.102268f,-0.679952f,0.726066f}}, +{{0.062089f,1.120556f,0.013571f},{0.213416f,0.625813f,-0.750175f}}, +{{0.055653f,1.116538f,-0.004967f},{0.285104f,0.916379f,0.280892f}}, +{{0.073236f,1.127517f,-0.018539f},{-0.080508f,-0.183660f,-0.979675f}}, +{{0.097255f,1.142515f,-0.013571f},{0.217933f,0.657094f,-0.721580f}}, +{{0.103691f,1.146534f,0.004967f},{0.328593f,0.904233f,0.272622f}}, +{{0.086108f,1.135554f,0.018539f},{0.069887f,0.266060f,0.961394f}}, +{{0.118517f,1.120851f,0.018539f},{0.118351f,0.230445f,0.965850f}}, +{{0.142718f,1.128828f,0.004967f},{0.550462f,0.785180f,0.283639f}}, +{{0.133860f,1.125908f,-0.013571f},{0.351756f,0.561113f,-0.749260f}}, +{{0.100801f,1.115011f,-0.018539f},{-0.104312f,-0.120365f,-0.987213f}}, +{{0.076600f,1.107034f,-0.004967f},{-0.485305f,-0.819880f,-0.303690f}}, +{{0.085458f,1.109954f,0.013571f},{-0.335215f,-0.507584f,0.793695f}}, +{{0.100462f,1.096595f,0.013571f},{0.440474f,0.288522f,-0.850124f}}, +{{0.090049f,1.095060f,-0.004967f},{0.753807f,0.564867f,0.335643f}}, +{{0.118499f,1.099253f,-0.018539f},{-0.105014f,-0.047823f,-0.993316f}}, +{{0.157361f,1.104982f,-0.013571f},{0.510880f,0.362712f,-0.779351f}}, +{{0.167775f,1.106517f,0.004967f},{0.818567f,0.503647f,0.276131f}}, +{{0.139325f,1.102323f,0.018539f},{0.174383f,0.148564f,0.973388f}}, +{{0.146495f,1.081785f,0.018539f},{0.207129f,0.000000f,0.978301f}}, +{{0.176409f,1.081785f,0.004967f},{-0.330485f,0.000000f,0.943785f}}, +{{0.165460f,1.081785f,-0.013571f},{0.606739f,0.000000f,-0.794885f}}, +{{0.124597f,1.081785f,-0.018539f},{-0.094638f,0.000000f,-0.995483f}}, +{{0.094683f,1.081785f,-0.004967f},{0.254250f,0.000000f,-0.967132f}}, +{{0.105632f,1.081785f,0.013571f},{-0.474441f,0.000000f,0.880276f}}, +{{0.100462f,1.066976f,0.013571f},{0.440474f,-0.288522f,-0.850124f}}, +{{0.090049f,1.068511f,-0.004967f},{0.217689f,-0.139500f,-0.965972f}}, +{{0.118499f,1.064318f,-0.018539f},{-0.105014f,0.047823f,-0.993316f}}, +{{0.157361f,1.058589f,-0.013571f},{0.510880f,-0.362712f,-0.779351f}}, +{{0.167775f,1.057054f,0.004967f},{0.278420f,-0.182165f,-0.942991f}}, +{{0.139325f,1.061248f,0.018539f},{0.174383f,-0.148564f,0.973388f}}, +{{0.118517f,1.042720f,0.018539f},{0.118351f,-0.230445f,0.965850f}}, +{{0.142718f,1.034743f,0.004967f},{0.550462f,-0.785180f,0.283639f}}, +{{0.133860f,1.037663f,-0.013571f},{0.351756f,-0.561113f,-0.749260f}}, +{{0.100801f,1.048560f,-0.018539f},{-0.104312f,0.120365f,-0.987213f}}, +{{0.076600f,1.056537f,-0.004967f},{-0.485305f,0.819880f,-0.303690f}}, +{{0.085458f,1.053617f,0.013571f},{-0.335215f,0.507584f,0.793695f}}, +{{0.062089f,1.043015f,0.013571f},{0.213416f,-0.625813f,-0.750145f}}, +{{0.055653f,1.047033f,-0.004967f},{0.285104f,-0.916379f,0.280892f}}, +{{0.073236f,1.036054f,-0.018539f},{-0.080508f,0.183660f,-0.979675f}}, +{{0.097255f,1.021056f,-0.013571f},{0.217933f,-0.657094f,-0.721580f}}, +{{0.103690f,1.017037f,0.004967f},{0.328593f,-0.904233f,0.272622f}}, +{{0.086108f,1.028017f,0.018539f},{0.069887f,-0.266060f,0.961394f}}, +{{0.045269f,1.018576f,0.018539f},{0.031220f,-0.277963f,0.960051f}}, +{{0.054513f,1.005669f,0.004967f},{0.154027f,-0.953520f,0.258950f}}, +{{0.051130f,1.010394f,-0.013571f},{0.104923f,-0.703665f,-0.702719f}}, +{{0.038502f,1.028025f,-0.018539f},{-0.043672f,0.223426f,-0.973724f}}, +{{0.029259f,1.040932f,-0.004967f},{-0.132206f,0.954161f,-0.268410f}}, +{{0.032642f,1.036208f,0.013571f},{-0.102268f,0.679952f,0.726066f}}, +{{-0.000000f,1.033862f,0.013571f},{0.049898f,-0.694449f,-0.717795f}}, +{{-0.000000f,1.038830f,-0.004967f},{0.069124f,-0.962004f,0.264046f}}, +{{-0.000000f,1.025258f,-0.018539f},{-0.017029f,0.237220f,-0.971282f}}, +{{-0.000000f,1.006720f,-0.013571f},{0.051515f,-0.717185f,-0.694937f}}, +{{-0.000000f,1.001752f,0.004967f},{0.069338f,-0.965056f,0.252663f}}, +{{-0.000000f,1.015323f,0.018539f},{0.020081f,-0.279794f,0.959838f}}, +{{0.059509f,0.966995f,0.059509f},{-0.707083f,0.000000f,-0.707083f}}, +{{0.081291f,0.966995f,0.021782f},{-0.965911f,0.000000f,-0.258797f}}, +{{0.081291f,0.966995f,-0.021782f},{-0.965911f,0.000000f,0.258797f}}, +{{0.059509f,0.966995f,-0.059509f},{-0.707083f,0.000000f,0.707083f}}, +{{0.021782f,0.966995f,-0.081291f},{-0.258797f,0.000000f,0.965911f}}, +{{-0.021782f,0.966995f,-0.081291f},{0.258797f,0.000000f,0.965911f}}, +{{-0.059509f,0.966995f,-0.059509f},{0.707083f,0.000000f,0.707083f}}, +{{-0.081291f,0.966995f,-0.021782f},{0.965911f,0.000000f,0.258797f}}, +{{-0.081291f,0.966995f,0.021782f},{0.965911f,0.000000f,-0.258797f}}, +{{-0.059509f,0.966995f,0.059509f},{0.707083f,0.000000f,-0.707083f}}, +{{-0.021782f,0.966995f,0.081291f},{0.258797f,0.000000f,-0.965911f}}, +{{0.021782f,0.966995f,0.081291f},{-0.258797f,0.000000f,-0.965911f}}, +{{0.021782f,0.905501f,0.081291f},{-0.258797f,0.000000f,-0.965911f}}, +{{-0.021782f,0.905501f,0.081291f},{0.258797f,0.000000f,-0.965911f}}, +{{-0.059509f,0.905501f,0.059509f},{0.707083f,0.000000f,-0.707083f}}, +{{-0.081291f,0.905501f,0.021782f},{0.965911f,0.000000f,-0.258797f}}, +{{-0.081291f,0.905501f,-0.021782f},{0.965911f,0.000000f,0.258797f}}, +{{-0.059509f,0.905501f,-0.059509f},{0.707083f,0.000000f,0.707083f}}, +{{-0.021782f,0.905501f,-0.081291f},{0.258797f,0.000000f,0.965911f}}, +{{0.021782f,0.905501f,-0.081291f},{-0.258797f,0.000000f,0.965911f}}, +{{0.059509f,0.905501f,-0.059509f},{-0.707083f,0.000000f,0.707083f}}, +{{0.081291f,0.905501f,-0.021782f},{-0.965911f,0.000000f,0.258797f}}, +{{0.081291f,0.905501f,0.021782f},{-0.965911f,0.000000f,-0.258797f}}, +{{0.059509f,0.905501f,0.059509f},{-0.707083f,0.000000f,-0.707083f}}, +{{0.059509f,0.905501f,0.059509f},{0.055239f,0.996918f,0.055239f}}, +{{0.081291f,0.905501f,0.021782f},{0.075472f,0.996918f,0.020203f}}, +{{0.081291f,0.905501f,-0.021782f},{0.075472f,0.996918f,-0.020203f}}, +{{0.059509f,0.905501f,-0.059509f},{0.055239f,0.996918f,-0.055239f}}, +{{0.021782f,0.905501f,-0.081291f},{0.020203f,0.996918f,-0.075472f}}, +{{-0.021782f,0.905501f,-0.081291f},{-0.020203f,0.996918f,-0.075472f}}, +{{-0.059509f,0.905501f,-0.059509f},{-0.055239f,0.996918f,-0.055239f}}, +{{-0.081291f,0.905501f,-0.021782f},{-0.075472f,0.996918f,-0.020203f}}, +{{-0.081291f,0.905501f,0.021782f},{-0.075472f,0.996918f,0.020203f}}, +{{-0.059509f,0.905501f,0.059509f},{-0.055239f,0.996918f,0.055239f}}, +{{-0.021782f,0.905501f,0.081291f},{-0.020203f,0.996918f,0.075472f}}, +{{0.021782f,0.905501f,0.081291f},{0.020203f,0.996918f,0.075472f}}, +{{0.021782f,0.905501f,0.081291f},{-0.121677f,0.882565f,-0.454115f}}, +{{-0.021782f,0.905501f,0.081291f},{0.121677f,0.882565f,-0.454115f}}, +{{-0.059509f,0.905501f,0.059509f},{0.332438f,0.882565f,-0.332438f}}, +{{-0.081291f,0.905501f,0.021782f},{0.454115f,0.882565f,-0.121677f}}, +{{-0.081291f,0.905501f,-0.021782f},{0.454115f,0.882565f,0.121677f}}, +{{-0.059509f,0.905501f,-0.059509f},{0.332438f,0.882565f,0.332438f}}, +{{-0.021782f,0.905501f,-0.081291f},{0.121677f,0.882565f,0.454115f}}, +{{0.021782f,0.905501f,-0.081291f},{-0.121677f,0.882565f,0.454115f}}, +{{0.059509f,0.905501f,-0.059509f},{-0.332438f,0.882565f,0.332438f}}, +{{0.081291f,0.905501f,-0.021782f},{-0.454115f,0.882565f,0.121677f}}, +{{0.081291f,0.905501f,0.021782f},{-0.454115f,0.882565f,-0.121677f}}, +{{0.059509f,0.905501f,0.059509f},{-0.332438f,0.882565f,-0.332438f}}, +{{0.043184f,0.893202f,0.043184f},{-0.332438f,0.882565f,-0.332438f}}, +{{0.058990f,0.893202f,0.015806f},{-0.454115f,0.882565f,-0.121677f}}, +{{0.058990f,0.893202f,-0.015806f},{-0.454115f,0.882565f,0.121677f}}, +{{0.043184f,0.893202f,-0.043184f},{-0.332438f,0.882565f,0.332438f}}, +{{0.015806f,0.893202f,-0.058990f},{-0.121677f,0.882565f,0.454115f}}, +{{-0.015806f,0.893202f,-0.058990f},{0.121677f,0.882565f,0.454115f}}, +{{-0.043184f,0.893202f,-0.043184f},{0.332438f,0.882565f,0.332438f}}, +{{-0.058990f,0.893202f,-0.015806f},{0.454115f,0.882565f,0.121677f}}, +{{-0.058990f,0.893202f,0.015806f},{0.454115f,0.882565f,-0.121677f}}, +{{-0.043184f,0.893202f,0.043184f},{0.332438f,0.882565f,-0.332438f}}, +{{-0.015806f,0.893202f,0.058990f},{0.121677f,0.882565f,-0.454115f}}, +{{0.015806f,0.893202f,0.058990f},{-0.121677f,0.882565f,-0.454115f}}, +{{0.015806f,0.893202f,0.058990f},{0.014863f,0.998321f,0.055452f}}, +{{-0.015806f,0.893202f,0.058990f},{-0.014863f,0.998321f,0.055452f}}, +{{-0.043184f,0.893202f,0.043184f},{-0.040590f,0.998321f,0.040590f}}, +{{-0.058990f,0.893202f,0.015806f},{-0.055452f,0.998321f,0.014863f}}, +{{-0.058990f,0.893202f,-0.015806f},{-0.055452f,0.998321f,-0.014863f}}, +{{-0.043184f,0.893202f,-0.043184f},{-0.040590f,0.998321f,-0.040590f}}, +{{-0.015806f,0.893202f,-0.058990f},{-0.014863f,0.998321f,-0.055452f}}, +{{0.015806f,0.893202f,-0.058990f},{0.014863f,0.998321f,-0.055452f}}, +{{0.043184f,0.893202f,-0.043184f},{0.040590f,0.998321f,-0.040590f}}, +{{0.058990f,0.893202f,-0.015806f},{0.055452f,0.998321f,-0.014863f}}, +{{0.058990f,0.893202f,0.015806f},{0.055452f,0.998321f,0.014863f}}, +{{0.043184f,0.893202f,0.043184f},{0.040590f,0.998321f,0.040590f}}, +{{0.043184f,0.893202f,0.043184f},{-0.707083f,0.000000f,-0.707083f}}, +{{0.058990f,0.893202f,0.015806f},{-0.965911f,0.000000f,-0.258797f}}, +{{0.058990f,0.893202f,-0.015806f},{-0.965911f,0.000000f,0.258797f}}, +{{0.043184f,0.893202f,-0.043184f},{-0.707083f,0.000000f,0.707083f}}, +{{0.015806f,0.893202f,-0.058990f},{-0.258797f,0.000000f,0.965911f}}, +{{-0.015806f,0.893202f,-0.058990f},{0.258797f,0.000000f,0.965911f}}, +{{-0.043184f,0.893202f,-0.043184f},{0.707083f,0.000000f,0.707083f}}, +{{-0.058990f,0.893202f,-0.015806f},{0.965911f,0.000000f,0.258797f}}, +{{-0.058990f,0.893202f,0.015806f},{0.965911f,0.000000f,-0.258797f}}, +{{-0.043184f,0.893202f,0.043184f},{0.707083f,0.000000f,-0.707083f}}, +{{-0.015806f,0.893202f,0.058990f},{0.258797f,0.000000f,-0.965911f}}, +{{0.015806f,0.893202f,0.058990f},{-0.258797f,0.000000f,-0.965911f}}, +{{0.015806f,0.770438f,0.058990f},{-0.283731f,0.000000f,-0.958892f}}, +{{-0.015806f,0.770438f,0.058990f},{0.283731f,0.000000f,-0.958892f}}, +{{-0.043184f,0.759393f,0.043184f},{0.755028f,0.000000f,-0.655660f}}, +{{-0.058990f,0.740261f,0.015806f},{0.986297f,0.000000f,-0.164892f}}, +{{-0.058990f,0.718170f,-0.015806f},{0.935179f,0.000000f,0.354137f}}, +{{-0.043184f,0.699038f,-0.043184f},{0.648152f,0.000000f,0.761498f}}, +{{-0.015806f,0.687992f,-0.058990f},{0.227668f,0.000000f,0.973724f}}, +{{0.015806f,0.687992f,-0.058990f},{-0.227668f,0.000000f,0.973724f}}, +{{0.043184f,0.699038f,-0.043184f},{-0.648152f,0.000000f,0.761498f}}, +{{0.058990f,0.718170f,-0.015806f},{-0.935179f,0.000000f,0.354137f}}, +{{0.058990f,0.740261f,0.015806f},{-0.986297f,0.000000f,-0.164892f}}, +{{0.043184f,0.759393f,0.043184f},{-0.755028f,0.000000f,-0.655660f}}, +{{0.021782f,0.966995f,0.081291f},{0.019105f,0.997253f,0.071383f}}, +{{-0.021782f,0.966995f,0.081291f},{-0.019105f,0.997253f,0.071383f}}, +{{-0.059509f,0.966995f,0.059509f},{-0.052248f,0.997253f,0.052248f}}, +{{-0.081291f,0.966995f,0.021782f},{-0.071383f,0.997253f,0.019105f}}, +{{-0.081291f,0.966995f,-0.021782f},{-0.071383f,0.997253f,-0.019105f}}, +{{-0.059509f,0.966995f,-0.059509f},{-0.052248f,0.997253f,-0.052248f}}, +{{-0.021782f,0.966995f,-0.081291f},{-0.019105f,0.997253f,-0.071383f}}, +{{0.021782f,0.966995f,-0.081291f},{0.019105f,0.997253f,-0.071383f}}, +{{0.059509f,0.966995f,-0.059509f},{0.052248f,0.997253f,-0.052248f}}, +{{0.081291f,0.966995f,-0.021782f},{0.071383f,0.997253f,-0.019105f}}, +{{0.081291f,0.966995f,0.021782f},{0.071383f,0.997253f,0.019105f}}, +{{0.059509f,0.966995f,0.059509f},{0.052248f,0.997253f,0.052248f}}, +{{0.010628f,0.999793f,0.039665f},{-0.156743f,-0.795740f,-0.584979f}}, +{{-0.010628f,0.999793f,0.039665f},{0.156743f,-0.795740f,-0.584948f}}, +{{-0.029037f,0.999793f,0.029037f},{0.428205f,-0.795740f,-0.428205f}}, +{{-0.039665f,0.999793f,0.010628f},{0.584979f,-0.795740f,-0.156743f}}, +{{-0.039665f,0.999793f,-0.010628f},{0.584979f,-0.795740f,0.156743f}}, +{{-0.029037f,0.999793f,-0.029037f},{0.428205f,-0.795740f,0.428205f}}, +{{-0.010628f,0.999793f,-0.039665f},{0.156743f,-0.795740f,0.584979f}}, +{{0.010628f,0.999793f,-0.039665f},{-0.156743f,-0.795740f,0.584979f}}, +{{0.029037f,0.999793f,-0.029037f},{-0.428205f,-0.795740f,0.428205f}}, +{{0.039665f,0.999793f,-0.010628f},{-0.584979f,-0.795740f,0.156743f}}, +{{0.039665f,0.999793f,0.010628f},{-0.584979f,-0.795740f,-0.156743f}}, +{{0.029037f,0.999793f,0.029037f},{-0.428205f,-0.795740f,-0.428205f}}, +{{0.059509f,0.966995f,0.059509f},{-0.428205f,-0.795740f,-0.428205f}}, +{{0.081291f,0.966995f,0.021782f},{-0.584979f,-0.795740f,-0.156743f}}, +{{0.081291f,0.966995f,-0.021782f},{-0.584979f,-0.795740f,0.156743f}}, +{{0.059509f,0.966995f,-0.059509f},{-0.428205f,-0.795740f,0.428205f}}, +{{0.021782f,0.966995f,-0.081291f},{-0.156743f,-0.795740f,0.584979f}}, +{{-0.021782f,0.966995f,-0.081291f},{0.156743f,-0.795740f,0.584979f}}, +{{-0.059509f,0.966995f,-0.059509f},{0.428205f,-0.795740f,0.428205f}}, +{{-0.081291f,0.966995f,-0.021782f},{0.584979f,-0.795740f,0.156743f}}, +{{-0.081291f,0.966995f,0.021782f},{0.584979f,-0.795740f,-0.156743f}}, +{{-0.059509f,0.966995f,0.059509f},{0.428205f,-0.795740f,-0.428205f}}, +{{-0.021782f,0.966995f,0.081291f},{0.156743f,-0.795740f,-0.584948f}}, +{{0.021782f,0.966995f,0.081291f},{-0.156743f,-0.795740f,-0.584979f}}, +{{0.029037f,0.999793f,0.029037f},{0.024842f,0.999359f,0.024842f}}, +{{0.039665f,0.999793f,0.010628f},{0.033906f,0.999359f,0.009064f}}, +{{0.039665f,0.999793f,-0.010628f},{0.033906f,0.999359f,-0.009064f}}, +{{0.029037f,0.999793f,-0.029037f},{0.024842f,0.999359f,-0.024842f}}, +{{0.010628f,0.999793f,-0.039665f},{0.009064f,0.999359f,-0.033906f}}, +{{-0.010628f,0.999793f,-0.039665f},{-0.009064f,0.999359f,-0.033906f}}, +{{-0.029037f,0.999793f,-0.029037f},{-0.024842f,0.999359f,-0.024842f}}, +{{-0.039665f,0.999793f,-0.010628f},{-0.033906f,0.999359f,-0.009064f}}, +{{-0.039665f,0.999793f,0.010628f},{-0.033906f,0.999359f,0.009064f}}, +{{-0.029037f,0.999793f,0.029037f},{-0.024842f,0.999359f,0.024842f}}, +{{-0.010628f,0.999793f,0.039665f},{-0.009064f,0.999359f,0.033906f}}, +{{0.010628f,0.999793f,0.039665f},{0.009064f,0.999359f,0.033906f}}, +{{0.029037f,1.040789f,0.029037f},{-0.707083f,0.000000f,-0.707083f}}, +{{0.039665f,1.040789f,0.010628f},{-0.965911f,0.000000f,-0.258797f}}, +{{0.039665f,1.040789f,-0.010628f},{-0.965911f,0.000000f,0.258797f}}, +{{0.029037f,1.040789f,-0.029037f},{-0.707083f,0.000000f,0.707083f}}, +{{0.010628f,1.040789f,-0.039665f},{-0.258797f,0.000000f,0.965911f}}, +{{-0.010628f,1.040789f,-0.039665f},{0.258797f,0.000000f,0.965911f}}, +{{-0.029037f,1.040789f,-0.029037f},{0.707083f,0.000000f,0.707083f}}, +{{-0.039665f,1.040789f,-0.010628f},{0.965911f,0.000000f,0.258797f}}, +{{-0.039665f,1.040789f,0.010628f},{0.965911f,0.000000f,-0.258797f}}, +{{-0.029037f,1.040789f,0.029037f},{0.707083f,0.000000f,-0.707083f}}, +{{-0.010628f,1.040789f,0.039665f},{0.258797f,0.000000f,-0.965911f}}, +{{0.010628f,1.040789f,0.039665f},{-0.258797f,0.000000f,-0.965911f}}, +{{0.010628f,0.999793f,0.039665f},{-0.258797f,0.000000f,-0.965911f}}, +{{-0.010628f,0.999793f,0.039665f},{0.258797f,0.000000f,-0.965911f}}, +{{-0.029037f,0.999793f,0.029037f},{0.707083f,0.000000f,-0.707083f}}, +{{-0.039665f,0.999793f,0.010628f},{0.965911f,0.000000f,-0.258797f}}, +{{-0.039665f,0.999793f,-0.010628f},{0.965911f,0.000000f,0.258797f}}, +{{-0.029037f,0.999793f,-0.029037f},{0.707083f,0.000000f,0.707083f}}, +{{-0.010628f,0.999793f,-0.039665f},{0.258797f,0.000000f,0.965911f}}, +{{0.010628f,0.999793f,-0.039665f},{-0.258797f,0.000000f,0.965911f}}, +{{0.029037f,0.999793f,-0.029037f},{-0.707083f,0.000000f,0.707083f}}, +{{0.039665f,0.999793f,-0.010628f},{-0.965911f,0.000000f,0.258797f}}, +{{0.039665f,0.999793f,0.010628f},{-0.965911f,0.000000f,-0.258797f}}, +{{0.029037f,0.999793f,0.029037f},{-0.707083f,0.000000f,-0.707083f}}, +{{0.010628f,1.040789f,0.039665f},{0.008759f,0.999420f,0.032777f}}, +{{-0.010628f,1.040789f,0.039665f},{-0.008759f,0.999420f,0.032777f}}, +{{-0.029037f,1.040789f,0.029037f},{-0.023988f,0.999420f,0.023988f}}, +{{-0.039665f,1.040789f,0.010628f},{-0.032777f,0.999420f,0.008759f}}, +{{-0.039665f,1.040789f,-0.010628f},{-0.032777f,0.999420f,-0.008759f}}, +{{-0.029037f,1.040789f,-0.029037f},{-0.023988f,0.999420f,-0.023988f}}, +{{-0.010628f,1.040789f,-0.039665f},{-0.008759f,0.999420f,-0.032777f}}, +{{0.010628f,1.040789f,-0.039665f},{0.008759f,0.999420f,-0.032777f}}, +{{0.029037f,1.040789f,-0.029037f},{0.023988f,0.999420f,-0.023988f}}, +{{0.039665f,1.040789f,-0.010628f},{0.032777f,0.999420f,-0.008759f}}, +{{0.039665f,1.040789f,0.010628f},{0.032777f,0.999420f,0.008759f}}, +{{0.029037f,1.040789f,0.029037f},{0.023988f,0.999420f,0.023988f}}, +{{-0.000000f,1.073586f,-0.000000f},{0.000000f,-1.000000f,0.000000f}}, +{{0.029037f,1.040789f,0.029037f},{-0.441267f,-0.781365f,-0.441267f}}, +{{0.039665f,1.040789f,0.010628f},{-0.602802f,-0.781365f,-0.161504f}}, +{{0.039665f,1.040789f,-0.010628f},{-0.602802f,-0.781365f,0.161504f}}, +{{0.029037f,1.040789f,-0.029037f},{-0.441267f,-0.781365f,0.441267f}}, +{{0.010628f,1.040789f,-0.039665f},{-0.161504f,-0.781365f,0.602802f}}, +{{-0.010628f,1.040789f,-0.039665f},{0.161504f,-0.781365f,0.602802f}}, +{{-0.029037f,1.040789f,-0.029037f},{0.441267f,-0.781365f,0.441267f}}, +{{-0.039665f,1.040789f,-0.010628f},{0.602802f,-0.781365f,0.161504f}}, +{{-0.039665f,1.040789f,0.010628f},{0.602802f,-0.781365f,-0.161504f}}, +{{-0.029037f,1.040789f,0.029037f},{0.441267f,-0.781365f,-0.441267f}}, +{{-0.010628f,1.040789f,0.039665f},{0.161504f,-0.781365f,-0.602802f}}, +{{0.010628f,1.040789f,0.039665f},{-0.161504f,-0.781365f,-0.602802f}}, +{{-0.912364f,-0.170034f,0.061946f},{0.531083f,-0.005066f,0.847285f}}, +{{0.154416f,-1.051438f,0.041345f},{-0.107669f,0.644215f,0.757195f}}, +{{0.971600f,-0.341193f,0.041516f},{0.893704f,-0.158971f,0.419507f}}, +{{-0.167382f,-1.124962f,0.061947f},{-0.091342f,-0.566393f,0.819025f}}, +{{-0.896165f,-0.166818f,0.041516f},{0.585925f,-0.001892f,0.810327f}}, +{{-0.004223f,0.741985f,0.062230f},{-0.002869f,-0.545946f,0.837794f}}, +{{-0.986862f,-0.167462f,0.041345f},{-0.937834f,0.007996f,0.346904f}}, +{{0.685855f,-0.745268f,0.041345f},{-0.475753f,0.402600f,0.782006f}}, +{{0.000367f,0.728330f,0.041345f},{-0.004517f,-0.622456f,0.782617f}}, +{{-0.001294f,-1.064916f,0.041345f},{0.002594f,0.623188f,0.782037f}}, +{{-0.977830f,-0.169442f,0.057994f},{-0.646474f,0.003845f,0.762902f}}, +{{0.174600f,-1.088835f,0.068387f},{-0.012116f,0.043611f,0.998962f}}, +{{0.882681f,-0.013414f,0.041345f},{-0.613819f,-0.103641f,0.782586f}}, +{{-0.843297f,-0.474176f,0.041345f},{0.586413f,0.208594f,0.782678f}}, +{{-0.946375f,-0.303652f,0.068156f},{-0.163091f,-0.013001f,0.986511f}}, +{{-0.534724f,-0.953058f,0.067879f},{-0.053346f,-0.076144f,0.995666f}}, +{{0.633042f,-0.925573f,0.041516f},{0.580035f,-0.696371f,0.422559f}}, +{{-0.623354f,-0.913334f,0.061946f},{-0.342601f,-0.405042f,0.847652f}}, +{{-0.898812f,-0.011658f,0.061946f},{0.740074f,-0.116092f,0.662404f}}, +{{0.783281f,0.285529f,0.057994f},{-0.553514f,-0.313761f,0.771447f}}, +{{0.001012f,0.819027f,0.041516f},{0.003265f,0.906308f,0.422559f}}, +{{-0.956528f,-0.338642f,0.061946f},{-0.575091f,-0.117313f,0.809595f}}, +{{-0.743266f,-0.793851f,0.061946f},{-0.404767f,-0.352580f,0.843684f}}, +{{0.926163f,-0.506442f,0.041345f},{0.880703f,-0.324137f,0.345286f}}, +{{0.955601f,0.002055f,0.061946f},{0.522813f,0.090030f,0.847652f}}, +{{-0.495402f,-1.022599f,0.041516f},{-0.455977f,-0.783258f,0.422559f}}, +{{-0.959080f,-0.003081f,0.062230f},{-0.534837f,0.086550f,0.840480f}}, +{{0.804687f,0.311056f,0.068387f},{-0.038789f,-0.025025f,0.998932f}}, +{{-0.971732f,0.003811f,0.041345f},{-0.909391f,0.164220f,0.382061f}}, +{{-0.777377f,-0.615885f,0.041345f},{0.541276f,0.307260f,0.782647f}}, +{{0.913241f,0.089456f,0.067879f},{0.089755f,0.024049f,0.995666f}}, +{{-0.882301f,-0.011303f,0.041516f},{0.575091f,-0.104862f,0.811304f}}, +{{-0.452347f,-0.958497f,0.062230f},{0.254799f,0.479202f,0.839869f}}, +{{0.869883f,-0.539728f,0.068465f},{0.068087f,-0.031404f,0.997162f}}, +{{0.335832f,-1.096575f,0.041516f},{0.306894f,-0.852779f,0.422559f}}, +{{-0.857965f,0.141959f,0.061946f},{0.473617f,-0.162664f,0.865535f}}, +{{-0.841643f,0.139441f,0.041516f},{0.548143f,-0.203131f,0.811304f}}, +{{-0.770910f,-0.723004f,0.067879f},{-0.076144f,-0.053194f,0.995666f}}, +{{0.661954f,0.511776f,0.067879f},{0.065432f,0.065950f,0.995666f}}, +{{-0.927091f,0.169856f,0.041345f},{-0.868252f,0.318094f,0.380657f}}, +{{0.956205f,-0.335212f,0.061947f},{0.523392f,-0.090548f,0.847224f}}, +{{-0.915828f,0.160871f,0.062230f},{-0.549883f,0.185217f,0.814417f}}, +{{0.776450f,0.279299f,0.041345f},{-0.568560f,-0.321543f,0.757164f}}, +{{0.970656f,-0.166552f,0.061946f},{0.536729f,0.009888f,0.843684f}}, +{{0.575238f,-0.855680f,0.041345f},{-0.396649f,0.479751f,0.782586f}}, +{{0.842370f,0.137589f,0.041345f},{-0.586535f,-0.210700f,0.782006f}}, +{{-0.307907f,-1.010559f,0.041345f},{0.228828f,0.611744f,0.757225f}}, +{{0.986856f,-0.169769f,0.041516f},{0.906308f,-0.003265f,0.422559f}}, +{{0.149874f,0.756608f,0.068387f},{-0.005737f,-0.045808f,0.998932f}}, +{{0.756816f,0.465213f,0.041516f},{0.696371f,0.580035f,0.422559f}}, +{{-0.636231f,-0.923675f,0.041516f},{-0.585070f,-0.692160f,0.422559f}}, +{{0.918353f,-0.501492f,0.057994f},{0.610675f,-0.215278f,0.762017f}}, +{{-0.791063f,0.286149f,0.061946f},{0.456435f,-0.276162f,0.845790f}}, +{{0.853632f,0.146573f,0.062230f},{-0.500992f,-0.200140f,0.841975f}}, +{{-0.872462f,0.211483f,0.068202f},{-0.097171f,0.051851f,0.993896f}}, +{{-0.973039f,-0.338287f,0.041516f},{-0.894192f,-0.156255f,0.419507f}}, +{{0.909814f,-0.164534f,0.062230f},{-0.537248f,-0.013184f,0.843287f}}, +{{-0.001940f,-1.155613f,0.041516f},{-0.003265f,-0.906308f,0.422559f}}, +{{0.483588f,0.673592f,0.061946f},{0.267067f,0.458357f,0.847652f}}, +{{0.625094f,-0.911095f,0.061947f},{0.339366f,-0.407727f,0.847652f}}, +{{-0.847462f,0.319394f,0.057994f},{-0.555498f,0.321451f,0.766839f}}, +{{0.841421f,-0.652345f,0.061947f},{0.451766f,-0.266152f,0.851497f}}, +{{-0.854294f,0.325625f,0.041345f},{-0.812464f,0.469802f,0.345134f}}, +{{0.775619f,-0.617324f,0.041345f},{-0.565905f,0.328410f,0.756218f}}, +{{0.694434f,0.419702f,0.062230f},{-0.420087f,-0.348704f,0.837794f}}, +{{-0.775426f,0.280835f,0.041516f},{0.505295f,-0.296426f,0.810419f}}, +{{0.451420f,0.621911f,0.062230f},{-0.274087f,-0.469955f,0.839015f}}, +{{0.784430f,-0.620125f,0.057994f},{-0.574389f,0.352367f,0.738823f}}, +{{0.003295f,-1.078571f,0.062230f},{-0.013153f,0.600513f,0.799493f}}, +{{-0.700194f,0.413943f,0.062230f},{0.421247f,-0.335490f,0.842586f}}, +{{0.333315f,-1.080252f,0.061947f},{0.180120f,-0.500198f,0.846950f}}, +{{-0.686783f,0.408681f,0.041345f},{0.474349f,-0.402570f,0.782861f}}, +{{0.169884f,-1.124357f,0.061947f},{0.091220f,-0.520707f,0.848842f}}, +{{-0.755846f,0.467474f,0.041516f},{-0.692373f,0.586444f,0.420301f}}, +{{0.172436f,0.803771f,0.041516f},{0.160588f,0.891964f,0.422559f}}, +{{0.330043f,0.744856f,0.061946f},{0.174230f,0.507736f,0.843684f}}, +{{0.742338f,0.457265f,0.061946f},{0.408429f,0.340342f,0.846950f}}, +{{0.857037f,-0.478544f,0.061946f},{-0.489120f,0.163152f,0.856777f}}, +{{-0.745505f,0.454597f,0.061946f},{-0.413068f,0.337474f,0.845820f}}, +{{0.448567f,0.607790f,0.041345f},{-0.315134f,-0.536821f,0.782586f}}, +{{-0.680534f,0.494124f,0.067879f},{-0.065981f,0.065493f,0.995666f}}, +{{0.457931f,-0.954737f,0.062230f},{-0.280038f,0.458663f,0.843287f}}, +{{0.001277f,-1.139413f,0.061947f},{0.007904f,-0.505875f,0.862545f}}, +{{-0.687850f,-0.743995f,0.041345f},{0.479690f,0.396588f,0.782647f}}, +{{0.927818f,0.168003f,0.041516f},{0.852779f,0.306894f,0.422559f}}, +{{-0.582699f,-0.868023f,0.062230f},{0.351543f,0.415204f,0.839015f}}, +{{0.587532f,-0.863190f,0.062230f},{-0.347850f,0.418317f,0.839015f}}, +{{-0.896260f,-0.330063f,0.062230f},{0.506394f,0.097507f,0.856746f}}, +{{0.699266f,-0.750529f,0.062230f},{-0.426771f,0.334056f,0.840388f}}, +{{0.581772f,0.531437f,0.062230f},{-0.335215f,-0.420026f,0.843287f}}, +{{0.447128f,-0.945206f,0.041345f},{-0.307321f,0.541337f,0.782586f}}, +{{-0.786908f,-0.626688f,0.062230f},{0.472365f,0.269936f,0.839015f}}, +{{0.169528f,-1.140870f,0.041516f},{0.154149f,-0.893094f,0.422559f}}, +{{-0.626022f,0.574509f,0.061946f},{-0.336497f,0.405805f,0.849727f}}, +{{0.744576f,-0.791183f,0.061947f},{0.417524f,-0.337382f,0.843684f}}, +{{0.156051f,0.714564f,0.041345f},{-0.119114f,-0.642201f,0.757195f}}, +{{-0.633970f,0.588987f,0.041516f},{-0.580035f,0.696371f,0.422559f}}, +{{-0.309136f,-1.019722f,0.057994f},{0.260567f,0.648183f,0.715476f}}, +{{-0.576165f,0.519094f,0.041345f},{0.396588f,-0.479690f,0.782647f}}, +{{-0.928745f,-0.504589f,0.041516f},{-0.852779f,-0.306894f,0.422559f}}, +{{-0.588460f,0.526605f,0.062230f},{0.350688f,-0.428205f,0.832820f}}, +{{0.855318f,0.324088f,0.041516f},{0.786523f,0.450301f,0.422559f}}, +{{0.972113f,0.001699f,0.041516f},{0.893124f,0.154149f,0.422559f}}, +{{-0.454286f,0.615452f,0.057994f},{0.354778f,-0.573321f,0.738517f}}, +{{0.412033f,-1.023359f,0.067879f},{0.039583f,-0.084048f,0.995666f}}, +{{-0.448056f,0.608620f,0.041345f},{0.319529f,-0.570177f,0.756798f}}, +{{-0.180212f,-1.102163f,0.068267f},{-0.024476f,-0.086673f,0.995911f}}, +{{-0.492845f,0.687489f,0.041516f},{-0.452651f,0.786828f,0.419507f}}, +{{0.306980f,0.673972f,0.041345f},{-0.215583f,-0.584735f,0.782037f}}, +{{0.635304f,0.587089f,0.041516f},{0.585070f,0.692160f,0.422559f}}, +{{-0.487532f,0.671851f,0.061946f},{-0.271981f,0.446822f,0.852229f}}, +{{-0.912423f,-0.502072f,0.061946f},{-0.471664f,-0.180090f,0.863155f}}, +{{0.853842f,-0.663231f,0.041516f},{0.783685f,-0.457289f,0.420301f}}, +{{0.896638f,-0.322659f,0.062230f},{-0.534593f,0.097507f,0.839442f}}, +{{0.491918f,-1.024075f,0.041516f},{0.450301f,-0.786523f,0.422559f}}, +{{-0.883609f,-0.323172f,0.041345f},{0.614734f,0.101169f,0.782189f}}, +{{0.389408f,0.697323f,0.067879f},{0.039247f,0.084231f,0.995666f}}, +{{-0.757743f,-0.801799f,0.041516f},{-0.696371f,-0.580035f,0.422559f}}, +{{-0.330970f,-1.081443f,0.061946f},{-0.179022f,-0.490371f,0.852901f}}, +{{-0.856246f,-0.660675f,0.041516f},{-0.786523f,-0.450301f,0.422559f}}, +{{-0.313988f,0.688016f,0.061946f},{0.174566f,-0.501694f,0.847224f}}, +{{0.494474f,0.686013f,0.041516f},{0.455977f,0.783258f,0.422559f}}, +{{-0.383649f,0.694974f,0.068620f},{-0.024720f,0.053407f,0.998260f}}, +{{0.840715f,-0.476028f,0.041516f},{-0.551347f,0.205786f,0.808466f}}, +{{0.314402f,-1.022389f,0.062230f},{-0.183996f,0.514023f,0.837794f}}, +{{-0.173364f,-1.140357f,0.041516f},{-0.160588f,-0.891964f,0.422559f}}, +{{0.882393f,-0.324808f,0.041345f},{-0.612384f,0.115177f,0.782098f}}, +{{0.576511f,0.518026f,0.041345f},{-0.403577f,-0.473952f,0.782586f}}, +{{-0.335823f,0.749737f,0.057994f},{-0.218299f,0.603351f,0.766991f}}, +{{0.157933f,-1.059988f,0.057994f},{-0.105502f,0.627430f,0.771447f}}, +{{-0.337051f,0.758902f,0.041345f},{-0.317789f,0.883023f,0.345286f}}, +{{0.622426f,0.576747f,0.061946f},{0.337413f,0.417524f,0.843684f}}, +{{-0.854559f,-0.483159f,0.062230f},{0.564776f,0.219275f,0.795556f}}, +{{-0.305424f,0.673895f,0.041516f},{0.199805f,-0.552721f,0.809015f}}, +{{-0.695361f,-0.756289f,0.062230f},{0.403058f,0.355449f,0.843287f}}, +{{0.896159f,-0.169124f,0.041345f},{-0.622517f,0.004517f,0.782586f}}, +{{-0.154830f,-1.065395f,0.062230f},{0.078372f,0.515213f,0.853450f}}, +{{-0.162234f,0.727504f,0.062230f},{0.108005f,-0.529038f,0.841670f}}, +{{-0.339533f,-1.095566f,0.041516f},{-0.313059f,-0.850520f,0.422559f}}, +{{-0.155343f,0.714852f,0.041345f},{0.104587f,-0.613330f,0.782830f}}, +{{0.754918f,-0.804061f,0.041516f},{0.692160f,-0.585070f,0.422559f}}, +{{-0.170456f,0.804283f,0.041516f},{-0.153417f,0.894284f,0.420301f}}, +{{0.486604f,-1.008437f,0.061947f},{0.276955f,-0.459853f,0.843684f}}, +{{0.679606f,-0.830711f,0.067879f},{0.065706f,-0.065767f,0.995666f}}, +{{0.686923f,0.407408f,0.041345f},{-0.479751f,-0.396649f,0.782586f}}, +{{0.946294f,-0.238594f,0.067879f},{0.092563f,-0.007721f,0.995666f}}, +{{-0.170812f,0.787771f,0.061946f},{-0.099246f,0.525712f,0.844813f}}, +{{-0.484516f,-1.010179f,0.061946f},{-0.259774f,-0.469771f,0.843684f}}, +{{-0.095634f,0.776288f,0.067879f},{-0.008271f,0.092593f,0.995666f}}, +{{-0.156978f,-1.051150f,0.041345f},{0.112522f,0.612201f,0.782617f}}, +{{0.895332f,-0.006523f,0.062230f},{-0.536210f,-0.092105f,0.839015f}}, +{{-0.577438f,-0.854612f,0.041345f},{0.403546f,0.473891f,0.782647f}}, +{{0.155669f,0.723801f,0.057994f},{-0.115421f,-0.625690f,0.771447f}}, +{{0.911495f,0.165486f,0.061946f},{0.500961f,0.192877f,0.843684f}}, +{{-0.840608f,-0.655361f,0.061946f},{-0.454054f,-0.256661f,0.853175f}}, +{{0.166455f,0.788376f,0.061946f},{0.089999f,0.523118f,0.847468f}}, +{{0.307337f,0.688374f,0.062230f},{-0.168706f,-0.512436f,0.841975f}}, +{{0.839680f,0.318775f,0.061946f},{0.458602f,0.267312f,0.847468f}}, +{{-0.449494f,-0.944376f,0.041345f},{0.313822f,0.538377f,0.782067f}}, +{{-0.002205f,0.802827f,0.061946f},{0.001801f,0.531632f,0.846950f}}, +{{0.338606f,0.758979f,0.041516f},{0.313059f,0.850520f,0.422559f}}, +{{0.305419f,-1.011127f,0.041345f},{-0.208625f,0.586474f,0.782617f}}, +{{0.286385f,-0.958602f,0.022780f},{-0.107578f,0.296426f,0.948973f}}, +{{0.340738f,0.764807f,0.012816f},{0.341441f,0.933805f,-0.106632f}}, +{{-0.421482f,-0.896011f,0.022780f},{0.157842f,0.272835f,0.949004f}}, +{{-0.541452f,-0.811841f,0.022780f},{0.202826f,0.241279f,0.949004f}}, +{{-0.147196f,-0.996131f,0.022780f},{0.055025f,0.310434f,0.948973f}}, +{{0.644114f,0.371531f,0.022780f},{-0.241798f,-0.202490f,0.948943f}}, +{{-0.171525f,0.810397f,0.012816f},{-0.173864f,0.978973f,-0.106449f}}, +{{0.759666f,-0.808057f,0.012816f},{0.760704f,-0.640248f,-0.106632f}}, +{{-0.145662f,0.659815f,0.022779f},{0.055849f,-0.310282f,0.948973f}}, +{{-0.341665f,-1.101394f,0.012816f},{-0.341441f,-0.933805f,-0.106632f}}, +{{0.840311f,-0.169072f,0.022780f},{-0.315439f,0.000275f,0.948943f}}, +{{-0.286391f,0.621411f,0.022940f},{0.107578f,-0.296793f,0.948851f}}, +{{-0.339166f,0.764730f,0.012644f},{-0.338939f,0.934690f,-0.106876f}}, +{{0.540583f,0.475255f,0.022780f},{-0.202948f,-0.241401f,0.948943f}}, +{{0.827403f,-0.315054f,0.022780f},{-0.310312f,0.056581f,0.948943f}}, +{{-0.174451f,-1.146467f,0.012816f},{-0.174108f,-0.978912f,-0.106632f}}, +{{0.788322f,-0.456850f,0.022940f},{-0.296701f,0.108402f,0.948790f}}, +{{0.497585f,0.691382f,0.012816f},{0.498428f,0.860317f,-0.106632f}}, +{{-0.861625f,-0.663770f,0.012816f},{-0.861812f,-0.495834f,-0.106632f}}, +{{-0.762503f,-0.805781f,0.012816f},{-0.762627f,-0.637959f,-0.106632f}}, +{{-0.828543f,-0.313520f,0.022780f},{0.310678f,0.052889f,0.949034f}}, +{{0.495013f,-1.029454f,0.012816f},{0.495834f,-0.861812f,-0.106601f}}, +{{0.859212f,-0.666342f,0.012816f},{0.861690f,-0.496078f,-0.106449f}}, +{{0.639300f,0.591837f,0.012816f},{0.640248f,0.760704f,-0.106632f}}, +{{0.287849f,0.621483f,0.022779f},{-0.108127f,-0.296213f,0.948973f}}, +{{-0.495940f,0.692868f,0.012816f},{-0.493759f,0.863033f,-0.106479f}}, +{{-0.420133f,0.560204f,0.022779f},{0.155980f,-0.273904f,0.949004f}}, +{{0.978226f,0.002768f,0.012816f},{0.979430f,0.171178f,-0.106632f}}, +{{0.860697f,0.327183f,0.012816f},{0.861812f,0.495834f,-0.106632f}}, +{{-0.934580f,-0.506703f,0.012816f},{-0.934812f,-0.338664f,-0.106601f}}, +{{-0.540259f,0.476256f,0.022779f},{0.202368f,-0.241646f,0.949004f}}, +{{-0.637952f,0.593747f,0.012816f},{-0.637959f,0.762627f,-0.106632f}}, +{{0.146326f,0.659545f,0.022780f},{-0.055025f,-0.310465f,0.948973f}}, +{{0.170597f,-1.146983f,0.012816f},{0.171178f,-0.979430f,-0.106632f}}, +{{0.419263f,-0.896790f,0.022780f},{-0.157414f,0.273263f,0.948943f}}, +{{0.933653f,0.170117f,0.012816f},{0.934812f,0.338664f,-0.106632f}}, +{{-0.644984f,-0.708117f,0.022780f},{0.241615f,0.202368f,0.949004f}}, +{{0.420612f,0.559424f,0.022780f},{-0.157933f,-0.272958f,0.948943f}}, +{{0.173522f,0.809881f,0.012816f},{0.174108f,0.978912f,-0.106632f}}, +{{-0.760594f,0.471471f,0.012816f},{-0.762474f,0.638173f,-0.106449f}}, +{{-0.643983f,0.372725f,0.022779f},{0.242164f,-0.201697f,0.949004f}}, +{{-0.727102f,0.252846f,0.022940f},{0.273843f,-0.156896f,0.948851f}}, +{{0.727283f,-0.589341f,0.022780f},{-0.273721f,0.156682f,0.948943f}}, +{{-0.859661f,0.328730f,0.012644f},{-0.861843f,0.495773f,-0.106693f}}, +{{-0.001949f,-1.161819f,0.012816f},{-0.001465f,-0.994293f,-0.106632f}}, +{{-0.979153f,-0.339356f,0.012816f},{-0.979858f,-0.168798f,-0.106479f}}, +{{-0.640227f,-0.928423f,0.012816f},{-0.640248f,-0.760704f,-0.106632f}}, +{{0.761576f,0.469195f,0.012816f},{0.762627f,0.637959f,-0.106632f}}, +{{0.993062f,-0.169778f,0.012816f},{0.994293f,-0.001465f,-0.106632f}}, +{{-0.288719f,-0.958069f,0.022780f},{0.108066f,0.296121f,0.949004f}}, +{{0.789874f,0.118527f,0.022780f},{-0.296487f,-0.107608f,0.948943f}}, +{{0.539389f,-0.812842f,0.022780f},{-0.202490f,0.241768f,0.948943f}}, +{{0.728062f,0.251405f,0.022780f},{-0.273293f,-0.157445f,0.948943f}}, +{{-0.932915f,0.171981f,0.012644f},{-0.934049f,0.340831f,-0.106571f}}, +{{-0.789192f,0.120264f,0.022940f},{0.296396f,-0.108432f,0.948882f}}, +{{0.337946f,-1.102410f,0.012816f},{0.338664f,-0.934812f,-0.106601f}}, +{{-0.827316f,-0.021086f,0.022940f},{0.310709f,-0.055300f,0.948882f}}, +{{-0.728931f,-0.587992f,0.022780f},{0.273080f,0.157323f,0.949004f}}, +{{-0.977837f,0.004893f,0.012644f},{-0.979034f,0.173467f,-0.106571f}}, +{{-0.498513f,-1.027969f,0.012816f},{-0.498428f,-0.860317f,-0.106632f}}, +{{0.931987f,-0.508567f,0.012644f},{0.933897f,-0.341136f,-0.106876f}}, +{{0.001022f,0.825233f,0.012816f},{0.001465f,0.994293f,-0.106632f}}, +{{0.637024f,-0.930333f,0.012816f},{0.637959f,-0.762627f,-0.106601f}}, +{{-0.790743f,-0.455114f,0.022780f},{0.296243f,0.107517f,0.949034f}}, +{{0.827673f,-0.023066f,0.022780f},{-0.310678f,-0.054476f,0.948943f}}, +{{-0.001214f,-1.009039f,0.022780f},{0.000275f,0.315287f,0.948973f}}, +{{0.000344f,0.672452f,0.022779f},{-0.000275f,-0.315287f,0.948973f}}, +{{0.643113f,-0.709311f,0.022780f},{-0.241432f,0.202948f,0.948943f}}, +{{-0.993062f,-0.167457f,0.012644f},{-0.994263f,0.003540f,-0.106723f}}, +{{-0.840316f,-0.166910f,0.022940f},{0.315592f,-0.001923f,0.948882f}}, +{{0.977710f,-0.342280f,0.012816f},{0.978515f,-0.176489f,-0.106479f}}, +{{0.144792f,-0.996401f,0.022780f},{-0.054476f,0.310556f,0.948973f}}, +{{0.958261f,-0.338820f,-0.030219f},{0.690359f,-0.124241f,-0.712668f}}, +{{-0.973326f,-0.167473f,-0.030388f},{-0.700797f,0.002228f,-0.713340f}}, +{{0.624349f,-0.915181f,-0.030219f},{0.449843f,-0.537736f,-0.713034f}}, +{{0.000992f,0.805478f,-0.030219f},{0.001038f,0.701041f,-0.713095f}}, +{{0.913447f,-0.501802f,-0.030388f},{0.658010f,-0.240364f,-0.713584f}}, +{{-0.488610f,-1.010876f,-0.030219f},{-0.351421f,-0.606586f,-0.713095f}}, +{{-0.958403f,0.001450f,-0.030388f},{-0.690420f,0.122318f,-0.712973f}}, +{{0.331218f,-1.083837f,-0.030219f},{0.238777f,-0.659139f,-0.713065f}}, +{{-0.914375f,0.165215f,-0.030388f},{-0.658681f,0.240364f,-0.712973f}}, +{{0.973307f,-0.169749f,-0.030219f},{0.701102f,-0.001038f,-0.713034f}}, +{{0.746424f,0.456520f,-0.030219f},{0.537736f,0.449843f,-0.713034f}}, +{{-0.627507f,-0.913309f,-0.030219f},{-0.451399f,-0.536332f,-0.713126f}}, +{{-0.959693f,-0.335954f,-0.030219f},{-0.691122f,-0.119327f,-0.712790f}}, +{{-0.001920f,-1.142064f,-0.030219f},{-0.001038f,-0.701041f,-0.713095f}}, +{{-0.842577f,0.318847f,-0.030388f},{-0.607349f,0.349681f,-0.713309f}}, +{{-0.745480f,0.458750f,-0.030219f},{-0.537675f,0.450392f,-0.712729f}}, +{{0.170063f,0.790432f,-0.030219f},{0.122745f,0.690237f,-0.713065f}}, +{{0.915080f,0.163388f,-0.030219f},{0.659169f,0.238807f,-0.713034f}}, +{{0.167196f,-1.127523f,-0.030219f},{0.120701f,-0.690603f,-0.713065f}}, +{{-0.625277f,0.578595f,-0.030219f},{-0.449812f,0.537675f,-0.713126f}}, +{{-0.916007f,-0.499974f,-0.030219f},{-0.659078f,-0.238746f,-0.713126f}}, +{{0.843575f,0.317331f,-0.030219f},{0.607685f,0.349620f,-0.713034f}}, +{{0.958766f,-0.000633f,-0.030219f},{0.690634f,0.120701f,-0.713034f}}, +{{-0.486089f,0.675745f,-0.030219f},{-0.348521f,0.608631f,-0.712760f}}, +{{0.626579f,0.576723f,-0.030219f},{0.451430f,0.536393f,-0.713034f}}, +{{0.842119f,-0.656440f,-0.030219f},{0.607807f,-0.350230f,-0.712668f}}, +{{0.485161f,-1.012331f,-0.030219f},{0.349620f,-0.607685f,-0.713065f}}, +{{-0.747351f,-0.793106f,-0.030219f},{-0.537675f,-0.449782f,-0.713126f}}, +{{-0.844502f,-0.653918f,-0.030219f},{-0.607624f,-0.349590f,-0.713126f}}, +{{0.487683f,0.674289f,-0.030219f},{0.351421f,0.606616f,-0.713065f}}, +{{-0.170991f,-1.127018f,-0.030219f},{-0.122745f,-0.690207f,-0.713095f}}, +{{-0.332432f,0.746178f,-0.030388f},{-0.238777f,0.658498f,-0.713645f}}, +{{-0.334881f,-1.082841f,-0.030219f},{-0.240761f,-0.658406f,-0.713095f}}, +{{0.744552f,-0.795336f,-0.030219f},{0.536393f,-0.451460f,-0.713034f}}, +{{-0.168124f,0.790937f,-0.030219f},{-0.122379f,0.690664f,-0.712699f}}, +{{0.333954f,0.746254f,-0.030219f},{0.240761f,0.658437f,-0.713065f}}, +{{0.301516f,0.657424f,-0.068468f},{0.069094f,0.188971f,-0.979522f}}, +{{-0.151795f,0.697767f,-0.068468f},{-0.034791f,0.198462f,-0.979461f}}, +{{0.672233f,-0.734432f,-0.068468f},{0.153966f,-0.129582f,-0.979522f}}, +{{-0.302354f,-0.994011f,-0.068468f},{-0.069063f,-0.188910f,-0.979553f}}, +{{-0.300144f,0.657355f,-0.068620f},{-0.068331f,0.188482f,-0.979675f}}, +{{-0.154384f,-1.033897f,-0.068468f},{-0.035218f,-0.198035f,-0.979553f}}, +{{0.440313f,0.592449f,-0.068468f},{0.100864f,0.174108f,-0.979522f}}, +{{-0.762476f,-0.606749f,-0.068468f},{-0.174291f,-0.100284f,-0.979553f}}, +{{-0.674762f,-0.732418f,-0.068468f},{-0.154241f,-0.129032f,-0.979553f}}, +{{0.438036f,-0.930350f,-0.068468f},{0.100345f,-0.174413f,-0.979522f}}, +{{0.760323f,-0.609026f,-0.068468f},{0.174474f,-0.100955f,-0.979461f}}, +{{0.565719f,0.504359f,-0.068468f},{0.129582f,0.153935f,-0.979522f}}, +{{-0.438876f,0.593763f,-0.068468f},{-0.100406f,0.174627f,-0.979492f}}, +{{0.865640f,-0.016918f,-0.068468f},{0.198248f,0.034639f,-0.979522f}}, +{{0.761637f,0.270163f,-0.068468f},{0.174444f,0.100345f,-0.979522f}}, +{{-0.827036f,-0.467758f,-0.068468f},{-0.189062f,-0.068484f,-0.979553f}}, +{{-0.564544f,0.506049f,-0.068468f},{-0.129032f,0.154271f,-0.979553f}}, +{{0.150955f,-1.034353f,-0.068468f},{0.034639f,-0.198187f,-0.979522f}}, +{{0.826197f,0.131172f,-0.068468f},{0.189215f,0.068545f,-0.979522f}}, +{{0.153544f,0.697310f,-0.068468f},{0.035218f,0.198065f,-0.979522f}}, +{{-0.673072f,0.397845f,-0.068468f},{-0.154180f,0.129612f,-0.979492f}}, +{{-0.760739f,0.271531f,-0.068620f},{-0.173833f,0.100497f,-0.979614f}}, +{{-0.001734f,-1.047482f,-0.068468f},{-0.000275f,-0.201178f,-0.979553f}}, +{{-0.866479f,-0.319670f,-0.068468f},{-0.198401f,-0.034608f,-0.979492f}}, +{{-0.566558f,-0.840946f,-0.068468f},{-0.129490f,-0.153874f,-0.979553f}}, +{{0.673923f,0.395831f,-0.068468f},{0.154332f,0.129124f,-0.979522f}}, +{{0.878769f,-0.169607f,-0.068468f},{0.201239f,-0.000275f,-0.979522f}}, +{{-0.825562f,0.132822f,-0.068620f},{-0.188910f,0.068941f,-0.979553f}}, +{{0.299046f,-0.994910f,-0.068468f},{0.068514f,-0.189154f,-0.979522f}}, +{{-0.865314f,-0.015038f,-0.068620f},{-0.198004f,0.035066f,-0.979553f}}, +{{-0.441152f,-0.929035f,-0.068468f},{-0.100803f,-0.174047f,-0.979553f}}, +{{0.824723f,-0.469408f,-0.068620f},{0.188421f,-0.068819f,-0.979644f}}, +{{0.000895f,0.710895f,-0.068468f},{0.000305f,0.201178f,-0.979553f}}, +{{0.563705f,-0.842636f,-0.068468f},{0.129124f,-0.154332f,-0.979522f}}, +{{-0.878787f,-0.167553f,-0.068620f},{-0.200751f,0.000275f,-0.979614f}}, +{{0.865184f,-0.322257f,-0.068468f},{0.198431f,-0.035340f,-0.979461f}}, +{{-0.000009f,-0.168293f,-0.068544f},{0.000031f,0.000000f,-1.000000f}}, +}; +int const faces_gehaeuse[][3]= +{{11,6,5}, +{5,0,11}, +{6,7,4}, +{4,5,6}, +{7,8,3}, +{3,4,7}, +{8,9,2}, +{2,3,8}, +{9,10,1}, +{1,2,9}, +{11,10,1}, +{1,0,11}, +{12,13,10}, +{10,11,12}, +{14,13,10}, +{10,9,14}, +{15,14,9}, +{9,8,15}, +{16,15,8}, +{8,7,16}, +{17,16,7}, +{7,6,17}, +{12,17,6}, +{6,11,12}, +{23,18,17}, +{17,12,23}, +{18,19,16}, +{16,17,18}, +{19,20,15}, +{15,16,19}, +{20,21,14}, +{14,15,20}, +{21,22,13}, +{13,14,21}, +{23,22,13}, +{13,12,23}, +{24,25,22}, +{22,23,24}, +{26,25,22}, +{22,21,26}, +{27,26,21}, +{21,20,27}, +{28,27,20}, +{20,19,28}, +{29,28,19}, +{19,18,29}, +{24,29,18}, +{18,23,24}, +{35,30,29}, +{29,24,35}, +{30,31,28}, +{28,29,30}, +{31,32,27}, +{27,28,31}, +{32,33,26}, +{26,27,32}, +{33,34,25}, +{25,26,33}, +{35,34,25}, +{25,24,35}, +{36,37,34}, +{34,35,36}, +{38,37,34}, +{34,33,38}, +{39,38,33}, +{33,32,39}, +{40,39,32}, +{32,31,40}, +{41,40,31}, +{31,30,41}, +{36,41,30}, +{30,35,36}, +{47,42,41}, +{41,36,47}, +{42,43,40}, +{40,41,42}, +{43,44,39}, +{39,40,43}, +{44,45,38}, +{38,39,44}, +{45,46,37}, +{37,38,45}, +{47,46,37}, +{37,36,47}, +{48,49,46}, +{46,47,48}, +{50,49,46}, +{46,45,50}, +{51,50,45}, +{45,44,51}, +{52,51,44}, +{44,43,52}, +{53,52,43}, +{43,42,53}, +{48,53,42}, +{42,47,48}, +{59,54,53}, +{53,48,59}, +{54,55,52}, +{52,53,54}, +{55,56,51}, +{51,52,55}, +{56,57,50}, +{50,51,56}, +{57,58,49}, +{49,50,57}, +{59,58,49}, +{49,48,59}, +{60,61,58}, +{58,59,60}, +{62,61,58}, +{58,57,62}, +{63,62,57}, +{57,56,63}, +{64,63,56}, +{56,55,64}, +{65,64,55}, +{55,54,65}, +{60,65,54}, +{54,59,60}, +{71,66,65}, +{65,60,71}, +{66,67,64}, +{64,65,66}, +{67,68,63}, +{63,64,67}, +{68,69,62}, +{62,63,68}, +{69,70,61}, +{61,62,69}, +{71,70,61}, +{61,60,71}, +{72,73,70}, +{70,71,72}, +{74,73,70}, +{70,69,74}, +{75,74,69}, +{69,68,75}, +{76,75,68}, +{68,67,76}, +{77,76,67}, +{67,66,77}, +{72,77,66}, +{66,71,72}, +{83,78,77}, +{77,72,83}, +{78,79,76}, +{76,77,78}, +{79,80,75}, +{75,76,79}, +{80,81,74}, +{74,75,80}, +{81,82,73}, +{73,74,81}, +{83,82,73}, +{73,72,83}, +{84,85,82}, +{82,83,84}, +{86,85,82}, +{82,81,86}, +{87,86,81}, +{81,80,87}, +{88,87,80}, +{80,79,88}, +{89,88,79}, +{79,78,89}, +{84,89,78}, +{78,83,84}, +{95,90,89}, +{89,84,95}, +{90,91,88}, +{88,89,90}, +{91,92,87}, +{87,88,91}, +{92,93,86}, +{86,87,92}, +{93,94,85}, +{85,86,93}, +{95,94,85}, +{85,84,95}, +{96,97,94}, +{94,95,96}, +{98,97,94}, +{94,93,98}, +{99,98,93}, +{93,92,99}, +{100,99,92}, +{92,91,100}, +{101,100,91}, +{91,90,101}, +{96,101,90}, +{90,95,96}, +{107,102,101}, +{101,96,107}, +{102,103,100}, +{100,101,102}, +{103,104,99}, +{99,100,103}, +{104,105,98}, +{98,99,104}, +{105,106,97}, +{97,98,105}, +{107,106,97}, +{97,96,107}, +{108,109,106}, +{106,107,108}, +{110,109,106}, +{106,105,110}, +{111,110,105}, +{105,104,111}, +{112,111,104}, +{104,103,112}, +{113,112,103}, +{103,102,113}, +{108,113,102}, +{102,107,108}, +{119,114,113}, +{113,108,119}, +{114,115,112}, +{112,113,114}, +{115,116,111}, +{111,112,115}, +{116,117,110}, +{110,111,116}, +{117,118,109}, +{109,110,117}, +{119,118,109}, +{109,108,119}, +{120,121,118}, +{118,119,120}, +{122,121,118}, +{118,117,122}, +{123,122,117}, +{117,116,123}, +{124,123,116}, +{116,115,124}, +{125,124,115}, +{115,114,125}, +{120,125,114}, +{114,119,120}, +{149,138,137}, +{137,126,149}, +{136,137,138}, +{138,139,136}, +{135,136,139}, +{139,140,135}, +{134,135,140}, +{140,141,134}, +{133,134,141}, +{141,142,133}, +{132,133,142}, +{142,143,132}, +{131,132,143}, +{143,144,131}, +{130,131,144}, +{144,145,130}, +{129,130,145}, +{145,146,129}, +{128,129,146}, +{146,147,128}, +{127,128,147}, +{147,148,127}, +{148,149,126}, +{126,127,148}, +{173,172,175}, +{175,174,173}, +{172,171,176}, +{176,175,172}, +{171,170,177}, +{177,176,171}, +{170,169,178}, +{178,177,170}, +{169,168,179}, +{179,178,169}, +{168,167,180}, +{180,179,168}, +{167,166,181}, +{181,180,167}, +{166,165,182}, +{182,181,166}, +{165,164,183}, +{183,182,165}, +{164,163,184}, +{184,183,164}, +{163,162,185}, +{185,184,163}, +{162,173,174}, +{174,185,162}, +{209,198,221}, +{221,210,209}, +{208,209,210}, +{210,211,208}, +{207,208,211}, +{211,212,207}, +{206,207,212}, +{212,213,206}, +{205,206,213}, +{213,214,205}, +{204,205,214}, +{214,215,204}, +{203,204,215}, +{215,216,203}, +{202,203,216}, +{216,217,202}, +{201,202,217}, +{217,218,201}, +{200,201,218}, +{218,219,200}, +{199,200,219}, +{219,220,199}, +{198,199,220}, +{220,221,198}, +{245,244,247}, +{247,246,245}, +{244,243,248}, +{248,247,244}, +{243,242,249}, +{249,248,243}, +{242,241,250}, +{250,249,242}, +{241,240,251}, +{251,250,241}, +{240,239,252}, +{252,251,240}, +{239,238,253}, +{253,252,239}, +{238,237,254}, +{254,253,238}, +{237,236,255}, +{255,254,237}, +{236,235,256}, +{256,255,236}, +{235,234,257}, +{257,256,235}, +{234,245,246}, +{246,257,234}, +{281,270,293}, +{293,282,281}, +{280,281,282}, +{282,283,280}, +{279,280,283}, +{283,284,279}, +{278,279,284}, +{284,285,278}, +{277,278,285}, +{285,286,277}, +{276,277,286}, +{286,287,276}, +{275,276,287}, +{287,288,275}, +{274,275,288}, +{288,289,274}, +{273,274,289}, +{289,290,273}, +{272,273,290}, +{290,291,272}, +{271,272,291}, +{291,292,271}, +{270,271,292}, +{292,293,270}, +{308,307,306}, +{309,308,306}, +{310,309,306}, +{311,310,306}, +{312,311,306}, +{313,312,306}, +{314,313,306}, +{315,314,306}, +{316,315,306}, +{317,316,306}, +{318,317,306}, +{307,318,306}, +{367,475,435}, +{464,432,352}, +{370,352,380}, +{344,336,369}, +{333,337,373}, +{333,319,337}, +{356,451,333}, +{437,334,466}, +{333,373,345}, +{378,462,423}, +{436,473,438}, +{395,357,346}, +{423,400,443}, +{329,333,345}, +{405,409,400}, +{404,470,402}, +{346,372,349}, +{440,450,428}, +{425,416,351}, +{475,427,398}, +{325,345,347}, +{325,329,345}, +{383,361,338}, +{351,470,404}, +{346,338,372}, +{420,472,403}, +{421,362,366}, +{413,462,378}, +{319,350,337}, +{319,323,350}, +{352,386,407}, +{393,394,479}, +{411,401,376}, +{462,400,423}, +{337,355,354}, +{337,350,355}, +{378,423,461}, +{462,407,405}, +{476,346,349}, +{435,475,385}, +{428,395,368}, +{464,375,432}, +{347,360,358}, +{347,345,360}, +{386,326,407}, +{442,382,386}, +{418,340,374}, +{340,333,329}, +{349,375,464}, +{321,370,342}, +{455,416,425}, +{342,370,431}, +{334,453,356}, +{436,341,473}, +{345,373,360}, +{374,329,325}, +{444,437,457}, +{356,410,451}, +{391,330,425}, +{373,337,354}, +{369,341,436}, +{359,352,370}, +{456,327,324}, +{456,458,327}, +{471,427,475}, +{324,327,414}, +{405,363,409}, +{369,336,341}, +{401,425,322}, +{373,354,371}, +{472,349,343}, +{396,386,352}, +{367,471,475}, +{462,405,400}, +{453,348,410}, +{431,380,413}, +{360,373,379}, +{437,425,334}, +{387,468,455}, +{432,442,396}, +{435,408,357}, +{357,408,383}, +{459,378,335}, +{386,382,326}, +{358,379,381}, +{358,360,379}, +{430,333,340}, +{383,338,346}, +{323,319,406}, +{334,404,453}, +{410,332,451}, +{471,414,427}, +{354,384,371}, +{354,355,384}, +{394,435,377}, +{351,477,470}, +{370,380,431}, +{438,430,418}, +{333,451,406}, +{371,384,388}, +{384,390,388}, +{391,425,401}, +{362,464,359}, +{432,396,352}, +{479,377,440}, +{406,434,323}, +{321,359,370}, +{381,379,392}, +{379,397,392}, +{459,413,378}, +{425,387,455}, +{435,385,408}, +{408,463,383}, +{387,328,468}, +{357,383,346}, +{379,373,397}, +{373,399,397}, +{453,402,348}, +{411,391,401}, +{418,430,340}, +{373,388,399}, +{366,362,359}, +{457,466,344}, +{373,371,388}, +{335,461,433}, +{353,391,411}, +{376,322,444}, +{349,469,375}, +{330,387,425}, +{376,401,322}, +{338,364,372}, +{389,423,330}, +{339,474,393}, +{423,443,330}, +{431,413,459}, +{399,388,419}, +{443,320,448}, +{444,322,437}, +{397,399,412}, +{448,328,387}, +{353,389,391}, +{460,478,339}, +{375,445,432}, +{408,446,463}, +{339,478,474}, +{440,377,450}, +{392,412,415}, +{392,397,412}, +{380,462,413}, +{443,448,330}, +{461,423,389}, +{479,394,377}, +{341,356,473}, +{428,450,395}, +{388,417,419}, +{388,390,417}, +{451,434,406}, +{393,474,394}, +{478,367,474}, +{460,465,478}, +{352,407,462}, +{478,467,367}, +{433,389,353}, +{406,319,333}, +{419,424,422}, +{419,417,424}, +{466,334,336}, +{455,468,365}, +{344,466,336}, +{330,448,387}, +{343,349,464}, +{380,352,462}, +{415,429,426}, +{415,412,429}, +{475,398,385}, +{374,340,329}, +{448,320,328}, +{375,454,445}, +{400,409,480}, +{416,477,351}, +{412,441,429}, +{412,399,441}, +{473,333,430}, +{473,356,333}, +{403,343,421}, +{399,419,441}, +{469,331,454}, +{368,476,420}, +{419,422,441}, +{338,361,364}, +{368,395,476}, +{349,372,469}, +{467,456,324}, +{450,357,395}, +{469,454,375}, +{441,422,439}, +{457,437,466}, +{420,476,472}, +{474,435,394}, +{403,472,343}, +{438,473,430}, +{465,467,478}, +{432,445,442}, +{476,349,472}, +{429,441,447}, +{343,464,362}, +{407,326,363}, +{372,364,331}, +{377,357,450}, +{416,365,477}, +{443,480,320}, +{426,429,447}, +{426,447,449}, +{407,363,405}, +{455,365,416}, +{400,480,443}, +{322,425,437}, +{474,367,435}, +{366,359,321}, +{422,424,452}, +{422,452,439}, +{433,461,389}, +{372,331,469}, +{404,402,453}, +{324,414,471}, +{324,471,367}, +{410,348,332}, +{439,452,456}, +{452,458,456}, +{334,351,404}, +{359,464,352}, +{396,442,386}, +{467,324,367}, +{336,356,341}, +{425,351,334}, +{449,447,460}, +{447,465,460}, +{385,398,446}, +{389,330,391}, +{377,435,357}, +{385,446,408}, +{451,332,434}, +{336,334,356}, +{447,441,465}, +{441,467,465}, +{356,453,410}, +{421,343,362}, +{335,378,461}, +{441,456,467}, +{383,463,361}, +{395,346,476}, +{441,439,456}, +{486,533,361}, +{361,463,486}, +{544,501,434}, +{434,332,544}, +{518,494,446}, +{446,398,518}, +{487,493,449}, +{449,460,487}, +{492,489,458}, +{458,452,492}, +{538,544,332}, +{332,348,538}, +{507,492,452}, +{452,424,507}, +{551,529,366}, +{366,321,551}, +{493,506,426}, +{426,449,493}, +{481,552,320}, +{320,480,481}, +{530,483,477}, +{477,365,530}, +{531,545,331}, +{331,364,531}, +{548,532,363}, +{363,326,548}, +{495,497,442}, +{442,445,495}, +{533,531,364}, +{364,361,533}, +{509,528,368}, +{368,420,509}, +{545,491,454}, +{454,331,545}, +{508,516,403}, +{403,421,508}, +{515,481,480}, +{480,409,515}, +{491,495,445}, +{445,454,491}, +{552,546,328}, +{328,320,552}, +{506,512,415}, +{415,426,506}, +{485,530,365}, +{365,468,485}, +{511,507,424}, +{424,417,511}, +{536,502,433}, +{433,353,536}, +{521,511,417}, +{417,390,521}, +{512,520,392}, +{392,415,512}, +{494,486,463}, +{463,446,494}, +{542,487,460}, +{460,339,542}, +{488,503,431}, +{431,459,488}, +{519,542,339}, +{339,393,519}, +{496,525,376}, +{376,444,496}, +{514,536,353}, +{353,411,514}, +{502,543,335}, +{335,433,502}, +{540,490,457}, +{457,344,540}, +{517,538,348}, +{348,402,517}, +{546,485,468}, +{468,328,546}, +{520,524,381}, +{381,392,520}, +{501,550,323}, +{323,434,501}, +{498,482,479}, +{479,440,498}, +{522,521,390}, +{390,384,522}, +{510,499,438}, +{438,418,510}, +{483,484,470}, +{470,477,483}, +{535,522,384}, +{384,355,535}, +{513,505,427}, +{427,414,513}, +{524,534,358}, +{358,381,524}, +{523,548,326}, +{326,382,523}, +{543,488,459}, +{459,335,543}, +{532,515,409}, +{409,363,532}, +{547,513,414}, +{414,327,547}, +{489,547,327}, +{327,458,489}, +{500,527,369}, +{369,436,500}, +{490,496,444}, +{444,457,490}, +{549,526,374}, +{374,325,549}, +{503,541,342}, +{342,431,503}, +{541,551,321}, +{321,342,541}, +{526,510,418}, +{418,374,526}, +{497,523,382}, +{382,442,497}, +{534,539,347}, +{347,358,534}, +{528,504,428}, +{428,368,528}, +{537,535,355}, +{355,350,537}, +{525,514,411}, +{411,376,525}, +{482,519,393}, +{393,479,482}, +{550,537,350}, +{350,323,550}, +{529,508,421}, +{421,366,529}, +{516,509,420}, +{420,403,516}, +{539,549,325}, +{325,347,539}, +{505,518,398}, +{398,427,505}, +{504,498,440}, +{440,428,504}, +{484,517,402}, +{402,470,484}, +{499,500,436}, +{436,438,499}, +{527,540,344}, +{344,369,527}, +{564,558,540}, +{540,527,564}, +{581,580,500}, +{500,499,581}, +{577,582,498}, +{498,504,577}, +{559,554,549}, +{549,539,559}, +{570,574,509}, +{509,516,570}, +{562,575,508}, +{508,529,562}, +{588,569,519}, +{519,482,588}, +{566,571,514}, +{514,525,566}, +{563,577,504}, +{504,528,563}, +{561,559,539}, +{539,534,561}, +{565,573,510}, +{510,526,565}, +{557,553,551}, +{551,541,557}, +{578,557,541}, +{541,503,578}, +{554,565,526}, +{526,549,554}, +{585,583,496}, +{496,490,585}, +{580,564,527}, +{527,500,580}, +{555,586,488}, +{488,543,555}, +{567,561,534}, +{534,524,567}, +{573,581,499}, +{499,510,573}, +{582,588,482}, +{482,498,582}, +{568,567,524}, +{524,520,568}, +{558,585,490}, +{490,540,558}, +{579,555,543}, +{543,502,579}, +{571,560,536}, +{536,514,571}, +{583,566,525}, +{525,496,583}, +{569,556,542}, +{542,519,569}, +{586,578,503}, +{503,488,586}, +{556,587,487}, +{487,542,556}, +{572,568,520}, +{520,512,572}, +{560,579,502}, +{502,536,560}, +{576,572,512}, +{512,506,576}, +{575,570,516}, +{516,508,575}, +{574,563,528}, +{528,509,574}, +{584,576,506}, +{506,493,584}, +{553,562,529}, +{529,551,553}, +{587,584,493}, +{493,487,587}, +{590,593,584}, +{584,587,590}, +{624,615,562}, +{562,553,624}, +{593,601,576}, +{576,584,593}, +{603,614,563}, +{563,574,603}, +{602,607,570}, +{570,575,602}, +{601,605,572}, +{572,576,601}, +{617,598,579}, +{579,560,617}, +{605,609,568}, +{568,572,605}, +{621,590,587}, +{587,556,621}, +{591,599,578}, +{578,586,591}, +{608,621,556}, +{556,569,608}, +{594,611,566}, +{566,583,594}, +{606,617,560}, +{560,571,606}, +{598,622,555}, +{555,579,598}, +{619,592,585}, +{585,558,619}, +{609,610,567}, +{567,568,609}, +{595,589,588}, +{588,582,595}, +{604,596,581}, +{581,573,604}, +{610,616,561}, +{561,567,610}, +{622,591,586}, +{586,555,622}, +{597,613,564}, +{564,580,597}, +{592,594,583}, +{583,585,592}, +{623,612,565}, +{565,554,623}, +{599,620,557}, +{557,578,599}, +{620,624,553}, +{553,557,620}, +{612,604,573}, +{573,565,612}, +{616,618,559}, +{559,561,616}, +{614,600,577}, +{577,563,614}, +{611,606,571}, +{571,566,611}, +{589,608,569}, +{569,588,589}, +{615,602,575}, +{575,562,615}, +{607,603,574}, +{574,570,607}, +{618,623,554}, +{554,559,618}, +{600,595,582}, +{582,577,600}, +{596,597,580}, +{580,581,596}, +{613,619,558}, +{558,564,613}, +{619,613,625}, +{597,596,625}, +{595,600,625}, +{623,618,625}, +{603,607,625}, +{602,615,625}, +{608,589,625}, +{606,611,625}, +{600,614,625}, +{618,616,625}, +{604,612,625}, +{624,620,625}, +{620,599,625}, +{612,623,625}, +{594,592,625}, +{613,597,625}, +{591,622,625}, +{616,610,625}, +{596,604,625}, +{589,595,625}, +{610,609,625}, +{592,619,625}, +{622,598,625}, +{617,606,625}, +{611,594,625}, +{621,608,625}, +{599,591,625}, +{590,621,625}, +{609,605,625}, +{598,617,625}, +{605,601,625}, +{607,602,625}, +{614,603,625}, +{601,593,625}, +{615,624,625}, +{593,590,625}, +}; +int const nFaces_gehaeuse=948; +float const matrix_gehaeuse[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.000000f,0.168293f,-0.000000f,1.000000f, +}; +float const material_gehaeuse[]={ +0.4f,0.3f,0.0f,1.000000f,1.0f,1.0f,0.330270f,104.000000f,0.000000f,}; +struct C3DObject const object_gehaeuse={verticies_gehaeuse, faces_gehaeuse, &nFaces_gehaeuse, matrix_gehaeuse, material_gehaeuse}; +/* */ + +/* */ +float const verticies_minutenzeiger[][2][3]= +{{{0.034424f,0.034424f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.047024f,0.012600f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.047024f,-0.012600f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.034424f,-0.034424f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.012600f,-0.047024f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.012600f,-0.047024f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.034424f,-0.034424f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.047024f,-0.012600f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.047024f,0.012600f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.034424f,0.034424f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.012600f,0.047024f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.012600f,0.047024f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.012600f,0.738157f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.012600f,0.738157f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.034424f,0.697664f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.034424f,0.697664f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +}; +int const faces_minutenzeiger[][3]= +{{12,15,0}, +{0,11,12}, +{13,12,11}, +{11,10,13}, +{14,13,10}, +{10,9,14}, +{11,0,10}, +{10,0,9}, +{9,0,1}, +{8,9,1}, +{8,1,2}, +{7,8,2}, +{7,2,3}, +{6,7,3}, +{6,3,4}, +{5,6,4}, +}; +int const nFaces_minutenzeiger=16; +float const matrix_minutenzeiger[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +-0.000000f,0.000000f,0.045552f,1.000000f, +}; +float const material_minutenzeiger[]={ +0.000000f,0.000000f,0.000000f,1.000000f,0.500000f,0.500000f,0.500000f,50.000000f,0.000000f,}; +struct C3DObject const object_minutenzeiger={verticies_minutenzeiger, faces_minutenzeiger, &nFaces_minutenzeiger, matrix_minutenzeiger, material_minutenzeiger}; +/* */ + +/* */ +float const verticies_sekundenzeiger[][2][3]= +{{{0.010426f,0.010426f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.014242f,0.003816f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.014242f,-0.003816f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.010426f,-0.010426f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.003816f,-0.014242f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.003816f,-0.014242f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.010426f,-0.010426f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.014242f,-0.003816f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.014242f,0.003816f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.010426f,0.010426f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.003816f,0.014242f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.003816f,0.014242f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.003816f,0.223563f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.003816f,0.223563f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.010426f,0.211299f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.010426f,0.211299f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +}; +int const faces_sekundenzeiger[][3]= +{{12,15,0}, +{0,11,12}, +{13,12,11}, +{11,10,13}, +{14,13,10}, +{10,9,14}, +{9,10,11}, +{11,0,9}, +{9,0,1}, +{8,9,1}, +{8,1,2}, +{7,8,2}, +{6,7,2}, +{6,2,3}, +{6,3,4}, +{5,6,4}, +}; +int const nFaces_sekundenzeiger=16; +float const matrix_sekundenzeiger[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.286437f,-0.286437f,0.026623f,1.000000f, +}; +float const material_sekundenzeiger[]={ +0.000000f,0.000000f,0.000000f,1.000000f,0.500000f,0.500000f,0.500000f,50.000000f,0.000000f,}; +struct C3DObject const object_sekundenzeiger={verticies_sekundenzeiger, faces_sekundenzeiger, &nFaces_sekundenzeiger, matrix_sekundenzeiger, material_sekundenzeiger}; +/* */ + +/* */ +float const verticies_sekziffernblatt[][2][3]= +{{{0.044059f,-0.188907f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.051061f,-0.220878f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.044861f,-0.222235f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.037859f,-0.190265f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.041999f,-0.189438f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.048605f,-0.221493f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.042390f,-0.222774f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.035783f,-0.190719f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.109459f,-0.159901f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.128532f,-0.186497f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.133690f,-0.182798f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.114616f,-0.156202f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.167437f,-0.096303f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.195679f,-0.112842f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.192472f,-0.118319f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.164230f,-0.101780f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.190626f,-0.026406f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.223154f,-0.030028f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.223856f,-0.023721f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.191328f,-0.020099f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.182159f,0.059235f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.213348f,0.069157f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.215271f,0.063109f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.184083f,0.053187f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.145732f,0.123238f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.170189f,0.144987f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.165971f,0.149730f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.141514f,0.127981f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.076422f,0.174251f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.089919f,0.204068f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.095700f,0.201450f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.082204f,0.171634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.004484f,0.190007f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.004686f,0.222735f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.001660f,0.222774f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.001862f,0.190046f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.079803f,0.172634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.092930f,0.202615f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.087116f,0.205161f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.073989f,0.175180f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.139648f,0.129717f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.163834f,0.151766f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.168110f,0.147076f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.143923f,0.125026f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.183136f,0.055454f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.214200f,0.065760f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.212202f,0.071784f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.181138f,0.061478f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.191286f,-0.017736f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.223856f,-0.020956f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.223231f,-0.027272f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.190662f,-0.024052f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.165198f,-0.099746f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.193642f,-0.115935f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.196782f,-0.110419f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.168338f,-0.094230f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.116260f,-0.154777f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.135661f,-0.181135f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.130549f,-0.184897f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.111149f,-0.158539f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +}; +int const faces_sekziffernblatt[][3]= +{{2,1,0}, +{0,3,2}, +{7,4,5}, +{5,6,7}, +{8,11,10}, +{10,9,8}, +{15,12,13}, +{13,14,15}, +{16,19,18}, +{18,17,16}, +{23,20,21}, +{21,22,23}, +{24,27,26}, +{26,25,24}, +{31,28,29}, +{29,30,31}, +{32,35,34}, +{34,33,32}, +{39,36,37}, +{37,38,39}, +{40,43,42}, +{42,41,40}, +{47,44,45}, +{45,46,47}, +{48,51,50}, +{50,49,48}, +{55,52,53}, +{53,54,55}, +{56,59,58}, +{58,57,56}, +}; +int const nFaces_sekziffernblatt=30; +float const matrix_sekziffernblatt[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.286562f,-0.284436f,0.026623f,1.000000f, +}; +float const material_sekziffernblatt[]={ +0.228571f,0.258647f,0.168421f,1.000000f,0.546763f,0.546763f,0.546763f,189.000000f,0.000000f,}; +struct C3DObject const object_sekziffernblatt={verticies_sekziffernblatt, faces_sekziffernblatt, &nFaces_sekziffernblatt, matrix_sekziffernblatt, material_sekziffernblatt}; +/* */ + +/* */ +float const verticies_stundenzeiger[][2][3]= +{{{0.052070f,0.052070f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.068033f,0.028180f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.073639f,-0.000000f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.068033f,-0.028180f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.052070f,-0.052070f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.028180f,-0.068033f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.000000f,-0.073639f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.028180f,-0.068033f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.052070f,-0.052070f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.068033f,-0.028180f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.073639f,-0.000000f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.068033f,0.028180f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.052070f,0.052070f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.028180f,0.068033f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.000000f,0.073639f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.028180f,0.068033f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.028180f,0.527469f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.000000f,0.587389f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.028180f,0.527470f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{-0.104648f,0.356832f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +{{0.104648f,0.356831f,0.000000f},{0.000000f,0.000000f,-1.000000f}}, +}; +int const faces_stundenzeiger[][3]= +{{16,20,0}, +{0,15,16}, +{17,16,15}, +{15,14,17}, +{18,17,14}, +{14,13,18}, +{19,18,13}, +{13,12,19}, +{13,14,15}, +{12,13,15}, +{15,0,12}, +{12,0,11}, +{11,0,1}, +{10,11,1}, +{10,1,2}, +{9,10,2}, +{9,2,3}, +{9,3,4}, +{8,9,4}, +{8,4,5}, +{7,8,5}, +{7,5,6}, +}; +int const nFaces_stundenzeiger=22; +float const matrix_stundenzeiger[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.000000f,0.000000f,0.034164f,1.000000f, +}; +float const material_stundenzeiger[]={ +0.000000f,0.000000f,0.000000f,1.000000f,0.500000f,0.500000f,0.500000f,50.000000f,0.000000f,}; +struct C3DObject const object_stundenzeiger={verticies_stundenzeiger, faces_stundenzeiger, &nFaces_stundenzeiger, matrix_stundenzeiger, material_stundenzeiger}; +/* */ + +/* */ +float const verticies_ziffernblatt[][2][3]= +{{{0.391697f,0.706950f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.341634f,0.620237f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.366324f,0.605982f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.416388f,0.692695f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.706950f,0.391698f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.620237f,0.341634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.605982f,0.366324f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.692695f,0.416388f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.692695f,-0.416387f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.605982f,-0.366324f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.620237f,-0.341634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.706950f,-0.391697f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.416388f,-0.692695f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.366324f,-0.605982f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.341634f,-0.620237f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.391698f,-0.706950f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.391697f,-0.706950f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.341634f,-0.620237f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.366324f,-0.605983f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.416387f,-0.692695f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.706950f,-0.391698f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.620237f,-0.341634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.605982f,-0.366325f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.692695f,-0.416388f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.692695f,0.416387f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.605983f,0.366324f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.620238f,0.341634f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.706950f,0.391697f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.416388f,0.692695f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.366325f,0.605982f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.341634f,0.620237f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.391698f,0.706950f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.028474f,0.801347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.028474f,0.601347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.028474f,0.601347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.028474f,0.801347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.801347f,0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.601347f,0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.601347f,-0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.801347f,-0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.028474f,-0.801347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.028474f,-0.601347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.028474f,-0.601347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{0.028474f,-0.801347f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.801347f,-0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.601347f,-0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.601347f,0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +{{-0.801347f,0.028474f,0.000000f},{0.000000f,0.000000f,1.000000f}}, +}; +int const faces_ziffernblatt[][3]= +{{1,2,3}, +{3,0,1}, +{6,5,4}, +{4,7,6}, +{10,9,8}, +{8,11,10}, +{13,14,15}, +{15,12,13}, +{17,18,19}, +{19,16,17}, +{22,21,20}, +{20,23,22}, +{26,25,24}, +{24,27,26}, +{29,30,31}, +{31,28,29}, +{34,33,32}, +{32,35,34}, +{37,38,39}, +{39,36,37}, +{42,41,40}, +{40,43,42}, +{45,46,47}, +{47,44,45}, +}; +int const nFaces_ziffernblatt=24; +float const matrix_ziffernblatt[]={ +1.000000f,0.000000f,0.000000f,0.000000f, +0.000000f,1.000000f,0.000000f,0.000000f, +0.000000f,0.000000f,1.000000f,0.000000f, +0.000000f,0.000000f,0.026623f,1.000000f, +}; +float const material_ziffernblatt[]={ +0.228571f,0.258647f,0.168421f,1.000000f,0.546763f,0.546763f,0.546763f,189.000000f,0.000000f,}; +struct C3DObject const object_ziffernblatt={verticies_ziffernblatt, faces_ziffernblatt, &nFaces_ziffernblatt, matrix_ziffernblatt, material_ziffernblatt}; +/* */ + +/* */ +}; diff --git a/samples/OpenGL/pocketwatch/uhr.h b/samples/OpenGL/pocketwatch/uhr.h new file mode 100644 index 0000000..78e4f3f --- /dev/null +++ b/samples/OpenGL/pocketwatch/uhr.h @@ -0,0 +1,88 @@ +#ifndef STRUCT_3D_OBJECT +#define STRUCT_3D_OBJECT +struct C3DObject +{ + float const (*verticies)[2][3]; + int const (*faces)[3]; + int const (*nFaces); + float const (*matrix); + float const (*material); +}; +#endif/*STRUCT_3D_OBJECT*/ +namespace uhr +{ +/* */ +/* */ +extern float const verticies_boden[][2][3]; +extern int const faces_boden[][3]; +extern int const nFaces_boden; +extern float const matrix_boden[]; +extern float const material_boden[]; +extern struct C3DObject const object_boden; +/* */ + +/* */ +extern float const verticies_deckel[][2][3]; +extern int const faces_deckel[][3]; +extern int const nFaces_deckel; +extern float const matrix_deckel[]; +extern float const material_deckel[]; +extern struct C3DObject const object_deckel; +/* */ + +/* */ +extern float const verticies_gehaeuse[][2][3]; +extern int const faces_gehaeuse[][3]; +extern int const nFaces_gehaeuse; +extern float const matrix_gehaeuse[]; +extern float const material_gehaeuse[]; +extern struct C3DObject const object_gehaeuse; +/* */ + +/* */ +extern float const verticies_minutenzeiger[][2][3]; +extern int const faces_minutenzeiger[][3]; +extern int const nFaces_minutenzeiger; +extern float const matrix_minutenzeiger[]; +extern float const material_minutenzeiger[]; +extern struct C3DObject const object_minutenzeiger; +/* */ + +/* */ +extern float const verticies_sekundenzeiger[][2][3]; +extern int const faces_sekundenzeiger[][3]; +extern int const nFaces_sekundenzeiger; +extern float const matrix_sekundenzeiger[]; +extern float const material_sekundenzeiger[]; +extern struct C3DObject const object_sekundenzeiger; +/* */ + +/* */ +extern float const verticies_sekziffernblatt[][2][3]; +extern int const faces_sekziffernblatt[][3]; +extern int const nFaces_sekziffernblatt; +extern float const matrix_sekziffernblatt[]; +extern float const material_sekziffernblatt[]; +extern struct C3DObject const object_sekziffernblatt; +/* */ + +/* */ +extern float const verticies_stundenzeiger[][2][3]; +extern int const faces_stundenzeiger[][3]; +extern int const nFaces_stundenzeiger; +extern float const matrix_stundenzeiger[]; +extern float const material_stundenzeiger[]; +extern struct C3DObject const object_stundenzeiger; +/* */ + +/* */ +extern float const verticies_ziffernblatt[][2][3]; +extern int const faces_ziffernblatt[][3]; +extern int const nFaces_ziffernblatt; +extern float const matrix_ziffernblatt[]; +extern float const material_ziffernblatt[]; +extern struct C3DObject const object_ziffernblatt; +/* */ + +/* */ +}; \ No newline at end of file -- cgit v1.2.3 From 4542fdb44ae7525b2806233b1d499b1c0202fbf7 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Sat, 26 Apr 2014 18:21:56 +0200 Subject: rotateable observer --- .gitmodules | 3 +++ extra/linmath.h | 1 + samples/OpenGL/frustum/frustum.c | 23 ++++++++++++++++++++-- samples/OpenGL/minimal_glsl/minimal_glsl.c | 2 +- .../x11argb_opengl_glsl/x11argb_opengl_glsl.c | 8 +------- 5 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 160000 extra/linmath.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d03f608 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "extra/linmath.h"] + path = extra/linmath.h + url = git@github.com:datenwolf/linmath.h.git diff --git a/extra/linmath.h b/extra/linmath.h new file mode 160000 index 0000000..f7418fa --- /dev/null +++ b/extra/linmath.h @@ -0,0 +1 @@ +Subproject commit f7418faa1bffa56a5754f98dcc628fcfbf8606c5 diff --git a/samples/OpenGL/frustum/frustum.c b/samples/OpenGL/frustum/frustum.c index c5732c8..2728cee 100644 --- a/samples/OpenGL/frustum/frustum.c +++ b/samples/OpenGL/frustum/frustum.c @@ -412,6 +412,23 @@ struct { float near, far; } frustum = {-1, 1, -1, 1, 1, 4}; +struct { + struct { + float phi, theta; + } rot; +} observer; + +void observer_motion(int x, int y) +{ + int const win_width = glutGet(GLUT_WINDOW_WIDTH); + int const win_height = glutGet(GLUT_WINDOW_HEIGHT); + + observer.rot.phi = -180.f + 360.f * (float)x / (float)win_width; + observer.rot.theta = -90.f + 180.f * (float)y / (float)win_height; + + glutPostRedisplay(); +} + void display_observer(float frustum_aspect) { int const win_width = glutGet(GLUT_WINDOW_WIDTH); @@ -434,8 +451,8 @@ void display_observer(float frustum_aspect) glLoadIdentity(); if(1) { glTranslatef(0, 0, -10); - glRotatef(15, 1, 0, 0); - glRotatef(-15, 0, 1, 0); + glRotatef(observer.rot.theta, 1, 0, 0); + glRotatef(observer.rot.phi, 0, 1, 0); glTranslatef(0, 0, 2.5); } else { gluLookAt(3, 1, -5, 0, 0, -2.5, 0, 1, 0); @@ -536,6 +553,8 @@ int main(int argc, char *argv[]) window_observer = glutCreateWindow("Observer"); glutDisplayFunc(display); + glutMotionFunc(observer_motion); + glutPassiveMotionFunc(observer_motion); window_view = glutCreateWindow("Frustum View"); glutDisplayFunc(display); diff --git a/samples/OpenGL/minimal_glsl/minimal_glsl.c b/samples/OpenGL/minimal_glsl/minimal_glsl.c index 2d1b0fa..72ba3ff 100644 --- a/samples/OpenGL/minimal_glsl/minimal_glsl.c +++ b/samples/OpenGL/minimal_glsl/minimal_glsl.c @@ -38,7 +38,7 @@ static const GLchar *fragment_shader_source = "uniform sampler2D texRGB;" "void main()" "{" -" gl_FragColor = -texture2D(texCMYK, gl_TexCoord[0].st) + texture2D(texRGB, gl_TexCoord[0].st);" +" gl_FragColor = -texture2D(texCMYK, gl_TexCoord[0].st) + texture2D(texRGB, gl_TexCoord[0].st); " "}\0"; GLuint shaderFragment = 0; diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c index 0852cbc..7aae5a8 100644 --- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c +++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c @@ -578,14 +578,8 @@ static void redrawTheWindow(double T) struct timespec Ta, Tb; - clock_gettime(CLOCK_MONOTONIC_RAW, &Ta); glXSwapBuffers(Xdisplay, glX_window_handle); - glXWaitGL(); - clock_gettime(CLOCK_MONOTONIC_RAW, &Tb); - - fprintf(stderr, "glXSwapBuffers + glXWaitGL returned after %f ms\n", - 1e3*( (double)Tb.tv_sec + 1e-9*(double)Tb.tv_nsec ) - - 1e3*( (double)Ta.tv_sec + 1e-9*(double)Ta.tv_nsec ) ); + glXWaitGL(); } static double getftime(void) { -- cgit v1.2.3