Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
8f76f00d
Commit
8f76f00d
authored
Sep 09, 2011
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add shaderScalarField
parent
c0fb7beb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
0 deletions
+188
-0
include/Utils/Shaders/shaderScalarField.frag
include/Utils/Shaders/shaderScalarField.frag
+14
-0
include/Utils/Shaders/shaderScalarField.h
include/Utils/Shaders/shaderScalarField.h
+62
-0
include/Utils/Shaders/shaderScalarField.vert
include/Utils/Shaders/shaderScalarField.vert
+37
-0
src/Utils/Shaders/shaderScalarField.cpp
src/Utils/Shaders/shaderScalarField.cpp
+75
-0
No files found.
include/Utils/Shaders/shaderScalarField.frag
0 → 100644
View file @
8f76f00d
// ShaderScalarField::fragmentShaderText
PRECISON
;
VARYING_FRAG
vec3
color
;
VARYING_FRAG
float
scalar
;
FRAG_OUT_DEF
;
void
main
()
{
float
s
=
scalar
*
50
.
0
;
if
(
s
-
floor
(
s
)
<=
0
.
01
)
gl_FragColor
=
vec4
(
0
.
0
);
else
gl_FragColor
=
vec4
(
color
,
0
.
0
);
}
include/Utils/Shaders/shaderScalarField.h
0 → 100644
View file @
8f76f00d
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __CGOGN_SHADER_SCALARFIELD__
#define __CGOGN_SHADER_SCALARFIELD__
#include "Utils/GLSLShader.h"
#include "Utils/clippingShader.h"
#include "Geometry/vector_gen.h"
namespace
CGoGN
{
namespace
Utils
{
class
ShaderScalarField
:
public
ClippingShader
{
protected:
// shader sources
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
VBO
*
m_vboPos
;
VBO
*
m_vboScal
;
void
restoreUniformsAttribs
();
public:
ShaderScalarField
();
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
unsigned
int
setAttributeScalar
(
VBO
*
vbo
);
};
}
// namespace Utils
}
// namespace CGoGN
#endif
include/Utils/Shaders/shaderScalarField.vert
0 → 100644
View file @
8f76f00d
// ShaderScalarField::vertexShaderText
ATTRIBUTE
vec3
VertexPosition
;
ATTRIBUTE
float
VertexScalar
;
uniform
mat4
ModelViewProjectionMatrix
;
VARYING_VERT
vec3
color
;
VARYING_VERT
float
scalar
;
INVARIANT_POS
;
vec3
color_map_blue_white_red
(
float
x
)
{
vec3
c
=
vec3
(
0
);
if
(
x
<
0
.
0
)
c
.
b
=
1
.
0
;
else
if
(
x
<
0
.
5
)
{
c
.
r
=
2
.
0
*
x
;
c
.
g
=
2
.
0
*
x
;
c
.
b
=
1
.
0
;
}
else
if
(
x
<
1
.
0
)
{
c
.
r
=
1
.
0
;
c
.
g
=
2
.
0
-
2
.
0
*
x
;
c
.
b
=
2
.
0
-
2
.
0
*
x
;
}
else
c
.
r
=
1
.
0
;
return
c
;
}
void
main
()
{
gl_Position
=
ModelViewProjectionMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
color
=
color_map_blue_white_red
(
VertexScalar
);
scalar
=
VertexScalar
;
}
src/Utils/Shaders/shaderScalarField.cpp
0 → 100644
View file @
8f76f00d
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <GL/glew.h>
#include "Utils/Shaders/shaderScalarField.h"
namespace
CGoGN
{
namespace
Utils
{
#include "shaderScalarField.vert"
#include "shaderScalarField.frag"
ShaderScalarField
::
ShaderScalarField
()
{
m_nameVS
=
"ShaderColorPerVertex_vs"
;
m_nameFS
=
"ShaderColorPerVertex_fs"
;
m_nameGS
=
"ShaderColorPerVertex_gs"
;
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
glxfrag
.
append
(
fragmentShaderText
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
}
unsigned
int
ShaderScalarField
::
setAttributePosition
(
VBO
*
vbo
)
{
m_vboPos
=
vbo
;
return
bindVA_VBO
(
"VertexPosition"
,
vbo
);
}
unsigned
int
ShaderScalarField
::
setAttributeScalar
(
VBO
*
vbo
)
{
m_vboScal
=
vbo
;
return
bindVA_VBO
(
"VertexScalar"
,
vbo
);
}
void
ShaderScalarField
::
restoreUniformsAttribs
()
{
bind
();
bindVA_VBO
(
"VertexPosition"
,
m_vboPos
);
bindVA_VBO
(
"VertexScalar"
,
m_vboScal
);
unbind
();
}
}
// namespace Utils
}
// namespace CGoGN
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment