GLConfig.hpp 1.62 KB
Newer Older
1 2 3 4
// code not yet for use (6/12/2009); if long here uselessly, delete.
//

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

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

9 10 11
/*! Storage for general 3d view settings.

Is saved along with simulation and passed to every call to render(...).
12
Contains more or less what used to be inside OpenGLRenderer.
13 14 15 16 17

*/
class GLConfig: public Serializable{

	Vector3r lightPos,bgColor;
18
	Body::id_t currSel;
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
	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));
};
42 43 44

} // namespace yade