Server IP : 195.201.23.43 / Your IP : 18.226.28.197 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/libreoffice/program/opengl/ |
Upload File : |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #version 150 layout(triangles) in; layout(triangle_strip, max_vertices=27) out; in mat4 projectionMatrix[]; in mat4 modelViewMatrix[]; in mat4 shadowMatrix[]; uniform float hexagonSize; uniform sampler2D permTexture; out vec2 texturePosition; out float fuzz; out vec2 v_center; out vec3 normal; out vec4 shadowCoordinate; const float expandFactor = 0.0318; float snoise(vec2 p) { return texture(permTexture, p).r; } mat4 identityMatrix(void) { return mat4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); } mat4 scaleMatrix(vec3 axis) { mat4 matrix = identityMatrix(); matrix[0][0] = axis.x; matrix[1][1] = axis.y; matrix[2][2] = axis.z; return matrix; } mat4 translationMatrix(vec3 axis) { mat4 matrix = identityMatrix(); matrix[3] = vec4(axis, 1.0); return matrix; } void emitHexagonVertex(vec3 center, vec2 translation) { vec4 pos = vec4(center + hexagonSize * expandFactor * vec3(translation, 0.0), 1.0); gl_Position = projectionMatrix[0] * modelViewMatrix[0] * pos; shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[0] * modelViewMatrix[0] * pos; texturePosition = vec2((pos.x + 1), (1 - pos.y)) / 2; EmitVertex(); } void main() { const vec2 translateVectors[6] = vec2[]( vec2(-3, -2), vec2(0, -4), vec2(3, -2), vec2(3, 2), vec2(0, 4), vec2(-3, 2) ); vec3 center = gl_in[0].gl_Position.xyz; v_center = (1 + center.xy) / 2; fuzz = snoise(center.xy); // Draw “walls” to the hexagons. if (hexagonSize < 1.0) { vec3 rearCenter = vec3(center.xy, -0.3); normal = vec3(0.0, 0.0, 0.3); emitHexagonVertex(center, translateVectors[5]); emitHexagonVertex(rearCenter, translateVectors[5]); for (int i = 0; i < 6; ++i) { emitHexagonVertex(center, translateVectors[i]); emitHexagonVertex(rearCenter, translateVectors[i]); } EndPrimitive(); } // Draw the main hexagon part. normal = vec3(0.0, 0.0, 1.0); emitHexagonVertex(center, translateVectors[5]); for (int i = 0; i < 6; ++i) { emitHexagonVertex(center, translateVectors[i]); emitHexagonVertex(center, vec2(0.0, 0.0)); } EndPrimitive(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */Private