Commit 7e7bcd54 authored by Jan Janssen's avatar Jan Janssen

Revert "Automated modification by Pycharm"

This reverts commit ff612183.
parent f4b5803b
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_FIXES_H
#define MU_PARSER_FIXES_H
/** \file
\brief This file contains compatibility fixes for some platforms.
*/
//
// Compatibility fixes
//
//---------------------------------------------------------------------------
//
// Intel Compiler
//
//---------------------------------------------------------------------------
#ifdef __INTEL_COMPILER
// remark #981: operands are evaluated in unspecified order
// disabled -> completely pointless if the functions do not have side effects
//
#pragma warning(disable:981)
// remark #383: value copied to temporary, reference to temporary used
#pragma warning(disable:383)
// remark #1572: floating-point equality and inequality comparisons are unreliable
// disabled -> everyone knows it, the parser passes this problem
// deliberately to the user
#pragma warning(disable:1572)
#endif
#endif // include guard
/*
__________
_____ __ __\______ \_____ _______ ______ ____ _______
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
\/ \/ \/ \/
Copyright (C) 2013 Ingo Berg
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MU_PARSER_FIXES_H
#define MU_PARSER_FIXES_H
/** \file
\brief This file contains compatibility fixes for some platforms.
*/
//
// Compatibility fixes
//
//---------------------------------------------------------------------------
//
// Intel Compiler
//
//---------------------------------------------------------------------------
#ifdef __INTEL_COMPILER
// remark #981: operands are evaluated in unspecified order
// disabled -> completely pointless if the functions do not have side effects
//
#pragma warning(disable:981)
// remark #383: value copied to temporary, reference to temporary used
#pragma warning(disable:383)
// remark #1572: floating-point equality and inequality comparisons are unreliable
// disabled -> everyone knows it, the parser passes this problem
// deliberately to the user
#pragma warning(disable:1572)
#endif
#endif // include guard
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
uniform mat4 modelview_projection_matrix;
uniform bool is_perspective;
uniform vec3 parallel_view_dir;
uniform vec3 eye_pos;
#if __VERSION__ >= 130
in vec3 position;
in vec4 color;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#define position gl_Vertex
#endif
in vec3 cylinder_base;
in vec3 cylinder_axis;
flat out vec4 vertex_color_out;
void main()
{
vertex_color_out = color;
if(cylinder_axis != vec3(0)) {
// Get view direction.
vec3 view_dir;
if(!is_perspective)
view_dir = parallel_view_dir;
else
view_dir = eye_pos - cylinder_base;
// Build local coordinate system.
vec3 u = normalize(cross(view_dir, cylinder_axis));
vec3 rotated_pos = cylinder_axis * position.x + u * position.y + cylinder_base;
gl_Position = modelview_projection_matrix * vec4(rotated_pos, 1.0);
}
else {
gl_Position = vec4(0);
}
}
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
uniform mat4 modelview_projection_matrix;
uniform bool is_perspective;
uniform vec3 parallel_view_dir;
uniform vec3 eye_pos;
#if __VERSION__ >= 130
in vec3 position;
in vec4 color;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#define position gl_Vertex
#endif
in vec3 cylinder_base;
in vec3 cylinder_axis;
flat out vec4 vertex_color_out;
void main()
{
vertex_color_out = color;
if(cylinder_axis != vec3(0)) {
// Get view direction.
vec3 view_dir;
if(!is_perspective)
view_dir = parallel_view_dir;
else
view_dir = eye_pos - cylinder_base;
// Build local coordinate system.
vec3 u = normalize(cross(view_dir, cylinder_axis));
vec3 rotated_pos = cylinder_axis * position.x + u * position.y + cylinder_base;
gl_Position = modelview_projection_matrix * vec4(rotated_pos, 1.0);
}
else {
gl_Position = vec4(0);
}
}
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
uniform int pickingBaseID;
#if __VERSION__ >= 130
in vec3 position;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#define position gl_Vertex
#endif
in vec3 cylinder_axis;
in float cylinder_radius;
out vec4 color_gs;
out vec3 cylinder_axis_gs;
out float cylinder_radius_gs;
void main()
{
#if __VERSION__ >= 130
// Compute color from object ID.
int objectID = pickingBaseID + gl_VertexID;
color_gs = vec4(
float(objectID & 0xFF) / 255.0,
float((objectID >> 8) & 0xFF) / 255.0,
float((objectID >> 16) & 0xFF) / 255.0,
float((objectID >> 24) & 0xFF) / 255.0);
#endif
cylinder_axis_gs = cylinder_axis;
cylinder_radius_gs = cylinder_radius;
gl_Position = vec4(position, 1);
}
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
uniform int pickingBaseID;
#if __VERSION__ >= 130
in vec3 position;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#define position gl_Vertex
#endif
in vec3 cylinder_axis;
in float cylinder_radius;
out vec4 color_gs;
out vec3 cylinder_axis_gs;
out float cylinder_radius_gs;
void main()
{
#if __VERSION__ >= 130
// Compute color from object ID.
int objectID = pickingBaseID + gl_VertexID;
color_gs = vec4(
float(objectID & 0xFF) / 255.0,
float((objectID >> 8) & 0xFF) / 255.0,
float((objectID >> 16) & 0xFF) / 255.0,
float((objectID >> 24) & 0xFF) / 255.0);
#endif
cylinder_axis_gs = cylinder_axis;
cylinder_radius_gs = cylinder_radius;
gl_Position = vec4(position, 1);
}
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
// Inputs from calling program:
uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
uniform float modelview_uniform_scale;
#if __VERSION__ >= 130
in vec3 position;
in vec3 normal;
in vec4 color;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#endif
// The cylinder data:
in vec3 cylinder_base; // The position of the cylinder in model coordinates.
in vec3 cylinder_axis; // The axis of the cylinder in model coordinates.
in float cylinder_radius; // The radius of the cylinder in model coordinates.
// Outputs to fragment shader
flat out vec4 cylinder_color_fs; // The base color of the cylinder.
flat out vec3 cylinder_view_base; // Transformed cylinder position in view coordinates
flat out vec3 cylinder_view_axis; // Transformed cylinder axis in view coordinates
flat out float cylinder_radius_sq_fs; // The squared radius of the cylinder
flat out float cylinder_length; // The length of the cylinder
void main()
{
// Pass color to fragment shader.
cylinder_color_fs = color;
// Pass radius to fragment shader.
cylinder_radius_sq_fs = cylinder_radius * modelview_uniform_scale;
cylinder_radius_sq_fs *= cylinder_radius_sq_fs;
// Transform cylinder to eye coordinates.
cylinder_view_base = vec3(modelview_matrix * vec4(cylinder_base, 1));
cylinder_view_axis = vec3(modelview_matrix * vec4(cylinder_axis, 0));
// Pass length to fragment shader.
cylinder_length = length(cylinder_view_axis);
#if __VERSION__ >= 130
// Transform and project vertex position.
gl_Position = modelview_projection_matrix * vec4(position, 1.0);
#else
// Transform and project vertex position.
gl_Position = modelview_projection_matrix * gl_Vertex;
#endif
}
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// OVITO is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
// Inputs from calling program:
uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
uniform float modelview_uniform_scale;
#if __VERSION__ >= 130
in vec3 position;
in vec3 normal;
in vec4 color;
#else
#define in attribute
#define out varying
#define flat
#define color gl_Color
#endif
// The cylinder data:
in vec3 cylinder_base; // The position of the cylinder in model coordinates.
in vec3 cylinder_axis; // The axis of the cylinder in model coordinates.
in float cylinder_radius; // The radius of the cylinder in model coordinates.
// Outputs to fragment shader
flat out vec4 cylinder_color_fs; // The base color of the cylinder.
flat out vec3 cylinder_view_base; // Transformed cylinder position in view coordinates
flat out vec3 cylinder_view_axis; // Transformed cylinder axis in view coordinates
flat out float cylinder_radius_sq_fs; // The squared radius of the cylinder
flat out float cylinder_length; // The length of the cylinder
void main()
{
// Pass color to fragment shader.
cylinder_color_fs = color;
// Pass radius to fragment shader.
cylinder_radius_sq_fs = cylinder_radius * modelview_uniform_scale;
cylinder_radius_sq_fs *= cylinder_radius_sq_fs;
// Transform cylinder to eye coordinates.
cylinder_view_base = vec3(modelview_matrix * vec4(cylinder_base, 1));
cylinder_view_axis = vec3(modelview_matrix * vec4(cylinder_axis, 0));
// Pass length to fragment shader.
cylinder_length = length(cylinder_view_axis);
#if __VERSION__ >= 130
// Transform and project vertex position.
gl_Position = modelview_projection_matrix * vec4(position, 1.0);
#else
// Transform and project vertex position.
gl_Position = modelview_projection_matrix * gl_Vertex;
#endif
}