shaderSimpleColor.h 2.85 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*                                                                              *
* 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.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
25
26
#ifndef __CGOGN_SHADER_SIMPLECOLOR__
#define __CGOGN_SHADER_SIMPLECOLOR__
Pierre Kraemer's avatar
Pierre Kraemer committed
27

Sylvain Thery's avatar
Sylvain Thery committed
28
#include "Utils/GLSLShader.h"
29
#include "Utils/clippingShader.h"
Sylvain Thery's avatar
Sylvain Thery committed
30
#include "Geometry/vector_gen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
31

Sylvain Thery's avatar
Sylvain Thery committed
32
33
#include "Utils/dll.h"

Sylvain Thery's avatar
Sylvain Thery committed
34
namespace CGoGN
Pierre Kraemer's avatar
Pierre Kraemer committed
35
{
Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
36

Sylvain Thery's avatar
Sylvain Thery committed
37
namespace Utils
Pierre Kraemer's avatar
Pierre Kraemer committed
38
39
{

Sylvain Thery's avatar
Sylvain Thery committed
40
class CGoGN_UTILS_API ShaderSimpleColor : public ClippingShader
Pierre Kraemer's avatar
Pierre Kraemer committed
41
{
Sylvain Thery's avatar
Sylvain Thery committed
42
43
protected:
	// shader sources
44
45
	static std::string vertexShaderText;
	static std::string fragmentShaderText;
46
47
	static std::string vertexShaderClipText;
	static std::string fragmentShaderClipText;
Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
48

49
	/// color
50
	CGoGNGLuint m_unif_color;
51
52
	Geom::Vec4f m_color;

53
54
55
56
57
	/// clipping
	CGoGNGLuint m_unif_planeClip;
	Geom::Vec4f m_planeClip;


58
59
60
61
	VBO* m_vboPos;

	void restoreUniformsAttribs();

Sylvain Thery's avatar
Sylvain Thery committed
62
public:
63
	ShaderSimpleColor(bool withClipping = false, bool back_is_transparent = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
64

Sylvain Thery's avatar
Sylvain Thery committed
65
	void setColor(const Geom::Vec4f& color);
Pierre Kraemer's avatar
Pierre Kraemer committed
66

67
	unsigned int setAttributePosition(VBO* vbo);
68
69

	void setClippingPlane(const Geom::Vec4f& plane);
70
71
72

	inline void setNoClippingPlane() { setClippingPlane(Geom::Vec4f(0.0f,0.0f,0.0f,0.0f)); }

Sylvain Thery's avatar
Sylvain Thery committed
73
};
Pierre Kraemer's avatar
Pierre Kraemer committed
74

Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
75
76
77
78
} // namespace Utils

} // namespace CGoGN

Sylvain Thery's avatar
Sylvain Thery committed
79
#endif