File: GLConfig.hpp

package info (click to toggle)
yade 2026.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,448 kB
  • sloc: cpp: 97,645; python: 52,173; sh: 677; makefile: 162
file content (54 lines) | stat: -rw-r--r-- 1,808 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// code not yet for use (6/12/2009); if long here uselessly, delete.
//

// 2009 © Václav Šmilauer <eudoxos@arcig.cz>
#include <core/Serializable.hpp>

namespace yade { // Cannot have #include directive inside.

/*! Storage for general 3d view settings.

Is saved along with simulation and passed to every call to render(...).
Contains more or less what used to be inside OpenGLRenderer.

*/
class GLConfig : public Serializable {
	Vector3r     lightPos, bgColor;
	Body::id_t   currSel;
	bool         dof, id, bbox, geom, wire, intrGeom, intrPhys;
	int          mask;
	bool         scaleDisplacements, scaleRotations;
	Vector3r     displacementScale;
	Real         rotationScale;
	vector<Se3r> clipPlaneSe3;
	vector<int>  clipPlaneActive; // should be bool, but serialization doesn't handle vector<bool>

	// not saved
	Vector3r highlightEmission0;
	Vector3r highlightEmission1;

	// normalized saw signal with given periodicity, with values ∈ 〈0,1〉 */
	Real normSaw(Real t, Real period)
	{
		Real xi = (t - period * ((int)(t / period))) / period; /* normalized value, (0-1〉 */
		return (xi < .5 ? 2 * xi : 2 - 2 * xi);
	}
	Real normSquare(Real t, Real period)
	{
		Real xi = (t - period * ((int)(t / period))) / period; /* normalized value, (0-1〉 */
		return (xi < .5 ? 0 : 1);
	}

	//! wrap number to interval x0…x1
	Real wrapCell(const Real x, const Real x0, const Real x1);
	//! wrap point to inside Scene's cell (identity if !Scene::isPeriodic)
	Vector3r wrapCellPt(const Vector3r& pt, Scene* rb);
	void     drawPeriodicCell(Scene*);

	REGISTER_ATTRIBUTES(
	        Serializable,
	        (dof)(id)(bbox)(geom)(wire)(intrGeom)(intrPhys)(mask)(scaleDisplacements)(scaleRotations)(displacementScale)(rotationScale)(clipPlaneSe3)(
	                clipPlaneActive));
};

} // namespace yade